/* Tech in Classe · Giochi — stessi token del sito principale */
:root {
  --primary: #2563eb;
  --primary-dark: #1e3a8a;
  --secondary: #f97316;
  --accent: #00b894;
  --accent2: #facc15;
  --dark: #09111f;
  --dark2: #152033;
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #142033;
  --text-light: #5f6f85;
  --border: #dce4ef;
  --ok: #00a383;
  --ko: #e0412b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 48px rgba(9,17,31,0.08);
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  /* colori delle 4 risposte: blu, arancio, verde, giallo */
  --opt-0: var(--primary);
  --opt-1: var(--secondary);
  --opt-2: var(--accent);
  --opt-3: var(--accent2);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* barra in alto */
.top {
  background: var(--dark);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px clamp(14px, 3vw, 32px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.top a.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.top img { height: 40px; width: auto; filter: grayscale(100%) brightness(1.7) contrast(1.15); }
.top .brand b { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.top .brand span { color: #9fb0c8; font-size: .85rem; white-space: nowrap; }
.top .spacer { flex: 1; }
.top .tbtn {
  background: transparent; border: 1px solid #2c3b55; color: #dfe7f3;
  border-radius: var(--radius-sm); padding: 7px 12px; font-size: .88rem; white-space: nowrap;
}
.top .tbtn:hover { border-color: #5b7099; }

main { max-width: 1120px; margin: 0 auto; padding: clamp(18px, 4vw, 40px) clamp(14px, 3vw, 32px) 60px; }

/* titoli */
.h-kicker { font-family: var(--font-display); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--primary); font-weight: 700; }
h1.h-page { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.7rem, 4.4vw, 2.6rem); line-height: 1.1; margin: 6px 0 10px; }
.lead { color: var(--text-light); max-width: 62ch; }
h2.h-sec { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; margin: 34px 0 12px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
h2.h-sec small { font-family: var(--font-body); font-weight: 500; color: var(--text-light); font-size: .85rem; }

/* pulsanti */
.btn {
  border: 1px solid var(--border); background: var(--card); border-radius: var(--radius-sm);
  padding: 9px 14px; font-weight: 600; font-size: .92rem; line-height: 1.2;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--ko); }
.btn.big { padding: 14px 22px; font-size: 1.05rem; border-radius: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* libreria: righe a registro, non card */
.shelf { border-top: 2px solid var(--dark); }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 18px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.row .t { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; line-height: 1.25; }
.row .m { color: var(--text-light); font-size: .86rem; margin-top: 2px; }
.row .acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.tag {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; margin-right: 6px; vertical-align: 2px;
  background: #e8efff; color: var(--primary-dark);
}
.tag.k-vf { background: #fff0e4; color: #9a4208; }
.tag.k-list { background: #e2f7f1; color: #00664f; }
.empty { color: var(--text-light); padding: 18px 0; border-bottom: 1px solid var(--border); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* editor */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(14px, 3vw, 26px); box-shadow: var(--shadow); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .lbl { font-size: .82rem; font-weight: 600; color: var(--text-light); }
.inp, textarea.inp, select.inp {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff;
  padding: 10px 12px; font-size: 1rem;
}
.inp:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 220px); gap: 14px; }
.kinds { display: flex; flex-wrap: wrap; gap: 8px; }
.kinds label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; font-weight: 600; cursor: pointer; }
.kinds input { accent-color: var(--primary); }
.kinds label:has(input:checked) { border-color: var(--primary); background: #eef3ff; }

.item { border-top: 1px solid var(--border); padding: 16px 0; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; }
.item .n { font-family: var(--font-display); font-weight: 700; color: var(--text-light); padding-top: 9px; }
.item .x { align-self: start; }
.ans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.ans .a { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 4px 4px 8px; }
.ans .a:has(input[type=radio]:checked) { border-color: var(--ok); background: #e6f7f2; }
.ans .a input[type=radio] { accent-color: var(--ok); width: 18px; height: 18px; }
.ans .a .inp { border: 0; padding: 6px 4px; }
.ans .a .inp:focus { outline: none; }
.vfpick { display: flex; gap: 8px; margin-top: 8px; }
.vfpick label { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 14px; font-weight: 600; cursor: pointer; }
.vfpick input { position: absolute; opacity: 0; pointer-events: none; }
.vfpick label:has(input:checked) { border-color: var(--dark); background: var(--dark); color: #fff; }
.hint { color: var(--text-light); font-size: .85rem; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-top: 16px; }
.bar .l, .bar .r { display: flex; flex-wrap: wrap; gap: 8px; }

/* finestra impostazioni partita */
dialog { margin: auto; border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 24px)); box-shadow: 0 30px 80px rgba(9,17,31,.35); }
dialog::backdrop { background: rgba(9,17,31,.55); }
dialog .dlg { padding: 22px; }
dialog h3 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 4px; }
.opts { display: grid; gap: 10px; margin: 16px 0; }
.opts .o { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 12px; font-weight: 600; font-size: .9rem; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--dark); color: #fff; }
.teams { display: grid; gap: 6px; }
.teams .inp { padding: 7px 10px; }
textarea.paste { min-height: 220px; font-family: ui-monospace, Menlo, monospace; font-size: .88rem; }

/* ===== schermo di gioco (pensato per la LIM) ===== */
.stage {
  position: fixed; inset: 0; z-index: 50; background: var(--dark); color: #fff;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); overflow-y: auto; overflow-x: hidden;
}
.stage .shead { display: flex; align-items: center; gap: 12px; padding: 12px clamp(12px, 3vw, 28px); border-bottom: 1px solid #1f2d45; }
.stage .shead .ttl { font-family: var(--font-display); font-weight: 600; color: #9fb0c8; font-size: .95rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage .shead .prog { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.stage .shead .spacer { flex: 1; }
.sbtn { background: transparent; color: #dfe7f3; border: 1px solid #2c3b55; border-radius: var(--radius-sm); padding: 7px 12px; font-size: .88rem; font-weight: 600; white-space: nowrap; }
.sbtn:hover { border-color: #6b82ad; }
.sbtn.solid { background: #fff; color: var(--dark); border-color: #fff; }
.sbody { padding: clamp(14px, 3vw, 36px); display: grid; align-content: center; justify-items: center; gap: clamp(16px, 3vh, 30px); }
.sfoot { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px clamp(12px, 3vw, 28px) 14px; border-top: 1px solid #1f2d45; align-items: center; }

/* punteggi squadre */
.score { display: flex; align-items: center; gap: 8px; border: 1px solid #2c3b55; border-radius: 999px; padding: 4px 6px 4px 12px; font-weight: 600; }
.score b { font-family: var(--font-display); background: #1f2d45; border-radius: 999px; min-width: 2em; text-align: center; padding: 2px 8px; }
.score.turn { border-color: var(--accent2); color: var(--accent2); }
.score.turn b { background: var(--accent2); color: var(--dark); }
.turnline { font-family: var(--font-display); color: var(--accent2); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: .9rem; }

.question { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.4rem, 3.6vw, 2.7rem); line-height: 1.2; text-align: center; max-width: 30ch; text-wrap: balance; }
.question.long { font-size: clamp(1.25rem, 3vw, 2.2rem); max-width: 36ch; }

.timer { width: min(520px, 80vw); height: 8px; background: #1f2d45; border-radius: 99px; overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--accent2); transform-origin: left; }
.timer.low i { background: var(--ko); }

.choices { width: min(1040px, 100%); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(8px, 1.6vw, 16px); }
.choice {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px;
  text-align: left; border: 0; border-radius: 14px; padding: clamp(14px, 2.4vh, 24px) clamp(14px, 2vw, 22px);
  font-size: clamp(1rem, 2vw, 1.45rem); font-weight: 600; line-height: 1.25; color: #fff; min-height: clamp(64px, 11vh, 120px);
  transition: transform .12s ease, opacity .25s ease, filter .25s ease;
}
.choice:active { transform: scale(.98); }
.choice .k {
  font-family: var(--font-display); font-weight: 800; width: 1.9em; height: 1.9em; border-radius: 8px;
  display: grid; place-items: center; background: rgba(0,0,0,.22); font-size: .95em;
}
.choice.c0 { background: var(--opt-0); }
.choice.c1 { background: var(--opt-1); }
.choice.c2 { background: var(--opt-2); }
.choice.c3 { background: var(--opt-3); color: var(--dark); }
.choice.c3 .k { background: rgba(0,0,0,.12); }
.choices.done .choice { opacity: .28; filter: saturate(.4); cursor: default; }
.choices.done .choice.right { opacity: 1; filter: none; outline: 4px solid #fff; outline-offset: 3px; }
.choices.done .choice.picked.wrong { opacity: .75; filter: none; outline: 4px dashed var(--ko); outline-offset: 3px; }

.vfrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(10px, 2vw, 20px); width: min(820px, 100%); }
.vf { border: 0; border-radius: 16px; font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 4.4vw, 3rem); padding: clamp(20px, 5vh, 46px) 10px; color: #fff; }
.vf.t { background: var(--accent); }
.vf.f { background: var(--ko); }
.vfrow.done .vf { opacity: .28; }
.vfrow.done .vf.right { opacity: 1; outline: 4px solid #fff; outline-offset: 3px; }

.verdict { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.3rem, 3vw, 2rem); min-height: 1.3em; text-align: center; }
.verdict.ok { color: var(--accent); }
.verdict.ko { color: #ff8a78; }

/* ruota */
.wheelbox { position: relative; width: min(62vh, 92vw, 640px); aspect-ratio: 1; margin-top: 18px; }
.wheelbox canvas { width: 100%; height: 100%; display: block; }
.wheelbox .pin {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 0; height: 0;
  border-left: 18px solid transparent; border-right: 18px solid transparent; border-top: 34px solid #fff;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.4));
}
.wheelbox .hub {
  position: absolute; inset: 0; margin: auto; width: 21%; height: 21%; border-radius: 50%;
  background: #fff; color: var(--dark); border: 0; font-family: var(--font-display); font-weight: 800;
  font-size: clamp(.95rem, 2.4vw, 1.4rem); box-shadow: 0 6px 22px rgba(0,0,0,.4);
}
.wheelbox .hub:disabled { cursor: default; color: var(--text-light); }
.wheel-wrap { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 14px; width: 100%; }
.drawn { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 5vw, 3.4rem); text-align: center; line-height: 1.15; max-width: 22ch; }
.leftcount { color: #9fb0c8; font-size: .95rem; }

/* classifica finale */
.board { width: min(640px, 100%); display: grid; gap: 10px; }
.board .p { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 14px; background: #152033; font-size: clamp(1.05rem, 2.4vw, 1.5rem); font-weight: 700; }
.board .p:first-child { background: var(--accent2); color: var(--dark); }
.board .p .pos { font-family: var(--font-display); font-weight: 800; }
.board .p .pts { font-family: var(--font-display); font-weight: 800; }
.review { width: min(820px, 100%); }
.review h4 { font-family: var(--font-display); color: #9fb0c8; font-weight: 600; margin-bottom: 8px; }
.review li { list-style: none; border-top: 1px solid #1f2d45; padding: 10px 0; }
.review li span { color: var(--accent); display: block; font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 90; font-weight: 600; max-width: calc(100vw - 24px); }

@media (max-width: 720px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr); }
  .row .acts { justify-content: flex-start; }
  .ans { grid-template-columns: minmax(0, 1fr); }
  .choices { grid-template-columns: minmax(0, 1fr); }
  .top .brand span { display: none; }
  .item { grid-template-columns: 26px minmax(0, 1fr); }
  .item .x { grid-column: 2; justify-self: start; }
}
@media (max-width: 520px) {
  .stage .shead .ttl, #stFull { display: none; }
  .stage .shead .spacer { display: block; }
}
@media (max-width: 380px) {
  .top img { height: 28px; }
  .top .brand b { font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) {
  .choice { transition: none; }
}
.sfoot .grow { flex: 1; }

/* giochi pronti tolti dalla lista */
.gone { margin-top: 18px; }
.gone summary { cursor: pointer; color: var(--text-light); font-size: .9rem; padding: 6px 0; }
.gone .row .t { color: var(--text-light); }
a.btn { text-decoration: none; color: inherit; }
