/* =========================================================
   Beerba v2 — Ruota della fortuna
   Pensata per stare su una TV al bancone: misure in vh,
   nessun elemento che dipenda dal passaggio del mouse.
   ========================================================= */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #07070a;
  --brick: #140e14;
  --neon: #ff2e93;
  --neon-core: #ffe4f2;
  --neon-deep: #c5006d;
  --cream: #efe7ea;
  --smoke: #8a8188;
  --line: rgba(255, 46, 147, 0.2);
  --ease: cubic-bezier(0.22, 0.75, 0.24, 1);
}

html, body {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--brick);
  background-image:
    radial-gradient(ellipse 62% 55% at 34% 45%, rgba(255, 46, 147, 0.2) 0%, transparent 66%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='38' viewBox='0 0 88 38'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.02' stroke-width='1'%3E%3Cpath d='M0 .5h88M0 19.5h88M0 37.5h88'/%3E%3Cpath d='M22 .5v19M66 .5v19M44 19.5v18M0 19.5v18M88 19.5v18'/%3E%3C/g%3E%3C/svg%3E");
  cursor: pointer;
}

.em { color: var(--neon); font-style: italic; }
kbd {
  display: inline-block;
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  color: var(--neon-core);
  border: 0.2vh solid var(--neon);
  border-radius: 0.5vh;
  padding: 0.3vh 1.1vh;
  margin: 0 0.3vh;
  background: rgba(255, 46, 147, 0.1);
  box-shadow: 0 0 1.6vh rgba(255, 46, 147, 0.3);
}

.stage {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 2.2vh 3vw;
}

/* ---------- Barra superiore ---------- */
.bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2vw;
}
.brand { display: flex; align-items: center; gap: 1.4vh; text-decoration: none; color: inherit; }
.brand-b {
  width: 5.4vh; height: 5.4vh;
  min-width: 34px; min-height: 34px;
  border: 0.26vh solid var(--neon);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: 2.7vh;
  color: var(--neon-core);
  text-shadow: 0 0 1.2vh var(--neon);
  box-shadow: 0 0 2.2vh rgba(255, 46, 147, 0.35), inset 0 0 1.2vh rgba(255, 46, 147, 0.18);
}
.brand-name { display: block; font-weight: 800; font-size: 2.4vh; letter-spacing: 0.14em; line-height: 1.1; }
.brand-sub {
  display: block;
  font-size: 1.3vh;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--neon);
}

.bar-right { display: flex; align-items: center; gap: 1.4vh; }
.session {
  font-size: 1.5vh;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--smoke);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.8vh 1.6vh;
  display: flex;
  align-items: center;
  gap: 0.9vh;
}
.dot {
  width: 0.9vh; height: 0.9vh;
  min-width: 6px; min-height: 6px;
  border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 1.2vh var(--neon);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.icon-btn {
  width: 4.4vh; height: 4.4vh;
  min-width: 34px; min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--neon);
  background: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
}
.icon-btn svg { width: 55%; height: 55%; }
.icon-btn:hover { background: var(--neon); color: var(--ink); }
:focus-visible { outline: 2px solid var(--neon); outline-offset: 3px; }
.icon-btn:focus-visible, .board-foot button:focus-visible {
  background: var(--neon);
  color: var(--ink);
  outline-offset: 4px;
}

/* ---------- Area di gioco ---------- */
.play {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 3vw;
}

.wheel-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.6vh;
}

.title {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 400;
  font-size: 5.4vh;
  line-height: 1;
  text-align: center;
  margin-bottom: 2.6vh;
}

.wheel-wrap {
  position: relative;
  width: min(56vh, 92%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.wheel-halo {
  position: absolute;
  inset: -12%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 46, 147, 0.28) 0%, transparent 62%);
  filter: blur(2vh);
  pointer-events: none;
}
.wheel { width: 100%; height: 100%; filter: drop-shadow(0 0 2.5vh rgba(255, 46, 147, 0.4)); }

.spinner {
  transform-origin: 250px 250px;
  transition: transform 7s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.pointer {
  position: absolute;
  top: -1.4vh;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 1.5vh solid transparent;
  border-right: 1.5vh solid transparent;
  border-top: 2.8vh solid var(--neon);
  filter: drop-shadow(0 0 1.4vh var(--neon));
  z-index: 3;
}



.hub {
  position: absolute;
  width: 11vh; height: 11vh;
  border-radius: 50%;
  background: var(--ink);
  border: 0.4vh solid var(--neon);
  display: grid;
  place-items: center;
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: 5vh;
  color: var(--neon-core);
  text-shadow: 0 0 1.6vh var(--neon), 0 0 4vh var(--neon-deep);
  box-shadow: 0 0 3.5vh rgba(255, 46, 147, 0.55), inset 0 0 2vh rgba(255, 46, 147, 0.2);
  z-index: 2;
}

.cue { font-size: 2.2vh; font-weight: 600; text-align: center; }
.cue-sub {
  font-size: 1.5vh;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--smoke);
  text-align: center;
}
/* La regola della casa: piccola, sempre visibile, mai in mezzo al gioco */
.cue-rule {
  font-size: 1.35vh;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--smoke);
  text-align: center;
  margin-top: 0.9vh;
  padding-top: 0.9vh;
  border-top: 1px solid rgba(255, 46, 147, 0.16);
  display: inline-block;
  padding-inline: 2vh;
}

.stage.spinning .cue, .stage.spinning .cue-sub, .stage.spinning .cue-rule { opacity: 0.35; }

/* ---------- Tabellone ---------- */
.board {
  width: clamp(15rem, 26vw, 23rem);
  flex-shrink: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 1vh;
  background: rgba(7, 7, 10, 0.55);
  padding: 2vh 1.6vh 1.4vh;
}
.board-head { border-bottom: 1px solid var(--line); padding-bottom: 1.2vh; flex-shrink: 0; }
.board-eyebrow {
  font-size: 1.3vh;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--neon);
  font-weight: 700;
}
.board-title {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 400;
  font-size: 2.8vh;
  line-height: 1.15;
  margin-top: 0.4vh;
}

.board-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.8vh;
  padding: 1.4vh 0.4vh 0 0;
  scrollbar-width: thin;
  scrollbar-color: var(--neon-deep) transparent;
}
.board-list::-webkit-scrollbar { width: 4px; }
.board-list::-webkit-scrollbar-thumb { background: rgba(255, 46, 147, 0.35); border-radius: 2px; }

.row {
  display: flex;
  align-items: center;
  gap: 1.2vh;
  padding: 1vh 1.2vh;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.6vh;
  background: rgba(0, 0, 0, 0.35);
  animation: rowIn 0.45s var(--ease);
}
.row.latest {
  border-color: var(--neon);
  background: rgba(255, 46, 147, 0.1);
  box-shadow: 0 0 2vh rgba(255, 46, 147, 0.25);
}
@keyframes rowIn { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }

.row-n {
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: max(2vh, 15px);
  color: var(--neon);
  width: max(2.6vh, 20px);
  text-align: center;
  flex-shrink: 0;
}
.row-body { min-width: 0; flex: 1; }
.row-prize {
  display: block;
  font-weight: 800;
  font-size: 1.55vh;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-time { display: block; font-size: 1.25vh; color: var(--smoke); letter-spacing: 0.14em; margin-top: 0.2vh; }

.board-empty {
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  color: var(--smoke);
  font-size: 1.9vh;
  text-align: center;
  padding: 3vh 1vh;
  line-height: 1.5;
}

.board-foot {
  margin-top: 1.2vh;
  padding-top: 1.2vh;
  border-top: 1px solid rgba(255, 46, 147, 0.14);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.25vh;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--smoke);
  flex-shrink: 0;
}
.board-foot button {
  font: inherit;
  color: var(--neon);
  background: none;
  border: 1px solid var(--line);
  border-radius: 0.4vh;
  padding: 0.7vh 1.2vh;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.25s, color 0.25s;
}
.board-foot button:hover { background: var(--neon); color: var(--ink); }

/* ---------- Esito ---------- */
.result {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(7, 7, 10, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  transition: opacity 0.45s var(--ease);
}
.result[hidden] { display: none; }
.result.show { opacity: 1; }

.result-card {
  text-align: center;
  padding: 4vh 6vw;
  transform: scale(0.82);
  transition: transform 0.55s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.result.show .result-card { transform: none; }

.result-eyebrow {
  font-size: 1.8vh;
  letter-spacing: 0.44em;
  text-transform: uppercase;
  color: var(--neon);
  font-weight: 700;
  margin-bottom: 1.6vh;
}
.result-title {
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: 11vh;
  line-height: 1;
  color: var(--neon-core);
  text-shadow: 0 0 1vh #fff, 0 0 4vh var(--neon), 0 0 10vh var(--neon-deep);
  margin-bottom: 2vh;
}
.result-prize {
  font-weight: 900;
  font-size: 4.2vh;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 1.4vh;
}
.result-desc {
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: 2.3vh;
  color: rgba(239, 231, 234, 0.8);
  max-width: 46rem;
  margin: 0 auto 3.5vh;
  line-height: 1.45;
}
.result-cue { font-size: 1.7vh; letter-spacing: 0.26em; text-transform: uppercase; color: var(--smoke); }

/* Un malus non festeggia */
.result.malus .result-title { color: var(--cream); text-shadow: 0 0 3vh rgba(255, 255, 255, 0.2); }
.result.malus .result-eyebrow { color: var(--smoke); }

/* ---------- Coriandoli ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 49; overflow: hidden; }
.confetti span {
  position: absolute;
  top: -3vh;
  width: 0.8vh;
  height: 1.6vh;
  border-radius: 1px;
  animation: fall linear forwards;
}
@keyframes fall {
  from { transform: translateY(0) rotate(0deg); opacity: 1; }
  to   { transform: translateY(106vh) rotate(560deg); opacity: 0; }
}

/* ---------- Schermi stretti ---------- */
@media (max-width: 900px), (max-aspect-ratio: 1/1) {
  .play { flex-direction: column; gap: 2vh; overflow-y: auto; }
  .board { width: 100%; align-self: auto; max-height: 34vh; }
  .title { font-size: 4.4vh; }
  .wheel-wrap { width: min(44vh, 88vw); }
  .session { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { transition-duration: 1.2s; }
  .confetti { display: none; }
  .dot { animation: none; }
}

/* =========================================================
   La Ruota d'Oro — si sblocca col super premio, dura un giro
   ========================================================= */
:root {
  --gold: #ffc43d;
  --gold-soft: #ffdf8a;
  --gold-deep: #b87400;
}

.gold-em {
  font-style: italic;
  color: var(--gold-soft);
  text-shadow: 0 0 1.4vh var(--gold), 0 0 4vh rgba(255, 196, 61, 0.55);
}

/* Il muro cambia luce: da rosa a oro.
   La classe la mette il JS sul body: :has() non esiste sui browser delle TV. */
body.gold {
  background-image:
    radial-gradient(ellipse 62% 55% at 34% 45%, rgba(255, 196, 61, 0.22) 0%, transparent 66%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='38' viewBox='0 0 88 38'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.02' stroke-width='1'%3E%3Cpath d='M0 .5h88M0 19.5h88M0 37.5h88'/%3E%3Cpath d='M22 .5v19M66 .5v19M44 19.5v18M0 19.5v18M88 19.5v18'/%3E%3C/g%3E%3C/svg%3E");
}

.is-gold .wheel-halo { background: radial-gradient(circle, rgba(255, 196, 61, 0.34) 0%, transparent 62%); }
.is-gold .wheel { filter: drop-shadow(0 0 3vh rgba(255, 196, 61, 0.55)); }
.is-gold .pointer { border-top-color: var(--gold); filter: drop-shadow(0 0 1.6vh var(--gold)); }
.is-gold .hub {
  border-color: var(--gold);
  color: var(--gold-soft);
  text-shadow: 0 0 1.6vh var(--gold), 0 0 4vh var(--gold-deep);
  box-shadow: 0 0 4vh rgba(255, 196, 61, 0.6), inset 0 0 2vh rgba(255, 196, 61, 0.25);
}
.is-gold kbd { color: var(--gold-soft); border-color: var(--gold); background: rgba(255, 196, 61, 0.12); box-shadow: 0 0 1.6vh rgba(255, 196, 61, 0.3); }
.is-gold .session { border-color: rgba(255, 196, 61, 0.35); }
.is-gold .dot { background: var(--gold); box-shadow: 0 0 1.2vh var(--gold); }

/* La trasformazione: scatto, lampo, atterraggio */
@keyframes morphSpin {
  0%   { transform: rotate(0deg) scale(1); }
  55%  { transform: rotate(240deg) scale(0.82); }
  100% { transform: rotate(360deg) scale(1.04); }
}
.is-morphing .wheel { animation: morphSpin 0.62s cubic-bezier(0.6, -0.3, 0.3, 1.4); }

@keyframes goldFlash {
  0%   { opacity: 0; }
  35%  { opacity: 0.92; }
  100% { opacity: 0; }
}
.gold-flash {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background: radial-gradient(circle at 50% 45%, #fff6d8 0%, rgba(255, 196, 61, 0.7) 30%, transparent 70%);
  animation: goldFlash 0.85s ease-out forwards;
}

@keyframes landPulse {
  0%   { transform: scale(1.1); filter: brightness(1.7); }
  60%  { transform: scale(0.985); filter: brightness(1.1); }
  100% { transform: scale(1); filter: brightness(1); }
}
.is-landing .wheel-wrap { animation: landPulse 0.9s cubic-bezier(0.22, 0.75, 0.24, 1); }

@keyframes goldTitle {
  0%   { opacity: 0; transform: translateY(-0.8vh) scale(0.94); }
  100% { opacity: 1; transform: none; }
}
.is-gold .title { animation: goldTitle 0.7s var(--ease); }

/* Esito: il super premio e i premi d'oro parlano in oro */
.result.super .result-title,
.result.from-gold .result-title {
  color: var(--gold-soft);
  text-shadow: 0 0 1vh #fff8e2, 0 0 4vh var(--gold), 0 0 11vh var(--gold-deep);
}
.result.super .result-eyebrow,
.result.from-gold .result-eyebrow { color: var(--gold); }
.result.super .result-prize,
.result.from-gold .result-prize { color: var(--gold-soft); }

/* Nel tabellone le vincite d'oro restano riconoscibili */
.row.gold { border-color: rgba(255, 196, 61, 0.6); background: rgba(255, 196, 61, 0.09); }
.row.gold .row-n { color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  .is-morphing .wheel, .is-landing .wheel-wrap, .is-gold .title { animation: none; }
  .gold-flash { display: none; }
}

/* Le etichette contro-ruotano con la stessa curva della ruota: restano dritte
   per tutto il giro, non solo alla fine. */
.spinner .lbl {
  transition: transform 7s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}
@media (prefers-reduced-motion: reduce) {
  .spinner .lbl { transition-duration: 1.2s; }
}

/* =========================================================
   Cornice della ruota — profondità e lampadine
   ========================================================= */
.deco { pointer-events: none; }

/* Le lampadine si accendono a coppie alterne, come sulle ruote da fiera */
@keyframes bulbBlink {
  0%, 45%   { opacity: 1; }
  55%, 100% { opacity: 0.22; }
}
.bulb {
  filter: drop-shadow(0 0 3px rgba(255, 46, 147, 0.9));
  animation: bulbBlink 1.6s steps(1, end) infinite;
}
.bulb-1 { animation-delay: 0.8s; }
.is-gold .bulb { filter: drop-shadow(0 0 3px rgba(255, 196, 61, 0.95)); }

/* La ruota ora ha una sua ombra, non solo l'alone */
.wheel {
  filter:
    drop-shadow(0 1.2vh 2vh rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 2.5vh rgba(255, 46, 147, 0.4));
}
.is-gold .wheel {
  filter:
    drop-shadow(0 1.2vh 2vh rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 3vh rgba(255, 196, 61, 0.55));
}

/* Il mozzo prende un anello, così non sembra appoggiato */
.hub {
  box-shadow:
    0 0 3.5vh rgba(255, 46, 147, 0.55),
    inset 0 0 2vh rgba(255, 46, 147, 0.2),
    0 0 0 0.5vh rgba(10, 5, 10, 0.9),
    0 0 0 0.75vh rgba(255, 46, 147, 0.35);
}
.is-gold .hub {
  box-shadow:
    0 0 4vh rgba(255, 196, 61, 0.6),
    inset 0 0 2vh rgba(255, 196, 61, 0.25),
    0 0 0 0.5vh rgba(10, 5, 10, 0.9),
    0 0 0 0.75vh rgba(255, 196, 61, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .bulb { animation: none; opacity: 1; }
}
