/* Design system stile My Nintendo Store / eShop.
   Rosso Nintendo #E60012, bianco pulito, tile grandi arrotondate, tipografia grassa. */

/* L'attributo hidden deve vincere SEMPRE.
   Il browser lo applica con "[hidden]{display:none}", che è una regola sua: basta
   un "display:flex" scritto qui dentro per annullarlo, e l'elemento resta visibile
   pur essendo hidden nell'HTML. Ci siamo cascati tre volte (.mag-modal, il bottone
   Annulla dello scan, il pannello di progresso, che mostrava "Preparazione…" per
   sempre). Una riga qui chiude la questione per tutti. */
[hidden] { display: none !important; }
:root {
  --nin-red: #E60012;
  --nin-red-dark: #b3000e;
  --ink: #2c2c2c;
  --muted: #6b6b6b;
  --bg: #ffffff;
  --bg-soft: #f6f6f6;
  --card: #ffffff;
  --line: #e5e5e5;
  --switch2-gold: #c9a227;   /* accento per la fascia Switch 2 */
  --radius: 18px;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
  --shadow-hi: 0 8px 28px rgba(0,0,0,.14);
  /* --- font-stack editoriali (solo font di sistema, niente CDN) --- */
  --serif: Georgia, "Times New Roman", "Iowan Old Style", "Palatino Linotype", serif;
  --display: "Helvetica Neue", "Arial Black", "Segoe UI", system-ui, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  /* --- carta della rivista (leggermente calda in light) --- */
  --paper: #faf7f2;
  --paper-line: #d9d2c6;
  --ombra-scaffale: 14px 22px 40px rgba(0,0,0,.28);
}
/* Dark theme: segue la preferenza di sistema (no toggle manuale). */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ececec; --muted: #9a9a9a;
    --bg: #16171a; --bg-soft: #101114; --card: #1e2024; --line: #2c2f35;
    --shadow: 0 2px 10px rgba(0,0,0,.4); --shadow-hi: 0 8px 28px rgba(0,0,0,.6);
    --paper: #1b1c20; --paper-line: #34363d;
    --ombra-scaffale: 14px 24px 46px rgba(0,0,0,.62);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* --- Header rosso Nintendo --- */
.topbar {
  background: var(--nin-red);
  color: #fff;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 20px;
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 50%;
  background: #fff; color: var(--nin-red);
  display: grid; place-items: center; font-weight: 900; font-size: 18px;
}
.nav { display: flex; gap: 20px; margin-left: auto; font-weight: 600; font-size: 15px; }
.nav a { opacity: .9; padding: 4px 2px; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a.active { opacity: 1; border-bottom-color: #fff; }

/* --- Layout --- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 20px 70px; }
.oos { opacity: .5; filter: grayscale(.3); }

/* ============================================================
   RIVISTA — impaginazione editoriale (home)
   ============================================================ */

/* --- Testata / masthead --- */
.mag-masthead {
  background: var(--nin-red);
  color: #fff;
  border-radius: 6px;
  padding: 22px 30px 18px;
  margin-bottom: 40px;
  position: relative;
  box-shadow: var(--shadow-hi);
  /* doppio filo bianco tipico delle testate */
  outline: 2px solid #fff; outline-offset: -8px;
  overflow: hidden;
}
.mag-masthead::after {
  content: ''; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(115deg, rgba(255,255,255,.05) 0 2px, transparent 2px 26px);
  pointer-events: none;
}
.mm-eyebrow {
  font-family: var(--serif); font-style: italic; font-size: 13px;
  letter-spacing: .02em; opacity: .92; margin-bottom: 8px;
}
.mm-titlebar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.mm-logo {
  margin: 0; font-family: var(--display);
  font-size: clamp(40px, 8vw, 74px); font-weight: 900; line-height: .84;
  letter-spacing: -.045em; text-transform: uppercase;
  text-shadow: 3px 4px 0 rgba(0,0,0,.22);
}
.mm-logo span { display: block; color: #ffe14d; -webkit-text-stroke: 0; }
.mm-issue { text-align: right; padding-bottom: 6px; }
.mm-issue-n {
  display: block; font-family: var(--display); font-weight: 900; font-size: 30px;
  line-height: 1; letter-spacing: -.02em;
}
.mm-issue-date { font-family: var(--serif); font-style: italic; font-size: 12.5px; opacity: .9; }
.mm-strilli {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 14px; border-top: 1.5px solid rgba(255,255,255,.4);
  font-family: var(--serif); font-size: 14px; position: relative;
}
.mm-strillo { font-style: italic; }
.mm-dot { font-size: 9px; opacity: .7; }
.mm-sfoglia {
  margin-left: auto; background: #fff; color: var(--nin-red);
  border: none; font-family: var(--sans); font-weight: 800; font-size: 13.5px;
  letter-spacing: .01em; padding: 9px 18px; border-radius: 4px; cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0,0,0,.25); transition: transform .1s, box-shadow .1s;
}
.mm-sfoglia:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 rgba(0,0,0,.25); }

/* --- Rubrica (ex sezione priorità) --- */
.rubrica { margin-bottom: 52px; }
.rubrica-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; }
.rubrica-kicker {
  font-family: var(--sans); font-weight: 800; font-size: 11px;
  text-transform: uppercase; letter-spacing: .18em;
  color: #fff; background: var(--nin-red); padding: 5px 10px 4px; border-radius: 3px;
  flex-shrink: 0; align-self: center;
}
.rubrica-title {
  margin: 0; font-family: var(--display); font-weight: 900;
  font-size: clamp(24px, 3.6vw, 34px); letter-spacing: -.025em; line-height: 1;
  color: var(--ink); flex-shrink: 0;
  /* icona + testo allineati al centro (non alla baseline: spingeva l'icona in basso) */
  display: inline-flex; align-items: center; gap: 9px;
}
.rubrica-title .ic { vertical-align: 0; }   /* dentro il flex l'offset non serve */
.rubrica-rule { flex: 1; height: 0; border-top: 3px double var(--ink); align-self: center; opacity: .55; }
.rubrica-count {
  font-family: var(--serif); font-style: italic; font-size: 13.5px; color: var(--muted);
  flex-shrink: 0; align-self: center;
}
.rubrica-gold .rubrica-kicker { background: #c98a00; }
.rubrica-gold .rubrica-title { color: #b5850e; }
.rubrica-switch2 .rubrica-title { color: var(--switch2-gold); }

/* --- Corpo asimmetrico: HERO (grande, sx) + colonna strilli (dx), stessa altezza --- */
.rubrica-body {
  display: grid; grid-template-columns: 1.55fr 1fr; gap: 34px;
  align-items: stretch;   /* hero e colonna strilli alla stessa altezza -> niente vuoti */
  margin-bottom: 22px;
}

/* ====== HERO: cover grande su "scaffale", cartellino, prezzone ====== */
.ed-hero {
  display: grid; grid-template-columns: minmax(190px, 250px) 1fr; gap: 28px;
  align-items: center; color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: 8px; padding: 26px 30px 26px 26px;
  position: relative; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.ed-hero::before {   /* filetto rosso a sinistra, come apertura d'articolo */
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  background: var(--nin-red);
}
.ed-hero:hover { transform: translateY(-3px); box-shadow: var(--shadow-hi); }
.rubrica-gold .ed-hero::before { background: #c98a00; }
.rubrica-switch2 .ed-hero::before { background: var(--switch2-gold); }

/* lo "scaffale": la cover appoggiata con ombra profonda + riflesso */
.ed-hero-shelf { position: relative; display: flex; align-items: center; justify-content: center; }
.ed-hero-cover {
  position: relative; width: 100%; max-width: 230px;
  aspect-ratio: 4 / 5; display: flex; align-items: flex-end; justify-content: center;
}
.ed-hero-cover img {
  max-width: 100%; max-height: 100%; object-fit: contain; display: block;
  border-radius: 4px;
  /* ombra profonda + micro-bordo caldo: la cover sembra un prodotto esposto */
  box-shadow: var(--ombra-scaffale);
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.15));
  background: #fff; padding: 2px;
  transform: perspective(900px) rotateY(-6deg);
  transition: transform .25s ease, box-shadow .25s ease;
}
.ed-hero:hover .ed-hero-cover img { transform: perspective(900px) rotateY(-2deg) translateY(-4px); }
.ed-hero-cover .noimg { font-size: 64px; }
/* base d'appoggio: sottile ellisse d'ombra a terra, effetto "sullo scaffale" */
.ed-hero-shelf::after {
  content: ''; position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%);
  width: 64%; height: 14px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0,0,0,.28), transparent 70%);
  filter: blur(2px); pointer-events: none;
}
/* cartellino prezzo/sconto appeso all'angolo */
.ed-cartellino {
  position: absolute; top: -6px; right: -4px; z-index: 3;
  background: var(--nin-red); color: #fff; text-align: center;
  width: 62px; height: 62px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 3px 4px 10px rgba(0,0,0,.35);
  transform: rotate(-9deg);
  border: 2px dashed rgba(255,255,255,.7);
}
.ed-cartellino em { font-family: var(--display); font-weight: 900; font-style: normal; font-size: 18px; line-height: 1; }
.ed-cartellino small { font-size: 8px; text-transform: uppercase; letter-spacing: .08em; opacity: .9; }

.ed-hero-text { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ed-kicker {
  font-family: var(--sans); font-weight: 800; font-size: 11px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--nin-red);
  border-bottom: 2px solid var(--nin-red); padding-bottom: 5px; align-self: flex-start;
}
.rubrica-gold .ed-kicker { color: #b5850e; border-color: #b5850e; }
.rubrica-switch2 .ed-kicker { color: var(--switch2-gold); border-color: var(--switch2-gold); }
.ed-hero-title {
  margin: 0; font-family: var(--display); font-weight: 800;
  font-size: clamp(19px, 2.3vw, 26px); line-height: 1.08; letter-spacing: -.02em;
  color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.ed-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ed-plat {
  font-family: var(--sans); font-weight: 700; font-size: 11px; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 3px; border: 1px solid var(--line); background: var(--card);
}
.ed-plat.sw2 { background: #fff7e0; border-color: #f0d47a; color: #b5850e; }
.ed-plat.sw  { background: #ffeaea; border-color: #ffc9c9; color: var(--nin-red); }
.ed-plat.acc { background: var(--bg-soft); color: var(--muted); }
.ed-plat.ip  { background: var(--nin-red); border-color: var(--nin-red); color: #fff; }
.ed-source, .ed-multi {
  font-family: var(--serif); font-style: italic; font-size: 12.5px; color: var(--muted);
}
.ed-multi::before { content: '· '; }
.ed-hero-price {
  margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--paper-line);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.ed-price-block { display: flex; flex-direction: column; }
.ed-price-now {
  font-family: var(--display); font-weight: 900; font-size: clamp(34px, 5vw, 46px);
  line-height: .9; color: var(--nin-red); letter-spacing: -.03em;
}
.ed-price-was { font-family: var(--serif); font-style: italic; font-size: 13.5px; color: var(--muted); text-decoration: line-through; margin-top: 4px; }
.ed-cta {
  font-family: var(--sans); font-weight: 800; font-size: 13px; color: var(--ink);
  border-bottom: 2px solid var(--nin-red); padding-bottom: 3px; white-space: nowrap;
}
.ed-hero:hover .ed-cta { color: var(--nin-red); }

/* ====== Colonna strilli (voci compatte, "anche in questo numero") ====== */
.strilli-col {
  border-top: 4px solid var(--ink); padding-top: 12px;
  display: flex; flex-direction: column;   /* distribuisce per riempire l'altezza dell'hero */
}
.strilli-label {
  font-family: var(--sans); font-weight: 800; font-size: 11px;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 10px;
}
.ed-strillo {
  display: grid; grid-template-columns: 58px 1fr; gap: 13px; align-items: center;
  padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--ink);
  transition: background .12s; flex: 1;   /* ogni strillo si allarga a riempire */
}
.ed-strillo:last-child { border-bottom: none; }
.ed-strillo:hover { background: var(--paper); }
.ed-strillo-thumb {
  position: relative; width: 58px; height: 72px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 4px; padding: 5px;
  box-shadow: 2px 4px 9px rgba(0,0,0,.18);
}
.ed-strillo-thumb img {
  max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 2px;
}
.ed-strillo-thumb .noimg { font-size: 28px; }
.ed-strillo-pct {
  position: absolute; top: -6px; left: -8px;
  background: var(--nin-red); color: #fff; font-family: var(--display); font-weight: 900;
  font-size: 10px; padding: 2px 5px; border-radius: 3px; box-shadow: 1px 1px 3px rgba(0,0,0,.3);
}
.ed-strillo-title {
  font-family: var(--sans); font-weight: 700; font-size: 13px; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 5px;
}
.ed-strillo-foot { display: flex; align-items: baseline; gap: 8px; }
.ed-strillo-price { font-family: var(--display); font-weight: 900; font-size: 16px; color: var(--nin-red); }
.ed-strillo-was { font-size: 11px; color: var(--muted); text-decoration: line-through; }
.ed-strillo-src { font-family: var(--serif); font-style: italic; font-size: 11px; color: var(--muted); margin-left: auto; }

/* ====== Fila secondaria: mini-card a "scaffale" (listino) ====== */
.mini-strip {
  display: grid; gap: 22px 20px; margin-top: 32px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  border-top: 1px solid var(--paper-line); padding-top: 26px;
}
.ed-mini { display: flex; flex-direction: column; gap: 9px; color: var(--ink); position: relative; }
.ed-mini-pct {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: var(--nin-red); color: #fff; font-family: var(--display); font-weight: 900;
  font-size: 12px; padding: 3px 7px; border-radius: 3px; box-shadow: 2px 2px 5px rgba(0,0,0,.28);
}
/* cover "sullo scaffale": box a proporzione FISSA con sfondo bianco uniforme, così
   cover verticali (giochi) e accessori quadrati/orizzontali si allineano in riga. */
.ed-mini-cover {
  aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 5px; padding: 10px; position: relative;
  box-shadow: 4px 7px 14px rgba(0,0,0,.16);
}
.ed-mini-cover img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  transition: transform .2s ease;
}
.ed-mini:hover .ed-mini-cover img { transform: translateY(-5px) scale(1.02); }
.ed-mini-cover .noimg { font-size: 40px; align-self: center; }
/* mini-card allineate in riga (niente sfalso alto-basso) */
.ed-mini-title {
  font-family: var(--sans); font-weight: 700; font-size: 13px; line-height: 1.28;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.4em;
}
.ed-mini-foot { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.ed-mini-price { font-family: var(--display); font-weight: 900; font-size: 18px; color: var(--nin-red); }
.ed-mini-was { font-size: 12px; color: var(--muted); text-decoration: line-through; }

/* --- Paginazione (piè di pagina editoriale) --- */
.pager {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: 44px; padding-top: 18px; border-top: 3px double var(--ink);
}
.pager a, .pager > span:not(.pager-folio) {
  font-family: var(--sans); font-weight: 800; font-size: 13.5px; color: var(--ink);
}
.pager a:hover { color: var(--nin-red); }
.pager .disabled { opacity: .35; }
.pager-folio { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--muted); }

/* --- Responsive home editoriale --- */
@media (max-width: 900px) {
  .rubrica-body { grid-template-columns: 1fr; gap: 26px; }
  .strilli-col { border-top-width: 3px; }
}
@media (max-width: 560px) {
  .mag-masthead { padding: 18px 20px 16px; }
  .ed-hero { grid-template-columns: 130px 1fr; gap: 16px; padding: 18px 18px 18px 16px; }
  .ed-hero-cover .noimg { font-size: 40px; }
  .rubrica-head { flex-wrap: wrap; gap: 8px 10px; }
  .rubrica-rule { display: none; }
  .mini-strip { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px 14px; }
  .mm-strilli { font-size: 12.5px; gap: 10px; }
  .mm-sfoglia { margin-left: 0; }
}

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); }

/* --- Storico (tabella) --- */
.htable { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.htable th, .htable td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.htable th { background: var(--bg-soft); font-weight: 700; }
.htable tr:last-child td { border-bottom: none; }
.htable .old { text-decoration: line-through; color: var(--muted); }
.htable .err { color: var(--nin-red); font-size: 12px; max-width: 280px; }
.status-ok { color: #1a9e4b; font-weight: 700; }
.status-warn { color: #d98a00; font-weight: 700; }
.status-down { color: var(--nin-red); font-weight: 700; }

@media (max-width: 640px) {
  .nav { gap: 14px; font-size: 14px; }
  .hero h1 { font-size: 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
}

/* --- Impostazioni --- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.panel h2 { margin: 0 0 16px; font-size: 18px; font-weight: 800; }
.soglie label { display: block; margin-bottom: 20px; font-weight: 700; font-size: 14px; }
.soglie small { display: block; color: var(--muted); font-weight: 400; margin-top: 4px; }
.range-row { display: flex; align-items: center; gap: 12px; margin: 8px 0 2px; }
.range-row input[type=range] { flex: 1; accent-color: var(--nin-red); }
.range-row output { font-weight: 800; color: var(--nin-red); min-width: 44px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-primary, .btn-ghost {
  border: none; font-weight: 700; font-size: 14px; padding: 10px 16px;
  border-radius: 999px; cursor: pointer; transition: filter .1s;
}
.btn-primary { background: var(--nin-red); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--nin-red); border: 1.5px solid var(--nin-red); }
.btn-ghost:hover { background: var(--nin-red); color: #fff; }
.act-msg { margin-top: 14px; font-size: 14px; color: var(--muted); min-height: 1.2em; }
.preview-box {
  margin-top: 14px; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; font-size: 12px; max-height: 340px;
  overflow: auto; white-space: pre-wrap; color: var(--ink);
}
.muted { color: var(--muted); }
.tag { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.tag-novita { background: #e6f4ea; color: #1a9e4b; }
.tag-rivista { background: #fff0f0; color: var(--nin-red); }
.tag-super { background: #fff4d6; color: #c98a00; }
.tag-stato { background: var(--bg-soft); color: var(--muted); }

/* --- Toggle dark theme nell'header --- */
.theme-toggle {
  background: rgba(255,255,255,.18); border: none; color: #fff; cursor: pointer;
  width: 34px; height: 34px; border-radius: 50%; font-size: 16px; line-height: 1;
}
.theme-toggle:hover { background: rgba(255,255,255,.3); }

@media (max-width: 720px) { .settings-grid { grid-template-columns: 1fr; } }

/* --- pill multi-negozio --- */
.pill.multi { background: #eef4ff; border-color: #cfe0ff; color: #2b62d9; }
@media (prefers-color-scheme: dark) { .pill.multi { background: #1a2740; border-color: #2b4576; color: #7aa2ff; } .pill.ip { background: #3a1a1a; border-color: #6b2b2b; } }

/* --- Pagina prodotto --- */
.back { display: inline-block; margin-bottom: 18px; font-weight: 700; color: var(--muted); }
.back:hover { color: var(--nin-red); }
.product-hero {
  display: grid; grid-template-columns: 320px 1fr; gap: 32px; margin-bottom: 26px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow);
}
.product-img { background: #fff; border-radius: 14px; display: grid; place-items: center; padding: 20px; min-height: 300px; }
.product-img img { max-width: 100%; max-height: 340px; object-fit: contain; }
.product-info h1 { margin: 0 0 12px; font-size: 26px; font-weight: 800; line-height: 1.2; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.ptag { font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line); }
.ptag.sw2 { background: #fff7e0; border-color: #f0d47a; color: #b5850e; }
.ptag.sw { background: #ffeaea; border-color: #ffc9c9; color: var(--nin-red); }
.ptag.ip { background: var(--nin-red); color: #fff; border-color: var(--nin-red); }
.best-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; font-size: 15px; margin-bottom: 14px; }
.bp-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.bp-value { font-size: 34px; font-weight: 800; color: var(--nin-red); }
.bp-old { text-decoration: line-through; color: var(--muted); }
.bp-pct { background: var(--nin-red); color: #fff; font-weight: 800; padding: 2px 10px; border-radius: 8px; }
.lowbadge { display: inline-block; background: #e6f4ea; color: #1a9e4b; font-weight: 800; padding: 6px 14px; border-radius: 999px; margin-bottom: 16px; }
.btn-primary.big { display: inline-block; font-size: 16px; padding: 13px 26px; margin-top: 6px; }
.htable.stores .price-cell { font-weight: 800; color: var(--nin-red); }
.htable.stores tr.inactive { opacity: .5; }
.htable.stores .disc { background: var(--nin-red); color: #fff; font-weight: 700; padding: 1px 8px; border-radius: 6px; font-size: 12px; }
.btn-ghost.small { padding: 5px 12px; font-size: 12px; }
.chart { width: 100%; height: auto; }
.chart-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }

@media (max-width: 720px) { .product-hero { grid-template-columns: 1fr; } }

/* --- gruppi azioni Impostazioni --- */
.action-group { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.action-group:last-of-type { border-bottom: none; }
.ag-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.action-group small { display: block; color: var(--muted); margin-top: 8px; font-size: 12px; }

/* --- loader scan --- */
.scan-progress { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--ink); }
.spinner {
  width: 18px; height: 18px; border: 3px solid var(--line);
  border-top-color: var(--nin-red); border-radius: 50%;
  animation: spin .8s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-primary:disabled { opacity: .6; cursor: default; }

/* ============ Rivista sfogliabile (page-flip 3D) ============ */
.mag-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(20,10,10,.82); backdrop-filter: blur(6px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.mag-modal[hidden] { display: none; }   /* l'attributo hidden deve vincere sul display:flex */
.mag-close {
  position: absolute; top: 20px; right: 24px; z-index: 10;
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: #fff; color: var(--nin-red); font-size: 20px; font-weight: 800; box-shadow: var(--shadow-hi);
}
.mag-stage { perspective: 2600px; width: min(94vw, 860px); height: min(84vh, 940px); }
.mag-book { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }

/* ogni "foglio" ruota sul lato sinistro come la pagina di un libro */
.mag-leaf {
  position: absolute; inset: 0;
  transform-origin: left center; transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.3,.1,.2,1), box-shadow .7s;
  backface-visibility: hidden;
  border-radius: 4px 14px 14px 4px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.mag-leaf.current { transform: rotateY(0deg); }
.mag-leaf.next    { transform: rotateY(0deg); }        /* impilate sotto */
.mag-leaf.flipped { transform: rotateY(-170deg); box-shadow: none; pointer-events: none; }

.mp-page {
  width: 100%; height: 100%; background: var(--paper); color: var(--ink);
  padding: 26px 30px 22px; overflow: hidden; display: flex; flex-direction: column;
  border-left: 6px solid rgba(0,0,0,.06);
}
/* piega centrale (ombra sul lato rilegatura) */
.mp-page::before {
  content:''; position: absolute; top:0; left:0; width: 40px; height: 100%;
  background: linear-gradient(90deg, rgba(0,0,0,.14), transparent); pointer-events: none;
}

/* ====== Copertina (da edicola): masthead + strillone + cover ====== */
.mp-cover {
  background: var(--nin-red); color:#fff; text-align:center;
  align-items:stretch; justify-content:space-between;
  padding: 30px 30px 26px; border-left: none;
  outline: 2px solid rgba(255,255,255,.85); outline-offset: -10px;
  position: relative; overflow: hidden;
}
.mp-cover::after {
  content:''; position:absolute; inset:0; pointer-events:none;
  background: repeating-linear-gradient(115deg, rgba(255,255,255,.05) 0 2px, transparent 2px 26px);
}
.mp-cover > * { position: relative; z-index: 1; }
.mp-cover-masthead { padding-top: 4px; }
.mp-cover-eyebrow { font-family: var(--serif); font-style: italic; font-size: 13px; opacity:.92; margin-bottom: 6px; }
.mp-cover-logo {
  font-family: var(--display); font-weight: 900; font-size: clamp(38px, 9vw, 58px);
  line-height:.82; letter-spacing:-.045em; text-transform: uppercase;
  text-shadow: 3px 4px 0 rgba(0,0,0,.22);
}
.mp-cover-logo span { display:block; color:#ffe14d; }
.mp-cover-issue { font-family: var(--serif); font-style: italic; font-size: 14px; margin-top: 10px; opacity:.95; }
.mp-cover-hero { flex:1; display:flex; align-items:center; justify-content:center; width:100%; margin: 14px 0; position: relative; }
.mp-cover-hero img {
  max-width: 62%; max-height: 320px; object-fit: contain;
  filter: drop-shadow(10px 18px 28px rgba(0,0,0,.5)); border-radius: 6px;
  transform: perspective(1000px) rotateY(-8deg);
}
.mp-cover-flash {
  position: absolute; top: 6%; right: 12%;
  background:#fff; color: var(--nin-red); font-family: var(--display); font-weight: 900;
  font-size: 24px; width: 74px; height: 74px; border-radius: 50%;
  display:flex; align-items:center; justify-content:center;
  transform: rotate(-12deg); box-shadow: 3px 5px 12px rgba(0,0,0,.4);
  border: 2px dashed var(--nin-red);
}
.mp-cover-strilli { display:flex; flex-direction:column; gap:6px; margin-bottom: 14px; }
.mp-cover-big {
  font-family: var(--display); font-weight: 800; font-size: clamp(16px, 3.2vw, 22px);
  line-height: 1.1; letter-spacing:-.01em;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.mp-cover-mini { font-family: var(--serif); font-style: italic; font-size: 14px; opacity:.92; }
.mp-cover-foot {
  font-family: var(--sans); font-weight: 700; font-size: 12px; letter-spacing:.04em;
  text-transform: uppercase; padding-top: 12px; border-top: 1.5px solid rgba(255,255,255,.4);
}

/* ====== Retro di copertina ====== */
.mp-back { background: var(--ink); color:#fff; align-items:center; justify-content:center; text-align:center; gap: 22px; border-left:none; }
.mp-back-logo { font-family: var(--display); font-weight: 900; font-size: 40px; line-height:.85; text-transform:uppercase; letter-spacing:-.04em; opacity:.35; }
.mp-back-logo span { display:block; color: var(--nin-red); opacity: 1; }
.mp-back-txt { font-family: var(--serif); font-style: italic; font-size: 16px; line-height: 1.6; opacity:.8; }

/* ====== Testata di rubrica nella modale ====== */
.mp-page-head { display:flex; align-items:baseline; gap:10px; margin-bottom:20px; }
.mp-rubrica-kicker {
  font-family: var(--sans); font-weight:800; font-size:10px; text-transform:uppercase; letter-spacing:.16em;
  color:#fff; background: var(--nin-red); padding:4px 8px 3px; border-radius:3px; align-self:center; flex-shrink:0;
}
.mp-page-head h3 { margin:0; font-family: var(--display); font-weight:900; font-size:22px; letter-spacing:-.02em; flex-shrink:0; }
.mp-rule { flex:1; height:0; border-top: 3px double var(--ink); opacity:.5; align-self:center; }
.mp-count { font-family: var(--serif); font-style:italic; font-size:13px; color:var(--muted); flex-shrink:0; align-self:center; }

/* ====== Corpo asimmetrico: HERO + colonna strilli ====== */
.mp-body { display:grid; grid-template-columns: 1.35fr 1fr; gap: 24px; align-items:start; }

.mp-hero {
  display:grid; grid-template-columns: 130px 1fr; gap:18px; align-items:center; color:var(--ink);
  background: var(--card); border:1px solid var(--paper-line); border-radius:8px;
  padding: 20px 22px 20px 20px; position:relative; overflow:hidden;
}
.mp-hero::before { content:''; position:absolute; left:0; top:0; bottom:0; width:5px; background: var(--nin-red); }
.mp-hero-shelf { position:relative; display:flex; align-items:center; justify-content:center; }
.mp-hero-cover { position:relative; width:100%; aspect-ratio:4/5; display:flex; align-items:flex-end; justify-content:center; }
.mp-hero-cover img {
  max-width:100%; max-height:100%; object-fit:contain; border-radius:3px; background:#fff; padding:2px;
  box-shadow: 8px 14px 26px rgba(0,0,0,.4);
  transform: perspective(800px) rotateY(-7deg);
}
.mp-hero-cover .noimg { font-size:44px; }
.mp-cartellino {
  position:absolute; top:-8px; right:-6px; z-index:3;
  background: var(--nin-red); color:#fff; text-align:center;
  width:54px; height:54px; border-radius:50%;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  box-shadow:3px 4px 9px rgba(0,0,0,.4); transform:rotate(-9deg); border:2px dashed rgba(255,255,255,.7);
}
.mp-cartellino em { font-family:var(--display); font-weight:900; font-style:normal; font-size:16px; line-height:1; }
.mp-cartellino small { font-size:7px; text-transform:uppercase; letter-spacing:.06em; opacity:.9; }
.mp-hero-text { display:flex; flex-direction:column; gap:9px; min-width:0; }
.mp-kicker {
  font-family:var(--sans); font-weight:800; font-size:10px; letter-spacing:.15em; text-transform:uppercase;
  color:var(--nin-red); border-bottom:2px solid var(--nin-red); padding-bottom:4px; align-self:flex-start;
}
.mp-hero-title {
  margin:0; font-family:var(--display); font-weight:800; font-size:18px; line-height:1.1; letter-spacing:-.02em;
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden;
}
.mp-hero-tags { display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
.mp-plat { font-family:var(--sans); font-weight:700; font-size:10.5px; padding:2px 8px; border-radius:3px; border:1px solid var(--line); background:var(--bg-soft); }
.mp-plat.sw2 { background:#fff7e0; border-color:#f0d47a; color:#b5850e; }
.mp-plat.sw { background:#ffeaea; border-color:#ffc9c9; color:var(--nin-red); }
.mp-plat.acc { background:var(--bg-soft); color:var(--muted); }
.mp-plat.ip { background:var(--nin-red); border-color:var(--nin-red); color:#fff; }
.mp-hero-src, .mp-hero-multi { font-family:var(--serif); font-style:italic; font-size:12px; color:var(--muted); }
.mp-hero-multi::before { content:'· '; }
.mp-hero-price { margin-top:4px; padding-top:12px; border-top:1px solid var(--paper-line); display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; }
.mp-hero-now { font-family:var(--display); font-weight:900; font-size:34px; line-height:.9; color:var(--nin-red); letter-spacing:-.03em; }
.mp-hero-was { font-family:var(--serif); font-style:italic; font-size:12.5px; color:var(--muted); text-decoration:line-through; }

.mp-strilli-col { border-top:4px solid var(--ink); padding-top:10px; }
.mp-strilli-label { font-family:var(--sans); font-weight:800; font-size:10.5px; text-transform:uppercase; letter-spacing:.12em; color:var(--muted); margin-bottom:8px; }
.mp-strillo { display:grid; grid-template-columns:48px 1fr; gap:11px; align-items:center; padding:10px 2px; border-bottom:1px solid var(--line); color:var(--ink); }
.mp-strillo:last-child { border-bottom:none; }
.mp-strillo-thumb { position:relative; width:50px; height:62px; flex-shrink:0; display:flex; align-items:center; justify-content:center; background:#fff; border-radius:4px; padding:4px; box-shadow:2px 3px 7px rgba(0,0,0,.18); }
.mp-strillo-thumb img { max-width:100%; max-height:100%; object-fit:contain; border-radius:2px; }
.mp-strillo-thumb .noimg { font-size:24px; }
.mp-more { font-family:var(--serif); font-style:italic; font-size:12px; color:var(--muted); padding-top:8px; }
.mp-strillo-pct { position:absolute; top:-5px; left:-7px; background:var(--nin-red); color:#fff; font-family:var(--display); font-weight:900; font-size:9px; padding:2px 4px; border-radius:3px; }
.mp-strillo-title { font-family:var(--sans); font-weight:700; font-size:12px; line-height:1.22; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; margin-bottom:4px; }
.mp-strillo-foot { display:flex; align-items:baseline; gap:7px; }
.mp-strillo-price { font-family:var(--display); font-weight:900; font-size:15px; color:var(--nin-red); }
.mp-strillo-was { font-size:10.5px; color:var(--muted); text-decoration:line-through; }
.mp-strillo-src { font-family:var(--serif); font-style:italic; font-size:10.5px; color:var(--muted); margin-left:auto; }

/* ====== Listino a piè pagina della modale ====== */

.mp-folio { margin-top:auto; padding-top:18px; text-align:center; font-family:var(--serif); font-style:italic; font-size:14px; color:var(--muted); }

.mag-controls { display:flex; align-items:center; gap:20px; margin-top:22px; }
.mag-nav { width:52px; height:52px; border-radius:50%; border:none; cursor:pointer; background:#fff; color:var(--nin-red); font-size:26px; font-weight:800; box-shadow:var(--shadow-hi); }
.mag-nav:disabled { opacity:.35; cursor:default; }
.mag-pagenum { color:#fff; font-weight:700; min-width:70px; text-align:center; }
.mag-loading { display:flex; align-items:center; justify-content:center; gap:12px; height:100%; color:var(--muted); font-weight:600; }

@media (max-width:640px){
  .mp-page { padding: 20px 18px; }
  .mp-body { grid-template-columns:1fr; gap:20px; }
  .mp-strilli-col { border-top-width:3px; }
  .mp-mini-strip { grid-template-columns:repeat(2, 1fr); }
  .mp-page-head { flex-wrap:wrap; gap:8px; padding-right: 48px; }  /* lascia spazio al tasto chiudi */
  .mp-rule { display:none; }
}

.hero-btn {
  margin-top: 18px; background: #fff; color: var(--nin-red); border: none;
  font-weight: 800; font-size: 15px; padding: 12px 26px; border-radius: 999px;
  cursor: pointer; box-shadow: var(--shadow-hi);
}
.hero-btn:hover { transform: translateY(-2px); transition: transform .1s; }

/* --- scan: log + annulla --- */
.scan-row { display: flex; gap: 10px; align-items: center; }

/* Riepilogo scan: ultimo esito e prossima esecuzione automatica */
.scan-meta { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.sm-riga { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.sm-et { color: var(--muted); min-width: 140px; }
.sm-val { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.sm-nota { color: var(--muted); }
@media (max-width: 560px) { .sm-et { min-width: 0; } }
.btn-ghost.danger { color: #c0392b; border-color: #c0392b; }
.btn-ghost.danger:hover { background: #c0392b; color: #fff; }
.scan-progress { margin-top: 14px; }
.scan-status { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.scan-logs:empty { display: none; }   /* niente blocco nero quando non ci sono log */
.scan-logs {
  background: #0f1115; color: #b8e6c0; border-radius: 10px; padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.6;
  max-height: 220px; overflow-y: auto; white-space: pre-wrap; margin: 0;
}

/* --- Pagina Novità --- */
.novita-list { display: flex; flex-direction: column; gap: 12px; }
.nv-row {
  display: flex; align-items: center; gap: 16px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 16px; box-shadow: var(--shadow); transition: transform .12s ease;
}
.nv-row:hover { transform: translateX(3px); box-shadow: var(--shadow-hi); }
.nv-thumb { width: 54px; height: 68px; flex-shrink: 0; background: #fff; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; padding: 5px; box-shadow: 2px 3px 8px rgba(0,0,0,.16); }
.nv-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.nv-main { flex: 1; min-width: 0; }
.nv-title { font-weight: 700; font-size: 15px; line-height: 1.3; margin-bottom: 5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nv-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.nv-date { font-family: var(--serif, Georgia), serif; font-style: italic; }
.nv-price { display: flex; align-items: baseline; gap: 8px; flex-shrink: 0; text-align: right; }
.nv-now { font-weight: 900; font-size: 20px; color: var(--nin-red); }
.nv-old { font-size: 13px; color: var(--muted); text-decoration: line-through; }
.nv-pct { background: var(--nin-red); color: #fff; font-weight: 800; font-size: 12px; padding: 2px 7px; border-radius: 6px; }
@media (max-width: 560px){ .nv-price { flex-direction: column; gap: 2px; align-items: flex-end; } }

/* rivista sfogliabile = immagini render (stesse di Telegram) */
.mag-img { width: 100%; height: 100%; object-fit: contain; background: var(--nin-red); display: block; }

/* affari d'oro evidenziati nella pagina Novità */
.nv-row.nv-gold { border-color: #ffd84d; box-shadow: 0 2px 14px rgba(230,160,0,.18); background: linear-gradient(100deg, color-mix(in srgb, #ffd84d 12%, var(--card)), var(--card)); }
.nv-goldtag { display: inline-block; font-size: 11px; font-weight: 800; color: #b5850e; background: #fff6da; border: 1px solid #ffd84d; padding: 1px 8px; border-radius: 999px; margin-bottom: 5px; }

/* ============================================================
   MOBILE — header con menu hamburger, layout compatto, no overflow
   ============================================================ */
.nav-burger { display: none; }
.nav-toggle { display: none; }

@media (max-width: 780px) {
  /* --- Header: brand compatto + hamburger --- */
  .topbar-inner { padding: 10px 14px; gap: 12px; position: relative; flex-wrap: wrap; }
  .brand { font-size: 17px; gap: 8px; }
  .brand .logo { width: 26px; height: 26px; font-size: 15px; }

  .nav-burger {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    margin-left: auto; width: 40px; height: 40px; cursor: pointer;
    align-items: center; border-radius: 8px;
  }
  .nav-burger span { display: block; width: 22px; height: 2.5px; background: #fff; border-radius: 2px; transition: transform .2s, opacity .2s; }
  .nav-toggle:checked + .nav-burger span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
  .nav-toggle:checked + .nav-burger span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked + .nav-burger span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

  /* menu a tendina: chiuso di default, si apre col checkbox */
  .nav {
    display: none; width: 100%; margin: 0; flex-direction: column; gap: 0;
    border-top: 1px solid rgba(255,255,255,.25); padding-top: 6px; margin-top: 4px;
  }
  .nav-toggle:checked ~ .nav { display: flex; }
  .nav a {
    padding: 12px 4px; border-bottom: 1px solid rgba(255,255,255,.14);
    border-left: 3px solid transparent; padding-left: 10px; font-size: 16px;
  }
  .nav a:last-child { border-bottom: none; }
  .nav a.active { border-bottom-color: rgba(255,255,255,.14); border-left-color: #fff; font-weight: 800; }

  /* --- Masthead compatto --- */
  .wrap { padding: 18px 14px 50px; }
  .mag-masthead { padding: 16px 16px 14px; margin-bottom: 26px; outline-offset: -6px; }
  .mm-eyebrow { font-size: 11.5px; margin-bottom: 6px; }
  .mm-logo { font-size: clamp(30px, 11vw, 44px); }
  .mm-titlebar { align-items: flex-start; gap: 8px; }
  .mm-issue { text-align: left; padding-bottom: 0; }
  .mm-issue-n { font-size: 20px; display: inline; margin-right: 8px; }
  .mm-issue-date { font-size: 11px; }
  .mm-strilli { margin-top: 12px; padding-top: 10px; font-size: 12.5px; gap: 8px; }
  .mm-sfoglia { margin-left: 0; width: 100%; margin-top: 8px; padding: 11px 16px; }

  /* --- Rubrica: hero e strilli in colonna --- */
  .rubrica { margin-bottom: 34px; }
  .rubrica-head { flex-wrap: wrap; gap: 8px 10px; margin-bottom: 14px; }
  .rubrica-rule { display: none; }
  .rubrica-title { font-size: clamp(20px, 6vw, 26px); }
  .rubrica-body { grid-template-columns: 1fr; gap: 20px; }
  .ed-hero { grid-template-columns: 130px 1fr; gap: 16px; padding: 16px 16px 16px 14px; }
  .ed-hero-title { font-size: 19px; }
  .ed-price-now { font-size: 30px; }
  .mini-strip { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 14px 10px; }

  /* --- Tabelle: niente overflow, riflow a schede --- */
  .htable, .htable thead, .htable tbody, .htable tr, .htable th, .htable td { display: block; width: 100%; }
  .htable thead { display: none; }               /* le intestazioni diventano etichette inline */
  .htable tr {
    border-bottom: 1px solid var(--line); padding: 10px 12px;
    display: grid; grid-template-columns: auto 1fr; gap: 2px 10px;
  }
  .htable td { border: none; padding: 3px 0; font-size: 13.5px; }
  .htable td::before {
    content: attr(data-label); font-weight: 700; color: var(--muted);
    font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
    display: block;
  }
  .htable .err { max-width: none; }

  /* --- Impostazioni --- */
  .panel { padding: 16px 14px; }
  .settings-grid { grid-template-columns: 1fr; gap: 14px; }
  .actions { gap: 8px; }
  .btn-primary, .btn-ghost { font-size: 13px; padding: 10px 14px; }
  .scan-row { flex-wrap: wrap; }
  .scan-logs { font-size: 11px; max-height: 180px; }
  .range-row output { min-width: 38px; font-size: 14px; }

  /* --- Pagina prodotto / novità --- */
  .product-hero { grid-template-columns: 1fr; gap: 18px; padding: 18px 16px; }
  .product-img { min-height: 200px; padding: 14px; }
  .product-info h1 { font-size: 21px; }
  .bp-value { font-size: 28px; }
  .nv-row { padding: 10px 12px; gap: 12px; flex-wrap: wrap; }
  .nv-title { font-size: 14px; }
  .nv-price { width: 100%; justify-content: flex-start; }

  /* --- Modale rivista --- */
  .mag-stage { width: 96vw; height: 74vh; }
  .mag-close { top: 12px; right: 12px; width: 38px; height: 38px; font-size: 17px; }
  .mag-nav { width: 44px; height: 44px; font-size: 22px; }
  .mag-controls { margin-top: 14px; gap: 14px; }
}

/* niente scroll orizzontale in nessun caso */
html, body { max-width: 100%; overflow-x: hidden; }

/* logo SVG nell'header (sostituisce il vecchio cerchio "S") */
/* anello bianco: il logo è rosso su header rosso, serve stacco */
.brand .logo-img {
  width: 34px; height: 34px; display: block; border-radius: 50%;
  background: #fff; padding: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
@media (max-width: 780px) { .brand .logo-img { width: 28px; height: 28px; } }

/* ============ Pattern di sfondo + effetto pagina 3D ============
   Il pattern (--pattern-bg, impostato da pattern.js) sta sullo sfondo; il contenuto
   centrale è una "pagina" in rilievo, come un foglio appoggiato sopra. */
body { background-image: var(--pattern-bg); background-repeat: repeat; background-attachment: fixed; }
/* depth = 7 (tarato nel playground): ombra laterale contenuta */
.wrap {
  background: var(--bg-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 7%, transparent),
              -7px 0 16px -10px rgba(0,0,0,.4),
               7px 0 16px -10px rgba(0,0,0,.4);
  position: relative;
}
/* filo verticale ai due bordi: accentua l'effetto "pagina" */
.wrap::before, .wrap::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--ink) 12%, transparent), transparent);
}
.wrap::before { left: 0; } .wrap::after { right: 0; }
@media (max-width: 780px) { .wrap { box-shadow: none; } .wrap::before, .wrap::after { display: none; } }

/* ============ Icone monocrome (sostituiscono le emoji) ============ */
.ic { display: inline-block; vertical-align: -0.18em; flex-shrink: 0; }
.ic + * { margin-left: 2px; }

/* pallini di stato (ex 🟢🟡🔴) */
.st-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.st-ok { background: #1a9e4b; box-shadow: 0 0 0 2px color-mix(in srgb, #1a9e4b 22%, transparent); }
.st-warn { background: #d98a00; box-shadow: 0 0 0 2px color-mix(in srgb, #d98a00 22%, transparent); }
.st-down { background: var(--nin-red); box-shadow: 0 0 0 2px color-mix(in srgb, var(--nin-red) 22%, transparent); }

/* badge negozio con colore d'accento del brand */
.store-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; letter-spacing: .01em;
  padding: 2px 9px 2px 7px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--sc) 35%, var(--line));
  background: color-mix(in srgb, var(--sc) 7%, var(--card));
  color: color-mix(in srgb, var(--sc) 75%, var(--ink));
}
.sb-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sc); flex-shrink: 0; }
@media (prefers-color-scheme: dark) {
  .store-badge { color: color-mix(in srgb, var(--sc) 45%, #fff); background: color-mix(in srgb, var(--sc) 14%, var(--card)); }
}

/* ---- allineamento icone: centro ottico col testo, ovunque ---- */
.panel h2, .rubrica-title, .nv-goldtag, .lowbadge,
.btn-primary, .btn-ghost, .mm-sfoglia, .ed-cta {
  display: inline-flex; align-items: center; gap: 8px;
}
.panel h2 { display: flex; }            /* titolo pannello a tutta riga */
.btn-primary, .btn-ghost { justify-content: center; }
.panel h2 .ic, .btn-primary .ic, .btn-ghost .ic,
.nv-goldtag .ic, .lowbadge .ic { vertical-align: 0; }

/* ============ Login area riservata ============ */
.login-wrap { display: flex; justify-content: center; padding: 40px 0; }
.login-card { max-width: 380px; width: 100%; }
.login-card p { margin: 0 0 18px; font-size: 14px; }
.login-input {
  width: 100%; padding: 12px 14px; font-size: 15px; margin-bottom: 12px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--bg-soft); color: var(--ink);
}
.login-input:focus { outline: none; border-color: var(--nin-red); }
.login-btn { width: 100%; padding: 12px; font-size: 15px; }
.login-err {
  background: color-mix(in srgb, var(--nin-red) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--nin-red) 35%, var(--line));
  color: var(--nin-red); font-size: 13px; font-weight: 600;
  padding: 10px 12px; border-radius: 8px; margin-bottom: 14px;
}
/* zona pericolosa (reset/elimina) */
.danger-zone { border-color: color-mix(in srgb, var(--nin-red) 30%, var(--line)); }
.danger-zone h2 { color: var(--nin-red); }
.btn-danger {
  background: var(--nin-red); color: #fff; border: none; font-weight: 700;
  font-size: 14px; padding: 10px 16px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-danger:hover { filter: brightness(1.1); }

/* tag prodotto digitale (eShop): distinto dal fisico */
.ed-plat.dig, .ptag.dig {
  background: #eef2ff; border-color: #c7d2fe; color: #4338ca;
}
@media (prefers-color-scheme: dark) {
  .ed-plat.dig, .ptag.dig { background: #1e1b4b; border-color: #3730a3; color: #a5b4fc; }
}
.store-badge[style*="6b5bd6"] { font-weight: 700; }
