/* Colour tokens live here only; components use them so light and dark both work. */
:root {
  color-scheme: light dark;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg: hsl(210 24% 96%);
  --surface: hsl(0 0% 100%);
  --ink: hsl(215 32% 14%);
  --ink-muted: hsl(215 14% 40%);
  --line: hsl(214 20% 87%);
  --brand: hsl(196 82% 30%);
  --brand-ink: hsl(0 0% 100%);
  --accent: hsl(158 62% 26%);
  --accent-soft: hsl(158 55% 92%);
  --bad: hsl(354 68% 38%);
  --bad-soft: hsl(354 70% 95%);
  --ring: hsl(196 82% 40%);
  --radius: 14px;
  --shadow: 0 1px 2px hsl(215 30% 20% / 0.08), 0 10px 24px hsl(215 30% 20% / 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: hsl(215 30% 8%);
    --surface: hsl(215 24% 13%);
    --ink: hsl(210 28% 95%);
    --ink-muted: hsl(212 14% 68%);
    --line: hsl(215 18% 25%);
    --brand: hsl(192 78% 62%);
    --brand-ink: hsl(215 45% 8%);
    --accent: hsl(154 55% 62%);
    --accent-soft: hsl(158 40% 17%);
    --bad: hsl(354 80% 70%);
    --bad-soft: hsl(354 40% 20%);
    --ring: hsl(192 78% 62%);
    --shadow: none;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

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

h1 {
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.35rem;
}

h2 {
  font-size: 1.1rem;
  margin: 0 0 0.35rem;
}

p {
  margin: 0 0 0.75rem;
}

.wrap {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1rem;
}

main.wrap {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.top-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.brand {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.bubbles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.bubble {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.bubble:hover {
  color: var(--ink);
  border-color: var(--ink-muted);
}

.bubble.active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  padding: 1.25rem;
}

.notice {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 10px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 1rem;
  padding: 0.6rem 0.9rem;
}

.form {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  margin-top: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.field-wide {
  grid-column: 1 / -1;
}

label {
  font-size: 0.92rem;
  font-weight: 600;
}

input,
select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  padding: 0.55rem 0.65rem;
  width: 100%;
}

input:focus-visible,
select:focus-visible,
.btn:focus-visible,
.bubble:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.error {
  color: var(--bad);
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
}

.table-wrap {
  margin-top: 0.75rem;
  overflow-x: auto;
}

.tides {
  border-collapse: collapse;
  font-size: 0.95rem;
  width: 100%;
}

.tides th {
  border-bottom: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.65rem;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.tides td {
  border-bottom: 1px solid var(--line);
  padding: 0.6rem 0.65rem;
  vertical-align: middle;
}

.tides tbody tr:last-child td {
  border-bottom: 0;
}

.tides tr.next {
  background: var(--accent-soft);
}

.tides tr.next td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

td.actions {
  text-align: right;
  white-space: nowrap;
}

.pill {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-muted);
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  white-space: nowrap;
}

.pill.next {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.btn {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 600;
  gap: 0.35rem;
  padding: 0.5rem 0.95rem;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--ink-muted);
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.btn.bad {
  background: var(--bad-soft);
  border-color: var(--bad);
  color: var(--bad);
}

.facts {
  display: grid;
  gap: 0.35rem 1rem;
  grid-template-columns: max-content 1fr;
  margin: 0 0 0.9rem;
}

.facts dt {
  color: var(--ink-muted);
  font-weight: 600;
}

.facts dd {
  margin: 0;
}

form.actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0;
}

.mut {
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.sr-only {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.foot {
  padding-top: 1rem;
  padding-bottom: 2rem;
}

.foot p {
  margin: 0;
}

@media (max-width: 34rem) {
  .card {
    padding: 1rem;
  }

  h1 {
    font-size: 1.2rem;
  }
}
