/* ============================================================
   PARTY BOX  -  Foglio di stile condiviso
   ------------------------------------------------------------
   Sistema di design comune a tutti i giochi: token colore,
   tipografia, bottoni, card, schermate, loader, ecc.
   Ogni gioco carica questo file e ridefinisce solo il proprio
   accento e i componenti che gli sono specifici (vedi il blocco
   <style> nel suo index.html).
   ============================================================ */

:root {
  --bg: #0f0e17;
  --surface: #1a1928;
  --card: #22203a;
  --accent: #ff6b6b;        /* sovrascritto da ogni gioco */
  --accent-deep: #ff4444;   /* tono scuro dell'accento per i gradienti */
  --accent2: #ffd166;
  --accent3: #06d6a0;
  --accent4: #118ab2;
  --text: #fffffe;
  --muted: #a7a9be;
  --border: rgba(255,255,255,0.08);
  --radius: 16px;
}

/* Sfondo con bagliori che seguono l'accento del gioco */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse at 20% 20%, color-mix(in srgb, var(--accent) 8%, transparent) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, color-mix(in srgb, var(--accent2) 5%, transparent) 0%, transparent 50%);
}

/* Titolo gioco: gradiente di default accento -> giallo (i giochi possono ridefinirlo) */
.game-title {
  font-family: 'Boogaloo', cursive; font-size: clamp(3rem, 8vw, 5rem);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  line-height: 1; letter-spacing: 2px;
  filter: drop-shadow(0 0 30px color-mix(in srgb, var(--accent) 40%, transparent));
}

/* Bottone primario: usa accento + tono scuro (--accent-deep) */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  font-size: 1.1rem; padding: 14px 36px;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
  }

body::before {
    content: ''; position: fixed; inset: 0;
    background: radial-gradient(ellipse at 20% 20%, rgba(255,107,107,0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 80%, rgba(255,209,102,0.05) 0%, transparent 50%);
    pointer-events: none; z-index: 0;
  }

.back-link {
    position: fixed; top: 16px; left: 16px; z-index: 200;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px 8px 11px; border-radius: 999px;
    background: rgba(26,25,40,0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border); color: var(--muted);
    font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 0.85rem;
    text-decoration: none; transition: color .2s, border-color .2s, transform .2s, background .2s;
  }

.back-link:hover { color: var(--text); border-color: rgba(255,255,255,.20); background: rgba(26,25,40,.92); transform: translateX(-2px); }

@media (max-width: 480px) { .back-link{ top:12px; left:12px; padding:7px 12px 7px 9px; font-size:.8rem; } }

.screen { display: none; position: relative; z-index: 1; }

.screen.active { display: block; }

.game-header { text-align: center; padding: 56px 20px 16px; }

.game-subtitle { color: var(--muted); font-size: 1rem; margin-top: 6px; letter-spacing: 3px; text-transform: uppercase; font-weight: 600; }

.container { max-width: 760px; margin: 0 auto; padding: 20px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }

.section-title { font-family: 'Boogaloo', cursive; font-size: 1.4rem; color: var(--accent2); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

.btn {
    border: none; border-radius: 50px; padding: 12px 26px; font-family: 'Nunito', sans-serif;
    font-weight: 800; font-size: 1rem; cursor: pointer; transition: all .2s;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: white;
  }

.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }

.btn:active { transform: translateY(0); }

.btn-success { background: linear-gradient(135deg, var(--accent3), #04b885); }

.btn-warning { background: linear-gradient(135deg, var(--accent2), #ffc300); color: #1a1928; }

.btn-danger { background: linear-gradient(135deg, #ff4444, #cc0000); }

.btn-ghost { background: transparent; border: 2px solid var(--border); color: var(--muted); }

.btn-ghost:hover { border-color: var(--accent); color: var(--text); }

.btn-sm { padding: 8px 16px; font-size: 0.9rem; }

.btn-block { width: 100%; }

.cat-grid { display: flex; flex-wrap: wrap; gap: 10px; }

.cat-chip {
    background: var(--surface); border: 2px solid var(--border); border-radius: 50px;
    padding: 8px 16px; cursor: pointer; font-weight: 700; color: var(--muted); transition: all .15s; user-select: none;
  }

.cat-chip:hover { border-color: var(--accent); }

.cat-chip.selected { border-color: var(--accent2); background: rgba(255,209,102,0.12); color: var(--accent2); }

.team-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }

.remove-x { background: none; border: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; padding: 4px 8px; border-radius: 8px; transition: .2s; }

.remove-x:hover { color: var(--accent); background: rgba(255,107,107,0.1); }

.opt-grid { display: flex; gap: 10px; flex-wrap: wrap; }

.opt {
    background: var(--surface); border: 2px solid var(--border); border-radius: 12px;
    padding: 10px 18px; cursor: pointer; font-weight: 800; color: var(--muted); transition: all .15s; user-select: none;
  }

.opt:hover { border-color: var(--accent3); }

.opt.selected { border-color: var(--accent3); background: rgba(6,214,160,0.1); color: var(--accent3); }

.opt-custom { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 2px solid var(--border); border-radius: 12px; padding: 6px 12px; }

.divider { height: 1px; background: var(--border); margin: 18px 0; }

.scores-bar { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding: 4px 20px 0; }

.score-pill { background: var(--surface); border: 1px solid var(--border); border-radius: 50px; padding: 7px 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; }

.score-dot { width: 12px; height: 12px; border-radius: 50%; }

.podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 30px auto; max-width: 520px; }

.podium-col { text-align: center; flex: 1; }

.podium-name { font-weight: 900; margin-bottom: 8px; }

.podium-score { color: var(--muted); font-weight: 800; margin-bottom: 6px; }

.podium-block { border-radius: 12px 12px 0 0; display: flex; align-items: flex-start; justify-content: center; padding-top: 8px; font-size: 1.6rem; }

#loader { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 30px; text-align: center; }

#loader-msg { color: var(--muted); max-width: 460px; line-height: 1.6; }

.spinner { width: 38px; height: 38px; border: 4px solid var(--border); border-top-color: var(--accent); border-radius: 50%; margin: 18px auto 0; animation: spin 0.8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

#confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 100; }

.center { text-align: center; }

.mt { margin-top: 18px; }

.hint { color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

@media (max-width:480px) { .back-link{ top:12px; left:12px; padding:7px 12px 7px 9px; font-size:.8rem; } }

.player-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }

textarea { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text); padding: 12px; font-family: 'Nunito',sans-serif; font-size: 0.95rem; resize: vertical; min-height: 70px; }

textarea:focus { outline: none; border-color: var(--accent); }

.reveal-wrap { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 20px; text-align: center; }

.pass-name { font-family: 'Boogaloo', cursive; font-size: clamp(2.4rem, 9vw, 3.6rem); margin-bottom: 6px; }

.pass-sub { color: var(--muted); margin-bottom: 30px; max-width: 320px; }

.reveal-card { background: linear-gradient(160deg, var(--card), #1b1930); border: 1px solid var(--border); border-radius: 22px;
    width: 100%; max-width: 380px; min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 30px 22px; box-shadow: 0 16px 40px rgba(0,0,0,0.45); margin-bottom: 24px; }

.reveal-role { font-family: 'Boogaloo', cursive; font-size: 2.6rem; letter-spacing: 1px; }

.scores-list { display: flex; flex-direction: column; gap: 8px; }

.score-line { display: flex; justify-content: space-between; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-weight: 800; }

.toggle-grid { display: flex; flex-direction: column; gap: 10px; }

.toggle-item { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 2px solid var(--border); border-radius: 12px; padding: 12px 16px; cursor: pointer; font-weight: 800; transition: .15s; }

.toggle-item.on { border-color: var(--accent3); background: rgba(6,214,160,0.08); }
