:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6a66;
  --line: #e2dfd7;
  --accent: #1f6f5c;
  --accent-text: #ffffff;
  --ok: #2f9e5b;
  --bad: #c0392b;
  --radius: 14px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151614;
    --card: #1f201d;
    --text: #ecebe6;
    --muted: #9c9b95;
    --line: #34352f;
    --accent: #4fb89a;
    --accent-text: #0d1f1a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + env(safe-area-inset-bottom));
}

h1 { font-size: 1.6rem; line-height: 1.2; margin: 8px 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 6px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.card.solved { border-color: var(--ok); }

button, input {
  font: inherit;
  border-radius: 10px;
  min-height: 44px;
}

input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}

button {
  border: 0;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
}

button:disabled { opacity: 0.6; cursor: default; }

label { display: block; font-weight: 600; margin-bottom: 6px; }

.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; }
.stack > * + * { margin-top: 12px; }

.teams { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

.team-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--line);
  text-align: left;
}

.team-btn[aria-pressed="true"] { border-color: var(--accent); }

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
  background: var(--team, var(--muted));
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.who { display: flex; align-items: center; gap: 8px; font-weight: 600; }

.tabs { display: flex; gap: 4px; margin: 12px 0; }
.tabs button { flex: 1; background: transparent; color: var(--muted); border: 1px solid var(--line); }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--line);
  color: var(--muted);
}

.badge.ok { background: var(--ok); color: #fff; }

.station-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.station img { width: 100%; border-radius: 10px; margin-bottom: 12px; }

.feedback { margin: 8px 0 0; font-weight: 600; }
.feedback.bad { color: var(--bad); }
.feedback.ok { color: var(--ok); }

details { margin-bottom: 12px; }
summary { cursor: pointer; color: var(--accent); }

a { color: var(--accent); }

.score { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.points { font-size: 1.4rem; font-weight: 700; }

.error { color: var(--bad); font-weight: 600; }
