/* ============================================================
   PRONTO INTERVENTO — Quiz Antincendio VVF
   Estetica: segnaletica industriale antincendio.
   Rosso sicurezza, bande di pericolo, condensed display type.
   ============================================================ */

:root {
  --red: #e2231a;
  --red-deep: #b01810;
  --yellow: #f5b301;
  --green: #2fa257;
  --bg: #16181d;
  --bg-2: #1e2127;
  --panel: #23272f;
  --panel-2: #2a2f39;
  --line: #363c48;
  --text: #eef0f3;
  --text-dim: #9aa3b2;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --radius: 14px;
  --font-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --font-body: "Saira", "Segoe UI", sans-serif;
}

.shell[data-theme="light"] {
  --bg: #f2efe8;
  --bg-2: #eae6dd;
  --panel: #ffffff;
  --panel-2: #f6f4ee;
  --line: #ddd8cc;
  --text: #1d2025;
  --text-dim: #5d6470;
  --shadow: 0 10px 26px rgba(40, 34, 20, .14);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body { margin: 0; }

.shell {
  min-height: 100dvh;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 500px at 85% -10%, rgba(226, 35, 26, .10), transparent 60%),
    radial-gradient(800px 420px at -10% 110%, rgba(245, 179, 1, .07), transparent 60%);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* ---- banda di pericolo ---- */
.stripe-top, .stripe {
  height: 10px;
  background: repeating-linear-gradient(-45deg,
    var(--yellow) 0 14px, #16181d 14px 28px);
}

/* ---- topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(14px, 4vw, 36px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--text);
  padding: 0;
}

.brand-mark { width: 38px; height: 38px; }
.brand-mark .flame {
  fill: var(--red);
  stroke: none;
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 26px;
  letter-spacing: .03em;
  line-height: 1;
}
.brand-text em { font-style: normal; color: var(--red); }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.badge-2026 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .08em;
  color: var(--yellow);
  border: 1.5px solid var(--yellow);
  padding: 3px 9px 2px;
  border-radius: 6px;
  white-space: nowrap;
}

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.shell[data-theme="light"] .ico-moon { display: none; }
.shell:not([data-theme="light"]) .ico-sun { display: none; }

/* ---- layout ---- */
main {
  flex: 1;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 40px) clamp(14px, 4vw, 36px) 60px;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 18px clamp(14px, 4vw, 36px) max(18px, env(safe-area-inset-bottom));
  color: var(--text-dim);
  font-size: 13px;
}
.footer p { margin: 4px 0; }
.footer-small { opacity: .75; }

/* ---- home ---- */
.hero { margin: 6px 0 26px; animation: rise .5s ease both; }
.hero-logo {
  display: flex;
  align-items: center;
  gap: clamp(16px, 4vw, 34px);
}
.hero-logo .logo {
  width: clamp(130px, 22vw, 220px);
  height: auto;
  border-radius: 22px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .hero-logo { flex-direction: column; text-align: center; }
  .hero-logo p { margin-inline: auto; }
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(42px, 8vw, 74px);
  line-height: .95;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: .015em;
}
.hero h1 .accent { color: var(--red); }
.hero p { max-width: 640px; color: var(--text-dim); margin: 0; font-size: 16px; }

.section-label {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .12em;
  font-size: 17px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 30px 0 14px;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-label .dot { width: 9px; height: 9px; background: var(--red); border-radius: 2px; }
.section-label.gold .dot { background: var(--yellow); }

.bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 16px;
}

.bank-card {
  position: relative;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow);
  padding: 20px 20px 16px;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease;
  animation: rise .5s ease both;
}
.bank-card:nth-child(2) { animation-delay: .06s; }
.bank-card:hover, .bank-card:focus-visible { transform: translateY(-3px); border-color: var(--red); }
.bank-card::before {
  content: "";
  position: absolute; inset: 0 auto 0 0; width: 5px;
  background: var(--red);
}
.bank-card.old::before { background: repeating-linear-gradient(-45deg, var(--yellow) 0 8px, #1a1a1a 8px 16px); }

.bank-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.bank-badge {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: .1em;
  background: var(--red);
  color: #fff;
  padding: 3px 10px 2px;
  border-radius: 6px;
}
.bank-card.old .bank-badge { background: var(--yellow); color: #1a1a1a; }
.bank-sub { font-size: 13px; color: var(--text-dim); letter-spacing: .02em; }

.bank-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.05;
  margin: 0 0 8px;
  text-transform: uppercase;
}
.bank-desc { font-size: 14.5px; color: var(--text-dim); margin: 0 0 12px; }
.bank-desc b { color: var(--text); font-weight: 600; }

.bank-warn {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 13px;
  color: var(--yellow);
  border: 1px dashed color-mix(in srgb, var(--yellow) 55%, transparent);
  border-radius: 8px;
  padding: 7px 10px;
  margin: 0 0 12px;
}

.bank-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.bank-stats { font-size: 12.5px; color: var(--text-dim); }
.bank-stats strong { color: var(--text); }
.bank-cta {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .08em;
  font-size: 16px;
  color: var(--red);
  text-transform: uppercase;
}
.bank-card.old .bank-cta { color: var(--yellow); }

/* ---- curiosità ---- */
.bank-card.curio::before { background: var(--yellow); }
.curio-badge { background: var(--yellow); color: #1a1a1a; }
.curio-article { animation: rise .4s ease both; }
.curio-article .bank-title { margin-bottom: 14px; }
.curio-article h4 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--yellow);
  margin: 20px 0 6px;
}
.curio-article p, .curio-article li { font-size: 15px; color: var(--text); }
.curio-article ul { padding-left: 22px; margin: 8px 0; }
.curio-article li { margin: 4px 0; }

/* ---- schermata modalità ---- */
.mode-page .bank-title { font-size: clamp(34px, 6vw, 52px); }
.back-link {
  background: none; border: 0; cursor: pointer;
  color: var(--text-dim); font: inherit; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0; margin-bottom: 18px;
}
.back-link:hover { color: var(--text); }

.mode-grid { display: grid; gap: 14px; margin-top: 20px; }

.mode-card {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 16px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 18px 20px;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  transition: transform .15s ease, border-color .15s ease;
  animation: rise .45s ease both;
}
.mode-card:nth-child(2) { animation-delay: .05s; }
.mode-card:nth-child(3) { animation-delay: .1s; }
.mode-card:hover:not(:disabled), .mode-card:focus-visible { transform: translateY(-2px); border-color: var(--red); }
.mode-card:disabled { opacity: .45; cursor: not-allowed; }

.mode-ico {
  width: 54px; height: 54px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--red) 14%, transparent);
}
.mode-ico svg { width: 28px; height: 28px; stroke: var(--red); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mode-name { font-family: var(--font-display); font-weight: 700; font-size: 24px; text-transform: uppercase; letter-spacing: .03em; }
.mode-hint { font-size: 13.5px; color: var(--text-dim); }
.mode-arrow { font-size: 22px; color: var(--text-dim); }

.exam-config {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px 20px;
  margin-top: 14px;
  animation: rise .4s ease both;
}
.config-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0; }
.config-row .lbl { min-width: 130px; font-size: 14px; color: var(--text-dim); }

.chip {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit; font-size: 14px;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  font-weight: 600;
}

.btn-primary {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
  font-size: 20px;
  background: var(--red);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 13px 30px;
  cursor: pointer;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--red) 45%, transparent);
  transition: transform .12s ease, filter .12s ease;
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.07); }
.btn-ghost {
  font: inherit; font-size: 14.5px;
  background: none; border: 1px solid var(--line);
  color: var(--text); border-radius: 10px;
  padding: 10px 18px; cursor: pointer;
}
.btn-ghost:hover { border-color: var(--text-dim); }

/* ---- quiz ---- */
.quiz-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.quiz-meta { display: flex; align-items: baseline; gap: 12px; }
.quiz-counter { font-family: var(--font-display); font-weight: 900; font-size: 30px; }
.quiz-counter small { font-size: 17px; color: var(--text-dim); font-weight: 700; }
.quiz-bank-tag { font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); }

.quiz-timer {
  font-family: var(--font-display); font-weight: 700; font-size: 24px;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 3px 12px;
  min-width: 86px; text-align: center;
}
.quiz-timer.low { color: var(--red); border-color: var(--red); animation: pulse 1s infinite; }

.progress { height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; margin-bottom: 22px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--red), var(--yellow)); border-radius: 99px; transition: width .35s ease; }

.q-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3.5vw, 30px);
  animation: rise .35s ease both;
}
.q-chapter { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--yellow); margin: 0 0 8px; }
.q-text {
  font-size: clamp(17px, 2.4vw, 21px);
  font-weight: 600;
  margin: 0 0 18px;
  line-height: 1.45;
}
.q-img {
  display: block;
  max-width: min(190px, 60%);
  margin: 0 auto 18px;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.opts { display: grid; gap: 10px; }

.opt {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr 34px;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 15.5px;
  color: var(--text);
  background: var(--panel-2);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.opt:hover:not(:disabled) { border-color: var(--text-dim); transform: translateX(3px); }
.opt:disabled { cursor: default; }

.opt-key {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 900; font-size: 18px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--text-dim) 18%, transparent);
}

.opt.sel { border-color: var(--text); }
.opt.correct {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 14%, var(--panel-2));
}
.opt.correct .opt-key { background: var(--green); color: #fff; }
.opt.wrong {
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 13%, var(--panel-2));
  animation: shake .45s ease;
}
.opt.wrong .opt-key { background: var(--red); color: #fff; }
.opt.faded { opacity: .5; }

/* segni animati ✓ / ✗ */
.mark { width: 30px; height: 30px; }
.mark path {
  fill: none;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: draw .5s ease forwards;
}
.mark.v path { stroke: var(--green); }
.mark.x path { stroke: var(--red); animation-duration: .38s; }
.mark.x path:nth-child(2) { animation-delay: .22s; }

/* pannello spiegazione */
.explain {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .5s ease, opacity .4s ease, margin .4s ease;
  margin-top: 0;
}
.explain.open { max-height: 600px; opacity: 1; margin-top: 18px; }
.explain-inner {
  border-left: 4px solid var(--yellow);
  border-radius: 0 10px 10px 0;
  background: color-mix(in srgb, var(--yellow) 7%, var(--panel-2));
  padding: 14px 16px;
  font-size: 14.5px;
}
.explain-inner .exp-title {
  font-family: var(--font-display);
  font-weight: 700; font-size: 17px;
  letter-spacing: .06em; text-transform: uppercase;
  margin: 0 0 6px;
  display: flex; gap: 8px; align-items: center;
}
.explain-inner .exp-title.ok { color: var(--green); }
.explain-inner .exp-title.ko { color: var(--red); }
.explain-inner p { margin: 5px 0; color: var(--text); }
.explain-inner .exp-ref { color: var(--text-dim); font-size: 13px; }

.quiz-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; }

/* ---- risultati ---- */
.result-wrap { text-align: center; animation: rise .5s ease both; }
.gauge { width: 190px; height: 190px; margin: 18px auto 6px; position: relative; }
.gauge svg { transform: rotate(-90deg); }
.gauge .track { fill: none; stroke: var(--panel-2); stroke-width: 13; }
.gauge .fill {
  fill: none; stroke: var(--green); stroke-width: 13; stroke-linecap: round;
  stroke-dasharray: 502;
  transition: stroke-dashoffset 1.1s cubic-bezier(.2, .7, .3, 1);
}
.gauge.fail .fill { stroke: var(--red); }
.gauge-num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 900; font-size: 46px;
}
.verdict {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(38px, 7vw, 58px);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin: 6px 0 2px;
}
.verdict.ok { color: var(--green); }
.verdict.ko { color: var(--red); }
.result-sub { color: var(--text-dim); margin: 0 0 22px; }

.review { text-align: left; margin-top: 30px; display: grid; gap: 12px; }
.review .q-card { animation: none; }
.review .q-text { font-size: 15.5px; margin-bottom: 10px; }
.rev-row { font-size: 14px; margin: 4px 0; display: flex; gap: 8px; }
.rev-row .tag { font-weight: 700; min-width: 86px; }
.rev-row.ok .tag { color: var(--green); }
.rev-row.ko .tag { color: var(--red); }

.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }

/* ---- vuoto ---- */
.empty {
  text-align: center; padding: 60px 20px; color: var(--text-dim);
  animation: rise .4s ease both;
}
.empty .big { font-size: 54px; margin-bottom: 10px; }

/* ---- animazioni ---- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}
@keyframes pulse { 50% { opacity: .55; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 560px) {
  .brand-text { font-size: 21px; }
  .badge-2026 { display: none; }
  .mode-card { grid-template-columns: 44px 1fr auto; padding: 14px 14px; }
  .mode-ico { width: 44px; height: 44px; }
  .quiz-actions { flex-direction: column-reverse; align-items: stretch; }
  .quiz-actions .btn-primary { width: 100%; }
}
