:root {
  --visible: .70;
  --beige: #f3e8d4;
  --bg: var(--beige);
  --ink: #161616;
  --blue: #2fb9f5;
  --yellow: #ffd23f;
  --yellow-soft: #fff1b8;
  --red: #ff4a26;
  --green: #72f242;
  --red-soft: #ffd9cf;
  --green-soft: #d9ffc9;
  --purple-soft: #b779f0;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

body {
  font-family: 'Patrick Hand', system-ui, sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

img { display: block; -webkit-user-drag: none; user-select: none; }

.js #camera { opacity: 0; }

/* ---------- schermata di caricamento (js/main.js) ---------- */
#loader { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; overflow: hidden; background: #000; color: #e8eefc; transition: opacity .6s ease, visibility .6s; }
html:not(.js) #loader { display: none; }
.ready #loader { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-t { margin: 0; font: 22px/1 'Patrick Hand', system-ui, sans-serif; letter-spacing: .04em; opacity: .75; }
/* la linea gialla si allunga con l'avanzamento (js/main.js); sotto, i tre puntini lampeggiano uno dopo l'altro */
.loader-dots i { font-style: normal; animation: loader-dot 1.2s infinite; }
.loader-dots i:nth-child(2) { animation-delay: .2s; }
.loader-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes loader-dot { 0%, 100% { opacity: .15; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .loader-dots i { animation: none; } }
/* il percorso: sopra la linea, tutta a destra, la sagoma gialla della fermata; il cerchio giallo sta sulla punta della linea e avanza con lei */
.loader-route { position: relative; width: min(56vw, 240px); margin: 44px 0 6px; }
.loader-bar { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.loader-run { position: absolute; left: 0; right: 0; top: 0; height: 3px; transform: translateX(0); }
.loader-pin { position: absolute; left: -5px; top: -3.5px; width: 10px; height: 10px; border-radius: 50%; background: #ffcf5a; }   /* niente bagliore */
.loader-stop { position: absolute; right: 0; bottom: 100%; fill: #ffb347; }
/* informativa in fondo alla schermata di caricamento */
.loader-priv { position: absolute; left: 16px; right: 16px; bottom: max(18px, env(safe-area-inset-bottom)); margin: 0 auto; max-width: 520px; text-align: center; font: 15px/1.35 'Patrick Hand', system-ui, sans-serif; color: rgba(232, 238, 252, .55); }
.loader-priv a { color: #ffb347; }
.loader-slow { max-width: 420px; margin: 4px 16px 0; text-align: center; font: 18px/1.35 'Patrick Hand', 'Comic Sans MS', cursive; color: #e9e9e4; opacity: 0; transition: opacity .6s; }
.loader-slow.is-on { opacity: 1; }
.loader-slow a { color: #ffd23f; }
/* telefono in orizzontale: schermata che copre tutto (sopra anche al caricamento) e chiede di girarlo. Solo telefoni:
   col dito e schermo basso (in orizzontale un telefono e alto meno di 500 px; i tablet no) */
#rot-lock { display: none; position: fixed; inset: 0; z-index: 1000; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; background: #000; color: #ffcf5a; text-align: center; }
#rot-lock p { margin: 0; color: #e8eefc; font: 24px/1.3 'Patrick Hand', system-ui, sans-serif; }
#rot-lock .rot-lock-ph { transform-box: fill-box; transform-origin: center; animation: rot-lock 2.6s ease-in-out infinite; }
@media (orientation: landscape) and (hover: none) and (pointer: coarse) and (max-height: 520px) {
  #rot-lock { display: flex; }
  html, body { overflow: hidden; }
}
@keyframes rot-lock { 0% { rotate: 90deg; opacity: 0; } 10%, 22% { rotate: 90deg; opacity: 1; } 55%, 85% { rotate: 0deg; opacity: 1; } 100% { rotate: 0deg; opacity: 0; } }   /* sdraiato, si mette dritto girando come la freccia (antiorario), poi sparisce e ricomincia */
@media (prefers-reduced-motion: reduce) { #rot-lock .rot-lock-ph { animation: none; } }
.loader-bar i { display: block; height: 100%; background: #ffb347; transform: scaleX(0); transform-origin: left; }
.js.ready #camera { opacity: 1; transition: opacity .4s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}

/* --- protezione contenuti (vedi js/protect.js) --- */
img, video, canvas, model-viewer {
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none; /* niente "Salva immagine" con pressione lunga su iOS */
}
/* tentativo di cattura: tutto nero, sopra solo l'invito a scrivermi */
#shield { position: fixed; inset: 0; z-index: 2147483647; display: none; align-items: center; justify-content: center; padding: 16px; background: #000; }
html.is-shielded #shield { display: flex; }
.shield-box { max-width: 420px; padding: 22px 26px; text-align: center; color: var(--ink); background: #fffdf7; border: 4px solid var(--ink); border-radius: 18px; box-shadow: 6px 6px 0 #ffd23f; font-family: 'Patrick Hand', system-ui, sans-serif; }
.shield-t { margin: 0 0 10px; font-size: 26px; line-height: 1.15; }
.shield-mail { font-size: 21px; color: #0a53d6; word-break: break-all; user-select: text; -webkit-user-select: text; }
@media print {
  html, body { display: none !important; }
}

/* strato trasparente sopra i contenuti (niente "Salva immagine" diretto sulle foto); il watermark resta solo quello impresso nelle immagini */
.crt-stage::after, .crt-zoom::after, .sb3::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.sb3::after { z-index: 1; }
.sb3-ui { z-index: 2; }
