* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, sans-serif;
  background: #fff;
  color: #000;
}
main { max-width: 520px; margin: 0 auto; padding: 32px 16px 64px; }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 32px; }

label, .label { display: block; margin: 0 0 20px; font-size: 0.9rem; }
input[type=text], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px;
  font: inherit; font-size: 1rem; color: #000;
  border: 1px solid #000; border-radius: 0; background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
input[type=file] { display: block; margin-top: 4px; font: inherit; }
.label { margin-bottom: 4px; }

canvas#paint {
  display: block; width: 100%; aspect-ratio: 3 / 2;
  border: 1px solid #000; background: #fff;
  touch-action: none; cursor: crosshair;
}
.tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 24px; }
.tools input[type=color] { width: 32px; height: 32px; padding: 0; border: 1px solid #000; background: none; }
.tools input[type=range] { width: 90px; }

button {
  font: inherit; font-size: 0.9rem; padding: 6px 10px;
  border: 1px solid #000; border-radius: 0; background: #fff; color: #000; cursor: pointer;
}
button.active, button[type=submit] { background: #000; color: #fff; }
button[type=submit] { width: 100%; padding: 12px; font-size: 1rem; }
button:disabled { opacity: 0.4; }
#msg { font-size: 0.9rem; }
#msg.err { color: #c00; }

/* admin */
.admin main { max-width: 760px; }
.stats { font-size: 0.9rem; margin: -24px 0 32px; }
.card { border-top: 1px solid #000; padding: 16px 0 24px; }
.card header { display: flex; justify-content: space-between; gap: 8px; }
.card h3 { margin: 0; font-size: 1rem; }
.card time { font-size: 0.8rem; color: #666; }
.card dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 12px 0; font-size: 0.9rem; }
.card dt { color: #666; }
.card dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.imgs a { flex: 1 1 240px; }
.imgs img { display: block; width: 100%; border: 1px solid #000; }
.voto { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; }
.voto button { min-width: 34px; padding: 6px; }
.voto .del { margin-left: auto; }

/* popup */
.popup {
  position: fixed; z-index: 20;
  width: 260px; max-width: calc(100vw - 32px);
  background: #fff; border: 1px solid #000; padding: 12px;
  font-size: 0.9rem; animation: entra 0.2s ease-out;
  box-shadow: 4px 4px 0 #000;
}
.popup.trema { animation: entra 0.2s ease-out, trema 0.4s 0.2s infinite; }
.popup img, .popup .nofoto {
  display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; margin-bottom: 8px;
}
.popup .nofoto { display: flex; align-items: center; justify-content: center; background: #eee; color: #666; }
.popup p { margin: 0 0 8px; padding-right: 20px; }
.popup .chiudi {
  position: absolute; top: 2px; right: 2px; border: none; background: none; font-size: 0.8rem; padding: 2px 4px; color: #999;
}
.btn {
  display: block; text-align: center; padding: 8px; background: #000; color: #fff; text-decoration: none; margin-top: 6px;
}
.btn.secondario { background: #fff; color: #000; border: 1px solid #000; }
@keyframes entra { from { transform: scale(0.6); opacity: 0; } }
@keyframes trema { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px) rotate(-1deg); } 75% { transform: translateX(3px) rotate(1deg); } }

.cookie {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  background: #000; color: #fff; padding: 16px; font-size: 0.9rem;
}
.cookie p { margin: 0 0 10px; }
.cookie-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cookie button { background: #fff; color: #000; }
.cookie button.piccolo { background: none; color: #777; border: none; font-size: 0.65rem; text-decoration: underline; }

.inter {
  position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, 0.85);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.inter-box { background: #fff; border: 1px solid #000; padding: 24px; max-width: 360px; width: 100%; text-align: center; }
.inter-box p { margin: 0 0 16px; font-size: 1.1rem; }
.inter-box button { display: block; width: 100%; margin-top: 6px; }
.inter-box button.piccolo { border: none; font-size: 0.65rem; color: #999; text-decoration: underline; }
.inter-box input { display: block; width: 100%; padding: 8px; font: inherit; border: 1px solid #000; }

.notifica {
  position: fixed; top: 40px; left: 50%; transform: translateX(-50%); z-index: 80;
  background: #fff; color: #000; border: 1px solid #000; padding: 10px 14px; font-size: 0.9rem;
  text-decoration: none; box-shadow: 4px 4px 0 #000; animation: scende 0.3s ease-out;
  max-width: calc(100vw - 32px);
}
@keyframes scende { from { transform: translate(-50%, -60px); } }

.barra {
  display: block; overflow: hidden; white-space: nowrap; background: #ff0; color: #000;
  border-bottom: 1px solid #000; padding: 6px 0; font-size: 0.85rem; font-weight: bold; text-decoration: none;
}
.barra span { display: inline-block; padding-left: 100%; animation: scorri 18s linear infinite; }
@keyframes scorri { to { transform: translateX(-100%); } }

/* popup ai lati */
.tasto-lati {
  position: fixed; top: 8px; left: 8px; z-index: 100;
  background: #fff; box-shadow: 3px 3px 0 #000; font-size: 0.8rem;
}
.popup.lato { transform: scale(0.45); animation: none; transition: top 0.2s, left 0.2s, right 0.2s; }
.popup.lato-sx { transform-origin: top left; }
.popup.lato-dx { transform-origin: top right; }

/* demenza */
.titolo-pazzo {
  font-family: 'Comic Sans MS', 'Comic Sans', 'Chalkboard SE', cursive;
  font-size: 2.4rem; text-align: center; margin-bottom: 4px; cursor: pointer; user-select: none;
  background: linear-gradient(90deg, #f00, #f80, #fd0, #0b0, #08f, #a0f, #f00);
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: arcobaleno 4s linear infinite, dondola 2s ease-in-out infinite;
}
@keyframes arcobaleno { to { background-position: 200% center; } }
@keyframes dondola { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) scale(1.05); } }
.slogan { text-align: center; font-style: italic; margin: 0 0 32px; font-size: 0.9rem; }

.piu-cm {
  position: fixed; z-index: 200; pointer-events: none; transform: translate(-50%, -50%);
  font-weight: bold; font-size: 1rem; color: #0a0; text-shadow: 1px 1px 0 #000;
  animation: sale 1s ease-out forwards;
}
@keyframes sale { to { transform: translate(-50%, -250%); opacity: 0; } }

.dvd {
  position: fixed; top: 0; left: 0; z-index: 15; width: 90px; height: 110px; object-fit: cover;
  pointer-events: none; border: 2px solid #000; border-radius: 50%;
}
.angolo {
  position: fixed; top: 50%; left: 50%; z-index: 150; pointer-events: none;
  transform: translate(-50%, -50%); font: bold 2rem 'Comic Sans MS', cursive; color: #f0f;
  text-shadow: 2px 2px 0 #000; animation: esplodi 2.5s ease-out forwards; white-space: nowrap;
}
@keyframes esplodi { from { transform: translate(-50%, -50%) scale(0.2); } 20% { transform: translate(-50%, -50%) scale(1.3); } to { opacity: 0; } }

.goccia {
  position: fixed; top: -60px; z-index: 12; pointer-events: none;
  animation-name: cade; animation-timing-function: linear; animation-fill-mode: forwards;
}
@keyframes cade { to { transform: translateY(calc(100vh + 120px)) rotate(540deg); } }

.footer-90 {
  max-width: 520px; margin: 0 auto; padding: 24px 16px 160px; text-align: center;
  font-family: 'Times New Roman', serif; font-size: 0.9rem; border-top: 3px double #000;
}
.footer-90 p { margin: 6px 0; }
.footer-90 .cantiere { font-weight: bold; background: repeating-linear-gradient(45deg, #fd0 0 12px, #000 12px 24px); color: #fff; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; padding: 6px; }
.footer-90 .contatore { font-family: monospace; background: #000; color: #0f0; padding: 2px 6px; letter-spacing: 2px; }
.footer-90 .caricamento { height: 14px; border: 1px solid #000; margin: 12px 0 4px; }
.footer-90 .caricamento div { height: 100%; width: 0; background: #08f; transition: width 0.3s; }
.footer-90 .piccolo { font-size: 0.7rem; color: #555; }
.footer-90 a { color: #00e; }

/* combo */
.combo {
  position: fixed; top: 44px; right: 12px; z-index: 210; pointer-events: none;
  font: bold 1.6rem 'Comic Sans MS', 'Comic Sans', cursive; color: #f0f;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #ff0;
}
.combo.bump { animation: bump 0.15s ease-out; }
@keyframes bump { from { transform: scale(1.5) rotate(-6deg); } }
.combo-annuncio {
  position: fixed; top: 40%; left: 50%; z-index: 220; pointer-events: none; text-align: center; width: 90vw;
  transform: translate(-50%, -50%); font: bold 2.2rem 'Comic Sans MS', 'Comic Sans', cursive;
  color: #ff0; text-shadow: 3px 3px 0 #000, -2px -2px 0 #f0f; animation: esplodi 2.5s ease-out forwards;
}
html.capovolto main, html.capovolto .footer-90, html.capovolto .barra { transform: rotate(180deg); }
main, .footer-90, .barra { transition: transform 1s ease-in-out; }
.gemma {
  position: fixed; top: -60px; z-index: 13; pointer-events: none;
  animation: cade linear forwards;
}

/* combo 67 */
.combo-67 {
  position: fixed; inset: 0; z-index: 230; pointer-events: none;
  display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.6);
  animation: svanisci 2.2s ease-in forwards;
}
.combo-67 img { width: min(80vw, 80vh); height: auto; animation: boom 0.35s ease-out; }
@keyframes boom { from { transform: scale(2.2) rotate(-8deg); } }
@keyframes svanisci { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
