/* =========================================================
   NEWWWZ — GLOBAL THEME + TOKENS (LIGHT/DARK)
   Put this in: /global.css  (or /public/global.css)
   ========================================================= */

/* =========================
   THEME TOKENS
   ========================= */

   
:root{
  --bg: #ffffff;
  --text: #000000;
  --border: #000000;

  /* surfaces */
  --surface: #ffffff;    /* panel/card/chip surface */
  --surface-2: #ffffff;  /* optional secondary surface */

  /* states */
  --hover-bg: #000000;
  --hover-text: #ffffff;

  --active-bg: #000000;   /* selected pill/bookmark */
  --active-text: #ffffff;

  /* muted */
  --muted: rgba(0,0,0,.75);
  --muted-2: rgba(0,0,0,.55);

  /* shadows (NEWWWZ look) */
  --shadow: 3px 3px 0 var(--border);

  /* ===== Mood (LIGHT) ===== */
  --mood-worried-bg: #fff0f0;
  --mood-neutral-bg: #e6e6e6;   /* più grigio, meno “quasi bianco” */
  --mood-optimistic-bg: #f0fff2;

  /* Mood text colors (LIGHT) */
  --mood-text: #000000;

  /* floating footer bg (light) */
  --float-bg: rgba(255,255,255,.85);
}

/* =========================
   DARK THEME (override tokens)
   Apply by: <html data-theme="dark">
   ========================= */
html[data-theme="dark"]{
  --bg: #000000;
  --text: #ffffff;
  --border: #ffffff;

  --surface: #000000;
  --surface-2: #000000;

  --hover-bg: #ffffff;
  --hover-text: #000000;

  --active-bg: #ffffff;
  --active-text: #000000;

  --muted: rgba(255,255,255,.80);
  --muted-2: rgba(255,255,255,.60);

  --shadow: 3px 3px 0 var(--border);

  /* ===== Mood (DARK) =====
     Qui puoi farli più “accesi” senza perdere leggibilità.
     NOTA: hai chiesto testo NERO dentro i box: lo gestiamo con --mood-text.
  */
  --mood-worried-bg: #ff5a5a;   /* rosso più acceso */
  --mood-neutral-bg: #bdbdbd;   /* grigio medio */
  --mood-optimistic-bg: #34d399;/* verde più acceso */

  /* testo dentro i mood box in DARK (perché sfondo chiaro) */
  --mood-text: #000000;

  --float-bg: rgba(0,0,0,.85);
}

/* =========================
   GLOBAL BASE APPLICATION
   (force hardcoded whites/blacks to follow tokens)
   ========================= */
html, body{
  background: var(--bg) !important;
  color: var(--text) !important;
}

/* Se qualche componente ha “color: #000” fisso, almeno il body regge */
body{
  background: var(--bg) !important;
  color: var(--text) !important;
}

/* =========================
   COMMON OVERRIDES
   (these are generic & safe)
   ========================= */

/* Inputs / placeholders - safe */
input, textarea, select{
  color: var(--text);
}
::placeholder{
  color: var(--muted-2);
}

/* Panels / cards generic (se esistono) */
.country-panel,
.lang-panel,
.mood-scope-panel,
.past-panel,
.past-country-panel,
#nw-lang-panel,
#nw-edition-panel,
.edition-group-head,
.edition-flyout,
.explainer-panel,
.profile-modal-content{
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

/* Topbar / chips / buttons generic */
.nw-topbar{
  background: var(--surface) !important;
  border-bottom-color: var(--border) !important;
}

.nw-chip,
#nw-clock,
.icon-btn,
#date-input,
.nw-date-btn,
.nw-date-input{
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

/* News rows generic */
.news-item{
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.news-cell{
  border-right-color: var(--border) !important;
}

/* Pills + bookmark generic */
.pill-button,
.bookmark-btn{
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

/* ACTIVE (pills/bookmark) uses tokens */
.pill-button[data-active="true"],
.bookmark-btn[data-saved="true"]{
  background: var(--active-bg) !important;
  color: var(--active-text) !important;
  border-color: var(--active-bg) !important;
}

/* ===== Mood index boxes ===== */
.mood-box{
  border-color: var(--border) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
}

.mood-box--worried{ background: var(--mood-worried-bg) !important; }
.mood-box--neutral{ background: var(--mood-neutral-bg) !important; }
.mood-box--optimistic{ background: var(--mood-optimistic-bg) !important; }

/* Qui rendiamo il testo dentro i mood box leggibile anche in dark */
.mood-box,
.mood-box *{
  color: var(--mood-text) !important;
}
html:not([data-theme="dark"]) .mood-box,
html:not([data-theme="dark"]) .mood-box *{
  /* in light vogliamo testo nero, già ok ma lo ribadiamo */
  color: #000000 !important;
}

/* Footer */
.nw-footer,
.control-footer{
  background: var(--bg) !important;
  color: var(--text) !important;
  border-top-color: var(--border) !important;
}
.nw-footer-link,
.control-footer-links a{
  color: var(--text) !important;
}

/* floating bottom-right footer */
.right-footer{
  background: var(--float-bg) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
.right-footer a{
  color: var(--text) !important;
}

/* ADS hardcoded black safety */
.news-item--ad .news-headline,
.news-item--ad .news-cell{
  color: var(--text) !important;
}

/* ADS chip outline ONLY in dark mode (come vuoi tu) */
html[data-theme="dark"] .cat-ads{
  border: 1px solid #ffffff !important;
}

/* =========================
   INVERSE HOVER (theme-aware)
   ========================= */
.nw-chip:hover,
.icon-btn:hover,
.nw-date-wrap:hover,
.mood-box-link:hover,
.control-link:hover,
.end-of-day:hover,
.past-strip:hover,
.edition-flyout .country-row:hover,
.edition-group:hover .edition-group-head,
.nw-date-btn:hover,
.nw-date-input:hover,
.cookie-btn:hover,
.profile-primary-btn:hover,
.profile-secondary-btn:hover,
.profile-tertiary-btn:hover,
.bookmark-btn:hover,
.pill-button:hover{
  background: var(--hover-bg) !important;
  color: var(--hover-text) !important;
  border-color: var(--hover-bg) !important;
}

/* =========================
   THEME TOGGLE (SUN/MOON + knob)
   (you already have markup; this is the “final” stable version)
   ========================= */
.nw-theme-toggle{
  position: relative;
  width: 56px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
}

.nw-theme-ico{
  font-size: 12px;
  line-height: 1;
  color: var(--text);
  opacity: 1; /* IMPORTANT: sempre visibile */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* “inactive” icon slightly muted but visible */
.nw-theme-ico[data-state="inactive"]{
  opacity: .55;
}

/* knob: centrato verticalmente perfetto */
.nw-theme-knob{
  position: absolute;
  top: 50%;
  left: 4px;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background: var(--text);
  transition: transform .18s ease, background .18s ease;
}

/* in dark knob slides right */
html[data-theme="dark"] .nw-theme-knob{
  transform: translate(28px, -50%);
}

/* hover inverse for toggle */
.nw-theme-toggle:hover{
  background: var(--hover-bg);
  border-color: var(--hover-bg);
}
.nw-theme-toggle:hover .nw-theme-ico{
  color: var(--hover-text);
}
.nw-theme-toggle:hover .nw-theme-knob{
  background: var(--hover-text);
}

/* =========================================================
   FIX #1 — SEARCH in DARK: niente riquadro bianco dentro
   ========================================================= */
html[data-theme="dark"] .search-box{
  background: #000 !important;
  border-color: #fff !important;
}

html[data-theme="dark"] .search-input{
  background: transparent !important;
  color: #fff !important;
}

html[data-theme="dark"] .search-input::placeholder{
  color: rgba(255,255,255,.75) !important;
}

/* =========================================================
   FIX #2 — THEME TOGGLE: icone sempre visibili
   ========================================================= */
.nw-theme-toggle .nw-theme-ico{
  opacity: 1 !important;
  visibility: visible !important;
  display: inline-flex !important;
}

/* inversione automatica sopra knob bianco/nero */
.nw-theme-toggle .nw-theme-ico{
  color: #fff !important;
  mix-blend-mode: difference !important;
}

.nw-theme-toggle:hover .nw-theme-ico{
  opacity: 1 !important;
}

/* =========================================================
   FIX #3A — "WORLD MOOD ▾" visibile in dark
   ========================================================= */
html[data-theme="dark"] .mood-scope-select{
  background: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}

html[data-theme="dark"] .mood-scope-select *{
  color: #fff !important;
}

/* =========================
   MOOD DROPDOWN — EXACT EDITION LOOK (BOMBPROOF)
   ========================= */

#mood-scope-panel{
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 99999;

  width: 260px;
  padding: 8px;

  border: 1px solid #000;
  background: #fff;
  box-shadow: 3px 3px 0 #000;

  display: none;
  max-height: none;
  overflow: visible;
}

/* titles like edition section headers but stronger */
#mood-scope-panel .mood-section-title{
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .7;
  margin: 6px 0 6px;
}

/* EACH ITEM = edition box row */
#mood-scope-panel .mood-row{
  border: 1px solid #000;
  background: #fff;
  color: #000;

  padding: 8px 10px;
  margin: 0 0 6px 0;

  font-size: 10px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
}

/* inverse hover */
#mood-scope-panel .mood-row:hover{
  background:#000;
  color:#fff;
  border-color:#000;
}

#mood-scope-panel .mood-row:last-child{ margin-bottom: 0; }

html[data-theme="dark"] .edition-group-head {
  background: #000;
  color: #fff;
  border: 1px solid #fff;
}

html[data-theme="dark"] .edition-group-head:hover {
  background: #fff;
  color: #000;
  border-color: #fff;
}

html[data-theme="dark"] #mood-scope-panel .country-row {
  background: #000;
  color: #fff;
  border: 1px solid #fff;
}

html[data-theme="dark"] #mood-scope-panel .country-row:hover {
  background: #fff;
  color: #000;
}

html[data-theme="dark"] #nw-lang-panel .country-row {
  background: transparent;
  border: none;
}

html[data-theme="dark"] #nw-lang-panel .country-row:hover {
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
}

html[data-theme="dark"] .icon-btn {
  border: 1px solid #fff;
  background: #000;
  color: #fff;
}

html[data-theme="dark"] .icon-btn:hover {
  background: #fff;
  color: #000;
  border-color: #fff;
}

/* =========================================
   MOOD INDEX — DARK MODE (correct selectors)
   ========================================= */

/* aggancio dark mode: copre più implementazioni */
html[data-theme="dark"] #mood-scope-panel .mood-row,
body.dark #mood-scope-panel .mood-row,
body.dark-mode #mood-scope-panel .mood-row,
html.dark #mood-scope-panel .mood-row {
  background: #000 !important;
  color: #fff !important;
  border: 1px solid #fff !important;
}

/* hover inverse */
html[data-theme="dark"] #mood-scope-panel .mood-row:hover,
body.dark #mood-scope-panel .mood-row:hover,
body.dark-mode #mood-scope-panel .mood-row:hover,
html.dark #mood-scope-panel .mood-row:hover {
  background: #fff !important;
  color: #000 !important;
}

/* forza anche eventuali span dentro */
html[data-theme="dark"] #mood-scope-panel .mood-row:hover *,
body.dark #mood-scope-panel .mood-row:hover *,
body.dark-mode #mood-scope-panel .mood-row:hover *,
html.dark #mood-scope-panel .mood-row:hover * {
  color: #000 !important;
}

/* =========================================
   DARK MODE — HEADER BUTTON INVERSE HOVER
   ========================================= */

html[data-theme="dark"] .nw-chip,
body.dark .nw-chip,
body.dark-mode .nw-chip,
html.dark .nw-chip,

html[data-theme="dark"] .nw-date-btn,
body.dark .nw-date-btn,
body.dark-mode .nw-date-btn,
html.dark .nw-date-btn,

html[data-theme="dark"] .icon-btn,
body.dark .icon-btn,
body.dark-mode .icon-btn,
html.dark .icon-btn,

html[data-theme="dark"] #nw-theme-toggle,
body.dark #nw-theme-toggle,
body.dark-mode #nw-theme-toggle,
html.dark #nw-theme-toggle {

  background: #000 !important;
  color: #fff !important;
  border: 1px solid #fff !important;
  outline: none !important;
  transition: background .15s ease, color .15s ease;
}


/* ===== HOVER INVERSE ===== */
html[data-theme="dark"] .nw-chip:hover,
body.dark .nw-chip:hover,
body.dark-mode .nw-chip:hover,
html.dark .nw-chip:hover,

html[data-theme="dark"] .nw-date-btn:hover,
body.dark .nw-date-btn:hover,
body.dark-mode .nw-date-btn:hover,
html.dark .nw-date-btn:hover,

html[data-theme="dark"] .icon-btn:hover,
body.dark .icon-btn:hover,
body.dark-mode .icon-btn:hover,
html.dark .icon-btn:hover,

html[data-theme="dark"] #nw-theme-toggle:hover,
body.dark #nw-theme-toggle:hover,
body.dark-mode #nw-theme-toggle:hover,
html.dark #nw-theme-toggle:hover {

  background: #fff !important;
  color: #000 !important;
  border: 1px solid #fff !important;
}


/* forza anche SVG a cambiare colore */
html[data-theme="dark"] .icon-btn:hover svg,
body.dark .icon-btn:hover svg,
body.dark-mode .icon-btn:hover svg,
html.dark .icon-btn:hover svg {

  stroke: #000 !important;
  fill: #000 !important;
}

/* =========================
   LANGUAGE PANEL — LIGHT underline black
   ========================= */

html[data-theme="light"] .lang-panel .country-row:hover,
body:not(.dark):not(.dark-mode) .lang-panel .country-row:hover {
  text-decoration: underline;
  text-decoration-color: #000;
  text-underline-offset: 4px;
}

/* =========================
   EDITION PANEL — CONTINENT hover must keep border
   ========================= */

html[data-theme="dark"] .edition-group-head,
body.dark .edition-group-head,
body.dark-mode .edition-group-head,
html.dark .edition-group-head {
  background: #000 !important;
  color: #fff !important;
  border: 1px solid #fff !important;
  box-sizing: border-box;
}

html[data-theme="dark"] .edition-group-head:hover,
body.dark .edition-group-head:hover,
body.dark-mode .edition-group-head:hover,
html.dark .edition-group-head:hover {
  background: #fff !important;
  color: #000 !important;
  border: 1px solid #fff !important; /* non sparire MAI */
}

/* =========================
   EDITION FLYOUT — countries dark default black + inverse hover (no jump)
   ========================= */

html[data-theme="dark"] .edition-flyout .country-row,
body.dark .edition-flyout .country-row,
body.dark-mode .edition-flyout .country-row,
html.dark .edition-flyout .country-row {
  background: #000 !important;
  color: #fff !important;

  border: 1px solid #fff !important; /* sempre presente */
  box-sizing: border-box;

  transform: none !important;         /* stop “movement” */
  transition: background .15s ease, color .15s ease; /* niente transform */
}

html[data-theme="dark"] .edition-flyout .country-row:hover,
body.dark .edition-flyout .country-row:hover,
body.dark-mode .edition-flyout .country-row:hover,
html.dark .edition-flyout .country-row:hover {
  background: #fff !important;
  color: #000 !important;
  border: 1px solid #fff !important;
}

:root {
  --row-bg: #fff;
  --row-fg: #000;
  --row-hover-bg: #000;
  --row-hover-fg: #fff;
}

[data-theme="dark"] {
  --row-bg: #000;
  --row-fg: #fff;
  --row-hover-bg: #fff;
  --row-hover-fg: #000;
}

/* riga news */
.news-row {
  background: var(--row-bg);
  color: var(--row-fg);
}

/* hover inverse */
.news-row:hover {
  background: var(--row-hover-bg);
  color: var(--row-hover-fg);
}

/* IMPORTANT: figli che avevi colorati/opacity devono seguire hover */
.news-row:hover * {
  color: var(--row-hover-fg) !important;
}

/* =========================================================
   NEWS ITEM — INVERSE HOVER (final fix)
   ========================================================= */

.news-item:hover {
  background: var(--hover-bg) !important;
  color: var(--hover-text) !important;
  border-color: var(--hover-text) !important;
}
/* === NEWS ROW INVERSE (minimal, safe) === */

.news-item:hover {
  background: var(--hover-bg) !important;
  border-color: var(--hover-text) !important;
}

.news-item:hover > .news-cell {
  color: var(--hover-text) !important;
}

/* =========================================================
   NEWS ROW — DISABLE ROW HOVER when hovering pills / bookmark
   (Chrome/Safari: uses :has)
   ========================================================= */
.news-item:hover:has(.pill-button:hover),
.news-item:hover:has(.bookmark-btn:hover),
.news-item:hover:has(.pill-buttons:hover) {
  background: var(--surface) !important;
  border-color: var(--border) !important;
}

.news-item:hover:has(.pill-button:hover) > .news-cell,
.news-item:hover:has(.bookmark-btn:hover) > .news-cell,
.news-item:hover:has(.pill-buttons:hover) > .news-cell {
  color: var(--text) !important;
}

/* PAST STRIP — FORCE CLICKABLE */
#past-strip{
  cursor: pointer !important;
  user-select: none !important;
  pointer-events: auto !important;
  position: relative !important;
  z-index: 999999 !important;
}

/* === DARK: row hover inverte SOLO le celle testo (non pill/stella) === */
html[data-theme="dark"] .news-item:hover{
  background: var(--hover-bg) !important;   /* bianco */
  border-color: var(--hover-bg) !important;
}

/* testo della riga (celle) diventa nero */
html[data-theme="dark"] .news-item:hover .news-cell{
  color: var(--hover-text) !important;      /* nero */
}

/* qualunque span dentro le celle segue il nero */
html[data-theme="dark"] .news-item:hover .news-cell *{
  color: var(--hover-text) !important;      /* nero */
}

/* pill e stella: mantieni stile base durante hover riga,
   MA NON quando il bottone è hoverato */
html[data-theme="dark"] .news-item:hover .pill-button:not(:hover),
html[data-theme="dark"] .news-item:hover .bookmark-btn:not(:hover){
  background: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}

html[data-theme="dark"] .news-item:hover .pill-button:not(:hover) *,
html[data-theme="dark"] .news-item:hover .bookmark-btn:not(:hover) *{
  color: #fff !important;
}

html[data-theme="dark"] .news-item:hover .bookmark-btn:not(:hover) svg{
  stroke: #fff !important;
  fill: transparent !important;
}

html[data-theme="dark"] .news-item:hover .pill-button *,
html[data-theme="dark"] .news-item:hover .bookmark-btn *{
  color: #fff !important;
}

html[data-theme="dark"] .news-item:hover .bookmark-btn svg{
  stroke: #fff !important;
  fill: transparent !important;
}

/* === DARK: quando passo su pill/stella, la riga NON deve invertire === */
html[data-theme="dark"] .news-item:hover:has(.pill-button:hover),
html[data-theme="dark"] .news-item:hover:has(.bookmark-btn:hover),
html[data-theme="dark"] .news-item:hover:has(.pill-buttons:hover){
  background: var(--surface) !important;     /* torna nero */
  border-color: var(--border) !important;
}

html[data-theme="dark"] .news-item:hover:has(.pill-button:hover) .news-cell,
html[data-theme="dark"] .news-item:hover:has(.bookmark-btn:hover) .news-cell,
html[data-theme="dark"] .news-item:hover:has(.pill-buttons:hover) .news-cell{
  color: var(--text) !important;             /* torna bianco */
}

html[data-theme="dark"] .news-item:hover:has(.pill-button:hover) .news-cell *,
html[data-theme="dark"] .news-item:hover:has(.bookmark-btn:hover) .news-cell *,
html[data-theme="dark"] .news-item:hover:has(.pill-buttons:hover) .news-cell *{
  color: var(--text) !important;
}

/* === DARK: inverse hover SU pill e stella === */
html[data-theme="dark"] .pill-button:hover{
  background:#fff !important;
  color:#000 !important;
  border-color:#fff !important;
}
html[data-theme="dark"] .pill-button:hover *{ color:#000 !important; }

html[data-theme="dark"] .bookmark-btn:hover{
  background:#fff !important;
  color:#000 !important;
  border-color:#fff !important;
}
html[data-theme="dark"] .bookmark-btn:hover *{ color:#000 !important; }
html[data-theme="dark"] .bookmark-btn:hover svg{
  stroke:#000 !important;
  fill:transparent !important;
}

/* =========================================================
   FINAL FIX — DARK: hover inverse su TESTO pill + stella
   (text node -> serve color sul bottone, non su "*")
   ========================================================= */

/* PILL: inverti testo + bordo in hover */
html[data-theme="dark"] .news-item .pill-button:hover{
  color:#000 !important;
  -webkit-text-fill-color:#000 !important; /* safety Chrome */
  background:#fff !important;
  border-color:#fff !important;
}

/* se mai dentro c’è uno span, lo copriamo comunque */
html[data-theme="dark"] .news-item .pill-button:hover *{
  color:#000 !important;
  -webkit-text-fill-color:#000 !important;
}

/* STAR (è testo "★" nel bottone): inverti colore in hover */
html[data-theme="dark"] .news-item .bookmark-btn:hover{
  color:#000 !important;
  -webkit-text-fill-color:#000 !important;
  background:#fff !important;
  border-color:#fff !important;
}

/* se in futuro diventa svg */
html[data-theme="dark"] .news-item .bookmark-btn:hover svg{
  stroke:#000 !important;
  fill:transparent !important;
}

/* se un wildcard in news-cell schiaccia tutto, ribadiamo sopra */
html[data-theme="dark"] .news-item:hover .pill-button:hover,
html[data-theme="dark"] .news-item:hover .bookmark-btn:hover{
  color:#000 !important;
  -webkit-text-fill-color:#000 !important;
}

@media (max-width: 520px) {
  html, body { overflow-x: hidden; }
  * { box-sizing: border-box; }
}

/* =========================================================
   MOBILE ONLY — NEWWWZ (NO DESKTOP CHANGES)
   Incolla in fondo allo <style>
   ========================================================= */
@media (max-width: 520px){

  /* --- 0) STOP overflow a destra --- */
  html, body { overflow-x: hidden; }
  .page, .nw-topbar, .nw-footer-inner { max-width: 100%; }

  /* =======================================================
     1) TOPBAR: evita che esca dal viewport
     (senza cambiare layout desktop)
     ======================================================= */

  /* riduci padding e gap */
  .nw-topbar{
    padding: 8px 8px;
    gap: 6px;
  }

  /* sinistra: togliamo il clock lungo (00:00:00) che rompe */
  #nw-clock{ display:none !important; }

  /* chip più compatti */
  .nw-chip{
    padding: 6px 8px;
    font-size: 9px;
    letter-spacing: .12em;
  }

  /* date input più corto */
  .nw-date-input{ width: 104px; }

  /* per NON sforare: su mobile nascondiamo 2 icone (alerts + saved)
     (account resta, il calendario resta) */
  #alert-mode-toggle,
  #saved-mode-toggle{
    display:none !important;
  }

  /* se ancora stringe: tieni i bottoni prev/next ma più stretti */
  .nw-date-btn{
    width: 26px;
    height: 28px;
  }

  /* =======================================================
     2) NEWS MOBILE: META SOPRA (in una riga), TITOLO SOTTO
     - Riga meta = Date | Time | Category + (pills+star a destra)
     - Riga sotto = SOLO title, clamp max 2 righe
     ======================================================= */

  /* override della tua regola @media (max-width:768px) che metteva 1 colonna */
  .news-item{
    position: relative;
    grid-template-columns: 74px 56px minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    align-items: center;
  }

  /* 3 celle meta sulla prima riga */
  .news-item .news-cell:nth-child(1){
    grid-column: 1; grid-row: 1;
    white-space: nowrap !important;
  }
  .news-item .news-cell:nth-child(2){
    grid-column: 2; grid-row: 1;
    white-space: nowrap !important;
  }
  .news-item .news-cell:nth-child(3){
    grid-column: 3; grid-row: 1;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* cell testo (headline+pills+star) va sotto e prende tutta la larghezza */
  .news-item .news-cell:nth-child(4){
    grid-column: 1 / -1;
    grid-row: 2;
    border-right: none !important;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    padding-bottom: 8px;
  }

  /* nella cell testo: separiamo visivamente controls (pills+star) sopra a destra */
  .news-text{
    justify-content: flex-start !important;
    gap: 10px;
  }

  /* sinistra: SOLO headline (e niente powered-by su mobile) */
  .powered-by-slot{ display:none !important; }

  /* headline: NON una riga sola, ma clamp 2 righe */
  .news-headline{
    white-space: normal !important;
    overflow: hidden !important;
    text-overflow: clip !important;

    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;

    line-height: 1.25;
  }

  /* destra (pills + bookmark): lo mettiamo nella riga META, top-right */
  .news-text > span:last-child{
    position: absolute;
    top: 6px;          /* dentro la news-item */
    right: 8px;
    z-index: 5;
    background: transparent;
  }

  /* piccolo respiro perché non collida con i controls a destra */
  .news-item .news-cell:nth-child(3){
    padding-right: 86px; /* spazio per pills+star */
  }

  /* meta row: mantieni divider verticali (già li hai via border-right)
     ma su mobile evita wrap nelle celle meta */
  .news-cell{
    white-space: nowrap;
  }

  /* =======================================================
     3) FOOTER: centrato (voci + control room)
     ======================================================= */
  .nw-footer-inner{
    flex-direction: column;
    align-items: center !important;
    text-align: center;
    gap: 6px;
  }

  .nw-footer-left,
  .nw-footer-nav{
    white-space: normal !important;
    text-align: center;
  }

}

/* =========================================
   MOBILE TOPBAR FIX (ONLY MOBILE)
   ========================================= */
@media (max-width:520px){

  /* 1) Topbar sempre sopra a tutto */
  .nw-topbar{
    position: fixed !important;
    top:0 !important; left:0 !important; right:0 !important;
    z-index: 9999999 !important;
  }

  /* 2) Layout topbar: 3 colonne (sx / centro / dx) */
  .nw-topbar{
    display:grid !important;
    grid-template-columns: 1fr auto 1fr !important;
    align-items:center !important;
    column-gap: 8px !important;
  }
  .nw-topbar-left{ justify-self:start !important; }
  .nw-topbar-right{ justify-self:end !important; display:flex !important; gap:6px !important; align-items:center !important; }

  /* 3) EDITION perfettamente centrato */
  #nw-edition-toggle{
    justify-self:center !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    text-align:center !important;
    width: auto !important;
  }
  #nw-edition-code{
    display:inline-block !important;
    text-align:center !important;
  }

  /* 4) DATE: nascondi frecce e testo, lascia SOLO icona (usiamo #nw-date-open se esiste) */
  #nw-date-prev,
  #nw-date-next{
    display:none !important;
  }

  /* se hai un bottone dedicato per aprire il datepicker */
  #nw-date-open{
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
  }

  /* nascondi l’input vero (resta funzionale via showPicker/click) */
  #date-input{
    position:absolute !important;
    left:-9999px !important;
    width:1px !important;
    height:1px !important;
    opacity:0 !important;
    pointer-events:none !important;
  }

  /* Se nel topbar hai un wrapper data, non farlo “mangiare” spazio */
  #nw-date-wrap{
    display:inline-flex !important;
    align-items:center !important;
  }

  /* 5) FRECCINE “⟶” nel pannello edizioni: toglile (se usi .edition-group-arrow) */
  .edition-group-arrow{
    display:none !important;
  }
}

@media (max-width:520px){

  /* ===== TOPBAR LAYOUT ===== */
  .nw-topbar{
    display:grid !important;
    grid-template-columns: auto auto 1fr auto auto auto !important;
    align-items:center !important;
    column-gap: 8px !important;
  }

  /* left wrapper “splitta” i figli nella grid */
  .nw-topbar-left{ display: contents !important; }

  /* Lang + Theme a sinistra */
  #nw-lang-toggle{ grid-column: 1 !important; justify-self:start !important; }
  #nw-theme-toggle{ grid-column: 2 !important; justify-self:start !important; }

  /* Edition PERFETTO centrato */
  #nw-edition-toggle{
    grid-column: 3 !important;
    justify-self:center !important;
    text-align:center !important;
  }
  /* se hai due span dentro (EDITION + WORLD) li centro */
  #nw-edition-toggle *{ text-align:center !important; }

  /* Right icons area */
  .nw-topbar-right{
    grid-column: 4 / span 3 !important;
    justify-self:end !important;
    display:flex !important;
    align-items:center !important;
    gap: 6px !important;
  }

  /* ===== NASCONDI su mobile i bottoni originali (li mettiamo nel menu) ===== */
  #alert-mode-toggle,
  #saved-mode-toggle{
    display:none !important;
  }

  /* ===== stile icone mobile (calendar/refresh/account) ===== */
  .nw-mobile-icon{
    width: 34px;
    height: 30px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    box-shadow: 3px 3px 0 var(--border);
    font-size: 14px;
    line-height: 1;
    padding: 0;
    border-radius: 0;
  }
  .nw-mobile-icon svg{
    width: 16px;
    height: 16px;
    display:block;
  }

  /* ===== account dropdown menu ===== */
  .nw-account-menu{
    position: fixed;
    top: calc(var(--nw-topbar-h, 56px) + 8px);
    right: 8px;
    width: 168px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 6px 6px 0 var(--border);
    z-index: 999999;
    display:none;
  }
  .nw-account-menu.open{ display:block; }

  .nw-account-menu button{
    width: 100%;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 10px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    padding: 10px 10px;
    font-size: 12px;
    letter-spacing: .06em;
    cursor:pointer;
  }
  .nw-account-menu button:last-child{ border-bottom:0; }

  .nw-account-menu .m-ico{
    width: 22px;
    display:inline-flex;
    justify-content:center;
    align-items:center;
    font-size: 14px;
    line-height:1;
  }

  /* ===== EDITION PANEL: 2 colonne (continenti sinistra, stati destra) ===== */
  #nw-edition-panel{
    position: fixed !important;
    top: var(--nw-topbar-h, 56px) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: calc(100vh - var(--nw-topbar-h, 56px)) !important;
    overflow: hidden !important;
    z-index: 999998 !important;
  }

  #nw-edition-panel .edition-panel-scroll{
    height: 100% !important;
    display:flex !important;
    flex-direction: column !important;
    overflow:auto !important;
  }

  /* lista continenti: metà sinistra */
  #nw-edition-panel .edition-group{
    width: 50vw !important;
    max-width: 50vw !important;
  }

  /* freccine via */
  #nw-edition-panel .edition-group-arrow{ display:none !important; }

  /* flyout: metà destra fissa */
  #nw-edition-panel .edition-flyout{
    position: fixed !important;
    top: var(--nw-topbar-h, 56px) !important;
    right: 0 !important;
    width: 50vw !important;
    height: calc(100vh - var(--nw-topbar-h, 56px)) !important;
    overflow:auto !important;
    border-left: 1px solid var(--border) !important;
    background: var(--surface) !important;
    display: none;
    z-index: 999999 !important;
  }
}

@media (max-width:520px){

  #nw-edition-panel{
    position: fixed !important;
    top: var(--nw-topbar-h, 56px) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: calc(100vh - var(--nw-topbar-h, 56px)) !important;
    overflow: hidden !important;
    z-index: 999998 !important;
    box-sizing: border-box !important;
  }

  /* wrapper diviso a metà */
  #nw-edition-panel .edition-panel-scroll{
    height: 100% !important;
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 50% 50% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  /* sinistra = continenti */
  #nw-edition-panel .edition-groups{
    grid-column: 1 !important;
    height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    border-right: 1px solid var(--border) !important;
    box-sizing: border-box !important;

    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* riga continente */
  #nw-edition-panel .edition-group{
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 12px 10px !important;

    display:flex !important;
    align-items:center !important;
    justify-content:center !important;

    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;

    border-bottom: 1px solid var(--border) !important;
  }

  #nw-edition-panel .edition-group-arrow{ display:none !important; }

  /* destra = contenitore che creerà il JS */
  #nw-edition-right{
    grid-column: 2 !important;
    height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: var(--surface) !important;
    box-sizing: border-box !important;
  }

  /* lista paesi = 1 colonna */
  #nw-edition-right .country-row{
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 12px 10px !important;
    border-bottom: 1px solid var(--border) !important;

    display:flex !important;
    align-items:center !important;
    justify-content:space-between !important;

    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* niente sbordi */
  #nw-edition-panel *{
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* =========================================================
   MOBILE EDITION — HARD RESET + NEW SPLIT UI (50/50)
   ========================================================= */
@media (max-width:520px){

  /* quando il pannello edition è aperto, noi mettiamo dentro un wrapper nuovo */
  #nw-edition-panel .nw-ed-mobile-split{
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 50% 50%;
    width: 100%;
    height: 100%;
    overflow: hidden;           /* ✅ niente sbordi */
    background: var(--surface);
  }

  #nw-edition-panel .nw-ed-left,
  #nw-edition-panel .nw-ed-right{
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;         /* ✅ niente sbordi */
    box-sizing: border-box;
  }

  #nw-edition-panel .nw-ed-left{
    border-right: 1px solid var(--border);
  }

  /* CONTINENTS: 1 colonna, righe full width */
  #nw-edition-panel .nw-ed-cont{
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;     /* centrato */
    text-align: center;
    padding: 14px 10px;
    border-bottom: 1px solid var(--border);
    box-sizing: border-box;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    user-select: none;
  }
  #nw-edition-panel .nw-ed-cont.is-active{
    background: var(--hover-bg);
    color: var(--hover-text);
    border-color: var(--hover-bg);
  }

  /* COUNTRIES: 1 colonna, 1 stato per riga full width */
  #nw-edition-panel .nw-ed-country{
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 10px;
    border-bottom: 1px solid var(--border);
    box-sizing: border-box;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    user-select: none;
  }

  /* ✅ ammazza QUALSIASI layout a 2 colonne dentro la nostra UI */
  #nw-edition-panel .nw-ed-right,
  #nw-edition-panel .nw-ed-right *{
    column-count: 1 !important;
    columns: 1 !important;
    grid-template-columns: 1fr !important;
    flex-wrap: nowrap !important;
  }

  /* sicurezza */
  #nw-edition-panel .nw-ed-mobile-split,
  #nw-edition-panel .nw-ed-mobile-split *{
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
}@media (max-width:520px){
  /* reset solo dei blocchi chiave del pannello edition */
  #nw-edition-panel,
  #nw-edition-panel .edition-panel-scroll,
  #nw-edition-panel .edition-groups,
  #nw-edition-panel .edition-group,
  #nw-edition-panel .edition-group-head,
  #nw-edition-panel .edition-flyout,
  #nw-edition-panel .country-row{
    all: unset;
  }
}
@media (max-width:520px){

  #nw-edition-panel{
    position: fixed;
    top: var(--nw-topbar-h, 56px);
    left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: calc(100vh - var(--nw-topbar-h, 56px));
    background: var(--surface);
    border-top: 1px solid var(--border);
    overflow: hidden;
    z-index: 999998;
    box-sizing: border-box;
  }

  /* split 50/50 */
  #nw-edition-panel .edition-panel-scroll{
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 50% 50%;
    overflow: hidden;
  }

  /* left: continents */
  #nw-edition-panel .edition-groups{
    grid-column: 1;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  #nw-edition-panel .edition-group{
    width: 100%;
  }

  #nw-edition-panel .edition-group-head{
    width: 100%;
    padding: 14px 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
  }

  /* right: flyout pinned to right half */
  #nw-edition-panel .edition-flyout{
    grid-column: 2;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
    box-sizing: border-box;
  }

  /* show selected flyout */
  #nw-edition-panel .edition-flyout.open,
  #nw-edition-panel .edition-flyout.active,
  #nw-edition-panel .edition-group.is-open .edition-flyout,
  #nw-edition-panel .edition-group[aria-expanded="true"] .edition-flyout{
    display: block;
  }

  /* countries: 1 per row */
  #nw-edition-panel .edition-flyout .country-row{
    width: 100%;
    padding: 14px 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;

    /* kill 2 columns */
    float: none;
    column-count: 1;
    columns: 1;
    flex-wrap: nowrap;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
  }
}

@media (max-width:520px){
  .nw-edm-overlay{
    position: fixed;
    top: var(--nw-topbar-h, 56px);
    left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: calc(100vh - var(--nw-topbar-h, 56px));
    background: var(--surface);
    z-index: 99999999;
    overflow: hidden;
    border-top: 1px solid var(--border);
    box-sizing: border-box;
  }

  .nw-edm-split{
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 50% 50%;
    overflow: hidden;
  }

  .nw-edm-left{
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
  }

  .nw-edm-right{
    overflow-y: auto;
    overflow-x: hidden;
  }

  .nw-edm-row{
    width: 100%;
    padding: 14px 10px;
    border-bottom: 1px solid var(--border);
    box-sizing: border-box;

    display: flex;
    align-items: center;
    justify-content: center;   /* continenti centrati */
    text-align: center;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    user-select: none;
  }

  .nw-edm-row.is-active{
    background: var(--hover-bg);
    color: var(--hover-text);
    border-bottom-color: var(--hover-bg);
  }

  .nw-edm-country{
    width: 100%;
    padding: 14px 10px;
    border-bottom: 1px solid var(--border);
    box-sizing: border-box;

    display: flex;                 /* ✅ 1 per riga */
    align-items: center;
    justify-content: space-between; /* codice a sx, nome a dx (o viceversa) */
    flex-wrap: nowrap;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    cursor: pointer;
    user-select: none;

    /* ✅ ammazza qualsiasi colonnamento */
    column-count: 1 !important;
    columns: 1 !important;
  }
}

/* TRENDING / VIRAL BAR */
.trending-bar {
  width: 100%;
  margin-top: 4px;
  margin-bottom: 4px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: #ff0000;
  color: #ffffff;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;

  /* ✅ meno “epilettico”: pulse lento */
  animation: viralPulse 6.5s ease-in-out infinite;

  transition: background 0.15s ease, color 0.15s ease;
}

.trending-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trending-label {
  font-weight: bold;
}

.trending-topic {
  opacity: 0.95;
  letter-spacing: 0.06em;
}

.trending-right {
  font-size: 9px;
  opacity: 0.9;
  white-space: nowrap;
}

/* ✅ pulse: non sparisce, respira soltanto */
@keyframes viralPulse {
  0%, 70%, 100% { opacity: 1; }
  85% { opacity: 0.65; }
}

/* ✅ accessibilità: se utente non vuole animazioni */
@media (prefers-reduced-motion: reduce) {
  .trending-bar { animation: none !important; }
}

/* TRENDING / VIRAL BAR — allow full title (no ellipsis) */
.trending-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
}

/* IMPORTANT: allow the left side to shrink/wrap properly */
.trending-left{
  display:flex;
  align-items:flex-start;
  gap:8px;
  flex:1;         /* take available space */
  min-width:0;    /* <-- this is key with flex + wrapping */
}

/* label never wraps */
.trending-label{
  font-weight:700;
  white-space:nowrap;
}

/* title can wrap (NO ellipsis) */
.trending-topic{
  white-space:normal !important;
  overflow:visible !important;
  text-overflow:clip !important;

  flex:1;
  min-width:0;

  /* optional: nicer wrapping */
  word-break:break-word;
  overflow-wrap:anywhere;
  line-height:1.25;
}

/* right side never wraps */
.trending-right{
  white-space:nowrap;
  margin-left:12px;
  flex:0 0 auto;
}

/* Mobile: allow 2 lines (or more) comfortably */
@media (max-width:520px){
  .trending-bar{
    padding:10px 12px;
    font-size:11px;
  }
  .trending-topic{
    line-height:1.3;
  }
}

.trending-topic{
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  display: block;
}