:root {
  color-scheme: dark;
  --bg: #0d0e11;
  --panel: #1a1d23;
  --panel-strong: #222733;
  --line: #343a46;
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f5f7fb;
  --muted: #a9b1c3;
  --primary: #ffca3a;
  --primary-ink: #17130a;
  --danger: #ef476f;
  --ok: #06d6a0;
  --blue: #4cc9f0;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 14px 38px rgba(0, 0, 0, 0.4);
  --ring: 0 0 0 3px rgba(255, 202, 58, 0.35);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

::selection {
  background: rgba(255, 202, 58, 0.35);
  color: var(--text);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--panel-strong);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--line);
  background-clip: padding-box;
}

* {
  scrollbar-color: var(--panel-strong) transparent;
  scrollbar-width: thin;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 202, 58, 0.12), transparent 32rem),
    linear-gradient(135deg, #101114 0%, #16191f 45%, #111318 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffd75a, var(--primary));
  color: var(--primary-ink);
  font-weight: 800;
  padding: 0 1.1rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255, 202, 58, 0.22);
  transition: transform 0.15s var(--ease), filter 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(255, 202, 58, 0.3);
}

button:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

button.secondary {
  background: var(--panel-strong);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

button.secondary:hover {
  border-color: var(--primary);
  background: #2a3040;
}

button.danger-button {
  color: #ffd6df;
  border-color: rgba(239, 71, 111, 0.55);
}

button.danger-button:hover {
  border-color: var(--danger);
  background: rgba(239, 71, 111, 0.16);
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #11141a;
  color: var(--text);
  padding: 0 0.85rem;
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

input::placeholder {
  color: rgba(169, 177, 195, 0.6);
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: var(--ring);
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 12ch;
  font-size: clamp(3rem, 12vw, 6.7rem);
  line-height: 0.9;
  background: linear-gradient(120deg, #ffffff 20%, var(--primary) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.65rem;
}

h3 {
  font-size: 1rem;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1180px, calc(100% - 2rem));
  min-height: 100vh;
  margin: 0 auto;
  padding: 2rem 0;
  display: grid;
  gap: 1.4rem;
  align-content: start;
}

.brand-panel {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 360px);
  gap: 1.5rem;
  align-items: end;
  padding: 2rem 0 0.8rem;
}

.eyebrow {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.subtitle {
  max-width: 42rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.game-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.game-list span,
.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.85rem;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.lobby-browser {
  grid-column: 1 / -1;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.open-rooms-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
}

.open-room-card {
  min-height: 7.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #11141a;
  color: var(--text);
  padding: 0.9rem;
  display: grid;
  gap: 0.45rem;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.open-room-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.open-room-card strong {
  font-size: 1.55rem;
}

.open-room-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.empty-rooms {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 1rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(34, 39, 51, 0.6), rgba(26, 29, 35, 0.92));
  padding: 1.15rem;
  display: grid;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.panel.compact {
  gap: 0.75rem;
}

.room-code-input {
  text-transform: uppercase;
}

.room-layout {
  display: grid;
  gap: 0.8rem;
  align-content: start;
}

.players-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

.player-chip.me {
  border-color: rgba(255, 202, 58, 0.6);
  background: rgba(255, 202, 58, 0.1);
}

.player-chip .player-tag {
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--primary);
}

.player-chip .player-score {
  display: inline-grid;
  place-items: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 900;
  font-size: 0.8rem;
}

.room-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.room-header h2 {
  font-size: 1.8rem;
}

.room-actions {
  display: flex;
  gap: 0.5rem;
}

.game-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
}

.players-list,
.actions-list,
.chat-messages {
  display: grid;
  gap: 0.55rem;
}

.player-row,
.action-row,
.chat-row {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 0.7rem;
}

.player-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.player-meta,
.small-muted {
  color: var(--muted);
  font-size: 0.82rem;
}

.status-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--danger);
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.status-dot.online {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(6, 214, 160, 0.2), 0 0 12px rgba(6, 214, 160, 0.6);
}

.chat-panel {
  min-height: 18rem;
}

.chat-messages {
  max-height: 11rem;
  overflow: auto;
  align-content: start;
}

.chat-row.system {
  color: var(--primary);
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 0.5rem;
}

.actions-list {
  max-height: 9rem;
  overflow: auto;
}

.game-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.game-toolbar label {
  min-width: min(100%, 220px);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.game-choice {
  min-height: 19rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #171b22, #11141a);
  padding: 1.15rem;
  display: grid;
  gap: 0.85rem;
  align-content: start;
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.game-choice:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 202, 58, 0.6);
  box-shadow: var(--shadow-sm);
}

.game-choice h3 {
  font-size: 1.35rem;
}

.two-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.three-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.secret-card {
  min-height: 15rem;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px solid rgba(255, 202, 58, 0.35);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 202, 58, 0.14), transparent 60%),
    #11141a;
  padding: 1.2rem;
  box-shadow: inset 0 0 60px rgba(255, 202, 58, 0.05);
}

.secret-word {
  margin-top: 0.7rem;
  font-size: clamp(2rem, 8vw, 4.5rem);
  font-weight: 950;
  color: var(--primary);
}

.danger-word {
  color: var(--danger);
}

.vote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.vote-card {
  min-height: 6.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 0.8rem;
  gap: 0.3rem;
  cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.vote-card:hover {
  transform: translateY(-2px);
  border-color: var(--danger);
  background: rgba(239, 71, 111, 0.14);
}

.result-box {
  display: grid;
  gap: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11141a;
  padding: 1rem;
}

.dial-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1rem;
  align-items: start;
}

.toolbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dial-stage {
  display: grid;
  gap: 0.5rem;
  padding: 1rem 1rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 8%, rgba(76, 201, 240, 0.1), transparent 62%),
    linear-gradient(180deg, #14181f, #10131a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), var(--shadow-sm);
}

.dial-side {
  display: grid;
  gap: 0.7rem;
  align-content: start;
}

.dial-clue-banner {
  border: 1px solid rgba(255, 202, 58, 0.55);
  border-radius: 8px;
  background: rgba(255, 202, 58, 0.12);
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.65rem;
  display: grid;
  gap: 0.35rem;
}

.dial-clue-banner h3 {
  font-size: clamp(1.1rem, 3vw, 1.65rem);
  line-height: 1.15;
}

.dial-clue-banner.muted {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.dial-gauge {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.dial-gauge.interactive {
  cursor: pointer;
  touch-action: none;
}

.dial-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 9;
  stroke-linecap: round;
}

.dial-zone-band {
  fill: none;
  stroke-linecap: round;
}

.dial-zone-band.edge {
  stroke: rgba(255, 202, 58, 0.32);
  stroke-width: 11;
}

.dial-zone-band.mid {
  stroke: rgba(6, 214, 160, 0.45);
  stroke-width: 11;
}

.dial-zone-band.core {
  stroke: var(--ok);
  stroke-width: 11;
  filter: drop-shadow(0 0 6px rgba(6, 214, 160, 0.55));
}

.dial-zone-center {
  stroke: var(--ok);
  stroke-width: 2;
  stroke-dasharray: 3 4;
  opacity: 0.65;
}

.dial-scale-num {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: middle;
}

.dial-needle-line {
  stroke: var(--text);
  stroke-width: 4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.35));
  transition: x2 0.3s var(--ease), y2 0.3s var(--ease);
}

.dial-hub-outer {
  fill: #11141a;
  stroke: var(--primary);
  stroke-width: 3.5;
}

.dial-hub-inner {
  fill: var(--primary);
}

.dial-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.dial-labels span:last-child {
  text-align: right;
}

.dial-pin {
  display: inline-grid;
  place-items: center;
  min-width: 1.6rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 800;
  vertical-align: middle;
}

.dial-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.dial-chip {
  display: grid;
  gap: 0.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  padding: 0.6rem 0.7rem;
}

.dial-chip strong {
  font-size: 1.02rem;
}

.scoreboard {
  display: grid;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11141a;
  padding: 0.7rem;
  margin-bottom: 0.6rem;
}

.score-list {
  display: grid;
  gap: 0.3rem;
}

.score-row {
  min-height: 2.15rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.8rem;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 0.4rem 0.55rem;
}

.score-row.champion {
  border-color: rgba(255, 202, 58, 0.75);
  background: rgba(255, 202, 58, 0.12);
}

.word-progress {
  display: grid;
  gap: 0.45rem;
}

.word-progress-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.8rem;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 0.55rem 0.7rem;
}

.word-reveal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.7rem;
}

.word-reveal-card {
  display: grid;
  gap: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 0.75rem;
}

.word-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.word-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.55rem;
  background: rgba(255, 202, 58, 0.12);
  color: var(--text);
  font-size: 0.86rem;
}

input[type="range"] {
  accent-color: var(--primary);
  padding: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-ink);
  padding: 0.8rem 1rem;
  font-weight: 800;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.3s var(--ease);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 900px) {
  .brand-panel,
  .entry-grid,
  .games-grid,
  .dial-layout,
  .dial-status-grid,
  .two-fields,
  .three-fields,
  .room-layout {
    grid-template-columns: 1fr;
  }

  .dial-stage {
    max-width: 460px;
    margin: 0 auto;
    width: 100%;
  }

  .game-list {
    justify-content: flex-start;
  }

  .room-header {
    align-items: stretch;
    flex-direction: column;
  }
}
