/* Grind (WEBNEKOH-313): interfaccia di private.nekoh.it.
   Tema: evoluzione dello stile di nekoh.it (scuro, accento oro). I colori stanno
   tutti nei token qui sotto: un'altra atmosfera è un altro blocco :root. La CSP
   del vhost vieta stili inline: niente attributi style nel markup, solo classi
   e proprietà impostate da JS (CSSOM). */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/assets/fonts/inter-latin.3100e775.woff2") format("woff2");
}
@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url("/assets/fonts/jetbrains-mono-latin.3520422d.woff2") format("woff2");
}

:root {
    color-scheme: dark;
    --bg: #121110;
    --bg-glow: #1a1712;
    --surface: #1a1918;
    --surface-2: #211f1d;
    --surface-3: #2a2825;
    --line: rgba(237, 236, 232, 0.08);
    --line-strong: rgba(237, 236, 232, 0.16);
    --text: #edece8;
    --text-2: #a8a7a1;
    --text-3: #7d7c77;
    --gold: #d9a548;
    --gold-hi: #f0c46a;
    --gold-soft: rgba(217, 165, 72, 0.14);
    --on-gold: #17130b;
    --green: #5bc08c;
    --green-soft: rgba(91, 192, 140, 0.14);
    --amber: #e8a34d;
    --amber-soft: rgba(232, 163, 77, 0.14);
    --red: #e5686b;
    --red-soft: rgba(229, 104, 107, 0.14);
    --blue: #82a9da;
    --blue-soft: rgba(130, 169, 218, 0.14);
    --violet: #a99ce0;
    --violet-soft: rgba(169, 156, 224, 0.14);
    --radius: 14px;
    --radius-sm: 9px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --tabbar: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100dvh;
    background: radial-gradient(120% 60% at 50% -10%, var(--bg-glow), var(--bg) 60%) fixed, var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--font);
    font-feature-settings: "tnum" 1, "cv11" 1;
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 12px);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold); }
svg { display: block; }
/* Icone del testo (le stringhe ICON di grind.js): grandi quanto il testo. Le
   regole più specifiche (chip, pulsanti, caselle) le ridimensionano. */
svg:not([class]) {
    width: 1.1em; height: 1.1em; flex-shrink: 0;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.badge svg, .row svg { width: 14px; height: 14px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }

/* --- barra in alto --------------------------------------------------------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 12px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: rgba(18, 17, 16, 0.86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 700; letter-spacing: -0.01em; }
.brand__mark { width: 26px; height: 26px; fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.brand__mark path:last-child { stroke: var(--green); }
.brand__name { font-size: 17px; }
.hud { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow: hidden; }
.chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 9px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--line);
    font-size: 13px; font-weight: 600; white-space: nowrap;
}
.chip svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip--gold { color: var(--gold-hi); background: var(--gold-soft); border-color: transparent; }
.chip--flame { color: var(--amber); }
.chip--coin { color: var(--gold); }
.chip--token { color: var(--blue); }
.chip--level { padding-left: 4px; }
.lvl-ring { width: 24px; height: 24px; }
.lvl-ring circle { fill: none; stroke-width: 3; }
.lvl-ring .track { stroke: var(--surface-3); }
.lvl-ring .fill { stroke: var(--gold); stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 900ms var(--ease); }
.icon-btn {
    width: 36px; height: 36px; display: grid; place-items: center;
    border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
    cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--text-2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn[aria-pressed="true"] .sound-off, .icon-btn[aria-pressed="false"] .sound-on { display: none; }

/* --- tab in basso -------------------------------------------------------- */
.tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(18, 17, 16, 0.94); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
}
.tabs a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--text-3); text-decoration: none; font-size: 11px; font-weight: 600;
    transition: color 160ms;
}
.tabs a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--gold-hi); }
.tabs a[aria-current="page"] svg { filter: drop-shadow(0 0 6px rgba(217, 165, 72, 0.5)); }
@media (min-width: 900px) {
    .tabs { left: 50%; right: auto; bottom: 16px; width: 520px; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 18px; height: var(--tabbar); padding: 0; }
}

/* --- struttura --------------------------------------------------------------- */
.main { max-width: 760px; margin: 0 auto; padding: 16px; outline: none; }
.section { margin-top: 22px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 10px; }
.section__title { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.section__meta { font-size: 13px; color: var(--text-3); }
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px;
}
.stack > * + * { margin-top: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.boot { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 60vh; color: var(--text-2); }
.boot__ring { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- eroe della settimana -------------------------------------------------- */
.hero {
    position: relative; overflow: hidden;
    border-radius: 20px; padding: 20px 18px 18px;
    background: linear-gradient(160deg, #221d14 0%, var(--surface) 55%);
    border: 1px solid rgba(217, 165, 72, 0.22);
}
.hero--rest { background: linear-gradient(160deg, #13221b 0%, var(--surface) 60%); border-color: rgba(91, 192, 140, 0.25); }
.hero--recovery { background: linear-gradient(160deg, #26180f 0%, var(--surface) 60%); border-color: rgba(232, 163, 77, 0.28); }
.hero--pause { background: linear-gradient(160deg, #141b26 0%, var(--surface) 60%); border-color: rgba(130, 169, 218, 0.25); }
.hero__kicker { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-hi); }
.hero--rest .hero__kicker { color: var(--green); }
.hero--recovery .hero__kicker { color: var(--amber); }
.hero--pause .hero__kicker { color: var(--blue); }
.hero__title { margin: 6px 0 2px; font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
.hero__sub { margin: 0; color: var(--text-2); font-size: 14px; }
.hero__xp { display: flex; align-items: baseline; gap: 6px; margin-top: 16px; }
.hero__xp-now { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.hero__xp-target { color: var(--text-2); font-weight: 600; }
.hero__badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

.bar { position: relative; height: 16px; margin-top: 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); overflow: hidden; }
.bar__fill {
    position: absolute; inset: 0 auto 0 0; width: 0;
    background: linear-gradient(90deg, #b47c23, var(--gold) 55%, var(--gold-hi));
    border-radius: inherit; transition: width 900ms var(--ease);
    box-shadow: 0 0 18px rgba(217, 165, 72, 0.45);
}
.bar__fill::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: translateX(-100%); animation: sheen 2.8s var(--ease) infinite;
}
.bar__pace { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: 0.55; border-radius: 2px; }
.bar__ticks { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(10, 1fr); pointer-events: none; }
.bar__ticks span + span { border-left: 1px solid rgba(0, 0, 0, 0.35); }
.bar--rest .bar__fill { background: linear-gradient(90deg, #2f8a5d, var(--green)); box-shadow: 0 0 18px rgba(91, 192, 140, 0.4); }
.bar--recovery .bar__fill { background: linear-gradient(90deg, #a5631c, var(--amber)); }
.bar--thin { height: 7px; margin-top: 8px; }
.bar--thin .bar__fill::after { display: none; }
@keyframes sheen { 0%, 40% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.pace { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.pace::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.pace--al_sicuro { color: var(--green); background: var(--green-soft); }
.pace--in_bilico { color: var(--amber); background: var(--amber-soft); }
.pace--a_rischio { color: var(--red); background: var(--red-soft); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(229, 104, 107, 0); background: rgba(229, 104, 107, 0.24); } }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); }
.badge--gold { background: var(--gold-soft); color: var(--gold-hi); }
.badge--violet { background: var(--violet-soft); color: var(--violet); }
.badge--red { background: var(--red-soft); color: var(--red); }
.badge--green { background: var(--green-soft); color: var(--green); }

/* --- missioni ------------------------------------------------------------- */
.mission {
    position: relative;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px 14px 12px; transition: transform 200ms var(--ease), border-color 200ms, opacity 300ms;
}
.mission--boss { border-color: rgba(169, 156, 224, 0.4); background: linear-gradient(150deg, rgba(169, 156, 224, 0.10), var(--surface) 55%); }
.mission--done { opacity: 0.55; }
.mission--done .mission__title { text-decoration: line-through; text-decoration-color: var(--text-3); }
.mission__top { display: flex; align-items: flex-start; gap: 12px; }
.mission__title { margin: 0; font-size: 16px; font-weight: 650; line-height: 1.3; }
.mission__meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 4px; font-size: 12.5px; color: var(--text-2); }
.mission__xp { margin-left: auto; text-align: right; flex-shrink: 0; }
.mission__xp b { display: block; font-size: 20px; font-weight: 800; color: var(--gold-hi); line-height: 1; font-variant-numeric: tabular-nums; }
.mission__xp span { font-size: 11px; color: var(--text-3); }
.mission__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.check {
    width: 30px; height: 30px; flex-shrink: 0; margin-top: 1px;
    display: grid; place-items: center; border-radius: 10px;
    border: 2px solid var(--line-strong); background: transparent; cursor: pointer;
    transition: transform 160ms var(--spring), border-color 160ms, background 160ms;
}
.check svg { width: 16px; height: 16px; fill: none; stroke: var(--on-gold); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(0.4); transition: 220ms var(--spring); }
.check:hover { border-color: var(--gold); transform: scale(1.06); }
.check:active { transform: scale(0.92); }
.check[aria-checked="true"] { background: var(--gold); border-color: var(--gold); }
.check[aria-checked="true"] svg { opacity: 1; transform: none; }
.check:disabled { cursor: default; opacity: 0.5; }
.steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.step { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; background: var(--surface-2); }
.step .check { width: 24px; height: 24px; border-radius: 8px; margin: 0; }
.step .check svg { width: 13px; height: 13px; }
.step__title { flex: 1; min-width: 0; font-size: 14px; }
.step--done .step__title { color: var(--text-3); text-decoration: line-through; }
.step__xp { font-size: 12.5px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.closing { font-size: 12.5px; color: var(--text-3); margin-top: 6px; padding-left: 4px; }
.closing b { color: var(--violet); }

/* --- pulsanti e moduli ------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 38px; padding: 0 14px; border-radius: 11px;
    border: 1px solid var(--line-strong); background: var(--surface-2);
    font-weight: 650; font-size: 14px; cursor: pointer; text-decoration: none; color: var(--text);
    transition: transform 140ms var(--spring), background 160ms, border-color 160ms;
}
.btn:hover { border-color: var(--text-3); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn--gold { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: var(--on-gold); border-color: transparent; box-shadow: 0 6px 22px -8px rgba(217, 165, 72, 0.8); }
.btn--gold:hover { filter: brightness(1.06); border-color: transparent; }
.btn--ghost { background: transparent; }
.btn--small { min-height: 30px; padding: 0 10px; font-size: 13px; border-radius: 9px; }
.btn--block { width: 100%; min-height: 48px; font-size: 16px; }
.btn--danger { color: var(--red); }
.field { display: grid; gap: 5px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
    width: 100%; padding: 10px 12px; border-radius: 10px;
    background: var(--bg); border: 1px solid var(--line-strong);
}
.textarea { min-height: 72px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 480px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
.rating { display: flex; gap: 4px; }
.rating button {
    flex: 1; height: 34px; border-radius: 9px; border: 1px solid var(--line-strong);
    background: var(--bg); color: var(--text-3); font-weight: 700; cursor: pointer;
}
.rating button[aria-pressed="true"] { background: var(--gold-soft); color: var(--gold-hi); border-color: rgba(217, 165, 72, 0.5); }
.form-steps { display: grid; gap: 6px; }
.form-steps .row .input { padding: 8px 10px; }
.details summary { cursor: pointer; color: var(--text-2); font-size: 13.5px; font-weight: 600; list-style: none; }
.details summary::-webkit-details-marker { display: none; }
.details summary::before { content: "+ "; color: var(--gold); }
.details[open] summary::before { content: "− "; }

/* --- piano ------------------------------------------------------------------ */
.plan-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.plan-item + .plan-item { border-top: 1px solid var(--line); }
.plan-item__xp { min-width: 54px; text-align: right; font-weight: 800; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.plan-item--off .plan-item__xp { color: var(--text-3); }
.toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; border-radius: 999px; background: var(--surface-3); border: 0; cursor: pointer; transition: background 180ms; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-2); transition: transform 220ms var(--spring), background 180ms; }
.toggle[aria-checked="true"] { background: var(--gold); }
.toggle[aria-checked="true"]::after { transform: translateX(18px); background: var(--on-gold); }
.toggle:disabled { opacity: 0.6; cursor: not-allowed; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--text-2); }
.notice { padding: 10px 12px; border-radius: 10px; font-size: 13.5px; background: var(--amber-soft); color: var(--amber); }
.notice--ok { background: var(--green-soft); color: var(--green); }
.notice--info { background: var(--blue-soft); color: var(--blue); }

/* --- livelli (griglia delle settimane) e giorni ------------------------------ */
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.level {
    display: grid; gap: 2px; align-content: start; text-align: left; padding: 10px 10px 9px;
    border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--text);
    font: inherit; cursor: pointer; transition: border-color 160ms, background 160ms, transform 160ms var(--spring);
}
.level:hover:not(:disabled) { border-color: var(--line-strong); transform: translateY(-1px); }
.level__num { display: flex; align-items: center; gap: 4px; font-size: 20px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.level__num svg { width: 14px; height: 14px; fill: var(--gold); stroke: none; }
.level__kind { font-size: 12px; font-weight: 700; color: var(--text-2); }
.level__dates, .level__meta { font-size: 11.5px; color: var(--text-3); }
.level--grind .level__kind { color: var(--gold-hi); }
.level--riposo .level__kind { color: var(--green); }
.level--recupero .level__kind { color: var(--amber); }
.level--pausa .level__kind { color: var(--blue); }
.level--forecast { border-style: dashed; }
.level--past { opacity: 0.5; cursor: default; }
.level--current { background: var(--surface-2); }
.level--won .level__num { color: var(--gold-hi); }
.level--selected { border: 1px solid var(--gold); background: var(--gold-soft); }
.plan-item--wrap { flex-wrap: wrap; }
.plan-item__tools { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.plan-steps { flex: 1 1 100%; }
.select--mini { width: auto; max-width: 100%; padding: 6px 8px; font-size: 13px; border-radius: 9px; }
.day-row { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 10px; padding: 10px 14px; }
.day-row + .day-row { border-top: 1px solid var(--line); }
.day-row__name { font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: capitalize; }
.day-row__items { display: block; font-size: 13.5px; overflow-wrap: anywhere; }
.day-row .bar { margin: 6px 0 0; }
.day-row__min { font-size: 12.5px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.day-row--today .day-row__name { color: var(--gold-hi); }
.day-row--over .day-row__min { color: var(--amber); }
.postpone { border-color: rgba(130, 169, 218, 0.3); }

/* --- extra ---------------------------------------------------------------- */
.extra-meter { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.extra-meter .bar { flex: 1; margin: 0; }
.extra-meter .bar__fill { background: linear-gradient(90deg, #6e5fc0, var(--violet)); box-shadow: none; }
form[data-form="extra"] { flex-wrap: wrap; }
form[data-form="extra"] .input { flex: 1 1 100%; }
form[data-form="extra"] .select { flex: 1; }

/* --- storico e profilo -------------------------------------------------------- */
.week-row { display: grid; grid-template-columns: 92px 1fr auto; align-items: center; gap: 12px; padding: 12px 14px; }
.week-row + .week-row { border-top: 1px solid var(--line); }
.week-row__date { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.week-row .bar { margin: 6px 0 0; }
.level-card { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.level-big { width: 86px; height: 86px; position: relative; }
.level-big svg { width: 100%; height: 100%; }
.level-big circle { fill: none; stroke-width: 7; }
.level-big .track { stroke: var(--surface-3); }
.level-big .fill { stroke: var(--gold); stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 1100ms var(--ease); }
.level-big b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; font-weight: 800; }

/* --- schermate speciali -------------------------------------------------------- */
.screen { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 24px 8px; }
.screen__icon { width: 72px; height: 72px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 22px; background: var(--gold-soft); }
.screen__icon svg { width: 36px; height: 36px; fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.screen h1 { margin: 0 0 8px; font-size: 24px; letter-spacing: -0.02em; }
.screen p { margin: 0 auto 18px; max-width: 420px; color: var(--text-2); }
.countdown { display: flex; justify-content: center; gap: 10px; margin: 16px 0; }
.countdown div { min-width: 64px; padding: 10px 6px; border-radius: 12px; background: var(--surface-2); }
.countdown b { display: block; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.countdown span { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.08em; }

/* --- effetti -------------------------------------------------------------------- */
.layer, .confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.confetti { width: 100vw; height: 100vh; }
.float-xp {
    position: fixed; z-index: 41; pointer-events: none;
    font-weight: 900; font-size: 20px; color: var(--gold-hi);
    text-shadow: 0 2px 12px rgba(217, 165, 72, 0.7), 0 0 2px #000;
}
.toasts { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 45; display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); }
.toast {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
    background: var(--surface-3); border: 1px solid var(--line-strong); box-shadow: 0 14px 40px -12px rgba(0, 0, 0, 0.8);
    animation: toast-in 320ms var(--spring);
}
.toast--error { border-color: rgba(229, 104, 107, 0.5); }
.toast__text { flex: 1; font-size: 14px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
.modal {
    width: min(460px, calc(100vw - 24px)); padding: 0; border: 1px solid var(--line-strong);
    border-radius: 20px; background: var(--surface); color: var(--text);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
.modal[open] { animation: modal-in 420ms var(--spring); }
.modal__body { padding: 22px 20px 18px; }
.modal__body h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.02em; }
.modal__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.modal--celebrate .modal__body { text-align: center; background: radial-gradient(80% 60% at 50% 0%, rgba(217, 165, 72, 0.22), transparent); }
.modal--celebrate .big { font-size: 56px; font-weight: 900; color: var(--gold-hi); letter-spacing: -0.03em; line-height: 1; margin: 8px 0; }
@keyframes modal-in { from { opacity: 0; transform: translateY(20px) scale(0.94); } }
.pop { animation: pop 520ms var(--spring); }
@keyframes pop { 30% { transform: scale(1.08); } }
.shake { animation: shake 380ms; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.view-enter { animation: view-in 280ms var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
    .bar__fill::after { display: none; }
}
