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

:root {
  --bg:          #07080f;
  --surface:     rgba(22, 25, 43, 0.4);
  --surface-2:   rgba(30, 34, 53, 0.5);
  --surface-3:   rgba(37, 42, 64, 0.6);
  --border:      rgba(255, 255, 255, 0.08);
  --border-light:rgba(255, 255, 255, 0.15);

  --accent:      #ff2a5f;
  --accent-2:    #ff7e40;
  --accent-glow: rgba(255, 42, 95, 0.35);

  --text:        #f3f4f8;
  --text-muted:  #9ba3bf;
  --text-faint:  #636a88;

  --green:       #00f2fe;
  --green-2:     #4facfe;
  --green-dim:   rgba(0, 242, 254, 0.15);
  
  --red:         #ff0844;
  --red-dim:     rgba(255, 8, 68, 0.15);
  --yellow:      #f9d423;

  --radius-s: 8px; --radius-m: 14px; --radius-l: 20px; --radius-xl: 28px;
  --shadow-m: 0 8px 32px rgba(0,0,0,0.4);
  --transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
  --glass-blur: blur(16px);
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
h1, h2, h3 { font-family: 'Outfit', sans-serif; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; color: var(--text); }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ─── Background ambient ─────────────────────────────────── */
.bg-shapes {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); pointer-events: none;
}
.shape {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.45; animation: float 20s infinite alternate ease-in-out;
}
.shape-1 { width: 450px; height: 450px; background: var(--accent); top: -150px; left: -100px; animation-delay: 0s; }
.shape-2 { width: 550px; height: 550px; background: var(--green); bottom: -200px; right: -150px; animation-delay: -5s; }
.shape-3 { width: 350px; height: 350px; background: var(--accent-2); top: 30%; left: 50%; animation-delay: -10s; }
@keyframes float { 
  0% { transform: translate(0, 0) scale(1); } 
  100% { transform: translate(40px, -40px) scale(1.15); } 
}

/* ─── Screens ────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: flex; }

/* ─── START SCREEN ───────────────────────────────────────── */
#screen-start {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.start-page {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: var(--radius-m);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 20px var(--accent-glow);
  border: 1px solid rgba(255,255,255,0.2);
}
.logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.5px;
}
.logo-text span { 
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.start-card {
  width: 100%;
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-m);
}

.nickname-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.nickname-display {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition);
}
.nickname-display:hover { border-color: var(--border-light); }

.join-row {
  display: flex;
  gap: 8px;
}
.room-code-input {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
}

/* ─── INPUTS / BUTTONS ───────────────────────────────────── */
.input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  font-size: 15px;
  outline: none;
  transition: all var(--transition);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.input:focus { border-color: var(--accent); background: rgba(30, 34, 53, 0.8); box-shadow: 0 0 0 3px var(--accent-glow); }
.input::placeholder { color: var(--text-faint); }
textarea.input { resize: vertical; min-height: 110px; line-height: 1.7; }
select.input { cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 20px;
  border-radius: var(--radius-m);
  font-family: 'Outfit', sans-serif;
  font-size: 15px; font-weight: 700; letter-spacing: 0.02em;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 6px 20px var(--accent-glow); transform: translateY(-2px); }
.btn-primary:active { transform: scale(0.97); }
.btn-secondary {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.btn-secondary:hover { border-color: var(--border-light); background: var(--surface-3); transform: translateY(-1px); }
.btn-ghost { color: var(--text-muted); padding: 8px 12px; border-radius: var(--radius-m); font-family: 'Inter', sans-serif; font-weight: 600; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,8,68,.3); }
.btn-danger:hover { background: rgba(255,8,68,.22); }
.btn-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0,242,254,.3); }
.btn-success:hover { background: rgba(0,242,254,.22); }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-s); }
.btn-full { width: 100%; }
.btn-lg { padding: 13px 20px; font-size: 15px; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }

/* ─── ROOM LAYOUT ────────────────────────────────────────── */
.room-layout {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(22, 25, 43, 0.3);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-logo { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 18px; color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; margin-right: 4px; }

.room-code-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 6px 12px;
  cursor: pointer;
  user-select: none;
  transition: border-color var(--transition);
}
.room-code-badge:hover { border-color: var(--accent); }
.room-code-badge .code { font-size: 14px; font-weight: 800; letter-spacing: .12em; }
.room-code-badge .copy-hint { font-size: 11px; color: var(--text-faint); }

.topbar-state {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  padding: 4px 10px; border-radius: 20px;
  text-transform: uppercase;
}
.state-ready  { background: rgba(249,212,35,.12); color: var(--yellow); border: 1px solid rgba(249,212,35,.2); }
.state-lobby   { background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border); }
.state-playing { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0,242,254,.2); }
.state-review  { background: rgba(249,212,35,.1); color: var(--yellow); border: 1px solid rgba(249,212,35,.2); }
.state-extra   { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(255,42,95,.2); }
.state-done    { background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border); }

.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Mobile tabs */
.mobile-tabs {
  display: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.mobile-tab {
  flex: 1; text-align: center; padding: 10px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.mobile-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Unified Game Container */
.game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.view { flex: 1; display: flex; flex-direction: column; }

/* Lobby Layout */
.lobby-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
}
.lobby-teams-area {
  flex: 2;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lobby-settings-area {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.section-title-clean {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 4px;
}


.view { flex: 1; }

/* ─── TEAMS PANEL ────────────────────────────────────────── */
#teams-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.team-card {
  background: var(--surface-2);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}
.team-card:hover { border-color: var(--border-light); transform: translateY(-2px); }
.team-card.active-turn { 
  border-color: var(--accent); 
  background: rgba(255,42,95, 0.05);
  box-shadow: 0 0 20px var(--accent-glow);
}

.team-head {
  display: flex; align-items: center;
  padding: 9px 12px 6px;
  gap: 6px;
}
.team-name {
  flex: 1;
  font-size: 13px; font-weight: 700;
  color: var(--text);
  background: none; border: none; outline: none;
  cursor: default;
  padding: 2px 0;
}
.team-name.editable { cursor: text; }
.team-name.editable:hover { background: var(--surface-2); border-radius: 4px; padding: 2px 6px; margin-left: -6px; }
.team-name.editable:focus { background: var(--surface-2); border-radius: 4px; padding: 2px 6px; margin-left: -6px; }

.team-score {
  font-family: 'Outfit', sans-serif;
  font-size: 20px; font-weight: 800; color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  min-width: 26px; text-align: right;
}

.team-players { padding: 2px 12px 10px; display: flex; flex-direction: column; gap: 3px; }

.player-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px;
}
.player-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-glow);
  border: 1.5px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--accent);
  flex-shrink: 0;
}
.player-avatar.offline { border-color: var(--border); color: var(--text-faint); background: var(--surface-3); }
.player-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-you { font-size: 10px; color: var(--text-faint); }
.badge-mic { font-size: 12px; }

.team-footer {
  padding: 0 10px 8px;
}
.team-footer-row {
  display: flex; gap: 5px; flex-wrap: wrap;
}
.btn-join-team {
  font-size: 11px; padding: 5px 10px;
  border-radius: var(--radius-s);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  transition: all var(--transition); flex: 1;
}
.btn-join-team:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-glow); }

.btn-delete-team {
  font-size: 11px; padding: 5px 8px;
  border-radius: var(--radius-s);
  background: var(--red-dim); border: 1px solid rgba(240,92,92,.3);
  color: var(--red); cursor: pointer;
  transition: all var(--transition); white-space: nowrap;
}
.btn-delete-team:hover { background: rgba(240,92,92,.22); border-color: var(--red); }

.teams-actions {
  display: flex; flex-direction: column; gap: 6px;
}

/* ─── INFO PANEL ─────────────────────────────────────────── */
/* Left empty since info panel is merged */

/* ─── LOBBY VIEW ─────────────────────────────────────────── */
.lobby-center {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; min-height: 300px;
  gap: 20px; text-align: center;
}
.lobby-center h2 { font-size: 26px; font-weight: 800; font-family: 'Outfit', sans-serif; margin-bottom: 8px; }
.lobby-center p { color: var(--text-muted); font-size: 14px; max-width: 340px; }
.lobby-buttons { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.waiting-msg {
  display: flex; flex-direction: column;
  align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 14px;
}

/* ─── TOP SCOREBOARD (In-Game) ─────────────────────────────── */
.top-scoreboard {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  width: 100%; margin-bottom: 16px;
}
.ts-team {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 14px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-s); font-weight: 600;
  color: var(--text-muted); transition: all var(--transition);
}
.ts-team.active {
  background: rgba(0, 242, 254, 0.1); border-color: var(--accent); color: var(--text);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}
.ts-team-info {
  display: flex; flex-direction: column; align-items: flex-start;
}
.ts-name { font-size: 14px; max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.ts-players { font-size: 11px; font-weight: 400; max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.7; }
.ts-score { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 18px; color: var(--accent); }

/* ─── GAME VIEW ──────────────────────────────────────────── */
.game-center {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; min-height: 300px;
  gap: 24px; text-align: center; padding: 16px;
}

.turn-label {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.turn-team  { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.turn-who   { font-size: 15px; font-weight: 700; }

/* Timer ring */
.timer-ring { position: relative; width: 96px; height: 96px; }
.timer-ring svg { transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke: var(--border); stroke-width: 6; }
.timer-ring circle.prog {
  stroke: var(--accent);
  stroke-dasharray: 283; stroke-dashoffset: 0;
  transition: stroke-dashoffset .85s linear, stroke .25s;
}
.timer-ring circle.prog.danger { stroke: var(--red); }
.timer-val {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800;
}
.timer-val.danger { color: var(--red); }

/* Word display */
.big-word {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(32px, 8vw, 72px);
  font-weight: 900; letter-spacing: -.02em; line-height: 1.1;
  text-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.word-hidden { color: var(--text-muted); font-size: 20px; font-weight: 600; font-family: 'Outfit', sans-serif;}

.game-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn-next-word { font-size: 16px; padding: 14px 32px; border-radius: var(--radius-l); }
.btn-end-turn  { font-size: 14px; }

/* Shown words log */
.observer-words-label {
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 4px; margin-top: 10px;
  text-align: center; width: 100%;
}
.shown-log {
  width: 100%; max-width: 460px;
  display: flex; flex-direction: column; gap: 4px;
  height: 220px; overflow-y: auto;
  background: var(--surface-2);
  border-radius: var(--radius-m);
  padding: 10px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.shown-log-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: var(--radius-s);
  font-size: 13px; background: var(--surface);
}

/* ─── REVIEW VIEW ────────────────────────────────────────── */
.review-wrap {
  max-width: 580px; margin: 0 auto; width: 100%;
  padding: 24px 0;
}
.review-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.review-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

.review-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.review-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m);
}
.review-word { flex: 1; font-size: 15px; font-weight: 600; }
.review-btns { display: flex; gap: 4px; }
.rbtn {
  width: 36px; height: 34px;
  border: 1px solid var(--border); border-radius: var(--radius-s);
  background: var(--surface-2); color: var(--text-muted);
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all var(--transition);
}
.rbtn[data-s="correct"].on  { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.rbtn[data-s="skip"].on     { background: var(--surface-3); border-color: var(--border-light); color: var(--text); }
.rbtn[data-s="penalty"].on  { background: var(--red-dim); border-color: var(--red); color: var(--red); }
.rbtn:hover { border-color: var(--border-light); }

.review-score-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; margin-bottom: 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-m);
  font-size: 14px; font-weight: 600;
}
.review-score-num { font-size: 24px; font-weight: 800; color: var(--accent); }

/* ─── RESULTS VIEW ───────────────────────────────────────── */
.results-center {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; min-height: 300px;
  gap: 20px; text-align: center; padding: 24px;
}
.trophy { font-size: 60px; animation: pop .5s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes pop { from { transform: scale(0); opacity: 0; } }
.results-title { font-size: 26px; font-weight: 800; }
.results-sub { font-size: 15px; color: var(--text-muted); }

.score-table { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 8px; }
.score-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-m);
  font-size: 15px; font-weight: 600;
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
}
.score-row.winner { background: rgba(62,207,110,.07); border-color: var(--green); }
.score-pts { font-size: 20px; font-weight: 800; color: var(--accent); }

/* ─── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px; width: 100%; max-width: 500px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-m);
}
.modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 22px; font-weight: 800;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 20px;
}

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .settings-grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }

/* Lang toggle */
.lang-toggle { display: flex; gap: 6px; }
.lang-btn {
  flex: 1; padding: 9px;
  border: 1px solid var(--border); border-radius: var(--radius-m);
  background: var(--surface-2); color: var(--text-muted);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
}
.lang-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.lang-btn:hover:not(.active) { border-color: var(--border-light); color: var(--text); }

/* Topic grid */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  max-height: 280px; overflow-y: auto;
}
.topic-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-m); padding: 12px; cursor: pointer;
  transition: all var(--transition);
}
.topic-card:hover { border-color: var(--border-light); background: var(--surface-3); }
.topic-card.selected { border-color: var(--accent); background: var(--accent-glow); box-shadow: 0 0 0 1px var(--accent); }
.topic-icon { font-size: 20px; margin-bottom: 5px; }
.topic-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.topic-desc { font-size: 11px; color: var(--text-muted); margin-bottom: 5px; line-height: 1.4; }
.topic-meta { font-size: 11px; color: var(--text-faint); display: flex; gap: 5px; align-items: center; }
.topic-badge {
  font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 4px;
  background: var(--surface-3); color: var(--text-faint);
}
.topic-badge.custom { background: var(--accent-glow); color: var(--accent); }

/* Custom topic list */
.custom-topic-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.ct-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-m);
}
.ct-name { font-size: 13px; font-weight: 600; flex: 1; }
.ct-meta { font-size: 11px; color: var(--text-muted); }
.ct-actions { display: flex; gap: 5px; margin-left: auto; }

/* ─── MISC ───────────────────────────────────────────────── */
.sep { height: 1px; background: var(--border); }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.card-title { font-size: 11px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: .07em; }

.extra-banner {
  background: var(--accent-glow); border: 1px solid var(--accent);
  border-radius: var(--radius-m); padding: 8px 14px;
  font-size: 13px; font-weight: 700; color: var(--accent);
  text-align: center;
}

/* Spinner */
.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast-container { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 7px; z-index: 999; }
.toast {
  padding: 10px 16px; border-radius: var(--radius-m);
  font-size: 13px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border);
  box-shadow: var(--shadow-m);
  animation: slide-in .18s ease;
  max-width: 280px;
}
.toast.error   { border-color: var(--red); color: var(--red); background: var(--red-dim); }
.toast.success { border-color: var(--green); color: var(--green); background: var(--green-dim); }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } }

/* Reconnect overlay */
.reconnect-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; font-size: 14px; color: var(--text-muted);
  z-index: 200;
}
.reconnect-overlay.hidden { display: none; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .room-body { grid-template-columns: 1fr; }
  .col-teams, .col-info { display: none; }
  .col-teams.tab-active, .col-info.tab-active { display: flex; }
  .col-main.tab-hidden { display: none; }
  .mobile-tabs { display: flex; }
}
@media (max-width: 480px) {
  .game-actions { flex-direction: column; align-items: center; }
  .btn-next-word { width: 100%; max-width: 280px; }
}

/* ─── ROLE BADGES ────────────────────────────────────────── */
.role-badge {
  padding: 6px 16px;
  border-radius: 30px;
  font-size: 13px; font-weight: 700;
  letter-spacing: .02em;
}
.role-explainer {
  background: rgba(108,99,255,.15);
  border: 1px solid var(--accent);
  color: var(--accent);
}
.role-guesser {
  background: rgba(240,180,41,.1);
  border: 1px solid var(--yellow);
  color: var(--yellow);
}
.role-observer {
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
}

/* ─── GUESSER / OBSERVER GAME VIEWS ─────────────────────── */
.word-hidden {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 15px; font-weight: 600;
}
.word-hidden-icon { font-size: 42px; }
.shown-hint { font-size: 13px; color: var(--text-faint); }
.observer-words-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-faint);
  align-self: flex-start;
}

/* ─── SCOREBOARD IN INFO PANEL ───────────────────────────── */
.score-entry {
  margin-bottom: 12px;
}
.score-entry-active .score-entry-name { color: var(--accent); }
.score-entry-top {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 5px;
}
.score-entry-name {
  font-size: 12px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100px;
}
.score-entry-pts {
  font-size: 16px; font-weight: 800; color: var(--accent);
  white-space: nowrap; flex-shrink: 0;
}
.score-entry-goal { font-size: 11px; color: var(--text-faint); font-weight: 500; }
.score-bar-bg {
  height: 5px; border-radius: 3px; background: var(--surface-3);
  overflow: hidden;
}
.score-bar-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  transition: width .4s ease;
}

/* Active team score highlight */
.team-score.active-score { color: var(--green); }

/* ─── DRAG AND DROP ──────────────────────────────────────── */
.draggable-player {
  cursor: grab;
  transition: opacity .15s;
}
.draggable-player:active { cursor: grabbing; opacity: .7; }
.draggable-player:hover { background: var(--surface-2); border-radius: var(--radius-s); }

.team-card[data-drop-tid] { transition: border-color .15s, background .15s; }
.team-card[data-drop-tid].drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}

/* ─── OFFLINE BADGE ──────────────────────────────────────── */
.badge-offline {
  font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 4px;
  background: var(--red-dim); color: var(--red);
  text-transform: uppercase; letter-spacing: .05em;
}

/* ─── KICK BUTTON ────────────────────────────────────────── */
.btn-kick-player {
  width: 18px; height: 18px; flex-shrink: 0;
  border-radius: 3px; font-size: 10px;
  color: var(--text-faint); cursor: pointer;
  background: none; border: 1px solid transparent;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); margin-left: auto;
}
.btn-kick-player:hover {
  background: var(--red-dim); border-color: rgba(240,92,92,.3);
  color: var(--red);
}

/* ─── READY STATE ────────────────────────────────────────── */
.ready-center {
  gap: 20px;
}
.ready-team-label {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted);
}
.ready-instruction {
  max-width: 380px; text-align: center;
  font-size: 15px; line-height: 1.6;
  color: var(--text);
}
.ready-start-btn {
  padding: 16px 44px;
  font-size: 18px; font-weight: 800;
  border-radius: var(--radius-l);
  box-shadow: 0 0 28px var(--accent-glow);
  animation: pulse-ready 1.8s ease-in-out infinite;
}
@keyframes pulse-ready {
  0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
  50%       { box-shadow: 0 0 40px rgba(108,99,255,.4); }
}

/* ─── WORDS REMAINING / SKIP COUNTER ────────────────────────────── */
.words-remaining-label {
  font-size: 12px; color: var(--text-faint); letter-spacing: .03em;
}
.words-empty {
  font-size: 22px; font-weight: 700; color: var(--yellow);
  padding: 8px 20px; border-radius: var(--radius-m);
  background: rgba(240,180,41,.1); border: 1px solid rgba(240,180,41,.3);
}
.skips-counter { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* ─── ROUND HISTORY (results screen) ────────────────────────────── */
.round-history {
  width: 100%; max-width: 420px;
  border: 1px solid var(--border); border-radius: var(--radius-m);
  background: var(--surface); overflow: hidden; margin-top: 4px;
}
.round-history-title {
  padding: 10px 16px; font-size: 13px; font-weight: 700;
  cursor: pointer; list-style: none; user-select: none;
  color: var(--text-muted);
}
.round-history-title::-webkit-details-marker { display: none; }
.round-history-table { padding: 0 8px 8px; }
.rh-header, .rh-row {
  display: grid;
  grid-template-columns: 28px 1fr 40px 32px 44px;
  gap: 4px; padding: 5px 8px; align-items: center; font-size: 13px;
}
.rh-header {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  color: var(--text-faint); letter-spacing: .06em;
  border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.rh-row { border-radius: var(--radius-s); transition: background var(--transition); }
.rh-row:hover { background: var(--surface-2); }
.rh-idx { color: var(--text-faint); font-size: 11px; }
.rh-team { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
