/* =====================================================================
   Test dell'Intelligenza — foglio di stile
   Palette: carta calda, inchiostro, blu petrolio, zafferano
   ===================================================================== */

:root {
  --bg: #F3F1EC;
  --surface: #FFFFFF;
  --surface-2: #F8F6F1;
  --ink: #15171B;
  --muted: #5C6068;
  --faint: #8C8F96;
  --line: #E3DFD6;
  --line-strong: #CFCABF;

  --band: #134E5E;
  --band-deep: #0E3D4A;
  --band-ink: #FFFFFF;
  --band-soft: rgba(255, 255, 255, .74);
  --band-faint: rgba(255, 255, 255, .5);
  --tile: rgba(255, 255, 255, .13);
  --tile-hover: rgba(255, 255, 255, .2);

  --accent: #F2B134;
  --accent-hover: #F6C25B;
  --accent-ink: #1C1404;

  --wait: #C6363F;
  --go: #2E9E5B;
  --good: #3DCB7A;
  --bad: #FF6B6B;

  --brand-ink: var(--band);
  --chart-area: rgba(19, 78, 94, .16);
  --shadow: 0 1px 2px rgba(20, 22, 27, .05), 0 4px 16px rgba(20, 22, 27, .05);

  --radius: 10px;
  --radius-sm: 7px;
  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --logo-cell: #fff;
  --logo-bg: #134E5E;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1214; --surface: #151C1F; --surface-2: #1A2226; --ink: #ECEDE9; --muted: #A2A9AC; --faint: #737B7F;
    --line: #243034; --line-strong: #33424A;
    --band: #0F3F4C; --band-deep: #0B323C;
    --brand-ink: #7FC4D2; --chart-area: rgba(127, 196, 210, .16);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --logo-bg: #23707F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1214; --surface: #151C1F; --surface-2: #1A2226; --ink: #ECEDE9; --muted: #A2A9AC; --faint: #737B7F;
  --line: #243034; --line-strong: #33424A;
  --band: #0F3F4C; --band-deep: #0B323C;
  --brand-ink: #7FC4D2; --chart-area: rgba(127, 196, 210, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --logo-bg: #23707F;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  min-height: 100vh; overflow-x: hidden;
}
#app { min-height: 100vh; display: flex; flex-direction: column; }
#view { flex: 1; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.015em; }
p { margin: 0; }
button { font: inherit; color: inherit; }
kbd {
  font: 500 .72em/1 var(--mono); padding: .28em .45em; border-radius: 4px;
  border: 1px solid currentColor; opacity: .7; vertical-align: .08em; white-space: nowrap;
}
.muted { color: var(--muted); }
.small { font-size: 14px; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ico { width: 100%; height: 100%; display: block; }

/* ---------- pulsanti ---------- */
.btn, .btn-ghost, .btn-line {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer;
  border: 0; transition: background .15s, transform .08s, border-color .15s, color .15s; white-space: nowrap;
}
.btn svg, .btn-ghost svg { width: 18px; height: 18px; }
.btn { background: var(--accent); color: var(--accent-ink); }
.btn:hover { background: var(--accent-hover); }
.btn:active, .btn-ghost:active, .btn-line:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 17px; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--band-ink); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .45); }
.btn-ghost:hover { box-shadow: inset 0 0 0 2px #fff; background: rgba(255, 255, 255, .06); }
.btn-line { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); font-weight: 600; font-size: 15px; height: 40px; padding: 0 16px; }
.btn-line:hover { border-color: var(--ink); }
.btn-line.danger { color: var(--wait); }
.btn-line.danger:hover { border-color: var(--wait); }
.btn kbd { opacity: .55; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.link-btn { background: none; border: 0; padding: 6px 4px; color: var(--band-soft); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 14px; }
.link-btn:hover { color: #fff; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 8px;
  background: transparent; border: 1px solid transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line); background: var(--surface-2); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- testata ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; text-decoration: none; letter-spacing: -.01em; color: var(--ink); }
.logo-mark { width: 30px; height: 30px; color: var(--logo-bg); flex: none; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: 7px; font-weight: 600; font-size: 15px; color: var(--muted); }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a.active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--band); border-radius: 7px 7px 0 0; }
:root[data-theme="dark"] .nav a.active { box-shadow: inset 0 -2px 0 var(--brand-ink); }
.tools { display: flex; gap: 4px; }

/* ---------- hero ---------- */
.hero { background: var(--band); color: var(--band-ink); position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 48px 48px; background-position: center -1px;
  -webkit-mask-image: radial-gradient(ellipse 70% 90% at 50% 40%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 90% at 50% 40%, #000 30%, transparent 75%);
}
.hero-in { position: relative; max-width: 760px; margin: 0 auto; padding: 72px 24px 80px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.hero-mark .logo-mark { width: 84px; height: 84px; color: rgba(255, 255, 255, .1); --logo-cell: #fff; }
.hero h1 { font-size: clamp(38px, 6.4vw, 68px); font-weight: 900; letter-spacing: -.035em; }
.hero-lead { font-size: clamp(17px, 2.2vw, 20px); color: var(--band-soft); max-width: 560px; }
.hero-sm .hero-in { padding: 56px 24px 60px; gap: 14px; }
.hero-index {
  margin-top: 4px; display: inline-flex; align-items: center; gap: 14px; text-decoration: none;
  padding: 10px 16px 10px 18px; border-radius: 999px; background: rgba(0, 0, 0, .18); color: var(--band-soft); font-size: 14px;
}
.hero-index b { color: #fff; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hero-index span:last-child { display: inline-flex; align-items: center; gap: 6px; }
.hero-index svg { width: 15px; height: 15px; }
.hero-index:hover { background: rgba(0, 0, 0, .28); color: #fff; }

/* ---------- home: filtri e schede ---------- */
.home-grid { padding-top: 40px; padding-bottom: 72px; }
.filters, .presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.filter {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent;
  font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.filter span { font: 500 12px var(--mono); color: var(--faint); }
.filter:hover { color: var(--ink); border-color: var(--ink); }
.filter.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filter.active span { color: var(--bg); opacity: .6; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card.card-promo {
  grid-column: span 3; background: var(--band); border-color: var(--band); color: #fff;
  flex-direction: row; align-items: center; justify-content: space-between; text-align: left; gap: 24px; padding: 32px 36px; min-height: 0;
}
.card.card-promo:hover { border-color: var(--band); }
.card.card-promo .eyebrow { color: var(--accent); }
.card.card-promo h3 { font-size: 28px; font-weight: 900; margin: 6px 0 8px; letter-spacing: -.02em; }
.card.card-promo p { color: var(--band-soft); max-width: 420px; }
.card.card-promo .btn { flex: none; }
@media (max-width: 1000px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } .card.card-promo { grid-column: span 2; } }
@media (max-width: 720px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .card.card-promo { grid-column: span 1; flex-direction: column; align-items: flex-start; padding: 24px; } }
@media (max-width: 460px) { .cards { grid-template-columns: 1fr; } }
.card {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 34px 22px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s, box-shadow .15s; min-height: 250px;
}
.card:hover { border-color: var(--band); transform: translateY(-2px); box-shadow: var(--shadow); }
:root[data-theme="dark"] .card:hover { border-color: var(--brand-ink); }
.card-ico { width: 56px; height: 56px; color: var(--brand-ink); margin-bottom: 18px; transition: transform .2s; }
.card:hover .card-ico { transform: scale(1.06); }
.card h3 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 15px; line-height: 1.45; max-width: 240px; }
.card-foot {
  margin-top: auto; padding-top: 18px; width: 100%; display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; border-top: 1px dashed var(--line); margin-top: 22px;
}
.card-foot .rec b { font-variant-numeric: tabular-nums; }
.tag {
  font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 5px 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line);
}
.chip-new {
  position: absolute; top: 12px; right: 12px; font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em;
  background: var(--accent); color: var(--accent-ink); padding: 5px 7px; border-radius: 4px;
}
.chip-new.sm { position: static; font-size: 10px; padding: 3px 5px; margin-left: 6px; vertical-align: 2px; }

/* ---------- area di gioco ---------- */
.stage {
  --tsize: 92px;
  position: relative; background: var(--band); color: var(--band-ink);
  min-height: clamp(520px, 72vh, 640px); display: flex; flex-direction: column;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background-color .12s; overflow: hidden;
}
.stage[data-tone="red"] { background: var(--wait); }
.stage[data-tone="green"] { background: var(--go); }
.stage[data-state="play"] { cursor: default; }
.stage.flash-red::after, .stage.flash-ok::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; animation: flash .35s ease-out forwards;
}
.stage.flash-red::after { background: rgba(198, 54, 63, .5); }
.stage.flash-ok::after { background: rgba(255, 255, 255, .12); }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.stage-hud {
  position: relative; z-index: 2; height: 56px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between;
  font: 500 14px var(--mono); color: var(--band-soft); gap: 12px;
}
.hud-left, .hud-right { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.stage-hud b { color: #fff; font-weight: 600; font-size: 16px; }
.hud-run { color: var(--accent); }
.hud-link { background: none; border: 0; color: var(--band-soft); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.hud-link:hover { color: #fff; }
.lives { display: inline-flex; align-items: center; gap: 5px; }
.lives i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--band-faint); display: inline-block; }
.lives i.on { background: #fff; border-color: #fff; }
.stage-inner {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  text-align: center; padding: 0 24px 56px; position: relative;
}
.intro, .result, .between, .num-form { display: flex; flex-direction: column; align-items: center; gap: 18px; max-width: 640px; }
.big-ico { width: 76px; height: 76px; color: #fff; }
.stage-h1 { font-size: clamp(34px, 5.4vw, 56px); font-weight: 900; letter-spacing: -.03em; }
.stage-title { font-size: clamp(30px, 5vw, 48px); font-weight: 800; letter-spacing: -.025em; }
.stage-lead { font-size: 19px; color: var(--band-soft); line-height: 1.5; max-width: 560px; }
.stage-lead b { color: #fff; }
.stage-kicker { font: 500 13px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--band-soft); }
.stage-keys { font-size: 14px; color: var(--band-faint); }
.score-xl { font-size: clamp(64px, 12vw, 112px); font-weight: 900; letter-spacing: -.045em; line-height: .95; font-variant-numeric: tabular-nums; }
.score-xl small { font-size: .32em; font-weight: 700; letter-spacing: -.01em; margin-left: .12em; color: var(--band-soft); }
.score-l { font-size: 56px; font-weight: 900; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.score-l small { font-size: .4em; color: var(--band-soft); font-weight: 700; }
.between { gap: 8px; }
.between .stage-lead { margin: 14px 0 10px; }
.badge { font: 600 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; background: var(--accent); color: var(--accent-ink); padding: 7px 10px; border-radius: 5px; }
.result { gap: 14px; }
.result .btn-row { margin-top: 8px; }
.result-stats {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0; margin: 4px 0 0; border: 1px solid rgba(255, 255, 255, .18); border-radius: 8px; overflow: hidden;
}
.result-stats div { padding: 10px 16px; border-right: 1px solid rgba(255, 255, 255, .18); text-align: left; }
.result-stats div:last-child { border-right: 0; }
.result-stats dt { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--band-faint); }
.result-stats dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.dots { display: flex; gap: 8px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .28); }
.dots i.on { background: #fff; }
.pop { animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.94); opacity: .4; } to { transform: none; opacity: 1; } }
.shake { animation: shake .3s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* barra del tempo */
.timebar { width: min(420px, 80vw); height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.timebar i { display: block; height: 100%; background: #fff; transform-origin: left; animation: drain var(--d, 1s) linear forwards; }
.timebar-top { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: min(520px, calc(100% - 48px)); }
@keyframes drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* griglie */
.grid { display: grid; gap: 14px; width: min(340px, 78vw); aspect-ratio: 1; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.tile {
  border: 0; padding: 0; border-radius: 12px; background: var(--tile); cursor: pointer;
  transition: background-color .1s, transform .1s; touch-action: manipulation;
}
.tile:hover { background: var(--tile-hover); }
.tile.lit { background: #fff; transition: none; }
.seq-grid.is-busy .tile, .nb-grid .tile { cursor: default; }
.seq-grid.is-busy .tile:hover, .nb-grid .tile:hover { background: var(--tile); }
.seq-grid .tile.lit, .nb-grid .tile.lit { background: #fff; }
.vgrid { grid-template-columns: repeat(var(--n), 1fr); width: min(420px, 82vw); gap: clamp(5px, 1.4vw, 10px); }
.vgrid .tile { border-radius: 8px; }
.vgrid .tile.hit { background: #fff; transform: scale(.96); }
.vgrid .tile.miss { background: rgba(0, 0, 0, .35); }
.vgrid .tile.reveal { background: rgba(255, 255, 255, .45); }

/* mira */
.aim-field { position: absolute; left: 24px; right: 24px; top: 0; bottom: 24px; }
.target {
  position: absolute; width: var(--tsize); height: var(--tsize); border-radius: 50%; border: 0; padding: 0; cursor: crosshair;
  background: #fff; display: grid; place-items: center; touch-action: manipulation;
}
.target i { position: absolute; border-radius: 50%; }
.target i:nth-child(1) { inset: 13%; background: var(--band); }
.target i:nth-child(2) { inset: 26%; background: #fff; }
.target i:nth-child(3) { inset: 39%; background: var(--band); }
.target.pop { animation: tpop .12s ease-out; }
@keyframes tpop { from { transform: scale(.6); } to { transform: scale(1); } }
.aim-hint { position: absolute; left: 0; right: 0; top: calc(50% + var(--tsize) / 2 + 18px); color: var(--band-soft); font-size: 18px; }

/* numeri */
.num-show { font-size: clamp(36px, calc(88vw / (var(--len) * .62)), 104px); font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; word-break: break-all; line-height: 1.05; max-width: 100%; }
.num-input {
  width: min(460px, 82vw); height: 64px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, .35); background: rgba(0, 0, 0, .15);
  color: #fff; font: 700 32px var(--font); text-align: center; letter-spacing: .06em; outline: none; font-variant-numeric: tabular-nums;
}
.num-input:focus { border-color: #fff; }
.compare { display: grid; gap: 4px; }
.compare .lbl { font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--band-faint); }
.cmp-num { font-size: clamp(26px, 5vw, 40px); font-weight: 800; letter-spacing: .04em; margin-bottom: 10px; word-break: break-all; font-variant-numeric: tabular-nums; }
.cmp-num del { text-decoration: line-through; text-decoration-thickness: 3px; color: var(--bad); }
.cmp-num del.miss { text-decoration: none; opacity: .6; }

/* parole */
.word { font-size: clamp(40px, 8vw, 72px); font-weight: 800; letter-spacing: -.02em; min-height: 1.2em; }

/* scimpanzé */
.chimp { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: clamp(4px, 1vw, 10px); width: min(820px, 100%); }
.chimp > * { aspect-ratio: 1; }
.ctile {
  border: 3px solid rgba(255, 255, 255, .75); background: transparent; border-radius: 10px; color: #fff; cursor: pointer;
  font-size: clamp(18px, 3.4vw, 34px); font-weight: 800; padding: 0; touch-action: manipulation;
}
.ctile:hover { background: rgba(255, 255, 255, .08); }
.chimp.masked .ctile { background: #fff; border-color: #fff; }
.chimp.masked .ctile span { visibility: hidden; }
.ctile.done { visibility: hidden; }

/* battitura */
.type-box {
  position: relative; width: min(820px, 100%); text-align: left; padding: 26px 28px; border-radius: 12px;
  background: rgba(0, 0, 0, .16); border: 2px solid rgba(255, 255, 255, .12); cursor: text;
}
.type-box.focus { border-color: rgba(255, 255, 255, .5); }
.type-text { font-size: clamp(19px, 2.4vw, 25px); line-height: 1.65; color: rgba(255, 255, 255, .5); max-height: calc(1.65em * 5); overflow: hidden; white-space: pre-wrap; word-break: normal; }
.type-text span { border-radius: 2px; }
.type-text .ok { color: #fff; }
.type-text .bad { color: #fff; background: rgba(255, 107, 107, .65); }
.type-text .cur { box-shadow: inset 0 -3px 0 var(--accent); color: #fff; }
.type-input { position: absolute; inset: 0; opacity: 0; resize: none; border: 0; padding: 0; caret-color: transparent; font-size: 16px; cursor: text; }
.type-live { display: flex; gap: 28px; font: 500 14px var(--mono); color: var(--band-soft); flex-wrap: wrap; justify-content: center; }
.type-live b { color: #fff; font-size: 18px; font-weight: 600; }

/* scelte multiple */
.choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; width: min(680px, 100%); }
.choices.two { grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(440px, 100%); }
.choice {
  height: 60px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .06); color: #fff;
  font-weight: 800; font-size: 18px; letter-spacing: .02em; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background .1s, border-color .1s; touch-action: manipulation; font-variant-numeric: tabular-nums;
}
.choice:hover { border-color: #fff; background: rgba(255, 255, 255, .12); }
.choice kbd { font-size: 11px; opacity: .55; }
.choice.ok { background: var(--go); border-color: var(--good); }
.choice.bad { background: var(--wait); border-color: var(--bad); }
.stroop-word { font-size: clamp(54px, 11vw, 104px); font-weight: 900; letter-spacing: .01em; min-height: 1.15em; line-height: 1.15; }

/* serie */
.series { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 6px 0 14px; }
.term {
  min-width: 72px; height: 72px; padding: 0 14px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .1); font-size: clamp(22px, 3.4vw, 32px); font-weight: 800; font-variant-numeric: tabular-nums;
}
.term.q { background: transparent; border: 2px dashed var(--accent); color: var(--accent); }
.term.q.ok { border-style: solid; background: var(--go); border-color: var(--good); color: #fff; }
.term.q.bad { border-style: solid; background: var(--wait); border-color: var(--bad); color: #fff; }

/* calcolo */
.math-q { font-size: clamp(44px, 8vw, 80px); font-weight: 900; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.math-form .num-input { width: min(300px, 70vw); }

/* rotazione */
.shapes { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; width: min(560px, 100%); }
.shape-box { aspect-ratio: 1; border-radius: 14px; background: rgba(0, 0, 0, .16); display: grid; place-items: center; padding: 8%; }
.shape { width: 100%; height: 100%; overflow: visible; }
.shape rect { fill: #fff; stroke: var(--band); stroke-width: 2; }
.shape-dot { fill: var(--band); }

/* n-back */
.nb-grid { width: min(300px, 70vw); gap: 10px; }
.nb-btn.ok { background: var(--good); }
.nb-btn.bad { background: var(--bad); }

/* ---------- sezioni sotto l'area di gioco ---------- */
.below { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-top: 32px; padding-bottom: 72px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 20px; font-weight: 800; }
.panel-about { grid-column: 1 / -1; }
.panel-about p { color: var(--muted); max-width: 820px; margin-bottom: 12px; font-size: 16px; line-height: 1.65; }
.panel-about p:last-child { margin-bottom: 0; }
.panel-about b { color: var(--ink); }
.legend { margin-top: 12px; font-size: 14px; color: var(--muted); }
.empty { color: var(--muted); font-size: 15px; padding: 48px 0; text-align: center; border: 1px dashed var(--line-strong); border-radius: 8px; }
.kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 16px 0 0; border-top: 1px solid var(--line); }
.kv:empty { display: none; }
.kv div { padding: 12px 10px 0 0; }
.kv dt { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.kv dd { margin: 4px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }

/* grafici */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.c-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.c-area { fill: var(--chart-area); }
.c-axis, .c-tick { stroke: var(--line-strong); stroke-width: 1; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-lbl { font: 500 14px var(--mono); fill: var(--faint); }
.c-mark line { stroke: var(--brand-ink); stroke-width: 2; }
.c-mark circle { fill: var(--brand-ink); stroke: var(--surface); stroke-width: 2; }
.c-mark text { font: 700 16px var(--font); fill: var(--brand-ink); }
.c-dot { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.c-dot.is-best { fill: var(--accent); stroke: var(--ink); }
.radar { width: 100%; max-width: 400px; height: auto; display: block; margin: 0 auto; overflow: visible; }
.r-ring { fill: none; stroke: var(--line); }
.r-spoke { stroke: var(--line); }
.r-area { fill: var(--chart-area); stroke: var(--brand-ink); stroke-width: 2; stroke-linejoin: round; }
.r-dot { fill: var(--brand-ink); stroke: var(--surface); stroke-width: 2; }
.r-lbl { font: 700 13px var(--font); fill: var(--ink); dominant-baseline: middle; }
.r-val { font: 500 12px var(--mono); fill: var(--muted); dominant-baseline: middle; }

/* ---------- pagine (profilo, percorso, report) ---------- */
.page-head { padding: 48px 0 28px; }
.page-head h1 { font-size: clamp(32px, 4.6vw, 46px); font-weight: 900; letter-spacing: -.03em; margin: 6px 0 10px; }
.page-head .btn { margin-top: 18px; }
.eyebrow { font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--brand-ink); }
.profile { display: grid; gap: 16px; padding-bottom: 72px; }
.hero-sm + .profile { padding-top: 32px; }
.profile-top { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 16px; }
.profile-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.index-panel { display: flex; flex-direction: column; gap: 10px; }
.index-num { font-size: 104px; font-weight: 900; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.index-lbl { font-size: 20px; font-weight: 700; }
.scale {
  position: relative; display: flex; justify-content: space-between; margin: 18px 0 10px; padding-top: 14px;
  font: 500 11px var(--mono); color: var(--faint);
  background: linear-gradient(90deg, var(--line) 0 100%) top / 100% 4px no-repeat;
}
.scale::before {
  content: ""; position: absolute; top: 0; left: 33.3%; width: 33.4%; height: 4px; background: var(--line-strong);
}
.scale i { position: absolute; top: -5px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); transform: translateX(-50%); box-shadow: 0 0 0 1px var(--ink); z-index: 1; }
.radar-panel p { text-align: center; color: var(--muted); }
.radar-panel b { color: var(--ink); }
.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 620px; }
.table th { text-align: left; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 0 12px 10px 0; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .is-empty td { color: var(--faint); }
.tname { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; }
.tname:hover { color: var(--brand-ink); }
.mini-ico { width: 22px; height: 22px; color: var(--brand-ink); flex: none; display: inline-block; }
.t-go { width: 32px; text-align: right; }
.t-go a { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; color: var(--muted); }
.t-go a:hover { background: var(--surface-2); color: var(--ink); }
.t-go svg { width: 16px; height: 16px; }
.pbar { position: relative; height: 22px; min-width: 120px; background: var(--surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.pbar i { position: absolute; inset: 0 auto 0 0; background: var(--chart-area); border-right: 2px solid var(--brand-ink); }
.pbar span { position: relative; font: 600 12px/20px var(--mono); padding-left: 8px; }
.feed, .report-list { list-style: none; margin: 0; padding: 0; }
.feed li, .report-list li { display: grid; grid-template-columns: 22px 1fr auto auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child, .report-list li:last-child { border-bottom: 0; }
.report-list li { grid-template-columns: 22px 1fr auto 130px; }
.feed b, .report-list b { font-variant-numeric: tabular-nums; }
.feed-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.data-actions label { cursor: pointer; }
.disclaimer { color: var(--faint); border-top: 1px solid var(--line); padding-top: 14px; line-height: 1.5; }
.profile > .disclaimer { border: 0; text-align: center; }

.path { display: grid; gap: 16px; padding-bottom: 72px; }
.resume { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-color: var(--accent); }
.resume .btn-row { justify-content: flex-end; }
.pick { list-style: none; margin: 4px 0 0; padding: 0; columns: 2; column-gap: 24px; }
.pick li { break-inside: avoid; }
.pick label { display: grid; grid-template-columns: 20px 22px 1fr auto 54px; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick label:hover .pick-name { color: var(--brand-ink); }
.pick input { width: 18px; height: 18px; accent-color: var(--band); margin: 0; }
.pick-name { font-weight: 600; }
.pick .small { text-align: right; }
.path-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 22px; flex-wrap: wrap; }

/* ---------- piè di pagina ---------- */
.foot { border-top: 1px solid var(--line); padding: 22px 0; font-size: 14px; }
.foot-in { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.foot-in > span:first-child { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; }
.foot .logo-mark { width: 20px; height: 20px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 8px; font-weight: 600; font-size: 15px;
  transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- accesso ---------- */
.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.gate-side {
  background: var(--band); color: #fff; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  position: relative; overflow: hidden;
}
.gate-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; }
.gate-brand .logo-mark { color: rgba(255, 255, 255, .12); width: 36px; height: 36px; }
.gate-demo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: min(300px, 60%); aspect-ratio: 1; align-self: center; }
.gate-demo i { border-radius: 12px; background: rgba(255, 255, 255, .12); transition: background .25s; }
.gate-demo i.on { background: #fff; transition: none; }
.gate-claim { font-size: 22px; line-height: 1.4; font-weight: 600; max-width: 420px; color: rgba(255, 255, 255, .85); }
.gate-main { display: grid; place-items: center; padding: 40px 24px; }
.gate-form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.gate-lock { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--brand-ink); margin-bottom: 8px; }
.gate-lock svg { width: 22px; height: 22px; }
.gate-form h1 { font-size: 34px; font-weight: 900; letter-spacing: -.03em; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.field > span:first-child { font-size: 14px; font-weight: 600; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input {
  width: 100%; height: 50px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  padding: 0 50px 0 14px; font: 500 17px var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
.pw-wrap input:focus { border-color: var(--band); box-shadow: 0 0 0 3px var(--chart-area); }
.pw-eye { position: absolute; right: 4px; top: 4px; width: 42px; height: 42px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 6px; }
.pw-eye:hover { color: var(--ink); }
.pw-eye svg { width: 20px; height: 20px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--band); margin: 0; }
.gate-err { min-height: 22px; color: var(--wait); font-weight: 600; font-size: 15px; }
.gate-form .btn svg { width: 18px; height: 18px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .profile-top, .profile-bottom { grid-template-columns: 1fr; }
  .pick { columns: 1; }
}
@media (max-width: 760px) {
  .wrap, .topbar-in { padding-left: 16px; padding-right: 16px; }
  .topbar-in { gap: 10px; }
  .brand span { display: none; }
  .nav { justify-content: center; }
  .nav a { padding: 8px 10px; }
  .below { grid-template-columns: 1fr; }
  .kv { grid-template-columns: repeat(2, 1fr); }
  .stage-hud { padding: 0 16px; font-size: 13px; }
  .hud-left, .hud-right { gap: 14px; }
  .stage-inner { padding: 0 16px 40px; gap: 18px; }
  .stage-lead { font-size: 17px; }
  .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gate { grid-template-columns: 1fr; }
  .gate-side { padding: 24px 20px; gap: 20px; }
  .gate-demo { display: none; }
  .gate-claim { font-size: 17px; }
  .type-box { padding: 18px; }
  .hero-in { padding: 52px 16px 56px; }
  .result-stats div { padding: 8px 12px; }
  .stage { --tsize: 76px; }
  .pick label { grid-template-columns: 20px 22px 1fr auto; }
  .pick .small { display: none; }
  .report-list li { grid-template-columns: 22px 1fr auto; }
  .report-list .pbar { grid-column: 2 / -1; }
  .feed li { grid-template-columns: 22px 1fr auto; }
  .feed li .small { display: none; }
}
@media (max-width: 420px) {
  .term { min-width: 58px; height: 58px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .timebar i { animation-duration: var(--d, 1s) !important; }
}
