/* Shared chrome for every game: the dark playroom palette, panels, buttons,
   the top bar and toasts. Each game links this first, then its own sheet. */

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

html, body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(ellipse at 50% 0%, #2b2138 0%, #17121f 60%, #0e0a14 100%);
  background-attachment: fixed;
  color: #f3ecdf;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body { -webkit-user-select: none; user-select: none; }

.hidden { display: none !important; }

/* ── panels ── */
.panel-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  background: rgba(12, 8, 18, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 20;
}

.panel {
  width: min(360px, 92vw);
  margin: auto;
  background: rgba(30, 22, 40, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 28px;
  text-align: center;
}

.panel h1 { font-size: 2.1rem; letter-spacing: 0.03em; }
.panel .sub { color: #b9a8cf; margin: 6px 0 22px; font-size: 0.95rem; line-height: 1.45; }

.panel button {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  color: #241a10;
  background: #ffd076;
  padding: 13px 18px;
}

.panel button.big { display: block; width: 100%; margin-bottom: 12px; font-size: 1.05rem; }

.panel button.alt {
  background: rgba(255, 255, 255, 0.12);
  color: #f3ecdf;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.panel button:active { transform: scale(0.98); }
.panel button:disabled { opacity: 0.45; cursor: default; }

.code { color: #ffd076; letter-spacing: 0.18em; }

/* ── inputs ── */
.join-row { display: flex; gap: 10px; }

.join-row input, .text-in {
  font: inherit;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  color: #f3ecdf;
  padding: 12px 10px;
  -webkit-user-select: text;
  user-select: text;
}

.join-row input {
  flex: 1;
  min-width: 0;
  font-size: 1.1rem;
  letter-spacing: 0.35em;
  text-align: center;
  text-transform: uppercase;
}

.text-in { display: block; width: 100%; margin-bottom: 12px; text-align: center; }
.join-row input:focus, .text-in:focus { outline: 2px solid #ffd076; }

.note { margin-top: 16px; font-size: 0.85rem; color: #9d8bb5; line-height: 1.5; }
.err { margin: -4px 0 12px; font-size: 0.88rem; color: #ff9d8a; }

.back-link {
  display: inline-block;
  margin-top: 18px;
  color: #9d8bb5;
  font-size: 0.85rem;
  text-decoration: none;
}
.back-link:hover { color: #cbbfe0; }

/* ── who am I ── */
/* These need `.panel` in the selector: `.panel button` above is more specific
   than a bare `.who-btn`, so without it every chip renders gold-as-selected. */
.who { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.who-label { color: #9d8bb5; font-size: 0.9rem; }
.panel .who-btn {
  flex: 1;
  font: inherit;
  font-weight: 600;
  padding: 10px 6px;
  border-radius: 10px;
  cursor: pointer;
  color: #cbbfe0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.panel .who-btn.on { background: #ffd076; color: #241a10; border-color: #ffd076; }

/* ── chips ── */
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 20px; }
.panel .chip {
  font: inherit;
  font-size: 0.9rem;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  color: #f3ecdf;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
}
.panel .chip:active { transform: scale(0.97); }
.panel .chip.on { background: #ffd076; color: #241a10; border-color: #ffd076; }

/* ── waiting dots ── */
.dots { display: flex; gap: 8px; justify-content: center; margin: 4px 0 26px; }
.dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: #ffd076;
  animation: blink 1.2s infinite ease-in-out;
}
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

/* ── top bar ── */
.topbar { display: flex; align-items: center; gap: 10px; }

.hud-btn {
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #f3ecdf;
  background: rgba(20, 14, 28, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 10px 15px;
  cursor: pointer;
  text-decoration: none;
}
.hud-btn:active { transform: scale(0.96); }
.hud-btn.gold { background: #ffd076; color: #241a10; border-color: #ffd076; }
.hud-btn:disabled { opacity: 0.45; cursor: default; }

.score { display: flex; gap: 8px; flex-wrap: wrap; font-size: 0.86rem; color: #cbbfe0; }
.score span {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 6px 12px;
}
.score b { color: #ffd076; }
.score .me { border-color: rgba(255, 208, 118, 0.5); }

#room-badge {
  margin-left: auto;
  color: #cbbfe0;
  background: rgba(20, 14, 28, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 10px 15px;
  font-size: 0.88rem;
}
#room-badge span { color: #ffd076; letter-spacing: 0.16em; font-weight: 600; }

/* ── toasts ── */
#toasts {
  position: fixed;
  top: max(70px, calc(env(safe-area-inset-top) + 56px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 30;
  pointer-events: none;
}

.toast {
  background: rgba(20, 14, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.92rem;
  white-space: nowrap;
  animation: toast-in 0.25s ease, toast-out 0.4s ease 3s forwards;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-out { to { opacity: 0; } }
