:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --border: #e3e3e0;
  --accent: #fc4c02;
  --error: #c62828;
  --best: #fff1e8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111112;
    --card: #1c1c1e;
    --text: #f2f2f7;
    --muted: #98989f;
    --border: #2c2c2e;
    --best: #33200f;
  }
}

* { box-sizing: border-box; }

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

#topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.brand { color: var(--accent); font-weight: 700; text-decoration: none; }

main { max-width: 720px; margin: 0 auto; padding: 20px 16px 48px; }

h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }

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

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

.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

button {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.danger { background: var(--error); }
button.link {
  background: none;
  color: var(--muted);
  padding: 4px 0;
  font-weight: 400;
}

input {
  display: block;
  width: 100%;
  margin: 8px 0;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.auth { max-width: 360px; margin: 48px auto; }
.auth button[type="submit"] { width: 100%; margin-top: 8px; }
.auth .link { display: block; margin: 12px auto 0; }

.activity { display: block; color: inherit; text-decoration: none; }
.activity:hover { border-color: var(--accent); }
.activity-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }

.stats { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.stat { display: flex; flex-direction: column; }
.stat-value { font-size: 1.1rem; font-weight: 600; }
.stat-label { font-size: 0.8rem; }
.stats.big .stat-value { font-size: 1.3rem; }

.chart { display: block; width: 100%; height: 130px; margin-top: 8px; touch-action: none; }
.chart-readout { font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.back { color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: 12px; }

#map { height: 340px; border-radius: 12px; border: 1px solid var(--border); margin: 12px 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
tr.best td { background: var(--best); font-weight: 600; }

.manage { display: flex; flex-direction: column; gap: 8px; }
.manage-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
select { font: inherit; padding: 8px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
