@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;700&family=Inter:wght@400;600;800&display=swap');

:root{
  --ink:#0b1020;
  --paper:#ffffff;
  --shadow:rgba(0,0,0,.25);
  --accent:#22c55e;
  --accent2:#06b6d4;
  --hot:#f59e0b;
  --pink:#fb7185;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:'Inter',system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  color:var(--ink);
  background: linear-gradient(135deg, #7c3aed 0%, #2563eb 40%, #06b6d4 100%);
  display:flex;
  justify-content:center;
  padding:16px;
}

#bg-bubbles{
  position:fixed;
  inset:0;
  pointer-events:none;
  background:
    radial-gradient(circle at 10% 20%, rgba(255,255,255,.20) 0 18%, transparent 19%),
    radial-gradient(circle at 80% 30%, rgba(255,255,255,.15) 0 14%, transparent 15%),
    radial-gradient(circle at 30% 85%, rgba(255,255,255,.12) 0 16%, transparent 17%),
    radial-gradient(circle at 70% 80%, rgba(255,255,255,.10) 0 22%, transparent 23%);
  mix-blend-mode: overlay;
}

#app{ width:100%; max-width:980px; position:relative; }

.topbar{ text-align:center; color:#fff; padding:8px 6px 14px; }
.logo{
  font-family:'Fredoka',system-ui,sans-serif;
  font-size:2.1rem;
  letter-spacing:.5px;
  text-shadow:0 6px 18px rgba(0,0,0,.25);
}
.subtitle{ opacity:.9; font-size:.95rem; }

.screen{ display:none; }
.screen.active{ display:block; }

.card{
  background:var(--paper);
  border-radius:28px;
  padding:18px;
  box-shadow:0 18px 40px var(--shadow);
  border:2px solid rgba(255,255,255,.55);
}
.card-pop{ animation: pop .18s ease-out; }
@keyframes pop { from{ transform:scale(.98); opacity:.7;} to{ transform:scale(1); opacity:1;} }

h2{ margin:6px 0 14px; font-family:'Fredoka',system-ui,sans-serif; font-size:1.8rem; text-align:center; }
.section-title{ font-family:'Fredoka',system-ui,sans-serif; margin:16px 0 10px; font-size:1.3rem; }

.field span{ display:block; font-weight:700; margin-bottom:6px; }
.field input[type=text], input[type=file]{
  width:100%;
  padding:12px 12px;
  border-radius:16px;
  border:2px solid rgba(15,23,42,.15);
  background:#fff;
  font-size:1rem;
}
.field input[type=text]:focus{ outline:none; border-color:rgba(34,197,94,.7); box-shadow:0 0 0 4px rgba(34,197,94,.15); }

.avatar-row{ display:flex; gap:12px; align-items:flex-end; }
.avatar-preview{
  width:84px; height:84px; border-radius:999px;
  background: linear-gradient(135deg, #fff7ed, #ffffff);
  border:3px solid rgba(124,58,237,.25);
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
  font-size:2rem;
}
.avatar-preview img{ width:100%; height:100%; object-fit:cover; }

.actions{ margin-top:14px; }

.btn{
  border:none;
  border-radius:999px;
  padding:14px 18px;
  font-weight:800;
  font-size:1.05rem;
  cursor:pointer;
  width:100%;
  box-shadow:0 10px 18px rgba(0,0,0,.12);
  transform: translateY(0);
  transition: transform .06s ease, box-shadow .12s ease, filter .12s ease;
}
.btn:hover{ transform: translateY(-1px); filter: brightness(1.02); }
.btn:active{ transform: translateY(1px); box-shadow:0 6px 10px rgba(0,0,0,.12); }
.btn-primary{ background: linear-gradient(135deg, var(--accent), #16a34a); color:#fff; }
.btn-secondary{ background: linear-gradient(135deg, #111827, #334155); color:#fff; }
.btn-chip{
  width:auto;
  padding:10px 12px;
  font-size:.95rem;
  border-radius:14px;
  background: rgba(17,24,39,.06);
  box-shadow:none;
}
.active-chip{
  background: rgba(34,197,94,.18);
  border:2px solid rgba(34,197,94,.25);
}

.divider{ display:flex; align-items:center; gap:10px; margin:14px 0; }
.divider:before,.divider:after{ content:""; height:2px; flex:1; background:rgba(15,23,42,.12); border-radius:99px; }
.divider span{ font-weight:900; color:rgba(15,23,42,.55); }

.hint{ margin-top:10px; font-size:.95rem; color:rgba(15,23,42,.70); text-align:center; }

.code-wrap{ text-align:center; margin-top:8px; }
.code-label{ font-weight:900; letter-spacing:.12em; color:rgba(15,23,42,.55); font-size:.85rem; }
.room-code-display{
  margin:10px auto 8px;
  display:inline-block;
  padding:10px 16px;
  border-radius:999px;
  background: linear-gradient(135deg, #fff7ed, #ffffff);
  border:3px dashed rgba(245,158,11,.65);
  font-family:'Fredoka',system-ui,sans-serif;
  font-size:2.2rem;
  letter-spacing:.25em;
}

.qr-wrap{ display:flex; flex-direction:column; align-items:center; gap:8px; margin:10px 0 6px; }
.qr-box{
  width:170px; height:170px;
  background:#fff;
  border-radius:18px;
  border:3px solid rgba(6,182,212,.25);
  display:flex; align-items:center; justify-content:center;
}
.qr-url{ font-size:.8rem; opacity:.75; text-align:center; word-break:break-all; }

.player-grid{
  list-style:none;
  padding:0;
  margin:8px 0 0;
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  justify-content:center;
}
.player-grid li{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:18px;
  background: linear-gradient(135deg, #fff7ed, #ffffff);
  border:2px solid rgba(124,58,237,.12);
  min-width:180px;
  justify-content:space-between;
}
.player-left{ display:flex; align-items:center; gap:10px; }
.player-grid img{
  width:34px; height:34px; border-radius:999px; object-fit:cover;
  border:2px solid rgba(34,197,94,.25);
}
.ready-pill{
  font-family:'Fredoka',system-ui,sans-serif;
  font-weight:900;
  padding:6px 10px;
  border-radius:999px;
  font-size:.95rem;
  transition: transform .18s ease;
}
.ready-yes{ background: rgba(34,197,94,.18); border:2px solid rgba(34,197,94,.25); }
.ready-no{ background: rgba(245,158,11,.14); border:2px solid rgba(245,158,11,.25); }

.ready-pill.pop {
  animation: popReady .25s ease-out;
}
@keyframes popReady {
  0% { transform: scale(0.85); }
  80% { transform: scale(1.10); }
  100% { transform: scale(1); }
}

.host-pill{
  margin:12px auto 10px;
  width:max-content;
  max-width:100%;
  padding:10px 14px;
  border-radius:999px;
  background: rgba(255,255,255,.55);
  border:2px solid rgba(255,255,255,.75);
  color:rgba(15,23,42,.75);
  font-weight:800;
  text-align:center;
}

.ready-panel{ margin-top:14px; }
.ready-hint{ text-align:center; margin-top:8px; opacity:.75; font-weight:700; }
.ready-results-note{ text-align:center; margin:12px 0 4px; font-weight:800; opacity:.7; }

.ready-counter{
  text-align:center;
  font-weight:900;
  margin:10px 0 0;
  opacity:.75;
}

.round-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
  flex-wrap:wrap;

  /* Keep the timer/header visible while scrolling during rounds */
  position: sticky;
  top: 0;
  z-index: 2000;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 10px 12px;
  border-radius: 18px;
  box-shadow: 0 10px 22px rgba(0,0,0,.10);
}
.badge{
  font-family:'Fredoka',system-ui,sans-serif;
  background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(255,247,237,.95));
  border:2px solid rgba(251,113,133,.25);
  padding:8px 12px;
  border-radius:999px;
  font-weight:800;
}
.timer{
  font-family:'Fredoka',system-ui,sans-serif;
  font-size:1.35rem;
  color:var(--hot);
  font-weight:900;
  text-shadow:0 10px 24px rgba(245,158,11,.20);
  animation: pulse 1s infinite;
}
@keyframes pulse{ 0%,100%{ transform:scale(1);} 50%{ transform:scale(1.05);} }

.prompt{
  background: linear-gradient(135deg, #ffffff, #fff7ed);
  border:3px solid rgba(6,182,212,.22);
  border-radius:24px;
  padding:16px 14px;
  font-family:'Fredoka',system-ui,sans-serif;
  font-size:1.7rem;
  line-height:1.2;
  text-align:center;
}
.prompt.small{ font-size:1.2rem; padding:12px 12px; }

.host-only{
  margin-top:14px;
  padding:14px;
  border-radius:22px;
  background: rgba(124,58,237,.08);
  border:2px dashed rgba(124,58,237,.25);
}
.submissions{ display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.sub-label{ font-weight:900; opacity:.7; }
.sub-count{
  font-family:'Fredoka',system-ui,sans-serif;
  font-size:1.4rem;
  padding:6px 12px;
  border-radius:999px;
  background: rgba(255,255,255,.8);
  border:2px solid rgba(34,197,94,.22);
}

#edit-canvas{
  width:100%;
  max-width:560px;
  height:auto;
  border-radius:22px;
  border:3px solid rgba(15,23,42,.10);
  background:#0b1020;
  margin-top:10px;
  touch-action:none;
  display:block;
  margin-left:auto;
  margin-right:auto;
}

.tool-row{ display:flex; gap:10px; justify-content:center; flex-wrap:wrap; margin-top:10px; }

.colors-row{
  display:flex;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
  margin:10px 0 0;
}
.color-swatch{
  width:34px;
  height:34px;
  border-radius:999px;
  border:3px solid rgba(15,23,42,.10);
  box-shadow:0 10px 18px rgba(0,0,0,.08);
  cursor:pointer;
}
.color-swatch.active{
  border-color: rgba(34,197,94,.75);
  box-shadow:0 0 0 5px rgba(34,197,94,.18), 0 10px 18px rgba(0,0,0,.10);
}

.slider-row{ display:flex; align-items:center; gap:10px; justify-content:center; margin-top:10px; }
.slider-label{ font-weight:900; opacity:.7; }
#brush-size{ width:min(420px, 70vw); }
.slider-val{
  font-family:'Fredoka',system-ui,sans-serif;
  font-weight:900;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(255,255,255,.75);
  border:2px solid rgba(6,182,212,.20);
}

.edit-controls{ display:flex; flex-wrap:wrap; gap:10px; margin:12px 0; justify-content:center; }

.voting-grid{ margin-top:12px; display:flex; flex-wrap:wrap; gap:14px; justify-content:center; }
.voting-card{
  width:200px;
  background: linear-gradient(135deg, #ffffff, #fff7ed);
  border-radius:22px;
  overflow:hidden;
  border:3px solid rgba(15,23,42,.08);
  box-shadow:0 14px 26px rgba(0,0,0,.10);
  cursor:pointer;
  transition: transform .08s ease, box-shadow .12s ease;
}
.voting-card:hover{ transform: translateY(-2px) rotate(-.2deg); box-shadow:0 18px 32px rgba(0,0,0,.14); }
.voting-card.selected{ border-color: rgba(34,197,94,.75); box-shadow:0 0 0 5px rgba(34,197,94,.15), 0 18px 32px rgba(0,0,0,.14); }
.voting-card img{ width:100%; display:block; aspect-ratio:4/3; object-fit:cover; }
.voter-name{ padding:10px 10px; font-weight:900; text-align:center; opacity:.75; }

.winner{ margin:10px 0 6px; font-family:'Fredoka',system-ui,sans-serif; font-size:1.45rem; text-align:center; }
.scoreboard{ list-style:none; padding:0; margin:6px 0 0; }
.scoreboard li{
  display:flex;
  justify-content:space-between;
  padding:10px 12px;
  border-radius:18px;
  background: rgba(255,255,255,.65);
  border:2px dashed rgba(15,23,42,.10);
  margin-bottom:8px;
  font-weight:800;
}

.gallery-grid{ margin-top:14px; display:flex; flex-wrap:wrap; gap:14px; justify-content:center; }
.gallery-card{
  width:260px;
  border-radius:24px;
  overflow:hidden;
  background: linear-gradient(135deg, #ffffff, #fff7ed);
  border:3px solid rgba(6,182,212,.18);
  box-shadow:0 14px 26px rgba(0,0,0,.10);
}
.gallery-prompt{
  padding:12px 12px 10px;
  font-family:'Fredoka',system-ui,sans-serif;
  font-size:1.05rem;
  line-height:1.15;
  color:rgba(11,16,32,.95);
  border-bottom:2px dashed rgba(15,23,42,.10);
}
.gallery-card img{ width:100%; display:block; aspect-ratio:4/3; object-fit:cover; }
.gallery-caption{ padding:10px 12px 12px; font-weight:900; color:rgba(15,23,42,.70); }

.toast{
  position:fixed;
  left:50%;
  bottom:16px;
  transform:translateX(-50%);
  background: rgba(239,68,68,.95);
  color:#fff;
  padding:10px 14px;
  border-radius:999px;
  font-weight:900;
  opacity:0;
  pointer-events:none;
  transition: opacity .15s ease, transform .15s ease;
  box-shadow:0 14px 26px rgba(0,0,0,.22);
}
.toast.show{ opacity:1; transform:translateX(-50%) translateY(-4px); }

@media (min-width: 860px){
  body{ padding:24px; }
  .card{ padding:22px 26px; }
  .logo{ font-size:2.4rem; }
  .prompt{ font-size:2.05rem; padding:18px 16px; }
  .timer{ font-size:1.5rem; }
  .voting-card{ width:240px; }
  .gallery-card{ width:300px; }
}

/* =========================
   v2 ADAPTED ADDITIONS
   Restores GOLD vibe for new v2 screens (Prepare/Hand/Bonus)
   ========================= */

.hand-grid{
  margin-top:14px;
  display:flex;
  flex-wrap:wrap;
  gap:14px;
  justify-content:center;
}

.card-thumb{
  width:220px;
  background: linear-gradient(135deg, #ffffff, #fff7ed);
  border-radius:22px;
  overflow:hidden;
  border:3px solid rgba(15,23,42,.08);
  box-shadow:0 14px 26px rgba(0,0,0,.10);
  cursor:pointer;
  transition: transform .08s ease, box-shadow .12s ease, filter .12s ease;
}
.card-thumb:hover{
  transform: translateY(-2px) rotate(-.2deg);
  box-shadow:0 18px 32px rgba(0,0,0,.14);
}
.card-thumb img{
  width:100%;
  display:block;
  aspect-ratio:4/3;
  object-fit:cover;
}
.card-thumb.selected{
  border-color: rgba(34,197,94,.75);
  box-shadow:0 0 0 5px rgba(34,197,94,.15), 0 18px 32px rgba(0,0,0,.14);
}
.card-thumb.used{
  opacity:.45;
  filter: grayscale(0.8);
  cursor:not-allowed;
}
.card-thumb.used:hover{
  transform:none;
  box-shadow:0 14px 26px rgba(0,0,0,.10);
}

/* Host rounds selector */
.host-only .rounds-row{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:12px;
  margin:12px 0 8px;
}
.rounds-label{
  font-weight:900;
  opacity:.75;
}
#roundSelect{
  padding:12px 14px;
  border-radius:14px;
  border:2px solid rgba(15,23,42,.15);
  background:#fff;
  font-weight:900;
}

/* Prepare progress pill */
#prepareProgress{
  font-family:'Fredoka',system-ui,sans-serif;
  font-weight:900;
  padding:8px 12px;
  border-radius:999px;
  background: rgba(255,255,255,.75);
  border:2px solid rgba(6,182,212,.20);
}


.check{display:flex;gap:10px;align-items:center;justify-content:center;margin-top:10px;font-weight:800;opacity:.9}
.check input{width:18px;height:18px}
