/* BARONATO · landing isometrica in pixel art — "Notte rossa" */
:root {
  --ink: #000;
  --panel: #120c0c;
  --line: #3a2622;
  --paper: #e9dfc8;
  --red: #c52411;
  --red-hi: #f44c11;
  --dim: #8c7a70;
  --px: "Silkscreen", "VT323", monospace;
  --mono: "VT323", ui-monospace, monospace;
  --frak: "UnifrakturMaguntia", Georgia, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--paper); overflow: hidden; }
body { font-family: var(--mono); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
img, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- scena ---------- */
.view { position: fixed; inset: 0; overflow: hidden; touch-action: pan-y; }
.can-pan .view { cursor: grab; }
.can-pan .view:active { cursor: grabbing; }
/* invito a camminare, solo la prima volta e solo se la via è più larga dello schermo */
.pan-hint { position: fixed; z-index: 3; left: 50%; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 84px); transform: translateX(-50%); font: 11px/1 var(--px); letter-spacing: .14em; color: var(--paper); opacity: 0; pointer-events: none; text-transform: uppercase; }
.can-pan:not(.walked) .pan-hint { animation: panhint 6s 2.5s ease-in-out 1 both; }
@keyframes panhint { 0%, 100% { opacity: 0; } 15%, 75% { opacity: .75; } }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; }
.layer { position: absolute; left: 0; top: 0; display: block; pointer-events: none; }
.light { mix-blend-mode: screen; opacity: 0; transition: opacity 1.2s; }
#l-day { opacity: 0; transition: opacity 1.2s; }
.actors { position: absolute; inset: 0; pointer-events: none; }
.actor { position: absolute; display: block; pointer-events: none; }
.actor.click { pointer-events: auto; cursor: pointer; }
.actor.flip { transform: scaleX(-1); }
/* di notte i personaggi prendono la luce della strada e un filo di rosso */
[data-state="aperto"] .actor, [data-state="chiuso"] .actor, [data-state="soundcheck"] .actor { filter: brightness(.78) drop-shadow(0 0 1px #c5241199); }
.sprite { position: absolute; overflow: hidden; pointer-events: none; }
.sprite > img { position: absolute; left: 0; top: 0; }
#rain, #smoke { pointer-events: none; }
#smoke { mix-blend-mode: screen; }
.sprite.refl { top: 100%; transform: scaleY(-1); opacity: .22; filter: blur(.3px) saturate(.6); }
/* selciato bagnato: il rosso della porta si specchia, sotto la pioggia di più */
[data-lit] #l-wet { opacity: .8; }
[data-lit][data-weather="pioggia"] #l-wet { opacity: 1; filter: brightness(1.3); }
[data-state="chiuso"] #l-wet, [data-state="giorno"] #l-wet { opacity: 0; }
/* fari: il livello illuminato si rivela solo dentro una lama che scorre */
#l-sweep { opacity: 0; transition: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0 38%, #000 45% 55%, transparent 62% 100%); mask-image: linear-gradient(90deg, transparent 0 38%, #000 45% 55%, transparent 62% 100%);
  -webkit-mask-size: 300% 100%; mask-size: 300% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.sweep #l-sweep { animation: sweep 1.8s cubic-bezier(.4,0,.6,1) 1; }
@keyframes sweep { 0% { opacity: 0; -webkit-mask-position: 100% 0; mask-position: 100% 0; } 12% { opacity: .9; } 88% { opacity: .9; } 100% { opacity: 0; -webkit-mask-position: 0 0; mask-position: 0 0; } }

/* stati */
[data-state="giorno"] #l-day { opacity: 1; }
[data-state="giorno"][data-weather="nuvoloso"] #l-day,
[data-state="giorno"][data-weather="pioggia"] #l-day { filter: saturate(.6) brightness(.85); }
[data-state="soundcheck"] #l-lamp, [data-state="aperto"] #l-lamp, [data-state="chiuso"] #l-lamp { opacity: 1; }
[data-state="soundcheck"][data-lit] #l-door { opacity: .45; }
[data-state="aperto"][data-lit] #l-door { opacity: 1; animation: breathe 6s ease-in-out infinite; }
/* respiro lento con un singhiozzo elettrico */
@keyframes breathe { 0%,100% { opacity: .78; } 40% { opacity: 1; } 61% { opacity: 1; } 62% { opacity: .3; } 63% { opacity: .95; } 64% { opacity: .45; } 66% { opacity: 1; } }
.flicker #l-lamp { animation: flick 1.1s steps(1) 1; }
@keyframes flick { 0%{opacity:1} 8%{opacity:.1} 14%{opacity:.9} 22%{opacity:0} 40%{opacity:.8} 46%{opacity:.05} 60%{opacity:1} }

/* ---------- HUD ---------- */
.hud { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 16px; right: 16px; z-index: 3; pointer-events: none; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hud p { margin: 0; }
.hud-name { font: 12px/1.2 var(--px); letter-spacing: .06em; color: var(--paper); }
.hud-name span { color: var(--red-hi); }
.hud-info { font: 18px/1 var(--mono); letter-spacing: .06em; color: var(--dim); }

.tip {
  position: fixed; z-index: 4; pointer-events: none; transform: translate(-50%, calc(-100% - 14px));
  font: 12px/1 var(--px); letter-spacing: .04em; white-space: nowrap; color: var(--paper);
  background: var(--panel); padding: 6px 8px 5px; border: 2px solid var(--line);
  box-shadow: 0 2px 0 #000, inset 0 0 0 1px #000;
}
.tip b { color: var(--red-hi); font-weight: 400; }

.bubble {
  position: fixed; z-index: 4; pointer-events: none; white-space: nowrap;
  transform: translate(-50%, -100%); font: 11px/1.1 var(--px); letter-spacing: .03em; color: #111;
  background: var(--paper); padding: 5px 7px 4px; border: 2px solid #000;
  animation: pop .18s steps(2);
}
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -8px; margin-left: -4px; border: 4px solid transparent; border-top-color: var(--paper); }
@keyframes pop { from { transform: translate(-50%, -80%); opacity: 0; } }

.bar {
  position: fixed; z-index: 3; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px);
  font: 12px/1.2 var(--px); letter-spacing: .04em; text-align: left;
  background: var(--panel); border: 2px solid var(--line); padding: 8px 12px 7px;
  box-shadow: 0 3px 0 #000, inset 0 0 0 1px #000;
}
.bar #bar-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar:hover, .bar:focus-visible { border-color: var(--red); outline: none; }
.bar-led { flex: none; width: 8px; height: 8px; background: #3a2622; box-shadow: inset -2px -2px 0 #0004; }
[data-lit] .bar-led { background: var(--red-hi); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { background: var(--red); } }

.hint { position: fixed; z-index: 3; left: 0; right: 0; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 60px); margin: 0; text-align: center; font: 11px/1 var(--px); letter-spacing: .06em; color: var(--dim); pointer-events: none; transition: opacity 1s; }
.hint.off { opacity: 0; }
.hot { position: fixed; z-index: 5; top: 0; left: 0; width: 48px; height: 48px; background: none; border: 0; opacity: 0; }

/* ---------- debug ---------- */
.debug { position: fixed; z-index: 6; top: 10px; left: 10px; width: 230px; display: flex; flex-direction: column; gap: 6px; padding: 10px; background: #000e; border: 1px solid #0f0; color: #0f0; font: 16px/1.1 var(--mono); }
.debug[hidden] { display: none; }
.debug label { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.debug select, .debug button { background: #000; color: #0f0; border: 1px solid #0f0; font: 15px var(--mono); padding: 2px 4px; }
.debug small { color: #9f9; white-space: pre-wrap; font-size: 13px; }

/* ---------- luce del giorno: dorata, ora blu, sera ---------- */
[data-sky="oro"] #l-day { filter: sepia(.35) saturate(1.35) brightness(.97) hue-rotate(-8deg); }
[data-sky="blu"] #l-day { filter: brightness(.6) saturate(.6) hue-rotate(12deg); }
[data-sky="blu"] #l-lamp { opacity: .6; }
[data-sky="sera"] #l-day { opacity: 0; }
[data-sky="sera"] #l-lamp { opacity: 1; }
#birds { pointer-events: none; }
/* battito: il portone pulsa sui colpi di cassa */
[data-lit].kick #l-door { filter: brightness(1.14); }
/* il graffito si accende */
.segno #l-hl { display: block !important; }
.segno .view #l-hl, .segno #l-hl { animation: segno 2.6s ease-out 1; filter: drop-shadow(0 0 2px #f44c11) drop-shadow(0 0 6px #c52411); }
@keyframes segno { 0% { opacity: 0; } 10% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
/* colore del giorno (libro brand): rosso pompeiano il martedì, pigmenti gli altri giorni */
.bar-led { background: var(--day, #3a2622); }
[data-martedi] .bar { border-color: #6a1d14; }

/* ---------- radio ---------- */
.radio {
  position: fixed; z-index: 3; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); width: 228px;
  background: #241512; border: 2px solid #000; box-shadow: 0 3px 0 #000, inset 0 0 0 2px #3a2622, inset 0 2px 0 4px #2e1b17;
  padding: 6px 8px 8px; font-family: var(--px); color: var(--paper); user-select: none;
}
.r-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.r-brand { font: 10px/1 var(--px); letter-spacing: .12em; color: #c9a86a; }
.r-lamps { display: flex; gap: 3px; }
.r-lamps i { width: 6px; height: 6px; background: #3a2018; box-shadow: inset -1px -1px 0 #0006; }
.r-lamps i.lit { background: #fc881e; box-shadow: 0 0 4px #f44c11; }
.r-body { display: grid; grid-template-columns: 44px 1fr 26px; gap: 6px; align-items: center; }
.r-power { width: 44px; height: 44px; padding: 0; border: 2px solid #000; background: #120b0a; position: relative; }
.r-grille { position: absolute; inset: 4px; background-image: radial-gradient(#5a3a30 45%, transparent 50%); background-size: 4px 4px; image-rendering: pixelated; }
.radio.on .r-grille { background-image: radial-gradient(#c5241188 45%, transparent 50%); animation: grille .45s steps(2) infinite; }
@keyframes grille { 50% { background-position: 1px 0; } }
.r-face { min-width: 0; }
.r-dial { position: relative; height: 16px; background: #d8c79e; border: 2px solid #000; cursor: pointer; overflow: hidden; }
.radio.on .r-dial { background: #f0d79a; box-shadow: inset 0 0 6px #fc881e; }
.r-ticks { position: absolute; inset: 3px 4px; background: repeating-linear-gradient(90deg, #5a3a30 0 1px, transparent 1px 8px); opacity: .7; }
.r-needle { position: absolute; top: 0; bottom: 0; width: 2px; background: #c52411; left: 8%; transition: left .35s steps(6); }
.r-screen { margin: 4px 0 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.r-screen b { font: 400 11px/1 var(--px); letter-spacing: .06em; color: var(--paper); white-space: nowrap; }
.r-screen span { font: 15px/1 var(--mono); color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-knob { --rot: 0deg; width: 26px; height: 26px; padding: 0; border: 2px solid #000; border-radius: 50%; background: conic-gradient(from var(--rot), #c52411 0 8%, #2a1a16 8% 100%); box-shadow: inset -2px -2px 0 #0008; transition: background .3s steps(3); }
.r-go { display: block; margin-top: 7px; padding: 6px 8px 5px; font: 10px/1 var(--px); letter-spacing: .06em; text-align: center; text-decoration: none; color: #fff; background: var(--red); border: 2px solid #000; box-shadow: inset -2px -2px 0 #0005; }
.r-go:hover, .r-go:focus-visible { background: var(--red-hi); outline: none; }
.radio.unlocked { box-shadow: 0 3px 0 #000, inset 0 0 0 2px #fc881e, 0 0 18px #c5241166; }
.radio button:focus-visible, .r-dial:focus-visible { outline: 2px solid var(--red-hi); outline-offset: 1px; }
/* telefono: la radio sale sopra la barra */
@media (max-width: 760px) {
  .hint { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 58px); }
  .pan-hint { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 80px); }
}

/* ---------- effetti ---------- */
/* tabellone a palette */
.flap { display: inline-block; min-width: .62em; text-align: center; }
.flap:not(.done) { color: var(--dim); }
/* lampo rosso dal portone */
.leak { position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: 0; mix-blend-mode: screen;
  background: radial-gradient(circle at var(--lx, 50%) var(--ly, 50%), #f44c11cc 0, #c5241166 18%, transparent 55%); }
.leak.go { animation: leak .9s ease-out 1; }
@keyframes leak { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
/* grana da pellicola + righe da tubo catodico, leggerissime */
.grain { position: fixed; inset: -50%; z-index: 2; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain .5s steps(4) infinite; }
.grain::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, #000 0 1px, transparent 1px 3px); opacity: .5; }
@keyframes grain { 25% { transform: translate(-3%, 2%); } 50% { transform: translate(2%, -3%); } 75% { transform: translate(-2%, -1%); } }

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .vol[open] .v-sheet, .strip.tearing { animation: none !important; }
  .leak.go { animation: none; }
  .radio.on .r-grille { animation: none; }
  #l-door, .bar-led, #l-sweep { animation: none !important; }
}

/* la gente */
.actor.crowd { transition: opacity .6s; }
[data-state="aperto"] .actor.near, [data-state="chiuso"] .actor.near, [data-state="soundcheck"] .actor.near { filter: brightness(.42) contrast(1.1); }
.entra #l-door { animation: entra .9s ease-out 1; }
@keyframes entra { 0% { filter: brightness(1); } 25% { filter: brightness(1.9) saturate(1.3); } 100% { filter: brightness(1); } }

/* ---------- console: la radio vive nella barra (una sola striscia, telefono e pc) ---------- */
.console {
  position: fixed; z-index: 3; left: 50%; transform: translateX(-50%);
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex; align-items: stretch; gap: 6px; width: min(600px, calc(100vw - 24px));
  user-select: none; -webkit-user-select: none;
}
.console .bar {
  position: static; transform: none; flex: 1; min-width: 0; max-width: none;
  justify-content: flex-start;
}
.r-knob {
  --rot: -40deg; flex: none; position: relative; width: 44px; height: 44px; padding: 0; border-radius: 50%;
  border: 2px solid #000; background: #1c110f; box-shadow: 0 3px 0 #000, inset 0 0 0 2px #3a2622;
  cursor: grab; touch-action: none;
}
.r-knob:active { cursor: grabbing; }
.r-cap {
  position: absolute; inset: 7px; border-radius: 50%; border: 2px solid #000;
  background: conic-gradient(from var(--rot), #c52411 0 7%, #3a2622 7% 50%, #2a1a16 50% 100%);
  box-shadow: inset -2px -2px 0 #0008; transition: background .25s steps(3);
}
.console.on .r-cap { background: conic-gradient(from var(--rot), #fc881e 0 7%, #5a2a1e 7% 50%, #3a1c16 50% 100%); box-shadow: inset -2px -2px 0 #0008, 0 0 10px #f44c1188; }
/* i segreti: sei lucine sulla ghiera, come la scala di una manopola */
.r-lamps { position: absolute; inset: 0; pointer-events: none; }
.r-lamps i { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; background: #3a2018;
  transform: rotate(calc(-150deg + var(--k) * 60deg)) translateY(-18px); }
.r-lamps i.lit { background: #fc881e; box-shadow: 0 0 4px #f44c11; }
.console.unlocked .r-knob { box-shadow: 0 3px 0 #000, inset 0 0 0 2px #fc881e, 0 0 16px #c5241188; }
.r-go {
  flex: none; display: grid; place-items: center; width: 44px; font: 14px/1 var(--px); text-decoration: none;
  color: var(--paper); background: var(--panel); border: 2px solid var(--line); box-shadow: 0 3px 0 #000, inset 0 0 0 1px #000;
}
.r-go[hidden] { display: none; }
.r-go:hover, .r-go:focus-visible, .r-knob:focus-visible { border-color: var(--red); outline: none; }
/* la lucina della barra diventa un equalizzatore quando la radio suona */
.bar-led { display: flex; align-items: flex-end; gap: 1px; width: 10px; height: 10px; background: none !important; box-shadow: none !important; }
.bar-led i { flex: 1; height: 100%; background: var(--day, #3a2622); }
[data-lit] .bar-led i { background: var(--red-hi); }
.console.on .bar-led i { animation: eq .5s steps(3) infinite; }
.console.on .bar-led i:nth-child(2) { animation-duration: .38s; }
.console.on .bar-led i:nth-child(3) { animation-duration: .62s; }
@keyframes eq { 0% { height: 30%; } 50% { height: 100%; } 100% { height: 55%; } }
.bar .st { color: #fc881e; }
@media (max-width: 760px) {
  .console { bottom: max(12px, env(safe-area-inset-bottom)); gap: 5px; }
  .console .bar { font-size: 11px; padding: 8px 9px 7px; }
}
@media (prefers-reduced-motion: reduce) { .console.on .bar-led i { animation: none; } }

/* ---------- Bafometto ---------- */
.actor.bafo { overflow: visible; }
.bafo-glow { position: absolute; left: 50%; top: 2%; width: 34px; height: 34px; margin-left: -17px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #ffb04a88 0, #ff6a1a33 40%, transparent 70%); mix-blend-mode: screen; animation: fiamma 1.3s steps(3) infinite; }
.actor.bafo.flip .bafo-glow { transform: scaleX(-1); }
@keyframes fiamma { 0% { opacity: .9; } 33% { opacity: .6; } 66% { opacity: 1; } }
.bafo-tende { z-index: 1; pointer-events: none; -webkit-mask-image: url(assets/door_mask.png); mask-image: url(assets/door_mask.png);
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%; }
.bafo-tende .ombra { filter: brightness(0) blur(.6px) !important; opacity: .82; }
.bafo-tende .bafo-glow { display: none; }
.bafo-in #l-door { opacity: .5 !important; filter: hue-rotate(18deg) saturate(1.2); animation: fiamma 1.6s steps(4) infinite !important; }
.bafo-knock #l-door { animation: tonfo .5s steps(2) 1 !important; opacity: .7 !important; }
@keyframes tonfo { 0%, 100% { transform: none; } 50% { transform: translateX(1px); } }
.lumino { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, #ff5a1aaa 0, #ff2a0a33 45%, transparent 70%); mix-blend-mode: screen; }
.lumino.trema { animation: trema 2.4s steps(1) 1; }
@keyframes trema { 0% { opacity: 1; } 10% { opacity: 0; } 18% { opacity: .9; } 30% { opacity: .1; } 42% { opacity: 1; } 55% { opacity: 0; } 70% { opacity: .7; } 100% { opacity: 0; } }

/* ---------- tavolino dei cartoni, furgoni, ex-voto ---------- */
#l-tavolo { opacity: 0; transition: opacity 1.4s steps(6); }
#l-tavolo.on { opacity: 1; }
.actor.veicolo { overflow: visible; }
.dueminuti { position: absolute; left: 52%; top: -1%; display: flex; gap: 6px; align-items: center; padding: 5px 8px 4px; font: 22px/1 var(--px); color: #ff5a2a; background: #120808;
  border: 3px solid #000; box-shadow: 0 3px 0 #000; letter-spacing: .06em; text-shadow: 0 0 6px #ff3a1a; pointer-events: none; transform: translateY(-100%); }
.dueminuti i { font-style: normal; font-size: 10px; color: #c86a4a; text-shadow: none; }
.dueminuti b { font-weight: 400; animation: lcd 1s steps(1) infinite; }
@keyframes lcd { 50% { opacity: .3; } }
.actor.flip .dueminuti { transform: scaleX(-1); }
.dueminuti.tilt b { animation-duration: .3s; }
.dueminuti.tilt { animation: tonfo .3s steps(2) 3; }
.freddo { position: absolute; right: 2%; top: 22%; width: 22%; height: 62%; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(ellipse at 40% 50%, #bfe6ffcc 0, #5aa8e866 35%, transparent 72%); animation: freddo 2.2s ease-in-out infinite; transition: opacity .6s; }
.freddo.off { opacity: 0; animation: none; }
@keyframes freddo { 50% { filter: brightness(1.25); } }
.goccia { position: absolute; width: 3px; height: 2px; background: #a9cbe4; opacity: .85; pointer-events: none; box-shadow: 4px 1px 0 #a9cbe4aa, -3px 2px 0 #a9cbe488; transition: opacity 600s linear; }
.goccia.asciuga { opacity: 0; }
.ubriaco .sprite { animation: barcolla 1.1s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes barcolla { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) translateX(1px); } }
.flash::after { content: ""; position: fixed; inset: 0; z-index: 2; pointer-events: none; background: #fffbe8; animation: flash .7s ease-out 1 forwards; mix-blend-mode: screen; }
@keyframes flash { 0% { opacity: .95; } 100% { opacity: 0; } }
.lumino.grazia { width: 40px; height: 40px; margin: -20px 0 0 -20px; animation: grazia 2.4s ease-out 1; }
@keyframes grazia { 0% { opacity: 0; } 15% { opacity: 1; transform: scale(1.3); } 100% { opacity: 0; transform: scale(1); } }
.exvoto { position: fixed; z-index: 4; pointer-events: none; transform: translate(-50%, -100%); display: grid; justify-items: center; gap: 3px; padding: 7px 10px 6px;
  background: linear-gradient(160deg, #e8e8e4 0, #a9aaa6 45%, #d9dad5 60%, #8e8f8b 100%); color: #2a2622; border: 2px solid #000;
  border-radius: 10px 10px 50% 50% / 10px 10px 34% 34%; box-shadow: 0 2px 0 #000, inset 0 0 0 1px #fff8, inset 0 0 0 4px #0002, 0 0 18px #ff8a3a55;
  padding: 8px 18px 14px; font: 15px/1.1 "IM Fell English", Georgia, serif; text-align: center; white-space: nowrap; animation: exvoto .5s steps(4); }
.exvoto b::before { content: "♥"; display: block; margin-bottom: 2px; font: 14px/1 Georgia, serif; color: #b03024; }
.exvoto b { font: 400 11px/1 "IM Fell English SC", Georgia, serif; letter-spacing: .2em; }
.exvoto.via { opacity: 0; transition: opacity 1s; }
@keyframes exvoto { from { opacity: 0; transform: translate(-50%, -80%); } }

/* ---------- volantino: fotocopia sotto la porta ----------
   una sola scala: etichette 12 · testo 16 · righe 20 · titoli 30 (Fraktur) · data 104.
   ritmo verticale a multipli di 4; margini laterali --g; ogni sezione aperta da un filetto con etichetta */
.vol { padding: 0; border: 0; background: none; width: min(420px, calc(100vw - 24px)); max-height: calc(100svh - 24px); overflow: visible; }
.vol::backdrop { background: #000d; }
.v-sheet { --ink: var(--day-ink, #1C1814); --pap: var(--day, #D2B06E); --g: 24px;
  position: relative; display: block; max-height: calc(100svh - 24px); overflow: auto; overscroll-behavior: contain; scrollbar-width: none;
  padding: 20px var(--g) 0; background: var(--pap); color: var(--ink); transform: rotate(-.5deg);
  font: 16px/1.4 "IM Fell English", Georgia, serif; font-kerning: normal; text-rendering: optimizeLegibility;
  box-shadow: 0 0 0 1px #0006, 0 14px 40px #000, 0 0 80px #c5241122; }
.v-sheet::-webkit-scrollbar { display: none; }
.v-sheet p, .v-sheet h1, .v-sheet h2, .v-sheet ol { margin: 0; }
/* toner: grana fitta e bordi bruciati della fotocopiatrice */
/* toner: la grana sta nello sfondo del foglio (scorre col contenuto), i bordi bruciati sono un'ombra interna */
.v-sheet { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.85 0.6'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") repeat local, var(--pap);
  box-shadow: inset 0 0 34px #0000004d, inset 0 0 3px #0008, 0 0 0 1px #0006, 0 14px 40px #000, 0 0 80px #c5241122; }
.vol[open] .v-sheet { animation: volin .6s steps(8) both; }
@keyframes volin { from { transform: translateY(70vh) rotate(-4deg); } to { transform: translateY(0) rotate(-.5deg); } }
.v-close { position: absolute; z-index: 3; top: 12px; right: 12px; width: 32px; height: 32px; padding: 0 0 2px; border: 1.5px solid var(--ink); background: none; color: var(--ink); font: 22px/1 "IM Fell English", serif; }
/* testata */
.v-mast { text-align: center; padding: 0 36px 12px; border-bottom: 4px double var(--ink); }
.v-brand { font: 400 46px/1 var(--frak); letter-spacing: .01em; }
.v-sub2 { margin-top: 6px !important; font: 13px/1 "IM Fell English SC", serif; letter-spacing: .28em; }
/* la data come un calendario da muro */
.v-date { display: flex; align-items: flex-end; gap: 16px; padding: 16px 0 16px; border-bottom: 1.5px solid var(--ink); }
.v-num { flex: none; min-width: 1.1ch; font: 104px/.74 "IM Fell English", serif; letter-spacing: -.05em; font-variant-numeric: lining-nums; }
.v-dcol { display: grid; gap: 4px; justify-items: start; padding-bottom: 2px; }
.v-kick { padding: 4px 8px 3px; background: var(--ink); color: var(--pap); font: 12px/1 "IM Fell English SC", serif; letter-spacing: .18em; }
.v-dow { font: 400 30px/1 var(--frak); margin-top: 4px; }
.v-mon { font: italic 16px/1.2 "IM Fell English", serif; }
/* sezioni */
.v-sec { padding: 16px 0; border-bottom: 1.5px solid var(--ink); }
.v-lab { margin: 0 0 8px !important; font: 400 12px/1 "IM Fell English SC", serif; letter-spacing: .2em; }
.v-title { margin: 0 0 12px !important; font: 400 30px/1.05 var(--frak); }
.v-lineup { list-style: none; padding: 0; display: grid; gap: 8px; margin-bottom: 12px !important; }
.v-lineup li { display: grid; grid-template-columns: 52px 1fr; column-gap: 12px; align-items: baseline; }
.v-t { grid-row: span 2; font: 16px/1.25 "IM Fell English SC", serif; letter-spacing: .04em; font-variant-numeric: lining-nums; }
.v-n { font: 20px/1.2 "IM Fell English", serif; }
.v-r { font: italic 15px/1.3 "IM Fell English", serif; opacity: .88; }
.v-hours { display: flex; align-items: center; gap: 8px; font: 15px/1 "IM Fell English SC", serif; letter-spacing: .1em; }
.v-hours b { font-weight: 400; font-size: 18px; letter-spacing: .04em; }
.v-dots { flex: 1; height: 1.5px; margin-top: 3px; background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 6px); }
.v-late { display: inline-flex; align-items: center; gap: 6px; }
.v-late img { width: 24px; height: 24px; filter: grayscale(1) contrast(3) brightness(.2); }
[data-martedi] .v-late img { filter: grayscale(1) contrast(3) brightness(3); }
.v-note { margin-top: 8px !important; font-style: italic; }
/* settimana */
.v-week { display: grid; grid-template-columns: repeat(7, 1fr); border: 1.5px solid var(--ink); }
.v-day { position: relative; display: grid; justify-items: center; gap: 4px; padding: 8px 0 8px; border-left: 1px solid var(--ink); min-width: 0; }
.v-day:first-child { border-left: 0; }
.v-day b { font: 400 12px/1 "IM Fell English SC", serif; letter-spacing: .08em; }
.v-dn { font: 22px/1 "IM Fell English", serif; font-variant-numeric: lining-nums; }
.v-day i { font: italic 12px/1 "IM Fell English", serif; white-space: nowrap; }
.v-day.off { background: repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in srgb, var(--ink) 20%, transparent) 4px 5px); }
.v-day.past { opacity: .4; }
.v-day.sel::after { content: ""; position: absolute; inset: 2px -2px; border: 2px solid var(--ink); border-radius: 50% 46% 52% 44%; transform: rotate(-5deg); pointer-events: none; }
/* fascia nera (al rovescio) */
.v-band { display: grid; gap: 6px; margin: 0 calc(var(--g) * -1); padding: 16px var(--g); background: var(--ink); color: var(--pap); }
.v-b1 { font: 14px/1 "IM Fell English SC", serif; letter-spacing: .16em; }
.v-b2 { font: italic 16px/1.35 "IM Fell English", serif; }
.v-b3 { font: 12px/1 "IM Fell English SC", serif; letter-spacing: .2em; opacity: .85; }
/* azioni */
.v-act { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 16px 0 0; }
.v-act a, .v-act button { display: grid; place-items: center; min-height: 44px; padding: 4px; border: 1.5px solid var(--ink); background: none; color: var(--ink); text-decoration: none;
  font: 14px/1.1 "IM Fell English SC", serif; letter-spacing: .1em; text-align: center; }
.v-act a:hover, .v-act button:hover, .v-act a:focus-visible, .v-act button:focus-visible, .v-close:hover, .v-close:focus-visible { background: var(--ink); color: var(--pap); outline: none; }
/* linea di taglio e strisce */
.v-cut { display: flex; align-items: center; gap: 10px; margin: 24px calc(var(--g) * -1) -6px !important; padding: 0; }
.v-cut::before, .v-cut::after { content: ""; flex: 1; border-top: 1.5px dashed var(--ink); }
.v-cut span { font: 12px/1 "IM Fell English SC", serif; letter-spacing: .16em; }
.v-strips { display: flex; margin: 0 calc(var(--g) * -1); height: 150px; }
.strip { --h: 100%; flex: 1; position: relative; display: block; height: var(--h); color: var(--ink); text-decoration: none; transform-origin: 50% 0; }
.strip::after { content: ""; position: absolute; top: 10px; bottom: 0; right: 0; border-right: 1.5px dashed var(--ink); }
.strip:last-child::after { display: none; }
.strip span { position: absolute; inset: 10px 0; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; writing-mode: vertical-rl; transform: rotate(180deg); }
.strip b { font: 400 15px/1 "IM Fell English SC", serif; letter-spacing: .04em; white-space: nowrap; }
.strip i { font: italic 13px/1 "IM Fell English", serif; letter-spacing: 0; opacity: .85; white-space: nowrap; }
.strip:hover, .strip:focus-visible { background: color-mix(in srgb, var(--ink) 12%, transparent); outline: none; }
.strip.tearing { animation: strappa .65s cubic-bezier(.5,0,.9,.4) 1 forwards; }
@keyframes strappa { 0% { transform: none; } 25% { transform: rotate(-7deg) translateY(4px); } 100% { transform: rotate(14deg) translate(18px, 160px); opacity: 0; } }
.strip.torn { --h: 36px; clip-path: polygon(0 0, 100% 0, 100% 80%, 84% 100%, 66% 78%, 48% 96%, 30% 76%, 14% 94%, 0 80%); }
.strip.torn span { inset: 8px 0 0; transform: none; writing-mode: horizontal-tb; }
.strip.torn i { display: none; }
.strip.torn b { font-size: 12px; letter-spacing: .06em; }
.v-toast { position: sticky; bottom: 12px; z-index: 3; margin: -48px auto 12px; width: max-content; max-width: 90%; padding: 8px 12px 7px; background: var(--ink); color: var(--pap); font: italic 15px/1.2 "IM Fell English", serif; }
@media (max-width: 400px) {
  .v-sheet { --g: 16px; padding-top: 16px; }
  .v-act a, .v-act button { font-size: 13px; letter-spacing: .05em; }
  .v-brand { font-size: 40px; }
  .v-num { font-size: 92px; }
  .v-sub2 { letter-spacing: .2em; }
}
/* telefono: la barra scorre se il testo non ci sta */
#bar-text.mq { text-overflow: clip; }
#bar-text.mq > * { display: inline-block; animation: mq 11s linear infinite; }
@keyframes mq { 0%, 18% { transform: translateX(0); } 70%, 82% { transform: translateX(var(--mq)); } 100% { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { #bar-text.mq > * { animation: none; } }

/* ---------- registro della porta: lo stesso volantino, in negativo (Notte) ---------- */
.reg .v-sheet { --ink: #E9DFC8; --pap: #1C1814; padding-bottom: 20px; }
.r-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0; border-bottom: 1.5px solid var(--ink); font: 14px/1 "IM Fell English SC", serif; letter-spacing: .14em; }
.r-nav button { width: 36px; height: 36px; border: 1.5px solid var(--ink); background: none; color: var(--ink); font: 20px/1 "IM Fell English", serif; }
.r-day { display: grid; grid-template-columns: 1fr 96px; gap: 6px; margin: 0; padding: 12px 0; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 40%, transparent); }
.r-day legend { float: left; grid-column: 1 / -1; padding: 0; margin-bottom: 2px; font: 400 22px/1 var(--frak); }
.r-day input, .r-day select, .r-consacra input { min-width: 0; height: 40px; padding: 0 10px; border: 1.5px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink);
  font: 16px/1 "IM Fell English", Georgia, serif; color-scheme: dark; }
.r-day input::placeholder, .r-consacra input::placeholder { color: color-mix(in srgb, var(--ink) 55%, transparent); font-style: italic; }
.r-day [name="nomi"], .r-day [name="nota"], .r-day [name="link"] { grid-column: 1 / -1; }
.r-day.spento input { opacity: .3; pointer-events: none; }
.r-day input:focus, .r-day select:focus, .r-consacra input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.r-consacra { display: grid; gap: 8px; padding: 16px 0; }
.r-consacra button { height: 44px; border: 1.5px solid var(--ink); background: var(--ink); color: var(--pap); font: 14px/1 "IM Fell English SC", serif; letter-spacing: .1em; }
.r-stato { min-height: 20px; margin-top: 12px !important; font: italic 16px/1.2 "IM Fell English", serif; text-align: center; }
.r-foot { margin-top: 8px !important; text-align: center; }
.r-foot button { border: 0; background: none; color: color-mix(in srgb, var(--ink) 55%, transparent); font: italic 13px/1 "IM Fell English", serif; text-decoration: underline; text-underline-offset: 3px; }
.reg .v-act { padding-top: 16px; }
/* quando si apre: le tende si chiudono un attimo */
.registro-in #l-door { animation: tende 1.2s steps(6) 1 !important; }
@keyframes tende { 0%, 100% { opacity: 1; } 40%, 60% { opacity: 0; } }
.v-n[href] { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

.reg.chiede .r-nav button, .reg.chiede .v-act, .reg.chiede .r-foot { display: none; }
.reg.chiede .r-nav { justify-content: center; }
.r-day option { background: #1C1814; color: #E9DFC8; }

/* ---------- la custode (ogni notte a locale chiuso) ---------- */
.custode { z-index: 1; pointer-events: none; visibility: hidden; }
.custode.su { visibility: visible; }
.custode .vetro { position: absolute; overflow: hidden; }
.custode .vetro::before { content: ''; position: absolute; inset: 0; background: #07030a; opacity: 0; transition: opacity 1.2s; }
.custode.buio .vetro::before { opacity: .86; }
.custode .riflesso { position: absolute; left: 0; top: 0; width: 30px; height: 44px; image-rendering: pixelated; opacity: 0; filter: blur(.35px); transition: opacity 1.4s; }
.custode.appare .riflesso { opacity: .88; }
.custode .macchia { position: absolute; inset: 0; opacity: 0; background-size: 12px 12px; image-rendering: pixelated;
  -webkit-mask-image: linear-gradient(90deg, #000 0 3px, transparent 3px calc(100% - 3px), #000 calc(100% - 3px)); mask-image: linear-gradient(90deg, #000 0 3px, transparent 3px calc(100% - 3px), #000 calc(100% - 3px)); }
.custode.maculato .macchia { opacity: .8; }
.custode .firma { position: absolute; right: 3px; bottom: 2px; font: italic 11px/1 "IM Fell English", serif; color: #f3e6cb; opacity: 0; transition: opacity 1.6s; text-shadow: 0 0 3px rgba(255, 110, 100, .7); }
.custode.firmato .firma { opacity: .92; }
.custode .vetro::after { content: ''; position: absolute; inset: 0; opacity: 0; mix-blend-mode: screen;
  background: radial-gradient(ellipse at 50% 62%, rgba(255, 78, 64, .95), rgba(190, 22, 32, .55) 60%, rgba(120, 0, 10, .2)); }
.custode.veglia .vetro::after { animation: veglia 2.6s ease-in-out 1; }
.custode.sfiora .vetro::after { animation: sfiora 1.8s ease-in-out 1; }
@keyframes veglia { 0% { opacity: 0; } 25% { opacity: 1; } 60% { opacity: .85; } 100% { opacity: 0; } }
@keyframes sfiora { 0%, 100% { opacity: 0; } 45% { opacity: .45; } }
.custode-riga { position: absolute; z-index: 1500; transform: translateX(-50%); margin: 0; white-space: nowrap; pointer-events: none;
  font: italic 13px/1.2 "IM Fell English", serif; letter-spacing: .02em; color: #efe3c9; opacity: 0; transition: opacity 1.6s; text-shadow: 0 1px 0 #000, 0 0 8px #000, 0 0 14px #000; }
.custode-riga.on { opacity: .94; }
.ronda { position: absolute; z-index: 1; width: 240px; height: 160px; margin: -80px 0 0 -120px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(closest-side, rgba(255, 150, 120, .9), rgba(235, 60, 50, .55) 30%, rgba(170, 20, 30, .22) 65%, transparent); mix-blend-mode: screen; filter: blur(3px); animation: respiro 3.2s ease-in-out infinite; }
@keyframes respiro { 50% { transform: scale(1.12); } }
.quieta #l-lamp { animation: none !important; opacity: 1 !important; filter: brightness(1.15) sepia(.25); }
.actor.bafo .sprite { transform-origin: 50% 100%; transition: transform .5s steps(3); }
.actor.bafo.inchino .sprite { transform: scaleY(.88) skewX(-5deg); }
.specchio #tip, .specchio #l-hl { visibility: hidden !important; }
/* le ombre di chi balla dietro le tende (sere aperte) */
.ombre { z-index: 1; pointer-events: none; image-rendering: pixelated; filter: blur(.7px); opacity: 0; transition: opacity 2s; }
.ombre.su { opacity: 1; }
.bafo-in .ombre { opacity: 0; }
/* Giacomino: lo shottino lasciato alla Madonnina, le cose che cadono dai ricci, le frasi all'etrusca */
.shottino { position: absolute; z-index: 5; width: 4px; height: 6px; pointer-events: none; background: linear-gradient(#e8f0f4 0 1px, #c4162a 1px); box-shadow: 0 0 4px rgba(255, 80, 60, .6); transition: opacity 2s; }
.shottino.via { opacity: 0; }
.dai-ricci { position: absolute; z-index: 1400; width: 3px; height: 3px; pointer-events: none; animation: cade 1.5s steps(8) forwards; }
@keyframes cade { 70% { transform: translate(6px, 120px); opacity: 1; } 100% { transform: translate(7px, 124px); opacity: 0; } }
.bubble.etrusco { direction: rtl; unicode-bidi: bidi-override; }
