/* ─── RESET & VARS ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0d0f;
  --surface: #161618;
  --surface2: #1e1e22;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --text: #f0ede8;
  --muted: #888580;
  --accent: #c9a96e;
  --star: #f0c040;
  --focus: #6ab0f5;
  --danger: #e05a5a;
  --danger-bg: #3d1a1a;
  --success: #5ab87a;
  --success-bg: #0f2e1a;
  --accent-text: #1a1208;
  --overlay-bg: rgba(0,0,0,0.75);
  --shadow-toast: var(--shadow-toast);
  /* bias badges */
  --bias-esquerda-bg: #f7c1c1;
  --bias-esquerda-text: #701f1f;
  --bias-centro-esquerda-bg: #fac775;
  --bias-centro-esquerda-text: #412402;
  --bias-centro-bg: #d3d1c7;
  --bias-centro-text: #2c2c2a;
  --bias-centro-direita-bg: #b5d4f4;
  --bias-centro-direita-text: #042c53;
  --bias-direita-bg: #9fe1cb;
  --bias-direita-text: #04342c;
}

body.light {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface2: #eceae4;
  --border: rgba(0,0,0,0.08);
  --border2: rgba(0,0,0,0.14);
  --text: #1a1814;
  --muted: #706d66;
  --accent: #8a6a2e;
  --star: #c8880a;
  --focus: #1a6bbf;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --success: #27ae60;
  --success-bg: #eafaf1;
  --accent-text: #1a1208;
  --overlay-bg: rgba(0,0,0,0.75);
  --shadow-toast: var(--shadow-toast);
  /* bias badges (mantidas iguais no light) */
  --bias-esquerda-bg: #f7c1c1;
  --bias-esquerda-text: #701f1f;
  --bias-centro-esquerda-bg: #fac775;
  --bias-centro-esquerda-text: #412402;
  --bias-centro-bg: #d3d1c7;
  --bias-centro-text: #2c2c2a;
  --bias-centro-direita-bg: #b5d4f4;
  --bias-centro-direita-text: #042c53;
  --bias-direita-bg: #9fe1cb;
  --bias-direita-text: #04342c;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition: background 0.2s, color 0.2s;
}

/* ─── SKIP LINK ─── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--accent);
  color: var(--accent-text);
  padding: 0.5rem 1rem;
  border-radius: 0 0 6px 6px;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  z-index: 9999;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; }

/* ─── SR-ONLY ─── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ─── FOCUS ─── */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* ─── HEADER ─── */
header {
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
  backdrop-filter: blur(12px);
  gap: 12px;
  flex-wrap: wrap;
}

.logo-area h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
}
.logo-area h1 span { color: var(--accent); }
.logo-area p {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 3px;
}

.header-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.header-meta  { font-size: 0.75rem; color: var(--muted); text-align: right; }

#country-count {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--accent);
  display: block;
}

/* ─── HEADER BUTTONS ─── */
.hbtn {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}
.hbtn:hover { border-color: var(--accent); color: var(--accent); }

#lang-toggle {
  font-weight: 500;
  letter-spacing: 0.03em;
  min-width: 3.2rem;
  justify-content: center;
}
#lang-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#fav-toggle-btn[aria-expanded="true"] {
  background: var(--star);
  border-color: var(--star);
  color: var(--accent-text);
}

/* ─── VIEW TOGGLE ─── */
.view-toggle-bar {
  padding: 0.7rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.view-toggle-bar[hidden] { display: none; }
.view-toggle-bar > span {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 4px;
}

.vtbtn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  padding: 0.35rem 0.8rem;
  border-radius: 5px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.vtbtn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

/* ─── SEARCH BAR ─── */
.search-bar {
  padding: 1.2rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-wrap { flex: 1; min-width: 200px; position: relative; }
.search-wrap input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  padding: 0.65rem 1rem 0.65rem 2.4rem;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s;
}
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input:focus-visible { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 2px; }
.search-wrap svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.4;
  pointer-events: none;
}

/* ─── REGION FILTERS ─── */
.region-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  list-style: none;
  padding: 0; margin: 0;
}
.region-btn {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.18s;
}
.region-btn:hover,
.region-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 500;
}

/* ─── FAV SECTION HEADER ─── */
#fav-section {
  padding: 1.5rem 2rem 0;
  border-bottom: 1px solid var(--border);
}
#fav-section[hidden] { display: none; }

.fav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 8px;
}
.fav-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}

.fav-add-ext-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  background: var(--surface);
  border: 1px dashed var(--border2);
  color: var(--muted);
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.fav-add-ext-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ─── GRID (countries + fav cards share this) ─── */
.grid-wrap {
  padding: 1.5rem 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.fav-grid { padding-bottom: 1.5rem; }

/* ─── COUNTRY / FAV CARD ─── */
.country-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  text-align: left;
  width: 100%;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}
.country-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.18s;
}
.country-card:hover,
.country-card:focus-visible {
  border-color: var(--border2);
  background: var(--surface2);
  transform: translateY(-1px);
}
.country-card:hover::before,
.country-card:focus-visible::before { opacity: 1; }

/* Fav card: accent stripe is star color */
.country-card.fav-card-item::before { background: var(--star); }

.country-flag {
  font-size: 1.8rem;
  line-height: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Favicon used as "flag" in fav cards */
.country-flag img {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  object-fit: contain;
  background: var(--surface2);
}
.country-flag .favicon-fallback {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-text);
}

.country-info { flex: 1; min-width: 0; }
.country-info .country-name,
.country-info h3 {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.2;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.country-info span { font-size: 0.72rem; color: var(--muted); }

/* Delete button on fav card */
.fav-card-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1;
}
.country-card.fav-card-item:hover .fav-card-delete { opacity: 0.7; }
.fav-card-delete:hover { opacity: 1 !important; color: var(--text); }

.no-results {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
  grid-column: 1 / -1;
}

/* ─── MODAL ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 12px;
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  overflow-y: auto;
  animation: slide-up 0.22s ease;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 1.3rem 1.4rem 0.9rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-flag { font-size: 2.2rem; flex-shrink: 0; display: flex; align-items: center; }
.modal-flag img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: contain;
  background: var(--surface2);
}
.modal-flag .favicon-fallback {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-text);
}

.modal-header-info h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.1;
}
.modal-header-info p { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

/* was: style="display:flex;gap:6px;margin-left:auto;flex-shrink:0" */
.modal-header-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

/* was: style="font-size:0.8rem;width:auto;padding:0 8px;" */
.modal-rename-btn {
  font-size: 0.8rem !important;
  width: auto !important;
  padding: 0 8px !important;
}

.modal-close {
  background: none;
  border: 1px solid var(--border2);
  color: var(--muted);
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--text); border-color: var(--text); }

.bias-legend {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0.6rem 1.4rem;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.bias-legend-label { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-right: 2px; }

.modal-body { padding: 0.8rem 1.4rem 1.4rem; }

.news-section-title {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin: 1rem 0 0.4rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

/* ─── NEWS LINK ─── */
.news-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.88rem;
  transition: background 0.15s;
  gap: 8px;
  margin-bottom: 2px;
}
.news-link:hover { background: var(--surface2); }

.news-link-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.news-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  opacity: 0.7;
}
.news-link-name { font-weight: 400; }

.news-link-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.news-link-url { font-size: 0.68rem; color: var(--muted); font-family: monospace; }
.news-link-arrow { color: var(--muted); font-size: 0.75rem; }

/* ─── STAR BUTTON ─── */
.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.3;
  transition: opacity 0.15s, transform 0.15s;
  flex-shrink: 0;
  padding: 2px 4px;
  color: var(--text);
}
.star-btn:hover { opacity: 0.9; transform: scale(1.15); }
.star-btn.starred { opacity: 1; }

/* Remove link button inside fav card modal */
.remove-link-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--muted);
  opacity: 0.5;
  padding: 2px 5px;
  transition: opacity 0.15s, color 0.15s;
  flex-shrink: 0;
}
.remove-link-btn:hover { opacity: 1; color: var(--text); }

/* Add link button inside fav card modal */
.fav-card-add-link {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  background: transparent;
  border: 1px dashed var(--border2);
  color: var(--muted);
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  justify-content: center;
}
.fav-card-add-link:hover { border-color: var(--accent); color: var(--accent); }

/* ─── BIAS BADGES ─── */
.bias-badge {
  font-size: 0.6rem;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.bias-esquerda        { background: var(--bias-esquerda-bg); color: var(--bias-esquerda-text); }
.bias-centro-esquerda { background: var(--bias-centro-esquerda-bg); color: var(--bias-centro-esquerda-text); }
.bias-centro          { background: var(--bias-centro-bg); color: var(--bias-centro-text); }
.bias-centro-direita  { background: var(--bias-centro-direita-bg); color: var(--bias-centro-direita-text); }
.bias-direita         { background: var(--bias-direita-bg); color: var(--bias-direita-text); }

/* ─── EXT / PICKER MODALS ─── */
.ext-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}
.ext-modal-overlay.open { display: flex; }

.ext-modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  animation: slide-up 0.2s ease;
  max-height: 90vh;
  overflow-y: auto;
}
.ext-modal h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
}

/* ─── CONFIRM MODAL ─── */
.confirm-modal {
  text-align: center;
  max-width: 360px;
}
.confirm-icon {
  font-size: 2.5rem;
  margin-bottom: 0.6rem;
}
.confirm-message {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
  line-height: 1.5;
}

/* ─── FIELD ERROR ─── */
.field-error {
  font-size: 0.72rem;
  color: var(--danger);
  margin-top: 4px;
  padding: 3px 6px;
  background: var(--danger-bg);
  border-radius: 4px;
  animation: fade-in 0.15s ease;
}
.field-error[hidden] { display: none; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── INLINE EMPTY/FULL MESSAGES ─── */
.fav-card-empty-msg {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1rem 0;
  text-align: center;
}

.fav-card-full-msg {
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
  margin-top: 0.8rem;
}

/* ─── LINK LIST ─── */
.link-list {
  list-style: none;
  padding: 0;
}

/* ─── EXT MODAL CARD LABEL ─── */
.ext-modal-card-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.8rem;
}

/* card picker list */
.card-picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0.8rem;
  max-height: 220px;
  overflow-y: auto;
}
.picker-link-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.8rem;
  padding: 0.4rem 0.6rem;
  background: var(--surface2);
  border-radius: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.55rem 0.8rem;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 7px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--text);
  transition: all 0.15s;
  text-align: left;
}
.card-picker-item:hover { border-color: var(--accent); background: var(--surface); }
.card-picker-item.selected { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.card-picker-item img,
.card-picker-item .favicon-fallback {
  width: 20px; height: 20px;
  border-radius: 3px;
  flex-shrink: 0;
  object-fit: contain;
}
.card-picker-item .favicon-fallback {
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--accent-text);
}
.card-picker-empty {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  padding: 0.8rem;
}
.card-picker-count {
  font-size: 0.68rem;
  color: var(--muted);
  margin-left: auto;
}

.ext-field { margin-bottom: 0.9rem; }
.ext-field label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
}
.ext-field input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s;
}
.ext-field input:focus-visible { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 2px; }
.ext-field input.input-error { border-color: var(--danger); }
.ext-field[hidden] { display: none; }

.ext-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 1.2rem; flex-wrap: wrap; }
.ext-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--muted);
  transition: all 0.15s;
}
.ext-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
.ext-btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--surface);
  font-weight: 600;
}
.ext-btn:hover:not(.primary):not(.danger) { border-color: var(--text); color: var(--text); }
.ext-btn[hidden] { display: none; }

/* ─── TOAST ─── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 20px var(--shadow-toast);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.22s ease forwards;
  pointer-events: auto;
  max-width: 320px;
}

.toast.toast-success { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.toast.toast-error   { border-color: var(--danger);  background: var(--danger-bg);  color: var(--danger); }
.toast.toast-info    { border-color: var(--accent);  background: var(--surface2);   color: var(--accent); }
.toast.toast-out     { animation: toast-out 0.2s ease forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0)   scale(1); }
  to   { opacity: 0; transform: translateY(8px) scale(0.96); }
}

/* ─── MOBILE ─── */
@media (max-width: 480px) {
  header { padding: 1rem; }
  .logo-area h1 { font-size: 1.4rem; }
  .search-bar { padding: 0.9rem 1rem; }
  .grid-wrap { padding: 1rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  #fav-section { padding: 1rem 1rem 0; }

  .news-link { flex-direction: column; align-items: flex-start; gap: 4px; }
  .news-link-left { flex-wrap: wrap; gap: 6px; }
  .news-link-right { padding-left: 13px; gap: 6px; }
  .news-link-arrow { display: none; }

  .toast-container { bottom: 1rem; right: 1rem; left: 1rem; }
  .toast { max-width: 100%; }
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }