/* 2 the Stars! — base comune a tutte le pagine.
   Colori, font, cielo, pulsanti, riquadri, finestre, impostazioni.
   Nessuno stile in linea nell'HTML: la politica di sicurezza lo vieta. */

@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 400; font-display: swap; src: url('/font/outfit-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 500; font-display: swap; src: url('/font/outfit-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 600; font-display: swap; src: url('/font/outfit-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 500; font-display: swap; src: url('/font/unbounded-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 700; font-display: swap; src: url('/font/unbounded-latin-700-normal.woff2') format('woff2'); }

:root {
  color-scheme: dark;
  --fondo: #070C1F;
  --cielo: radial-gradient(ellipse 120% 80% at 75% 0%, #1B2A5C 0%, #0E1838 45%, #070C1F 100%);
  --cielo-alto: radial-gradient(ellipse 140% 70% at 80% 0%, #1B2A5C 0%, #0E1838 50%, #070C1F 100%);
  --testo: #E6EBFA;
  --forte: #F4F1E6;
  --medio: #D3DAF3;
  --chiaro: #C9D2F0;
  --tenue: #AEB9DF;
  --spento: #8F9BC4;
  --oro: #FFD36E;
  --oro-chiaro: #FFE7A8;
  --oro-pallido: #FFF3C4;
  --oro-hover: #FFE08F;
  --scuro-su-oro: #1A1430;
  --rosso: #FF8A9B;
  --rosso-testo: #FF9AA8;
  --rosso-x: #FF6B80;
  --cuore: #FF6F91;
  --verde: #6FDCA0;
  --verde-nota: #9FE3BD;
  --carta: rgba(8, 13, 34, .64);
  --bordo: rgba(150, 170, 240, .18);
  --bordo-forte: rgba(150, 170, 240, .3);
  --finestra: #111A3D;
  --titoli: 'Unbounded', system-ui, sans-serif;
  --testi: 'Outfit', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: var(--testi);
  font-size: 16px;
  line-height: 1.4;
}
a { color: var(--oro); }
a:hover { color: var(--oro-chiaro); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.nascosto-vista {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- pagina a tutto schermo, senza scorrimento ---------- */
.notte {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--cielo);
  display: flex;
  flex-direction: column;
}

/* ---------- cielo: stelle, nuvole, luna, stella cadente ---------- */
@keyframes brilla { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
@keyframes deriva { from { left: -45%; } to { left: 105%; } }
@keyframes cadente {
  0% { opacity: 0; transform: translate(0, 0) rotate(20deg); }
  1.5% { opacity: 1; }
  7% { opacity: 0; transform: translate(340px, 124px) rotate(20deg); }
  100% { opacity: 0; transform: translate(340px, 124px) rotate(20deg); }
}
.cielo { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.stellina-cielo {
  position: absolute; border-radius: 50%; background: #F2F5FF;
  animation: brilla 5s ease-in-out infinite;
}
.stellina-cielo.luce { box-shadow: 0 0 6px rgba(200, 215, 255, .8); }
.nuvola {
  position: absolute; width: 520px; height: 150px; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(150, 165, 215, .2) 0%, rgba(150, 165, 215, 0) 70%);
  filter: blur(10px);
  animation: deriva 180s linear infinite;
}
.luna {
  position: absolute; top: 64px; right: 9%; width: 72px; height: 72px; border-radius: 50%;
  background: #E7E2CE; opacity: .85;
  box-shadow: 0 0 46px 10px rgba(231, 226, 206, .22), inset -16px -7px 0 rgba(170, 165, 145, .35);
}
.cadente {
  position: absolute; top: 12%; left: 52%; width: 150px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), #FFFFFF);
  opacity: 0; animation: cadente 11s ease-in infinite;
}

/* Animazioni spente dall'interruttore delle impostazioni */
.movimento-ridotto .stellina-cielo,
.movimento-ridotto .nuvola { animation: none; }
.movimento-ridotto .cadente { display: none; }

/* ---------- testata ---------- */
.testata {
  position: relative; flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px;
}
.marchio { flex: none; width: 30px; height: 35px; }
.titolo-gioco {
  margin: 0; font-family: var(--titoli); font-weight: 700; font-size: 20px;
  color: var(--forte); white-space: nowrap;
}
.titolo-gioco .punto, .oro { color: var(--oro); }
.riempi { flex: 1 1 auto; min-width: 0; }

/* ---------- pulsanti ---------- */
.tasto-icona {
  width: 44px; height: 44px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; border: 1px solid rgba(150, 170, 240, .25);
  background: rgba(8, 13, 34, .55); color: var(--medio);
  cursor: pointer; text-decoration: none; padding: 0;
}
.tasto-icona:hover { color: #FFFFFF; border-color: rgba(255, 211, 110, .55); }
.tasto-icona:focus-visible, .tasto:focus-visible, .tasto-oro:focus-visible,
.tasto-quieto:focus-visible, .tasto-pericolo:focus-visible, .piega:focus-visible {
  outline: 2px solid var(--oro); outline-offset: 2px;
}
.tasto-icona svg { width: 22px; height: 22px; }

.tasto-oro {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 0 26px; border: 0; border-radius: 14px;
  background: var(--oro); color: var(--scuro-su-oro);
  font-family: var(--titoli); font-size: 15px; font-weight: 700; letter-spacing: .02em;
  text-decoration: none; cursor: pointer;
}
.tasto-oro:hover { background: var(--oro-hover); color: var(--scuro-su-oro); }
.tasto-oro:disabled, .tasto-oro[aria-disabled="true"] {
  background: rgba(150, 170, 240, .14); color: var(--spento); cursor: not-allowed;
}

.tasto {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px;
  border: 1px solid rgba(255, 211, 110, .55); background: rgba(255, 211, 110, .1);
  color: var(--oro-chiaro); font-size: 16px; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.tasto:hover { background: rgba(255, 211, 110, .2); color: var(--oro-chiaro); }
.tasto:disabled { opacity: .5; cursor: not-allowed; }

.tasto-quieto {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid rgba(150, 170, 240, .3); background: transparent;
  color: var(--chiaro); font-size: 15px; font-weight: 500;
  text-decoration: none; cursor: pointer;
}
.tasto-quieto:hover { color: var(--forte); background: rgba(150, 170, 240, .1); }
.tasto-quieto svg { width: 17px; height: 17px; flex: none; }

.tasto-pericolo {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 20px; border: 0; border-radius: 14px;
  background: var(--rosso); color: #2A0F18; font-size: 16px; font-weight: 700; cursor: pointer;
}
.tasto-pericolo:hover { background: #FFA3B0; }

/* ---------- riquadri ---------- */
.carta {
  border-radius: 20px; background: var(--carta); border: 1px solid var(--bordo);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.etichetta { margin: 0; font-size: 14px; font-weight: 500; color: var(--tenue); }
.numero {
  margin: 4px 0 0; font-family: var(--titoli); font-size: 30px; color: var(--forte);
  font-variant-numeric: tabular-nums;
}
.numero small { font-family: var(--testi); font-size: 16px; color: var(--tenue); }
.titoletto { margin: 0; font-family: var(--titoli); font-weight: 500; font-size: 18px; color: var(--forte); }
.elenco { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.45; color: var(--medio); }
.nota { margin: 0; font-size: 14px; line-height: 1.45; color: var(--tenue); }

/* Riquadro richiudibile: l'intestazione è un pulsante */
.piega {
  width: 100%; min-height: 44px; padding: 0; border: 0; background: transparent;
  color: var(--forte); font-family: var(--titoli); font-weight: 500; font-size: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  cursor: pointer; text-align: left; border-radius: 8px;
}
.piega:hover { color: var(--oro-chiaro); }
.piega svg { width: 20px; height: 20px; flex: none; transition: transform .2s; }
.piega[aria-expanded="true"] svg { transform: rotate(180deg); }
.piega-titolo { margin: 0; }

/* Istruzioni diverse per mouse e tocco */
.solo-tocco { display: none; }
@media (hover: none) and (pointer: coarse) {
  .solo-mouse { display: none; }
  .solo-tocco { display: revert; }
}

/* ---------- finestre (dialoghi) ---------- */
@keyframes appare-velo { from { opacity: 0; } to { opacity: 1; } }
.velo {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(4, 7, 20, .7);
  animation: appare-velo .15s ease-out;
}
.finestra {
  width: 100%; max-width: 460px; max-height: calc(100dvh - 48px); overflow: auto;
  padding: 26px; border-radius: 22px;
  background: var(--finestra); border: 1px solid rgba(255, 211, 110, .35);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  display: flex; flex-direction: column; gap: 16px;
}
.finestra.larga { max-width: 760px; }
.finestra.allarme { border-color: rgba(255, 138, 155, .45); }
.finestra-testa { display: flex; align-items: center; gap: 12px; }
.finestra-testa h2 { margin: 0; flex: 1 1 auto; font-family: var(--titoli); font-weight: 500; font-size: 20px; color: var(--forte); }
.finestra p { margin: 0; line-height: 1.5; color: var(--medio); }
.finestra-tasti { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
@media (max-width: 599px) {
  .velo { align-items: flex-end; padding: 0; }
  .finestra, .finestra.larga {
    max-width: none; border-radius: 26px 26px 0 0; border-width: 1px 0 0;
    padding: 22px 18px 28px; max-height: 92dvh;
  }
  .finestra-tasti { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finestra-tasti > :only-child { grid-column: 1 / -1; }
}

/* Schede (regole) */
.schede { display: flex; gap: 8px; flex-wrap: wrap; }
.scheda {
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: var(--tenue); font-size: 16px; font-weight: 600; cursor: pointer;
}
.scheda:hover { color: var(--forte); }
.scheda[aria-selected="true"] { background: rgba(255, 211, 110, .14); border-color: rgba(255, 211, 110, .5); color: var(--oro-chiaro); }
.scheda:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; }
.pannello-regole { min-height: 220px; }
.regole-riga { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.regole-riga > svg { flex: none; }
.regole-testo { flex: 1 1 300px; display: flex; flex-direction: column; gap: 10px; }
.regole-testo .elenco { font-size: 16px; }
.regole-due { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.regole-due h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: var(--oro-chiaro); }
.regole-due .nota { grid-column: 1 / -1; }
@media (max-width: 599px) {
  .regole-due { grid-template-columns: 1fr; gap: 14px; }
  .regole-riga > svg { width: 72px; height: 72px; }
  .pannello-regole { min-height: 0; }
  .schede { gap: 6px; }
  .scheda { padding: 0 12px; font-size: 15px; }
}
.linea-q { stroke: #FFD36E; stroke-width: 3px; stroke-linecap: round; }
.linea-r { stroke: #7FD1C7; stroke-width: 3px; stroke-linecap: round; }
.linea-s { stroke: #B9A2F2; stroke-width: 3px; stroke-linecap: round; }

/* ---------- impostazioni ---------- */
.voce-opzione { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--bordo); }
.voce-opzione:last-of-type { border-bottom: 0; }
.voce-riga { display: flex; align-items: center; gap: 12px; }
.voce-riga label, .voce-nome { flex: 1 1 auto; font-size: 16px; font-weight: 600; color: var(--forte); }
.voce-dettaglio { margin: 0; font-size: 14px; color: var(--tenue); }
.interruttore {
  position: relative; flex: none; width: 52px; height: 30px; border-radius: 15px;
  border: 1px solid var(--bordo-forte); background: rgba(150, 170, 240, .14); cursor: pointer; padding: 0;
}
.interruttore::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--tenue); transition: transform .15s, background .15s;
}
.interruttore[aria-checked="true"] { background: rgba(255, 211, 110, .3); border-color: rgba(255, 211, 110, .6); }
.interruttore[aria-checked="true"]::after { transform: translateX(22px); background: var(--oro); }
.interruttore:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; }
.cursore-volume {
  width: 100%; accent-color: var(--oro);
  background-image: linear-gradient(var(--tenue), var(--tenue));
  background-size: 2px 12px; background-position: 50% 50%; background-repeat: no-repeat;
}
.cursore-volume:disabled { opacity: .4; }

/* ---------- banda della connessione ---------- */
.banda {
  position: fixed; left: 0; right: 0; top: 0; z-index: 60;
  padding: 8px 16px; text-align: center; font-size: 15px; font-weight: 600;
  background: #8C2236; color: #FFE3E8; box-shadow: 0 4px 18px rgba(0, 0, 0, .4);
}

/* ---------- avviso breve ---------- */
@keyframes avviso-entra { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.avviso {
  position: fixed; left: 50%; top: 76px; z-index: 55; transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px;
  background: #1A2552; border: 1px solid rgba(255, 211, 110, .35); color: var(--forte);
  font-size: 15px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  animation: avviso-entra .2s ease-out;
}

@keyframes gira { to { transform: rotate(360deg); } }
.rotella-attesa { width: 20px; height: 20px; animation: gira .9s linear infinite; }
