@font-face { font-family: 'Bodoni Moda'; src: url('font/bodoni.woff2') format('woff2'); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bodoni Moda'; src: url('font/bodoni-italic.woff2') format('woff2'); font-weight: 400 900; font-style: italic; font-display: swap; }

:root {
  --notte: oklch(0.16 0.035 268);
  --notte-2: oklch(0.205 0.04 268);
  --notte-3: oklch(0.255 0.045 268);
  --notte-4: oklch(0.31 0.05 268);
  --filo: oklch(0.83 0.14 82 / 0.22);
  --filo-forte: oklch(0.83 0.14 82 / 0.5);
  --oro: oklch(0.84 0.14 82);
  --oro-scuro: oklch(0.74 0.15 68);
  --sull-oro: oklch(0.22 0.05 60);
  --testo: oklch(0.95 0.016 85);
  --testo-2: oklch(0.8 0.03 262);
  --testo-3: oklch(0.7 0.035 262);
  --terracotta: oklch(0.7 0.13 42);
  --muschio: oklch(0.76 0.12 142);
  --f-alba: oklch(0.8 0.11 25);
  --f-giorno: oklch(0.94 0.06 92);
  --f-tramonto: oklch(0.74 0.16 52);
  --f-notte: oklch(0.64 0.13 268);
  --display: 'Bodoni Moda', 'Didot', 'Bodoni 72', Georgia, serif;
  --ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --r: 14px;
  --r-s: 10px;
  --spazio: 20px;
  --ombra: 0 10px 30px -12px oklch(0.05 0.03 268 / 0.8);
  --barra-h: 68px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--notte-4) var(--notte); }
body {
  margin: 0; min-height: 100dvh; background: var(--notte); color: var(--testo);
  font: 400 17px/1.5 var(--ui); padding-bottom: calc(var(--barra-h) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--oro); color: var(--sull-oro); }
a { color: var(--oro); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--oro); outline-offset: 3px; border-radius: 6px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.12; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); font-variation-settings: 'opsz' 72; }
h2 { font-size: 1.45rem; font-variation-settings: 'opsz' 40; }
h3 { font-size: 1.15rem; font-variation-settings: 'opsz' 18; }
p { margin: 0; }
.piccolo { font-size: 0.9rem; color: var(--testo-2); }
.num { font-variant-numeric: tabular-nums; }

/* testa e barra */
.demo-banner { background: var(--oro); color: var(--sull-oro); text-align: center; font-size: 0.85rem; font-weight: 600; padding: 6px 12px; }
.testa { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) var(--spazio) 10px; background: oklch(0.16 0.035 268 / 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--filo); }
.marchio { text-decoration: none; color: var(--testo); }
.marchio-nome { font-family: var(--display); font-size: 1.35rem; font-weight: 700; font-variation-settings: 'opsz' 30; }
.marchio-nome em { color: var(--oro); font-style: italic; font-weight: 500; }
.tasto-icona { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--filo); background: var(--notte-2); color: var(--oro); cursor: pointer; }
.tasto-icona:active { transform: scale(0.96); }
.barra { position: fixed; inset: auto 0 0 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--barra-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: oklch(0.14 0.035 268 / 0.96); backdrop-filter: blur(12px); border-top: 1px solid var(--filo); }
.barra a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--testo-3); text-decoration: none; font-size: 0.72rem; font-weight: 500; position: relative; }
.barra a[aria-current="page"] { color: var(--oro); }
.barra a[aria-current="page"]::before { content: ''; position: absolute; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--oro); box-shadow: 0 0 10px 2px oklch(0.84 0.14 82 / 0.7); }
.barra a[aria-current="page"] svg { margin-top: 6px; }

main { display: block; max-width: 760px; margin: 0 auto; padding: 24px var(--spazio) 40px; outline: none; }
.sez { margin-top: 36px; }
.sez > h2 { margin-bottom: 14px; }
.intro { color: var(--testo-2); margin-top: 8px; max-width: 60ch; }

/* tasti */
.tasto { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--filo-forte); background: var(--notte-2); color: var(--testo); font: 600 1rem var(--ui); cursor: pointer; text-decoration: none; transition: background .2s, transform .1s; }
.tasto:hover { background: var(--notte-3); }
.tasto:active { transform: scale(0.98); }
.tasto[disabled] { opacity: .45; cursor: not-allowed; }
.tasto-oro { background: var(--oro); color: var(--sull-oro); border-color: var(--oro); box-shadow: 0 8px 20px -10px oklch(0.05 0.03 268 / 0.9); }
.tasto-oro:hover { background: oklch(0.88 0.13 85); }
.tasto-piccolo { min-height: 42px; padding: 0 16px; font-size: 0.92rem; }
.tasto-vetro { background: oklch(0.12 0.03 268 / 0.6); backdrop-filter: blur(8px); border-color: oklch(1 0 0 / 0.25); }
.tasti { display: flex; flex-wrap: wrap; gap: 12px; }
.tasti-due { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* luminaria (firma dell'app) */
.luminaria { position: relative; margin: 4px -8px 0; }
.luminaria svg { width: 100%; height: auto; display: block; stroke: none; }
.luminaria .filo-arco { fill: none; stroke: var(--filo-forte); stroke-width: 1; }
.lamp { transition: opacity .6s, r .6s; }
.lum-testo { text-align: center; margin-top: -6px; }
.lum-ora { font-family: var(--display); font-size: clamp(3rem, 15vw, 4.6rem); font-weight: 500; line-height: 1; font-variation-settings: 'opsz' 96; font-variant-numeric: tabular-nums lining-nums; }
.lum-fase { font-size: 1.05rem; color: var(--oro); font-weight: 600; margin-top: 6px; }
.lum-prossima { color: var(--testo-2); font-size: 0.92rem; margin-top: 2px; }

/* elenchi di voci */
.voci { display: grid; gap: 1px; background: var(--filo); border: 1px solid var(--filo); border-radius: var(--r); overflow: hidden; }
.voce { display: flex; align-items: center; gap: 14px; padding: 16px 16px; min-height: 64px; background: var(--notte-2); color: var(--testo); text-decoration: none; border: 0; width: 100%; text-align: left; font: inherit; cursor: pointer; }
.voce:hover { background: var(--notte-3); }
.voce > svg:first-child { color: var(--oro); width: 26px; height: 26px; }
.voce-testo { flex: 1; min-width: 0; }
.voce-testo b { display: block; font-weight: 600; }
.voce-testo span { display: block; color: var(--testo-2); font-size: 0.9rem; }
.voce > svg:last-child { color: var(--testo-3); width: 18px; height: 18px; }

.riquadro { background: var(--notte-2); border: 1px solid var(--filo); border-radius: var(--r); padding: 18px; }
.riquadro + .riquadro { margin-top: 12px; }
.conto { display: flex; align-items: center; gap: 14px; }
.conto-num { font-family: var(--display); font-size: 2.4rem; line-height: 1; color: var(--oro); font-variant-numeric: tabular-nums lining-nums; min-width: 2.2ch; text-align: center; }

/* moduli */
label.campo { display: grid; gap: 6px; font-size: 0.92rem; color: var(--testo-2); font-weight: 500; }
.campo input, .campo select, .campo textarea, input.campo-in { width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--r-s); border: 1px solid var(--notte-4); background: var(--notte); color: var(--testo); font: 400 1rem var(--ui); caret-color: var(--oro); }
.campo textarea { min-height: 90px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--oro); outline: none; box-shadow: 0 0 0 3px oklch(0.84 0.14 82 / 0.2); }
.campi { display: grid; gap: 14px; }
.campi-due { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type=range] { width: 100%; accent-color: var(--oro); height: 32px; }
.interruttore { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 56px; padding: 6px 0; }
.interruttore + .interruttore { border-top: 1px solid var(--filo); }
.interruttore input[type=checkbox] { appearance: none; width: 52px; height: 30px; border-radius: 999px; background: var(--notte-4); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.interruttore input[type=checkbox]::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--testo-2); transition: transform .2s, background .2s; }
.interruttore input[type=checkbox]:checked { background: var(--oro-scuro); }
.interruttore input[type=checkbox]:checked::after { transform: translateX(22px); background: var(--testo); }

/* segmenti */
.segmenti { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; gap: 4px; background: var(--notte); border: 1px solid var(--notte-4); border-radius: 999px; }
.segmenti button { min-height: 44px; border-radius: 999px; border: 0; background: transparent; color: var(--testo-2); font: 600 0.95rem var(--ui); cursor: pointer; }
.segmenti button[aria-pressed="true"] { background: var(--oro); color: var(--sull-oro); }

/* regia */
.anteprima { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden; border: 1px solid var(--filo); background: #000; }
.anteprima canvas { width: 100%; height: 100%; display: block; }
.anteprima-etichetta { position: absolute; left: 14px; bottom: 12px; padding: 6px 12px; border-radius: 999px; background: oklch(0.1 0.03 268 / 0.7); font-weight: 600; font-size: 0.92rem; }
.tabellone { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tabellone th { text-align: left; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--testo-3); padding: 0 8px 8px; }
.tabellone td { padding: 14px 8px; border-top: 1px solid var(--filo); }
.tabellone tr.ora td { color: var(--oro); }
.tabellone tr.ora td:first-child b::after { content: ' · adesso'; font-weight: 500; font-size: 0.85rem; }
.pallino { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 10px; vertical-align: -1px; }
.tabellone tr.ora .pallino { box-shadow: 0 0 12px 3px currentColor; }
.fase-tasti { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fase-tasti button { min-height: 52px; border-radius: var(--r-s); border: 1px solid var(--notte-4); background: var(--notte); color: var(--testo); font: 600 0.92rem var(--ui); cursor: pointer; }
.fase-tasti button[aria-pressed="true"] { border-color: var(--oro); color: var(--oro); box-shadow: inset 0 0 0 1px var(--oro); }
.qr { background: #fff; padding: 10px; border-radius: var(--r-s); width: 168px; height: 168px; }
.qr img, .qr canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.link-copia { display: flex; gap: 8px; }
.link-copia input { flex: 1; min-width: 0; }
.passi { margin: 0; padding-left: 1.3em; display: grid; gap: 8px; color: var(--testo-2); }

/* cielo pieno */
.cielo-pieno { position: fixed; inset: 0; z-index: 100; background: #000; }
.cielo-pieno canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cielo-comandi { position: absolute; inset: auto 0 0 0; padding: 24px 24px calc(28px + env(safe-area-inset-bottom)); background: linear-gradient(to top, oklch(0.08 0.03 268 / 0.85), transparent); text-align: center; transition: opacity .4s; }
.cielo-comandi.nascosti { opacity: 0; pointer-events: none; }
.cielo-fase { font-family: var(--display); font-size: 1.6rem; margin-bottom: 14px; text-shadow: 0 2px 12px #000; }
.cielo-tasti { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.cielo-nota { margin-top: 12px; font-size: 0.85rem; color: oklch(0.9 0.02 260); text-shadow: 0 1px 6px #000; }

/* progetta */
.tabella { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.tabella th, .tabella td { padding: 10px 8px; text-align: right; border-top: 1px solid var(--filo); }
.tabella th:first-child, .tabella td:first-child { text-align: left; }
.tabella thead th { border-top: 0; color: var(--testo-3); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.tabella tbody td:nth-child(2) { color: var(--oro); font-weight: 600; }
.sezione-laterale { width: 100%; height: auto; display: block; margin-top: 8px; }
.risultato-grande { font-family: var(--display); font-size: 2.2rem; color: var(--oro); line-height: 1.1; font-variant-numeric: tabular-nums lining-nums; }
.tavolozza { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.colore { border-radius: var(--r); overflow: hidden; border: 1px solid var(--filo); background: var(--notte-2); }
.colore-campione { height: 72px; }
.colore div:last-child { padding: 12px; }
.colore b { display: block; }
.colore span { font-size: 0.88rem; color: var(--testo-2); }
.scorciatoie { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--notte-4); background: var(--notte); color: var(--testo); font: 500 0.92rem var(--ui); cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--oro); color: var(--oro); }

/* inventario */
.statistiche { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--filo); border: 1px solid var(--filo); border-radius: var(--r); overflow: hidden; }
.statistiche div { background: var(--notte-2); padding: 14px; }
.statistiche b { display: block; font-family: var(--display); font-size: 1.7rem; font-variant-numeric: tabular-nums lining-nums; color: var(--oro); line-height: 1.1; }
.statistiche span { font-size: 0.82rem; color: var(--testo-2); }
.griglia-statuine { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.statuina { display: block; background: var(--notte-2); border: 1px solid var(--filo); border-radius: var(--r); overflow: hidden; color: var(--testo); text-align: left; padding: 0; font: inherit; cursor: pointer; }
.statuina:hover { border-color: var(--filo-forte); }
.statuina-foto { aspect-ratio: 1; background: var(--notte-3); display: grid; place-items: center; color: var(--testo-3); }
.statuina-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.statuina-foto svg { width: 46px; height: 46px; stroke-width: 1.1; }
.statuina-testo { padding: 10px 12px 12px; }
.statuina-testo b { display: block; font-weight: 600; line-height: 1.25; }
.statuina-testo span { font-size: 0.82rem; color: var(--testo-2); }
.cerca { display: flex; gap: 10px; align-items: center; }
.cerca input { flex: 1; }
.vuoto { text-align: center; padding: 34px 18px; border: 1px dashed var(--filo-forte); border-radius: var(--r); color: var(--testo-2); }
.vuoto svg { width: 40px; height: 40px; color: var(--oro); margin-bottom: 10px; }
.vuoto b { display: block; color: var(--testo); font-size: 1.1rem; margin-bottom: 4px; }

/* personaggi */
.gruppo-titolo { font-family: var(--display); font-style: italic; font-weight: 500; font-size: 1.25rem; color: var(--oro); margin: 28px 0 10px; }
.personaggi { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.personaggio { background: var(--notte-2); border: 1px solid var(--filo); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.personaggio h3 { font-size: 1.2rem; }
.personaggio p { color: var(--testo-2); font-size: 0.95rem; flex: 1; }
.personaggio .dove { font-size: 0.85rem; color: var(--testo-3); }
.personaggio .dove b { color: var(--testo-2); font-weight: 600; }
.ce-lho { display: inline-flex; align-items: center; gap: 6px; color: var(--muschio); font-weight: 600; font-size: 0.92rem; min-height: 42px; }
.ce-lho svg { width: 18px; height: 18px; }
.mesi { columns: 2; column-gap: 20px; padding-left: 1.1em; margin: 0; color: var(--testo-2); }
.mesi li { margin-bottom: 6px; break-inside: avoid; }

/* montaggio */
.date { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.data-card { background: var(--notte-2); border: 1px solid var(--filo); border-radius: var(--r); padding: 14px; }
.data-card.prossima { border-color: var(--oro); }
.data-card .conto-num { font-size: 2rem; text-align: left; }
.data-card b { display: block; margin-top: 4px; }
.data-card span { font-size: 0.86rem; color: var(--testo-2); }
.gruppo-passi { margin-top: 22px; }
.gruppo-passi h3 { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.fila-lampade { display: inline-flex; gap: 5px; }
.fila-lampade i { width: 10px; height: 10px; border-radius: 50%; background: var(--notte-4); }
.fila-lampade i.accesa { background: var(--oro); box-shadow: 0 0 8px 1px oklch(0.84 0.14 82 / 0.7); }
.passo { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 14px; background: var(--notte-2); border: 1px solid var(--filo); border-radius: var(--r-s); cursor: pointer; }
.passo + .passo { margin-top: 6px; }
.passo input { appearance: none; width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--testo-3); flex: none; display: grid; place-items: center; cursor: pointer; }
.passo input:checked { background: var(--muschio); border-color: var(--muschio); }
.passo input:checked::after { content: ''; width: 12px; height: 7px; border-left: 2.5px solid var(--notte); border-bottom: 2.5px solid var(--notte); transform: rotate(-45deg) translate(1px, -1px); }
.passo:has(input:checked) span { color: var(--testo-3); text-decoration: line-through; text-decoration-color: var(--testo-3); }
.passo span { flex: 1; }
.passo .tasto-togli { width: 40px; height: 40px; border: 0; background: none; color: var(--testo-3); cursor: pointer; display: grid; place-items: center; }

/* cartolina */
.cartolina-anteprima { width: 100%; max-width: 420px; aspect-ratio: 4 / 5; display: block; margin: 0 auto; border-radius: var(--r); border: 1px solid var(--filo); background: var(--notte-2); }

/* foglio (dialog) */
.foglio { width: min(100% - 24px, 560px); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--filo-forte); border-radius: 22px; background: var(--notte-2); color: var(--testo); box-shadow: var(--ombra); }
.foglio::backdrop { background: oklch(0.06 0.03 268 / 0.7); backdrop-filter: blur(3px); }
.foglio-corpo { padding: 22px; }
.foglio-testa { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.foglio-testa button { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--filo); background: var(--notte); color: var(--testo); display: grid; place-items: center; cursor: pointer; }
.foglio-piede { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.foto-scelta { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: var(--r); border: 1px dashed var(--filo-forte); background: var(--notte); color: var(--testo-2); cursor: pointer; overflow: hidden; position: relative; }
.foto-scelta img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.foto-scelta input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.guida-passo { text-align: center; padding: 8px 4px; }
.guida-passo svg { width: 54px; height: 54px; color: var(--oro); stroke-width: 1.2; margin-bottom: 14px; }
.guida-passo p { color: var(--testo-2); margin-top: 10px; }
.puntini { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.puntini i { width: 8px; height: 8px; border-radius: 50%; background: var(--notte-4); }
.puntini i.on { background: var(--oro); }
.funzioni { display: grid; gap: 1px; background: var(--filo); border: 1px solid var(--filo); border-radius: var(--r); overflow: hidden; }
.funzioni a { display: flex; gap: 14px; padding: 16px; background: var(--notte-2); color: var(--testo); text-decoration: none; }
.funzioni a svg { color: var(--oro); width: 26px; height: 26px; margin-top: 2px; }
.funzioni b { display: block; }
.funzioni span { color: var(--testo-2); font-size: 0.92rem; }

.avviso { position: fixed; left: 50%; bottom: calc(var(--barra-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200; max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 999px; background: var(--testo); color: var(--notte); font-weight: 600; box-shadow: var(--ombra); }
.credit { text-align: center; margin-top: 40px; font-size: 0.85rem; color: var(--testo-3); }
.credit a { color: var(--testo-2); }

@media (min-width: 720px) {
  :root { --spazio: 32px; }
  .barra { left: 50%; right: auto; transform: translateX(-50%); width: min(680px, 100% - 32px); bottom: 14px; border: 1px solid var(--filo); border-radius: 22px; height: var(--barra-h); padding-bottom: 0; }
  body { padding-bottom: calc(var(--barra-h) + 30px); }
  .avviso { bottom: calc(var(--barra-h) + 34px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
.tasti-due .tasto { padding: 0 14px; white-space: nowrap; }
.campi-due { align-items: end; }
.cielo-pieno canvas[hidden] { display: none; }
