/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Brand palette (deep navy + electric cyan + kreavivity blue) ── */
  --primary:   #22d3ee;   /* cyan-400            */
  --primary-d: #0891b2;   /* cyan-600            */
  --accent:    #1854f4;   /* Kreavivity blue     */
  --accent-d:  #1244d4;   /* Kreavivity blue dark*/
  --green:     #34d399;   /* emerald-400         */
  --green-d:   #059669;   /* emerald-600         */
  --red:       #fb7185;   /* rose-400            */
  --red-d:     #e11d48;   /* rose-600            */
  --orange:    #fb923c;   /* orange-400          */
  --gold:      #fbbf24;   /* amber-400           */

  --bg:        #060a15;   /* deep navy-black     */
  --surface:   #0d1628;   /* dark navy card      */
  --surface2:  #172035;   /* mid navy            */
  --surface3:  #1f2d47;   /* lighter panel       */
  --border:    rgba(24, 84, 244, .22);

  --text:      #e2f0fb;   /* cool off-white      */
  --muted:     #6b8fa8;   /* muted slate-blue    */

  --radius:    14px;
  --radius-sm: 8px;
  --shadow:    0 4px 32px rgba(0,0,0,.65);
  --shadow-glow: 0 0 28px rgba(34, 211, 238, .2);
  --transition: .18s ease;
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ambient glow orbs + grid */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse 60% 50% at 15% 40%, rgba(24, 84, 244, .12) 0%, transparent 70%),
    radial-gradient(ellipse 45% 40% at 85% 20%, rgba(34, 211, 238, .08) 0%, transparent 60%),
    linear-gradient(rgba(24, 84, 244, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 84, 244, .04) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 44px 44px, 44px 44px;
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1rem 1rem 4rem;   /* bottom pad for brand badge */
  gap: 1rem;
}

/* ── Typography ───────────────────────────────────────────────── */
h1 {
  font-size: clamp(2.2rem, 9vw, 3.8rem);
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1;
}
h2 { font-size: clamp(1.2rem, 5vw, 1.8rem); font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; }
p  { color: var(--muted); line-height: 1.6; }

.logo-accent {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 18px rgba(34, 211, 238, .45));
}

/* ── Card / panel ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter var(--transition), transform var(--transition), box-shadow var(--transition);
  user-select: none;
  letter-spacing: .01em;
}
.btn:active { transform: scale(.95); }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none !important; }
.btn:not(:disabled):hover { filter: brightness(1.12); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: #fff;
  box-shadow: 0 0 20px rgba(24, 84, 244, .35);
}
.btn-primary:not(:disabled):hover {
  box-shadow: 0 0 30px rgba(34, 211, 238, .45);
}
.btn-green {
  background: var(--green);
  color: var(--bg);
  box-shadow: 0 0 16px rgba(52, 211, 153, .25);
}
.btn-red    { background: var(--red);    color: #fff; }
.btn-orange { background: var(--orange); color: var(--bg); }
.btn-ghost  {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-sm     { padding: .4rem .85rem; font-size: .82rem; border-radius: 6px; }
.btn-full   { width: 100%; }
.btn-half   { flex: 1; }
.mode-toggle { display: flex; gap: .5rem; }
.room-code-small { font-size: .8rem; color: var(--muted); margin-bottom: .5rem; overflow: hidden; }

/* ── Input ────────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: .75rem 1rem;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .15);
}
.input::placeholder { color: var(--muted); }

/* ── Form group ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .45rem; margin-bottom: 1rem; }
.form-group label {
  font-size: .78rem; color: var(--primary);
  font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
}

/* ── Divider ──────────────────────────────────────────────────── */
.divider {
  display: flex; align-items: center; gap: .75rem;
  color: var(--muted); font-size: .82rem; margin: .75rem 0;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--surface2);
}

/* ── Player list ──────────────────────────────────────────────── */
.player-list { display: flex; flex-direction: column; gap: .45rem; }
.player-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2);
  border: 1px solid transparent;
  padding: .6rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: border-color var(--transition);
}
.player-item .score {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.player-item .badge {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: #fff;
  font-size: .68rem; font-weight: 800;
  padding: .18rem .5rem; border-radius: 99px;
  text-transform: uppercase; letter-spacing: .05em;
}
.player-item.me          { border-color: var(--accent); box-shadow: 0 0 10px rgba(24,84,244,.2); }
.player-item.describing  { border-color: var(--orange); }

/* ── Room code & QR ───────────────────────────────────────────── */
.room-code {
  font-size: clamp(2.2rem, 11vw, 3.2rem);
  font-weight: 900;
  letter-spacing: .2em;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  filter: drop-shadow(0 0 12px rgba(34, 211, 238, .35));
}
.qr-box {
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
}
.qr-box img {
  border-radius: 10px;
  max-width: 220px; width: 100%;
  padding: 8px;
  background: #fff;   /* QR needs white bg */
  box-shadow: 0 0 0 2px var(--accent), 0 0 28px rgba(24, 84, 244, .35);
}
.join-url { font-size: .72rem; color: var(--muted); word-break: break-all; text-align: center; }

/* ── Timer ring ───────────────────────────────────────────────── */
.timer-ring {
  width: 80px; height: 80px; border-radius: 50%;
  background: conic-gradient(var(--primary) var(--pct, 100%), var(--surface2) 0);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 800;
  position: relative; flex-shrink: 0;
  transition: background .5s;
}
.timer-ring.warn { background: conic-gradient(var(--orange) var(--pct, 100%), var(--surface2) 0); }
.timer-ring.crit { background: conic-gradient(var(--red)    var(--pct, 100%), var(--surface2) 0); }
.timer-ring::after {
  content: ''; position: absolute;
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--surface);
}
.timer-ring span { position: relative; z-index: 1; }

/* ── Taboo card ───────────────────────────────────────────────── */
.taboo-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  text-align: center;
}
.taboo-word {
  font-size: clamp(2.2rem, 10vw, 3.8rem);
  font-weight: 900;
  color: var(--text);
  line-height: 1.05;
  margin-bottom: 1.2rem;
  letter-spacing: -.02em;
}
.taboo-label {
  font-size: .68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--red); margin-bottom: .6rem;
}
.taboo-list { display: flex; flex-direction: column; gap: .38rem; }
.taboo-item {
  background: rgba(251, 113, 133, .10);
  border: 1.5px solid rgba(251, 113, 133, .45);
  border-radius: var(--radius-sm);
  padding: .42rem .9rem;
  font-weight: 700; font-size: .97rem;
  color: #fda4af;
}

/* ── Guess area ───────────────────────────────────────────────── */
.guess-input-row { display: flex; gap: .5rem; }
.guess-feed {
  display: flex; flex-direction: column; gap: .38rem;
  max-height: 200px; overflow-y: auto;
}
.guess-entry {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .48rem .75rem; gap: .5rem;
}
.guess-entry .who { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.guess-entry .text { font-weight: 600; flex: 1; }

/* ── Status bar ───────────────────────────────────────────────── */
.status-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .72rem 1rem; gap: .5rem; flex-wrap: wrap;
}
.status-bar .label { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.status-bar .value { font-weight: 700; margin-top: .1rem; }

/* ── Event feed ───────────────────────────────────────────────── */
.event-feed {
  display: flex; flex-direction: column; gap: .3rem;
  max-height: 80px; overflow: hidden;
}
.event-item {
  font-size: .83rem; padding: .3rem .6rem;
  border-radius: 6px; animation: slideIn .3s ease;
}
.event-item.correct { background: rgba(52, 211, 153, .12); color: #6ee7b7; }
.event-item.skipped { background: rgba(251, 113, 133, .08); color: var(--muted); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-7px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Podium (game over) ───────────────────────────────────────── */
.podium { display: flex; flex-direction: column; gap: .7rem; }
.podium-entry {
  display: flex; align-items: center; gap: 1rem;
  background: var(--surface2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: .72rem 1rem;
  transition: border-color var(--transition);
}
.podium-entry.rank-1 { border-color: var(--gold);    box-shadow: 0 0 16px rgba(251,191,36,.15); }
.podium-entry.rank-2 { border-color: #c0c0c0; }
.podium-entry.rank-3 { border-color: #cd7f32; }
.rank-num  { font-size: 1.5rem; width: 2rem; text-align: center; }
.rank-name { flex: 1; font-weight: 700; font-size: 1.05rem; }
.rank-score{
  font-size: 1.35rem; font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Brand badge (fixed, always visible) ─────────────────────── */
.brand-badge {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 500;
  opacity: .35;
  transition: opacity var(--transition);
  pointer-events: none;
}
.brand-badge img {
  height: 22px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);   /* force white */
}

/* ── Utilities ────────────────────────────────────────────────── */
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm  { gap: .5rem; }
.gap-md  { gap: 1rem; }
.gap-lg  { gap: 1.5rem; }
.mt-sm   { margin-top: .5rem; }
.mt-md   { margin-top: 1rem; }
.mt-lg   { margin-top: 1.5rem; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.text-sm     { font-size: .83rem; }
.text-lg     { font-size: 1.2rem; }
.w-full      { width: 100%; }
.hidden      { display: none !important; }
.row         { display: flex; flex-direction: row; gap: .5rem; }

/* ── Toast ────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .7rem 1.4rem;
  border-radius: 99px;
  box-shadow: var(--shadow);
  font-weight: 600; font-size: .93rem;
  pointer-events: none; opacity: 0; transition: opacity .3s;
  z-index: 999; white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 99px; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (min-width: 600px) {
  #app { padding: 2rem 2rem 5rem; }
}
