:root {
  color-scheme: dark;
  --bg: #111827;
  --panel: #182234;
  --panel-2: #202d43;
  --line: #334155;
  --text: #f7fafc;
  --muted: #a9b7cc;
  --accent: #2dd4bf;
  --amber: #f59e0b;
  --danger: #f97373;
  --ok: #86efac;
  --blue: #60a5fa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, system-ui, -apple-system, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #05201d;
  font-weight: 800;
}

button.warn {
  background: #3a2b17;
  border-color: #8a641a;
  color: #fbd38d;
}

button.danger {
  background: #3a1d24;
  border-color: #8d3344;
  color: #fecdd3;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0d1421;
  color: var(--text);
  padding: 11px 12px;
}

.color-input {
  height: 48px;
  padding: 4px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.shell {
  width: min(1120px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar,
.grid,
.team-layout {
  display: grid;
  gap: 16px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 18px;
}

.brand {
  display: grid;
  gap: 4px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1;
}

.brand span,
.muted {
  color: var(--muted);
}

.grid {
  grid-template-columns: minmax(0, 380px) 1fr;
  align-items: start;
}

.panel,
.list-item,
.winner {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel {
  padding: 18px;
}

.panel h2,
.panel h3 {
  margin: 0 0 14px;
}

.form {
  display: grid;
  gap: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.join-box {
  display: grid;
  gap: 13px;
}

.qr {
  width: min(260px, 100%);
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  border-radius: 7px;
  background: #0d1421;
  border: 1px solid var(--line);
  color: var(--amber);
  font-size: 30px;
  font-weight: 900;
  padding: 9px 12px;
  letter-spacing: 0;
}

.link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.list {
  display: grid;
  gap: 8px;
}

.list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
}

.dot {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: var(--accent);
}

.rank {
  color: var(--amber);
  font-weight: 900;
}

.winner {
  padding: 18px;
  margin-bottom: 14px;
  border-color: rgba(245, 158, 11, 0.72);
  background: #241d11;
}

.winner strong {
  display: block;
  font-size: clamp(28px, 7vw, 64px);
  line-height: 1.05;
}

.team-layout {
  min-height: calc(100vh - 56px);
  align-content: center;
}

.buzzer {
  width: min(520px, 100%);
  aspect-ratio: 1;
  justify-self: center;
  border-radius: 50%;
  border: 10px solid #5f1a24;
  background: radial-gradient(circle at 34% 28%, #ffb3bd, #f97373 38%, #be123c 72%);
  color: white;
  font-size: clamp(38px, 11vw, 86px);
  font-weight: 1000;
  text-transform: uppercase;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.buzzer.ready {
  border-color: #0f766e;
  background: radial-gradient(circle at 34% 28%, #99f6e4, #2dd4bf 38%, #0f766e 72%);
  color: #05201d;
}

.status {
  text-align: center;
  color: var(--muted);
  font-size: 18px;
}

.error {
  border: 1px solid #8d3344;
  border-radius: 7px;
  background: #3a1d24;
  color: #fecdd3;
  padding: 10px 12px;
}

@media (max-width: 780px) {
  .topbar,
  .grid,
  .link-row {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 20px, 1120px);
    padding: 18px 0;
  }
}
