:root {
  color-scheme: light dark;
  --bg-top: #e0e7ff;
  --bg-bottom: #d1fae5;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #cbd5e1;
  --accent: #10b981;
  --accent-strong: #059669;
  --on-accent: #ffffff;
  --danger: #dc2626;
  --shadow: 0 12px 32px rgb(6 78 59 / 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-top: #064e3b;
    --bg-bottom: #0f172a;
    --surface: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #475569;
    --accent: #34d399;
    --accent-strong: #6ee7b7;
    --on-accent: #052e26;
    --danger: #f87171;
    --shadow: 0 12px 32px rgb(0 0 0 / 0.45);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-top), var(--bg-bottom)) fixed;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

main {
  width: min(34rem, 92vw);
  margin: clamp(1.5rem, 6vh, 4rem) 0 4rem;
  padding: 1.75rem 2rem 2rem;
  background: var(--surface);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

h1 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 1.25rem;
}

/* ---------- buttons ---------- */

button {
  font: inherit;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

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

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* primary actions */
.primary,
#signin {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.primary:hover,
#signin:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--on-accent);
}

#logout {
  padding: 0.3rem 0.85rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- sign-in ---------- */

#login {
  text-align: center;
  padding: 2rem 0 1rem;
}

#login p {
  color: var(--muted);
  margin: 0 0 1.25rem;
}

/* ---------- game list ---------- */

#games {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

#games li {
  margin: 0;
}

#games label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: 0.6rem;
  cursor: pointer;
  transition: background 0.15s;
}

#games label:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

#games input[type="radio"] {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  cursor: pointer;
  accent-color: var(--accent);
}

.port {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

/* ---------- status + actions ---------- */

.status {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.status strong {
  color: var(--text);
}

.actions {
  display: flex;
  gap: 0.6rem;
}

.actions button {
  flex: 1;
}

.note {
  margin: 1rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: 0.6rem;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--muted);
  font-size: 0.9rem;
}
