@font-face { font-family: 'Cinzel'; font-weight: 500; font-display: swap; src: url('fonts/cinzel-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-weight: 700; font-display: swap; src: url('fonts/cinzel-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('fonts/inter-latin-600-normal.woff2') format('woff2'); }

/* Sistema visivo (Sala del 24/11, U2): profondità per luminosità delle superfici, non per bordi;
   l'oro solo per l'azione principale, le cose fatte, il numero principale, la scheda attiva e Momento critico.
   Contrasti calcolati: testo ≥ 4,7:1, componenti ≥ 3:1. */
:root {
  --bg: #0E0D0B;
  --s1: #17150F;
  --s2: #201D17;
  --s3: #2A261F;
  --hair: #2A2620;
  --hair-strong: #3A352C;
  --text: #F2EEE6;
  --text-2: #A8A196;
  --text-3: #8E877B;
  --gold: #D4AF5A;
  --gold-press: #BF9C4C;
  --gold-dim: #9C8448;
  --gold-tint: #312B1A;
  --on-gold: #14110A;
  --stroke-todo: #7A7163;
  --track: #2B2720;
  --warn-bg: #2A1F12;
  --warn-line: #7A5A26;
  /* nomi storici, usati ancora da alcune parti */
  --panel: var(--s1); --panel-gold: var(--s1); --line: var(--hair-strong); --line-gold: #6E5B2E; --muted: var(--text-2); --gold-soft: var(--gold-tint);
  --serif: 'Cinzel', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, system-ui, 'Segoe UI', sans-serif;
  --quote: Georgia, 'Times New Roman', serif;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-pop: cubic-bezier(.3, 1.4, .5, 1);
  --appbar-h: 56px;
  --tab-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 16px; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
a { color: var(--gold); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.wrap { max-width: 480px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + var(--appbar-h) + 12px) 20px calc(var(--tab-h) + env(safe-area-inset-bottom) + 36px); display: flex; flex-direction: column; gap: 20px; }
.wrap.enter { animation: page-in 160ms var(--ease-out); }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
[id^="lg-"], #crisis { scroll-margin-top: calc(env(safe-area-inset-top) + var(--appbar-h) + 12px); }

/* Testata fissa con Momento critico */
.appbar { position: fixed; top: 0; left: 0; right: 0; z-index: 22; padding-top: env(safe-area-inset-top); background: rgba(14, 13, 11, .94); border-bottom: 1px solid var(--hair); }
.appbar-in { max-width: 480px; height: var(--appbar-h); margin: 0 auto; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.appbar-brand { font-family: var(--serif); font-weight: 700; font-size: 18px; letter-spacing: .16em; color: var(--gold); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.crisis-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: none; border-radius: 999px; background: var(--gold-tint); color: var(--gold); font-size: 14px; font-weight: 600; position: relative; transition: transform 90ms var(--ease-out), background-color 90ms linear; }
.crisis-pill::after { content: ''; position: absolute; inset: -4px -2px; }
.crisis-pill:active { transform: scale(.97); background: #3D3520; }

/* Tipografia: 7 stili */
h1 { margin: 0; font-family: var(--serif); font-size: 26px; line-height: 32px; font-weight: 700; letter-spacing: .02em; }
h2 { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 24px; font-weight: 700; letter-spacing: .04em; }
p { margin: 0; line-height: 1.5; }
.eyebrow, .over { margin: 0; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); }
.muted { color: var(--text-2); }
.small { font-size: 14px; line-height: 1.5; }
.tiny { font-size: 13px; line-height: 18px; }
.gold { color: var(--gold); }
.page-head { display: flex; flex-direction: column; gap: 4px; }
.page-head .date { margin: 0; font-size: 14px; color: var(--text-2); }
.page-head:has(.head-link) { flex-direction: row; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.head-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; font-weight: 500; color: var(--gold); text-decoration: none; }
.date { margin: -12px 0 0; font-size: 13px; color: var(--text-2); }
.brand { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 22px; letter-spacing: .14em; color: var(--gold); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--hair-strong); border-radius: 22px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--text); }

.section, .sec { display: flex; flex-direction: column; gap: 12px; }
.sec { margin-top: 12px; }
.section-head, .sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sec-head a { display: inline-flex; align-items: center; min-height: 44px; color: var(--gold); font-size: 14px; font-weight: 500; text-decoration: none; }

/* Superfici */
.card { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; border-radius: 16px; background: var(--s1); border: none; }
.card.gold { background: radial-gradient(120% 140% at 0% 0%, #221E15 0%, var(--s1) 60%); }
.card.warn { background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line); }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 10px 16px; border-radius: 12px; background: var(--warn-bg); color: var(--text); text-decoration: none; font-size: 14px; }
.notice b { color: var(--gold); font-weight: 600; white-space: nowrap; }
.next-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 0 12px 0 16px; border-radius: 16px; background: var(--s1); color: var(--text); text-decoration: none; font-size: 15px; }
.next-link svg { color: var(--text-3); flex-shrink: 0; }
.next-link:active { background: var(--s3); }

/* Pagina principale: anello e grado */
.hero { display: grid; grid-template-columns: 128px 1fr; gap: 20px; align-items: center; padding: 20px; border-radius: 16px; background: radial-gradient(120% 140% at 0% 0%, #221E15 0%, var(--s1) 60%); }
.ring { position: relative; width: 128px; height: 128px; }
.ring svg { width: 128px; height: 128px; transform: rotate(-90deg); display: block; }
.ring circle { fill: none; stroke-width: 9; }
.ring-track { stroke: var(--track); }
.ring-fill { stroke: var(--gold); stroke-linecap: round; }
.ring-fill.grow { animation: ring-grow 600ms var(--ease-out); }
@keyframes ring-grow { from { stroke-dashoffset: var(--from); } }
.ring-mark { stroke: var(--gold-dim); stroke-width: 2.5; stroke-linecap: round; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-n { font-family: var(--serif); font-weight: 700; font-size: 40px; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.ring-of { margin-top: 4px; font-size: 13px; color: var(--text-2); }
.hero-side { display: flex; flex-direction: column; gap: 4px; min-width: 0; color: var(--text); text-decoration: none; }
.hero-side .btn { margin-top: 6px; }
.grade-name { font-family: var(--serif); font-weight: 700; font-size: clamp(17px, 5.6vw, 22px); letter-spacing: .08em; text-transform: uppercase; overflow-wrap: anywhere; }
.prog { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.prog .lbl { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--text-2); }
.prog .lbl b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.line { height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; margin-bottom: 6px; }
.line > i { display: block; height: 100%; background: var(--gold); border-radius: 2px; }
.hero-note { grid-column: 1 / -1; font-size: 14px; color: var(--text-2); border-top: 1px solid var(--hair); padding-top: 12px; }
.hero-note b { color: var(--text); font-weight: 500; }

/* Tre numeri */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: -8px; }
.tile { position: relative; border-radius: 12px; background: var(--s1); }
.tile-main { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 92px; padding: 14px 12px 12px; color: var(--text); text-decoration: none; border-radius: 12px; }
.tile-main:active { background: var(--s3); }
.tile-n { font-family: var(--serif); font-weight: 700; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.tile-n small { font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--text-2); }
.tile-k { font-size: 12px; line-height: 16px; color: var(--text-2); padding-right: 14px; }
.tile-q { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; color: var(--text-3); font-size: 13px; font-weight: 600; text-decoration: none; }
.tile .tile-q { position: absolute; top: 0; right: 0; }
.tile-q::before { content: ''; position: absolute; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--hair-strong); }
.tile-q { position: relative; }

/* Settimana */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; padding: 16px 16px 12px; background: var(--s1); border-radius: 16px; }
.wcol { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.wbar { position: relative; width: 100%; max-width: 28px; height: 64px; border-radius: 6px; background: #1F1C16; overflow: hidden; display: flex; align-items: flex-end; }
.wbar > i { display: block; width: 100%; border-radius: 6px; }
.wbar.act > i { background: var(--gold); }
.wbar.part > i { background: var(--gold-dim); }
.wbar .thr { position: absolute; left: 0; right: 0; height: 1px; background: rgba(242, 238, 230, .2); }
.wd { font-size: 12px; color: var(--text-3); font-weight: 500; }
.wcol.today .wd { color: var(--text); font-weight: 600; }
.wcol.future .wbar { background: transparent; box-shadow: inset 0 0 0 1px var(--track); }

/* Elenco raggruppato (Da fare oggi, Legenda) */
.group { background: var(--s1); border-radius: 16px; overflow: hidden; }
.item { position: relative; display: flex; align-items: stretch; }
.item + .item::before, .group > .lg-item + .lg-item::before { content: ''; position: absolute; top: 0; right: 0; left: 52px; height: 1px; background: var(--hair); }
.item-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 8px 10px 16px; border: none; background: none; color: inherit; text-align: left; transition: background-color 90ms linear; }
.item-main:active, a.item:active { background: var(--s3); }
a.item { align-items: center; gap: 12px; min-height: 56px; padding: 10px 16px; text-decoration: none; color: var(--text-3); }
.tick { width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--stroke-todo); display: flex; align-items: center; justify-content: center; color: transparent; }
.item.done .tick { background: var(--gold); box-shadow: none; color: var(--on-gold); }
.item.locked .tick { box-shadow: none; color: var(--text-3); }
.item.pop .tick { animation: pop 240ms var(--ease-pop); }
@keyframes pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
.item-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item-a { font-size: 16px; line-height: 22px; }
.item.done .item-a { color: var(--text-2); }
.item-b { font-size: 13px; line-height: 18px; color: var(--text-2); }
.item.locked .item-a, .item.locked .item-b { color: var(--text-3); }
.item-side { width: 48px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: none; background: none; color: var(--text-3); font-size: 20px; }
.item-side:active { background: var(--s3); }
.group-foot { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; border: none; border-top: 1px solid var(--hair); background: none; color: var(--text-2); font-size: 14px; text-align: left; }
.group-foot .gold { font-weight: 600; white-space: nowrap; }
.group-foot:active { background: var(--s3); }
.duty-form { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; border-top: 1px solid var(--hair); }

/* Primo giorno */
.first-steps { margin: 0; padding: 16px; list-style: none; display: flex; flex-direction: column; gap: 12px; border-radius: 16px; background: var(--s1); }
.first-steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 22px; }
.first-steps .num { width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; background: var(--gold-tint); color: var(--gold); font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.first-steps li.done { color: var(--text-2); }
.first-steps li.done .num { background: var(--gold); color: var(--on-gold); }

/* Frase del giorno, senza scatola */
.quote-block { padding: 2px 0 0 16px; border-left: 2px solid var(--gold-dim); gap: 6px; }
.quote-original { margin: 0; font-family: var(--quote); font-style: italic; font-size: 21px; line-height: 1.35; }
.quote-text { margin: 0; font-size: 16px; line-height: 1.5; }
.quote-ref { margin: 0; font-size: 13px; color: var(--text-2); }
.quote-acts { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }

/* Righe (Profilo, interruttori, altre pagine) */
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; background: var(--s1); border: none; border-radius: 12px; text-align: left; }
button.row { color: var(--text); }
a.row { text-decoration: none; color: var(--text); }
.row .grow { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row .label-up, .label-up { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }
.row .time { font-size: 13px; color: var(--text-2); }
.box { width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--stroke-todo); display: flex; align-items: center; justify-content: center; }
.on .box { box-shadow: none; background: var(--gold); color: var(--on-gold); }
.row.locked { color: var(--text-3); }
.row-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; border: none; padding: 0; background: none; color: inherit; text-align: left; font: inherit; min-height: 44px; align-self: stretch; }
.row.pillar { padding-right: 4px; }
.info { width: 44px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: none; background: none; color: var(--text-3); }

/* Pulsanti: un solo pulsante oro per schermata */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--hair-strong); background: none; color: var(--text); font-weight: 600; font-size: 15px; text-decoration: none; text-align: center; transition: transform 90ms var(--ease-out), background-color 90ms linear; }
.btn:active:not([disabled]) { transform: scale(.97); background: var(--s3); }
.btn.solid { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.btn.solid:active:not([disabled]) { background: var(--gold-press); }
.btn.big { min-height: 56px; font-family: var(--serif); font-size: 17px; letter-spacing: .05em; font-weight: 700; }
.btn.small { min-height: 44px; font-size: 14px; font-weight: 500; border-radius: 22px; align-self: flex-start; padding: 0 16px; }
.btn.done, .btn[aria-disabled=true] { background: var(--gold-tint); border-color: transparent; color: var(--gold); cursor: default; }
.btn[disabled] { background: var(--s2); border-color: var(--s2); color: var(--text-3); cursor: not-allowed; }
.btn.text { border: none; padding: 0 4px; min-height: 44px; align-self: flex-start; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }
.btn.pick { border-color: var(--hair-strong); background: var(--s1); color: var(--text); font-size: 14px; }
.btn.pick.on { border-color: var(--gold-dim); background: var(--gold-tint); color: var(--gold); }
button.link { display: inline-flex; align-items: center; min-height: 44px; border: none; background: none; padding: 0; color: var(--gold); font: inherit; text-decoration: underline; text-underline-offset: 3px; align-self: flex-start; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { display: inline-flex; align-items: center; justify-content: center; line-height: 1.2; min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--stroke-todo); background: none; font-size: 14px; }
.chip-btn.on { border-color: var(--gold-dim); background: var(--gold-tint); color: var(--gold); font-weight: 600; }

.big-number { margin: 0; font-family: var(--serif); font-size: 56px; font-weight: 700; line-height: 1; color: var(--gold); }
.points { margin: 0; white-space: nowrap; flex-shrink: 0; font-family: var(--serif); font-size: 30px; font-weight: 700; color: var(--gold); }
.points span { font-size: 16px; color: var(--text-2); }
.split, .card.split { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
.counter, .card.counter { display: flex; flex-direction: row; align-items: center; gap: 18px; }

.bar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.bar > div { height: 6px; background: var(--gold); border-radius: 3px; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); }

.rank { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--s1); }
.rank.done { color: var(--text-2); }
.rank.now { background: var(--gold-tint); }
.rank-name { font-family: var(--serif); font-size: 17px; font-weight: 700; letter-spacing: .06em; color: var(--text); }
.badge { flex-shrink: 0; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; box-shadow: inset 0 0 0 1px var(--hair-strong); color: var(--text-2); }
.rank.done .badge { color: var(--text); }
.rank.now .badge { background: var(--gold); color: var(--on-gold); box-shadow: none; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
input[type=email], input[type=text], input[type=time], input[inputmode=numeric], textarea, select { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--hair-strong); background: var(--s1); font-size: 16px; color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { resize: none; }
.inline-form { display: flex; gap: 8px; }
.inline-form input[type=text] { flex: 1; }
.inline-form input[type=time] { width: 110px; flex-shrink: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.5; min-height: 44px; }
.check input { width: 24px; height: 24px; margin: 0; flex-shrink: 0; accent-color: var(--gold); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.track { width: 46px; height: 28px; flex-shrink: 0; padding: 3px; border-radius: 14px; background: var(--hair-strong); display: flex; transition: background-color 160ms linear; }
.switch.on .track { background: var(--gold); justify-content: flex-end; }
.knob { width: 22px; height: 22px; border-radius: 11px; background: var(--text); }

.help a { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; text-decoration: none; color: var(--text); font-size: 14px; border-top: 1px solid var(--hair); }
.help a span:last-child { color: var(--gold); font-weight: 600; white-space: nowrap; }

.del { width: 44px; height: 44px; flex-shrink: 0; border: none; background: none; color: var(--text-2); font-size: 20px; }
.msg { padding: 12px 14px; border-radius: 12px; background: var(--s1); font-size: 14px; line-height: 1.5; }
.msg.ok { background: var(--gold-tint); color: var(--gold); }

/* Barra delle schede */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; border-top: 1px solid var(--hair); background: rgba(14, 13, 11, .96); padding: 4px 8px calc(env(safe-area-inset-bottom) + 8px); }
nav.tabs .inner { display: flex; width: 100%; max-width: 480px; }
nav.tabs a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px; padding: 8px 0 4px; text-decoration: none; color: #8F887C; font-size: 12px; font-weight: 500; transition: color 160ms linear; }
nav.tabs a:active { color: var(--text); }
nav.tabs a[aria-current=page] { color: var(--gold); font-weight: 600; }
nav.tabs a[aria-current=page]::before { content: ''; position: absolute; top: -5px; width: 20px; height: 2px; border-radius: 1px; background: var(--gold); }
nav.tabs svg { width: 24px; height: 24px; }
body.kb nav.tabs { display: none; }

ol.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.45; }
.code-input { letter-spacing: .3em; font-size: 22px !important; text-align: center; }

/* Funzioni a pagamento: anteprima sfocata e non cliccabile */
.locked-wrap { display: grid; }
.locked-wrap > .preview, .locked-wrap > .lock-over { grid-area: 1 / 1; }
.preview { filter: blur(4px); opacity: .55; pointer-events: none; user-select: none; -webkit-user-select: none; display: flex; flex-direction: column; gap: 20px; }
.lock-over { display: flex; align-items: flex-start; justify-content: center; padding-top: 40px; z-index: 1; }
.lock-over .lock-card { width: 100%; box-shadow: 0 12px 40px rgba(0, 0, 0, .6); }
.lock-card .btn { align-self: flex-start; }
.lock-card .eyebrow { color: var(--gold); display: flex; align-items: center; gap: 6px; }

/* Schede secondarie (pilastro, guida, primo avvio) */
.sheet-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 480px; margin: 0 auto; max-height: 86vh; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 10px; padding: 12px 20px calc(env(safe-area-inset-bottom) + 24px); background: var(--s2); border-radius: 24px 24px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .5); }
.sheet::before { content: ''; align-self: center; width: 36px; height: 5px; border-radius: 3px; background: #4A443A; margin-bottom: 4px; flex-shrink: 0; }
.sheet.in { animation: sheet-in 320ms var(--ease-out); }
.sheet.in ~ .sheet-back, .sheet-back:has(+ .sheet.in) { animation: fade-in 200ms linear; }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } }
.sheet .label-up { margin: 8px 0 0; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.sheet-head h2 { margin: 4px 0 0; }
ul.list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.45; }
body.sheet-open { overflow: hidden; }
.teaser { display: flex; flex-direction: column; gap: 8px; filter: blur(2px); opacity: .6; }
.bar-ghost { display: block; height: 10px; border-radius: 5px; background: var(--hair-strong); }
.bar-ghost.short { width: 65%; }

/* Avviso breve in basso */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px); transform: translateX(-50%); z-index: 15; width: calc(100% - 40px); max-width: 440px; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px 8px 6px 16px; border-radius: 14px; background: #2F2A21; color: var(--text); font-size: 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, .5); animation: toast-in 200ms var(--ease-out); }
.toast-btn { min-height: 44px; padding: 0 12px; border: none; background: none; color: var(--gold); font-weight: 600; font-size: 14px; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* Momento critico */
.crisis-head { display: flex; flex-direction: column; gap: 4px; }
.crisis-head .eyebrow { color: var(--gold); }
.crisis-lead { font-family: var(--serif); font-size: 20px; line-height: 1.3; font-weight: 700; }
.crisis-foot { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--hair); }
.closed-day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; border-radius: 16px; background: var(--gold-tint); text-align: center; }
.closed-day .link { align-self: center; }
.closed-title { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-weight: 700; font-size: 17px; color: var(--gold); }

/* Respiro guidato: 10 secondi a ciclo, 4 dentro e 6 fuori */
.breath { display: flex; align-items: center; gap: 18px; padding: 6px 0; }
.breath-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.breath-circle { width: 96px; height: 96px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle, rgba(212, 175, 90, .35), rgba(212, 175, 90, .08)); border: 1.5px solid var(--gold); transform: scale(.6); }
.breath-circle span { font-size: 13px; font-weight: 600; color: var(--gold); transform: scale(1.4); }
.breath-circle.run { animation: breathe 10s ease-in-out infinite; }
.breath-circle.run span { animation: breathe-text 10s ease-in-out infinite; animation-delay: inherit; }
@keyframes breathe { 0% { transform: scale(.6); } 40% { transform: scale(1); } 100% { transform: scale(.6); } }
@keyframes breathe-text { 0% { transform: scale(1.4); } 40% { transform: scale(.9); } 100% { transform: scale(1.4); } }

/* Settimana, mese e 30 giorni */
.stat-row { display: flex; gap: 28px; flex-wrap: wrap; }
.stat { margin: 0; font-family: var(--serif); font-size: 28px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.stat span { font-size: 15px; color: var(--text-2); }
.mini-bar { display: grid; grid-template-columns: 118px 1fr 18px; align-items: center; gap: 10px; }
.mini-bar .bar { height: 6px; display: block; }
.mini-bar .bar > span { display: block; height: 6px; background: var(--gold); border-radius: 3px; }
.cal-nav { display: flex; align-items: center; gap: 2px; }
.cal-nav span { white-space: nowrap; }
.cal-nav .del { width: 44px; height: 44px; color: var(--gold); }
.cal-nav .del[disabled] { color: var(--hair-strong); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { text-align: center; font-size: 12px; color: var(--text-3); }
.cal-day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 9px; font-size: 13px; color: var(--text-3); background: #1F1C16; font-variant-numeric: tabular-nums; }
.cal-day.part { background: transparent; box-shadow: inset 0 0 0 1.5px var(--gold-dim); color: var(--text); }
.cal-day.act { background: var(--gold); color: var(--on-gold); font-weight: 600; }
.cal-day.today { outline: 1.5px solid var(--text); outline-offset: 1px; }
.dots { display: grid; grid-template-columns: repeat(15, 1fr); gap: 6px; }
.dots i { aspect-ratio: 1; border-radius: 50%; background: #1F1C16; }
.dots i.held { background: var(--gold); }
.dots i.fell { background: transparent; box-shadow: inset 0 0 0 1.5px var(--gold-dim); }
.dots i.today { outline: 1.5px solid var(--text); outline-offset: 1px; }

/* Campagna del mese */
.campaign h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.campaign audio { width: 100%; height: 40px; color-scheme: dark; }
.camp-list { display: flex; flex-direction: column; gap: 0; max-height: 360px; overflow-y: auto; padding-right: 4px; }
.camp-day { flex-shrink: 0; align-items: flex-start; padding: 10px 4px; border-bottom: 1px solid var(--hair); border-radius: 0; }
.camp-day .grow { flex-grow: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.camp-day .box { margin-top: 2px; }
.camp-day .day-n { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }
.camp-day.on .box { box-shadow: none; background: var(--gold); color: var(--on-gold); }
.camp-day.future { color: var(--text-3); }
.camp-day.future .day-n { color: var(--text-3); }

/* Piano di ogni impulso: patti, lettera, porta chiusa */
.plan { gap: 10px; }
.plan-head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0; border: none; background: none; color: inherit; text-align: left; font: inherit; }
.plan-head .grow { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.plan .label-up, .crisis .label-up, .fall .label-up { margin: 8px 0 0; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.chev { color: var(--text-3); transition: transform 160ms var(--ease-out); display: flex; }
.chev.open { transform: rotate(90deg); }
.pact { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--hair); }
.pact p { flex: 1; margin: 0; }
.pact-form { display: flex; flex-direction: column; gap: 8px; }
.pact-form .btn { align-self: flex-start; }
.plan textarea, .plan select { width: 100%; }
.door-item { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.door-item .row-main { align-items: flex-start; }
.door-item .grow { display: flex; flex-direction: column; gap: 3px; }
.door-item .box { margin-top: 2px; flex-shrink: 0; }
.door-item.on .box { box-shadow: none; background: var(--gold); color: var(--on-gold); }
.door-item .inline-form { align-items: flex-end; }
.fall { gap: 12px; }
.fall .chips, .streak .btn-row { flex-wrap: wrap; }
.better { background: var(--gold-tint); }
.better .eyebrow { color: var(--gold); }
.letter { white-space: pre-wrap; font-style: italic; }
.review { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.review:last-child { border-bottom: none; }
.btn-row.three .btn { flex: 1; }

/* Test dell'etichetta */
.label-q { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; }
.label-q .btn-row .btn { flex: 1; }
.label-result { padding: 14px 16px; gap: 6px; background: var(--gold-tint); }

/* Copia di sicurezza */
.file-btn { cursor: pointer; }
.onb-restore { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding-top: 10px; border-top: 1px solid var(--hair); }

/* Regalo dell'abbonamento (VICTUS): copertina facoltativa accanto al testo */
.card.gift { flex-direction: row; gap: 14px; align-items: center; background: var(--s2); }
.card.gift p { margin: 0 0 4px; }
.gift-cover { width: 64px; height: auto; border-radius: 4px; flex-shrink: 0; }

/* Passi della pagina d'acquisto */
.buy-steps { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.buy-steps li { flex: 1; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--s1); color: var(--text-2); counter-increment: step; }
.buy-steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1px currentColor; font-size: 12px; font-weight: 600; }
.buy-steps li.on { color: var(--text); background: var(--s2); }
.buy-steps li.on::before { background: var(--gold); box-shadow: none; color: var(--on-gold); }
.buy-steps li.done { color: var(--gold); }
.buy-steps li.done::before { content: '✓'; }

/* Legenda */
.lg-item { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; }
.group > .lg-item + .lg-item::before { left: 16px; }
.lg-t { font-weight: 600; font-size: 16px; }
.lg-item.hl { background: var(--gold-tint); }
.lg-item.hl .lg-t { color: var(--gold); }
.lg-grades { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.lg-grades li { display: grid; grid-template-columns: 92px 1fr; column-gap: 10px; font-size: 13px; color: var(--text-2); }
.lg-grades b { grid-row: span 2; font-family: var(--serif); color: var(--text); font-size: 14px; letter-spacing: .04em; }

/* Meno movimento: tutto istantaneo (il respiro guidato resta fermo) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .btn:active:not([disabled]), .crisis-pill:active { transform: none; }
  .breath-circle.run, .breath-circle.run span { animation: none; transform: none; }
}

/* Schermi stretti (320–359 px): anello più piccolo, niente scorrimento laterale */
@media (max-width: 359px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .hero { grid-template-columns: 104px 1fr; gap: 14px; padding: 16px; }
  .ring, .ring svg { width: 104px; height: 104px; }
  .ring-n { font-size: 32px; }
  .crisis-pill { padding: 0 10px; font-size: 13px; }
  .appbar-brand { font-size: 15px; letter-spacing: .12em; }
  .tile-n { font-size: 22px; }
}

/* Promemoria della copia di sicurezza */
.notice.backup { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 16px; }
.notice-acts { display: flex; gap: 8px; align-items: center; }
.card.own { background: var(--s2); }
.link-btn { border: none; background: none; padding: 0; font: inherit; font-size: 14px; font-weight: 500; color: var(--gold); cursor: pointer; }
