:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-2: #eef3f5;
  --text: #13232b;
  --muted: #5b6d75;
  --border: #d9e2e6;
  --accent: #0b7a8a;
  --accent-text: #ffffff;
  --sea: #d7ecf1;
  --sea-line: #b5d6df;
  --route: #0b7a8a;
  --sand: #e8a33d;
  --danger: #b3261e;
  --ok: #1e7a44;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 35, 43, 0.06), 0 4px 16px rgba(16, 35, 43, 0.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e1619;
    --surface: #152126;
    --surface-2: #1b2a30;
    --text: #e6eef1;
    --muted: #93a7af;
    --border: #26383f;
    --accent: #3cb8c8;
    --accent-text: #08262b;
    --sea: #12303a;
    --sea-line: #1d4350;
    --route: #5fd0de;
    --sand: #f0b45a;
    --danger: #ff8a80;
    --ok: #6fd39a;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0e1619;
  --surface: #152126;
  --surface-2: #1b2a30;
  --text: #e6eef1;
  --muted: #93a7af;
  --border: #26383f;
  --accent: #3cb8c8;
  --accent-text: #08262b;
  --sea: #12303a;
  --sea-line: #1d4350;
  --route: #5fd0de;
  --sand: #f0b45a;
  --danger: #ff8a80;
  --ok: #6fd39a;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); }
main { max-width: 980px; margin: 0 auto; padding: 20px 16px 48px; }

header.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
header.top h1 { font-size: 1.6rem; margin: 0; letter-spacing: -0.01em; }
header.top .sub { color: var(--muted); font-size: 0.9rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card h2 { font-size: 1.05rem; margin: 0 0 12px; }
.card h2 .hint { font-weight: 400; color: var(--muted); font-size: 0.85rem; margin-left: 6px; }

.grid { display: grid; gap: 16px; }
@media (min-width: 820px) {
  .grid.two { grid-template-columns: 1.15fr 1fr; align-items: start; }
}

/* progress */
.stats { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-bottom: 14px; }
.stat .big { font-size: 2.4rem; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.stat .big small { font-size: 1rem; font-weight: 600; color: var(--muted); margin-left: 4px; }
.stat .label { color: var(--muted); font-size: 0.85rem; }
.next { font-size: 1rem; margin: 0 0 12px; }
.next strong { color: var(--accent); }

.map { width: 100%; height: auto; display: block; border-radius: 10px; background: var(--sea); }
.map .grat { stroke: var(--sea-line); stroke-width: 1; fill: none; }
.map .route-bg { stroke: var(--route); stroke-opacity: 0.3; stroke-width: 3; stroke-dasharray: 6 7; fill: none; stroke-linecap: round; }
.map .route-done { stroke: var(--route); stroke-width: 4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.map .stop { fill: var(--surface); stroke: var(--route); stroke-width: 2.5; }
.map .stop.reached { fill: var(--route); }
.map .stop-label { fill: var(--text); font-weight: 600; }
.map .stop-km { fill: var(--muted); }
.map .boat { fill: var(--sand); stroke: var(--surface); stroke-width: 2; }

.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.6s ease; }
.bar-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.8rem; margin-top: 4px; }

/* form */
form .row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
form label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
form .field { margin-bottom: 12px; }
form .help { color: var(--muted); font-size: 0.78rem; margin-top: 3px; }
input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  min-height: 44px;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-text);
}
button.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
button.link { background: none; color: var(--accent); padding: 4px 6px; min-height: 0; font-weight: 600; }
button.danger { background: none; color: var(--danger); padding: 4px 6px; min-height: 0; }
button:disabled { opacity: 0.6; cursor: default; }
button.wide { width: 100%; }

.msg { border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 0.92rem; }
.msg.error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.msg.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.hidden { display: none !important; }

/* tables / lists */
.tabs { display: flex; gap: 4px; background: var(--surface-2); border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.tabs button { flex: 1; background: transparent; color: var(--muted); min-height: 36px; padding: 6px 10px; font-size: 0.9rem; }
.tabs button[aria-selected='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

ol.board { list-style: none; margin: 0; padding: 0; }
ol.board li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
ol.board li:last-child { border-bottom: 0; }
ol.board .rank { color: var(--muted); font-weight: 600; text-align: right; }
ol.board .who small { display: block; color: var(--muted); font-size: 0.78rem; }
ol.board .m { font-weight: 700; }
ol.board .meter { grid-column: 2 / 4; height: 4px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: -2px; }
ol.board .meter span { display: block; height: 100%; background: var(--accent); opacity: 0.7; }

ul.feed { list-style: none; margin: 0; padding: 0; }
ul.feed li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
ul.feed li:last-child { border-bottom: 0; }
ul.feed .when { color: var(--muted); font-size: 0.8rem; }
.empty { color: var(--muted); font-size: 0.92rem; padding: 6px 0; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
td.num, th.num { text-align: right; }
.scroll { overflow-x: auto; }

footer { color: var(--muted); font-size: 0.8rem; text-align: center; margin-top: 28px; }
