:root {
  color-scheme: light;
  --bg: #0f172a;
  --panel: #111827;
  --panel-soft: #1f2937;
  --text: #f3f4f6;
  --muted: #93a3b8;
  --accent: #22c55e;
  --accent-soft: #14532d;
  --danger: #ef4444;
  --warn: #f59e0b;
  --blue: #3b82f6;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at 20% -10%, #1d4ed8 0%, transparent 35%),
    radial-gradient(circle at 85% 120%, #0f766e 0%, transparent 40%),
    var(--bg);
  color: var(--text);
}

.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 330px 1fr 320px;
  gap: 18px;
}

.panel {
  background: color-mix(in oklab, var(--panel) 88%, black);
  border: 1px solid color-mix(in oklab, var(--muted) 20%, transparent);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(4px);
}

.connection-panel h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.field-label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid #334155;
  background: var(--panel-soft);
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.95rem;
}

.row {
  display: flex;
  gap: 8px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 700;
  background: var(--accent);
  color: #031109;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

.status {
  margin-top: 12px;
  margin-bottom: 0;
  font-weight: 700;
}

.status.connected {
  color: var(--accent);
}

.status.connecting {
  color: var(--warn);
}

.status.disconnected {
  color: #cbd5e1;
}

.status.error {
  color: var(--danger);
}

.game-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.game-header p {
  margin: 0 0 4px;
}

.game-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.muted {
  color: var(--muted);
}

.timer-wrap {
  margin-top: 14px;
}

.timer-top {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.92rem;
}

.timer-track {
  margin-top: 8px;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #334155;
  overflow: hidden;
}

.timer-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #16a34a, #84cc16);
  transition: width 120ms linear;
}

.stage {
  margin-top: 16px;
}

.question-title {
  margin: 0 0 14px;
  font-size: clamp(1.2rem, 2.2vw, 2rem);
  line-height: 1.3;
}

.question-meta {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.answers {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.answer {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #0b1220;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
}

.answer.correct {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent-soft) 62%, #0b1220);
}

.answer.selected {
  border-color: var(--blue);
}

.scoreboard {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.score-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: #0b1220;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px 12px;
}

.score-name {
  font-weight: 700;
}

.score-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.empty {
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
}
