/* TartuQuiz - stile sobrio e pulito, pensato per il telefono */
:root {
  --brand: #1f8a5f; --brand-dark: #146b49; --brand-soft: #eaf7f0; --accent: #f2b632; --on-brand: #fff;
  --bg: #f6faf7; --bg-2: #ffffff; --card: #ffffff; --line: #e1e8e3; --ink: #1c2420; --muted: #66726c;
  --ok: #1b8a53; --ok-bg: #e3f6ec; --bad: #b3322e; --bad-bg: #fbe6e4; --warn: #96620a; --warn-bg: #fbefd5;
  --chip: #e9eeeb; --btn2-bg: #e9eeeb; --btn2-ink: #1f5f4a;
  --grad: linear-gradient(135deg, #1f8a5f 0%, #29a371 100%);
  --r: 16px; --shadow: 0 1px 3px rgba(20, 40, 30, .08), 0 4px 14px rgba(20, 40, 30, .05); --shadow-lg: 0 6px 22px rgba(20, 40, 30, .14);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #4fcf9c; --brand-dark: #bfeedd; --brand-soft: #17332a; --accent: #f2b632; --on-brand: #06261a;
    --bg: #101613; --bg-2: #18201c; --card: #18201c; --line: #2a3530; --ink: #ecf1ee; --muted: #94a39b;
    --chip: #232d28; --btn2-bg: #232d28; --btn2-ink: #bfe8d9;
    --ok-bg: #13342a; --bad-bg: #3d1d1c; --warn-bg: #3a2d10; --warn: #e2b660; --ok: #5fd39c; --bad: #ff8a84;
    --grad: linear-gradient(135deg, #2a7459 0%, #1f5f4a 100%);
    --shadow: 0 1px 3px rgba(0, 0, 0, .4); --shadow-lg: 0 8px 24px rgba(0, 0, 0, .45);
  }
}
:root[data-theme="dark"] {
  --brand: #4fcf9c; --brand-dark: #bfeedd; --brand-soft: #17332a; --accent: #f2b632; --on-brand: #06261a;
  --bg: #101613; --bg-2: #18201c; --card: #18201c; --line: #2a3530; --ink: #ecf1ee; --muted: #94a39b;
  --chip: #232d28; --btn2-bg: #232d28; --btn2-ink: #bfe8d9;
  --ok-bg: #13342a; --bad-bg: #3d1d1c; --warn-bg: #3a2d10; --warn: #e2b660; --ok: #5fd39c; --bad: #ff8a84;
  --grad: linear-gradient(135deg, #2a7459 0%, #1f5f4a 100%);
  --shadow: 0 1px 3px rgba(0, 0, 0, .4); --shadow-lg: 0 8px 24px rgba(0, 0, 0, .45);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; min-height: 100dvh; }
#app { max-width: 640px; margin: 0 auto; padding: 0 16px calc(40px + env(safe-area-inset-bottom)); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); } .small { font-size: .88rem; } .center { text-align: center; }
.hidden { display: none !important; }

/* animazioni appena accennate */
@keyframes up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slide { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes fade { from { opacity: 0; } }
#app > * { animation: up .35s var(--ease) both; }
#app > *:nth-child(2) { animation-delay: .04s; } #app > *:nth-child(3) { animation-delay: .08s; }
#app > *:nth-child(4) { animation-delay: .12s; } #app > *:nth-child(n+5) { animation-delay: .16s; }
#app > .exam-head, #app.noanim > * { animation: none; }
#app.noanim > .qwrap.enter { animation: slide .25s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* barra superiore */
.topbar { display: flex; align-items: center; gap: 12px; padding: 16px 0 12px; }
.topbar img { width: 46px; height: 46px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px var(--line); }
.topbar .t { flex: 1; min-width: 0; }
.topbar .t b { display: block; font-size: 1.15rem; color: var(--brand); font-weight: 800; }
.topbar .t span { display: block; font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card.flat { box-shadow: none; }

/* bottoni */
button, .btn { font: inherit; font-weight: 650; border: 0; border-radius: 99px; padding: 14px 18px; min-height: 52px; background: var(--brand); color: var(--on-brand); cursor: pointer; width: 100%; transition: transform .12s var(--ease), background .15s, opacity .15s; }
button:hover { background: var(--brand-dark); }
button:active { transform: scale(.98); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.secondary { background: var(--btn2-bg); color: var(--btn2-ink); } button.secondary:hover { background: var(--line); }
button.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--line); } button.ghost:hover { background: var(--brand-soft); }
button.danger { background: var(--bad); } button.danger:hover { background: #962a26; }
button.ok { background: var(--ok); } button.ok:hover { background: #17633e; }
button.small { min-height: 40px; padding: 8px 14px; font-size: .92rem; width: auto; border-radius: 99px; }
button:focus-visible, input:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 40%, transparent); outline-offset: 2px; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }

/* form */
label { display: block; font-weight: 650; margin: 0 0 6px; font-size: .95rem; }
input[type=text], input[type=password], input[type=search] { font: inherit; width: 100%; padding: 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg-2); color: var(--ink); min-height: 52px; transition: border-color .15s, box-shadow .15s; }
input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
input.code { font-size: 1.6rem; letter-spacing: 5px; text-align: center; text-transform: uppercase; font-weight: 800; color: var(--brand); }
.msg { padding: 12px 14px; border-radius: 12px; font-size: .95rem; margin: 10px 0; }
.msg.err { background: var(--bad-bg); color: var(--bad); animation: shake .35s; } .msg.ok { background: var(--ok-bg); color: var(--ok); } .msg.info { background: var(--brand-soft); color: var(--brand-dark); }

/* login */
.login { padding-top: 6vh; text-align: center; }
.login img.logo { width: 140px; height: 140px; border-radius: 50%; box-shadow: 0 0 0 3px var(--line), var(--shadow-lg); }
.login h1 { margin-top: 20px; font-size: 2rem; font-weight: 800; color: var(--brand); }
.login .card { text-align: left; margin-top: 20px; }

/* statistiche */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 8px; text-align: center; box-shadow: var(--shadow); border-top: 3px solid var(--brand); }
.stat b { display: block; font-size: 1.9rem; line-height: 1.15; color: var(--ink); font-weight: 800; }
.stat span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat.ok { border-top-color: var(--ok); } .stat.bad { border-top-color: var(--bad); }
.stat.ok b { color: var(--ok); } .stat.bad b { color: var(--bad); }

.hero { background: var(--grad); color: #fff; border-radius: 18px; padding: 22px; margin-bottom: 14px; box-shadow: var(--shadow-lg); }
.hero h2 { color: #fff; font-size: 1.4rem; } .hero p { opacity: .95; }
.hero ul { margin: 0 0 18px; padding: 0; list-style: none; }
.hero li { margin: 7px 0; padding-left: 22px; position: relative; opacity: .96; }
.hero li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border-radius: 50%; background: #e6c277; }
.hero button { background: #fff; color: #164636; font-size: 1.05rem; } .hero button:hover { background: #eef5f1; }

/* cronologia */
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: flex; align-items: center; gap: 12px; padding: 12px 8px; margin: 0 -8px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.hist li + li { border-top: 1px solid var(--line); }
.hist li:hover, .hist li:active { background: var(--brand-soft); }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 4px 11px; border-radius: 99px; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.off { background: var(--chip); color: var(--muted); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.hist .g { flex: 1; min-width: 0; } .hist .g small { display: block; color: var(--muted); }

/* esame */
.exam-head { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 12px 0 10px; border-bottom: 1px solid var(--line); }
.exam-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 700; font-size: .95rem; }
.exam-meta > span:first-child { flex: 1; white-space: nowrap; }
.timer { font-variant-numeric: tabular-nums; font-size: 1.15rem; color: var(--brand-dark); background: var(--chip); padding: 5px 14px; border-radius: 99px; font-weight: 800; }
.timer.low { background: var(--warn-bg); color: var(--warn); } .timer.crit { background: var(--bad-bg); color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.bar { height: 6px; background: var(--line); border-radius: 9px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--brand); border-radius: 9px; transition: width .4s var(--ease); }
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 10px; }
.grid button { min-height: 38px; padding: 0; font-size: .85rem; border-radius: 9px; background: var(--chip); color: var(--ink); width: auto; font-weight: 700; }
.grid button.done { background: var(--brand); color: var(--on-brand); } .grid button.cur { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.qwrap.enter { animation: slide .25s var(--ease) both; }
.q-text { font-size: clamp(1.02rem, 2.9vh, 1.3rem); font-weight: 700; line-height: 1.35; margin: 10px 0 16px; }
.opt { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; background: var(--card); color: var(--ink); border: 1.5px solid var(--line); font-weight: 500; padding: 13px 14px; margin-bottom: 9px; box-shadow: none; border-radius: 16px; min-height: 0; line-height: 1.35; }
.opt:hover { background: var(--card); border-color: var(--brand); }
.opt .l { flex: none; width: 28px; height: 28px; border-radius: 50%; background: transparent; color: var(--brand); border: 1.5px solid var(--brand); display: grid; place-items: center; font-weight: 800; font-size: .9rem; transition: background .15s, color .15s; }
.opt.sel, .opt.sel:hover { border: 2px solid var(--brand); padding: 12px 13px; background: var(--brand-soft); font-weight: 650; }
.opt.sel .l { background: var(--brand); color: var(--on-brand); }
.opt.locked { opacity: .75; }
.nav { display: flex; gap: 10px; margin-top: 10px; } .nav button { flex: 1; }
.corr { font-size: .88rem; margin: 2px 0 10px; }

/* risultato */
.result { text-align: center; padding: 28px 16px; border-radius: 18px; color: #fff; margin: 10px 0 14px; box-shadow: var(--shadow-lg); }
.result.pass { background: var(--grad); } .result.fail { background: linear-gradient(135deg, #a32f2b, #bd3f3a); }
.result .big { font-size: 3.4rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; } .result h2 { color: #fff; margin-top: 10px; font-size: 1.5rem; }
.rev { border-left: 5px solid var(--bad); } .rev.okc { border-left-color: var(--ok); }
.rev .ro { padding: 10px 13px; border-radius: 10px; margin: 7px 0; background: var(--chip); font-size: .97rem; }
.rev .ro.good { background: var(--ok-bg); color: var(--ok); font-weight: 700; } .rev .ro.wrong { background: var(--bad-bg); color: var(--bad); text-decoration: line-through; }

/* admin */
.tabs { display: flex; gap: 6px; margin: 4px 0 14px; position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 4; }
.tabs button { background: var(--chip); color: var(--ink); padding: 10px 4px; min-height: 46px; font-size: .9rem; white-space: nowrap; }
.tabs button:hover { background: var(--line); } .tabs button.on, .tabs button.on:hover { background: var(--brand); color: #fff; }
.ucard { cursor: pointer; transition: border-color .15s, transform .12s var(--ease); } .ucard:hover { border-color: var(--brand); } .ucard:active { transform: scale(.99); }
.ucard .h { display: flex; align-items: center; gap: 12px; }
.ucard .h .n { flex: 1; min-width: 0; font-weight: 700; font-size: 1.05rem; } .ucard .h .codeline { margin: 4px 0 0; }
.codebox { font-family: ui-monospace, Consolas, monospace; font-weight: 800; letter-spacing: 2px; background: var(--chip); border-radius: 8px; padding: 8px 12px; display: inline-block; font-size: 1.15rem; color: var(--brand-dark); white-space: nowrap; }
.ucard .codebox { font-size: .95rem; padding: 4px 10px; }
.avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .95rem; }
.avatar.big { width: 56px; height: 56px; font-size: 1.2rem; }
.uhead { display: flex; align-items: center; gap: 14px; } .uhead h2 { margin: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.chip { font-size: .8rem; font-weight: 700; padding: 4px 11px; border-radius: 99px; background: var(--chip); color: var(--ink); }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.bad { background: var(--bad-bg); color: var(--bad); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .93rem; } .kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-weight: 600; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.toggle { width: 54px; height: 32px; border-radius: 99px; background: var(--line); position: relative; flex: none; padding: 0; min-height: 0; transition: background .2s; }
.toggle:hover { background: var(--line); } .toggle.on, .toggle.on:hover { background: var(--ok); }
.toggle::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); transition: left .2s var(--ease); }
.toggle.on::after { left: 26px; }
.back { background: transparent; color: var(--brand); width: auto; padding: 8px 4px; min-height: 40px; } .back:hover { background: transparent; text-decoration: underline; }
.fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); width: auto; border-radius: 99px; padding: 15px 24px; box-shadow: var(--shadow-lg); z-index: 8; }
.totals { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.hardq { font-size: .95rem; } .hardq small { color: var(--muted); display: block; }
.meter { height: 6px; border-radius: 9px; background: var(--line); margin: 8px 0 5px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 9px; background: var(--bad); }
@media (min-width: 760px) {
  body.admin #app { max-width: 900px; }
  body.admin .ulist { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
  body.admin .totals { grid-template-columns: repeat(4, 1fr); }
  body.admin .fab { right: max(18px, calc((100vw - 900px) / 2)); }
}

/* modale e toast */
.overlay { position: fixed; inset: 0; background: rgba(15, 25, 20, .5); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 12px; animation: fade .15s; }
.modal { background: var(--card); color: var(--ink); border-radius: 18px; padding: 22px; width: 100%; max-width: 480px; max-height: 88vh; overflow: auto; animation: up .25s var(--ease); box-shadow: var(--shadow-lg); }
.modal h3 { font-size: 1.2rem; } .modal .btns { display: flex; gap: 10px; margin-top: 16px; } .modal .btns button { flex: 1; }
@media (min-width: 560px) { .overlay { align-items: center; } }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #1c2420; color: #fff; padding: 12px 20px; border-radius: 99px; z-index: 60; font-size: .95rem; max-width: 90vw; box-shadow: var(--shadow-lg); animation: toastin .25s var(--ease) both; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 10px); } }
.spinner { width: 34px; height: 34px; border: 4px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* scelta del tema */
.seg { display: flex; gap: 4px; background: var(--chip); border-radius: 12px; padding: 4px; margin-top: 8px; }
.seg button, .seg button:hover { flex: 1; background: transparent; color: var(--muted); min-height: 42px; padding: 8px 6px; border-radius: 9px; font-size: .92rem; }
.seg button.on, .seg button.on:hover { background: var(--card); color: var(--brand); box-shadow: var(--shadow); }

/* esame: tutto in una schermata, senza scorrere la pagina */
#app.exam { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
#app.exam > * { flex: none; }
#app.exam .qwrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#app.exam .exam-head { position: static; border: 0; padding: 12px 0 4px; background: transparent; }
#app.exam .nav { margin-top: 8px; }
#app.exam .nav button { border-radius: 99px; }
.exam-meta { margin-bottom: 8px; font-size: .88rem; color: var(--muted); }
.exam-meta > span:first-child { flex: 1; }
.timer { font-size: 1.05rem; padding: 4px 13px; background: var(--brand-soft); color: var(--brand); }
.strip { display: flex; gap: 6px; justify-content: center; margin: 2px 0 8px; }
.strip button, .strip button:hover { flex: none; width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 50%; font-size: .85rem; font-weight: 700; background: var(--chip); color: var(--muted); }
.strip button.done, .strip button.done:hover { background: var(--brand); color: var(--on-brand); }
.strip button.cur, .strip button.cur:hover { background: var(--card); color: var(--brand); box-shadow: inset 0 0 0 2.5px var(--brand); transform: scale(1.12); }
.exam-head .bar { height: 4px; }
@media (max-height: 620px) { .q-text { margin: 6px 0 10px; } .opt { padding: 9px 12px; margin-bottom: 7px; } #app.exam .nav button { min-height: 46px; } }

/* home: tutto in una schermata, la cronologia scorre da sola dentro la sua scheda */
#app.home { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
#app.home > * { flex: none; }
#app.home .hist-card { flex: 1 1 auto; min-height: 90px; overflow-y: auto; margin-bottom: 10px; }
#app.home .topbar { padding: 12px 0 8px; } #app.home .topbar img { width: 40px; height: 40px; }
#app.home .hero { padding: 16px 18px; margin-bottom: 10px; border-radius: 20px; }
#app.home .hero h2 { font-size: 1.2rem; margin-bottom: .3em; } #app.home .hero ul { margin-bottom: 12px; }
#app.home .hero li { font-size: .9rem; margin: 4px 0; line-height: 1.35; }
#app.home .hero button { min-height: 48px; }
#app.home .stats { margin-bottom: 10px; } #app.home .stat { padding: 8px 6px; } #app.home .stat b { font-size: 1.5rem; }
#app.home p.center { margin: 0 0 8px; }
.theme-card { display: flex; align-items: center; gap: 12px; padding: 8px 12px; } .theme-card .seg { flex: 1; margin: 0; } .theme-card .seg button { min-height: 36px; font-size: .85rem; }
#app.home .theme-card { margin-bottom: 0; }

/* puntini domande: 2 righe da 15, ben distanziati. verde = risposta, giallo = saltata, grigio = non ancora vista, anello = domanda attuale */
.dots { display: grid; grid-template-columns: repeat(15, 1fr); row-gap: 2px; margin: 2px 0 8px; }
.dots button, .dots button:hover { min-width: 0; height: 28px; min-height: 0; padding: 0; background: transparent; border-radius: 0; position: relative; }
.dots button::before { content: ""; position: absolute; left: 50%; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--line); transition: background .2s, box-shadow .2s; }
.dots button.done::before { background: var(--brand); }
.dots button.skip::before { background: var(--accent); }
.dots button.cur::before { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
.skipnote { color: #b07d00; font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .skipnote { color: var(--accent); } }
:root[data-theme="dark"] .skipnote { color: var(--accent); }

/* al posto del logo: icona dell'app */
.topbar img { border-radius: 11px; box-shadow: none; }
.login img.logo { width: 120px; height: 120px; border-radius: 27px; box-shadow: var(--shadow-lg); }

/* home con barra in basso */
#app.tabbed { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
#app.tabbed > * { flex: none; animation: none; }
#app.tabbed .main { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 0 12px; }
#app.tabbed .main > * { flex: none; margin-bottom: 0; }
#app.tabbed .topbar { padding: 12px 0 8px; } #app.tabbed .topbar img { width: 40px; height: 40px; }
#app.tabbed .hero { padding: 16px 18px; border-radius: 22px; } #app.tabbed .hero h2 { font-size: 1.2rem; margin-bottom: .3em; }
#app.tabbed .hero ul { margin-bottom: 12px; } #app.tabbed .hero li { font-size: .9rem; margin: 4px 0; line-height: 1.35; }
#app.tabbed .hero button { min-height: 48px; }
#app.tabbed .stat { padding: 8px 6px; } #app.tabbed .stat b { font-size: 1.5rem; }
.pagehead { padding: 16px 0 6px; } .pagehead h1 { margin: 0; font-size: 1.5rem; } .pagehead p { margin: 2px 0 0; }
.chips button.chip, .chips button.chip:hover { width: auto; min-height: 0; padding: 8px 16px; font-size: .88rem; background: var(--chip); color: var(--muted); } .chips button.chip.on, .chips button.chip.on:hover { background: var(--brand); color: var(--on-brand); }
.chips { margin-top: 0; }
.listcard { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 14px; } .listcard .hist li { padding: 12px 0; margin: 0; } .listcard .badge { min-width: 84px; text-align: center; }
#app.tabbed .main > .listcard { flex: 1 1 auto; }
.acct { display: flex; align-items: center; gap: 12px; }
.links { padding: 2px 14px; } .links .line { display: flex; justify-content: space-between; padding: 14px 0; cursor: pointer; } .links .line + .line { border-top: 1px solid var(--line); }
.grow { flex: 1 1 auto; }
button.logout, button.logout:hover { background: var(--card); color: var(--bad); border: 1.5px solid color-mix(in srgb, var(--bad) 35%, var(--line)); }
.tabbar { display: flex; margin: 0 -16px; padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.tabbar .tab, .tabbar .tab:hover { flex: 1; background: transparent; color: var(--muted); min-height: 0; padding: 2px 0; border-radius: 0; font-weight: 650; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabbar .tab .ic { padding: 4px 20px; border-radius: 99px; display: block; transition: background .2s; } .tabbar .tab .ic svg { display: block; }
.tabbar .tab .tl { font-size: .74rem; }
.tabbar .tab.on, .tabbar .tab.on:hover { color: var(--brand); } .tabbar .tab.on .ic { background: var(--brand-soft); }
#app.tabbed .hero { box-shadow: none; }
.listcard .hist li, #app.tabbed .hist li { border-radius: 0; }

/* titolo di benvenuto */
.hello { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 8px; }
.hello .kick { font-size: .74rem; letter-spacing: .16em; font-weight: 800; color: var(--brand); }
.hello h1 { margin: 2px 0 0; font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.hello button.avatar { padding: 0; min-height: 0; width: 46px; height: 46px; flex: none; color: #fff; font-size: 1rem; }
#app.tabbed .hello { padding: 12px 0 6px; }

/* classifica admin */
.tabs button { padding: 10px 2px; font-size: .8rem; }
.rankrow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.pos { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--chip); color: var(--muted); }
.pos.p1 { background: #f2b632; color: #3b2a05; } .pos.p2 { background: #c9d0cc; color: #26302b; } .pos.p3 { background: #d9a273; color: #3a2210; }
.rk { flex: 1; min-width: 0; } .rn { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rk .meter { margin: 6px 0 4px; } .meter.good i { background: var(--brand); }
.rs { flex: none; text-align: right; } .rs b { display: block; font-size: 1.4rem; line-height: 1; color: var(--brand); } .rs small { color: var(--muted); font-size: .72rem; }

/* transizioni tra schermate (View Transitions) */
html.vt #app > * { animation: none; }
html.vt #app.noanim > .qwrap.enter { animation: none; }
.tabbar { view-transition-name: tabbar; }
::view-transition-group(root) { animation-duration: .3s; }
::view-transition-old(root) { animation: vt-out .2s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .3s var(--ease) both; }
html[data-nav="back"]::view-transition-old(root) { animation-name: vt-out-r; }
html[data-nav="back"]::view-transition-new(root) { animation-name: vt-in-r; }
html[data-nav="fade"]::view-transition-old(root) { animation-name: vt-fade-out; }
html[data-nav="fade"]::view-transition-new(root) { animation-name: vt-fade-in; }
::view-transition-group(tabbar) { animation-duration: .25s; }
@keyframes vt-out { to { opacity: 0; transform: translateX(-26px); } }
@keyframes vt-in { from { opacity: 0; transform: translateX(34px); } }
@keyframes vt-out-r { to { opacity: 0; transform: translateX(26px); } }
@keyframes vt-in-r { from { opacity: 0; transform: translateX(-34px); } }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; transform: translateY(10px); } }
/* piccoli ritocchi: pressione e comparsa delle righe */
.opt, .ucard, .rankrow, .hist li, .tabbar .tab, .strip button, .dots button { transition: transform .12s var(--ease), background .15s, border-color .15s, box-shadow .15s; }
.opt:active, .ucard:active, .rankrow:active { transform: scale(.985); }
.tabbar .tab:active { transform: scale(.93); }
.hero, .stat, .card { transition: transform .2s var(--ease), box-shadow .2s; }
@media (prefers-reduced-motion: reduce) { html.vt ::view-transition-group(*), html.vt ::view-transition-old(*), html.vt ::view-transition-new(*) { animation: none !important; } }

/* admin: barra in basso */
body.admin #app.tabbed .fab { bottom: calc(84px + env(safe-area-inset-bottom)); }
body.admin #app.tabbed .main { padding-bottom: 90px; }
body.admin #app.tabbed .ulist { display: block; }
#app.tabbed .main > .spinner { margin: 40px auto; }
@media (min-width: 760px) { body.admin #app.tabbed .ulist { display: grid; } }
#app.tabbed .main, .listcard { scrollbar-width: none; } #app.tabbed .main::-webkit-scrollbar, .listcard::-webkit-scrollbar { display: none; }

/* niente selezione dei testi (tranne nei campi da compilare) */
html, body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
img { -webkit-user-drag: none; user-drag: none; }

/* installazione */
.installwrap { margin-top: 14px; } .installwrap:empty { display: none; }
.steps p { margin: 0 0 8px; } .steps ol { margin: 0 0 8px; padding-left: 22px; } .steps li { margin: 6px 0; }

/* le ombre delle schede non vengono piu tagliate ai bordi (alone grigio) */
#app.tabbed .main { margin: 0 -16px; padding: 4px 16px 14px; }

/* iPhone: il bordo alto della pagina (sotto l'orologio) sfuma il contenuto: i titoli partono piu in basso */
@supports (-webkit-touch-callout: none) {
  #app { padding-top: 30px; }
  #app.tabbed, #app.exam, #app.home { height: 100dvh; box-sizing: border-box; }
}
