/* NMH Ride Board. Colors from the NMH logo: navy for structure and actions,
   light blue for surfaces and info, maroon for what's yours and highlights. */
:root {
  --navy: #102f5b;
  --sky: #86aed0;
  --maroon: #7e223e;
  --sky-soft: #e3edf6;
  --maroon-soft: #f4e3e8;
  --bg: #f1f6fb;
  --paper: #ffffff;
  --ink: #14213a;
  --muted: #5a6578;
  --line: #d6dde6;
  --accent: var(--navy);
  --accent-ink: #ffffff;
  --link: var(--navy);
  --font: system-ui, -apple-system, "Segoe UI", "PingFang TC", "PingFang SC", "Microsoft JhengHei", "Microsoft YaHei", "Noto Sans CJK TC", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #16345f; --maroon: #d98aa0; --sky-soft: #1b2d42; --maroon-soft: #3e1a25;
    --bg: #0e141d; --paper: #172130; --ink: #e6ecf3; --muted: #9aa7b8; --line: #2b3a4f;
    --accent: #86aed0; --accent-ink: #0b1a30; --link: #b9d3ea; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --navy: #16345f; --maroon: #d98aa0; --sky-soft: #1b2d42; --maroon-soft: #3e1a25;
  --bg: #0e141d; --paper: #172130; --ink: #e6ecf3; --muted: #9aa7b8; --line: #2b3a4f;
  --accent: #86aed0; --accent-ink: #0b1a30; --link: #b9d3ea; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font);
}
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--maroon); outline-offset: 2px; }
h1, h2 { line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.6rem; margin: 0.6em 0 0.4em; }
h2 { font-size: 1.15rem; margin: 1.4em 0 0.4em; color: var(--accent); }

/* top bar */
.bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  background: var(--navy); color: #fff; border-bottom: 3px solid var(--sky);
}
.bar-home { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; flex: 1; min-width: 0; }
.bar-logo { background: #fff; border-radius: 4px; padding: 2px; width: 40px; height: 24px; }
.bar-title { font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-chip {
  font: inherit; font-size: 0.8rem; color: #fff; background: transparent;
  border: 1px solid var(--sky); border-radius: 999px; padding: 4px 12px; cursor: pointer; min-height: 32px;
}

/* page */
main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 8px 16px 32px; }
main:focus { outline: none; }
.hero { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 28px 0 8px; }
.hero img { width: 165px; height: auto; }
.wordmark { margin: 8px 0 0; font-size: 1.5rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.callout {
  background: var(--sky-soft); border-left: 4px solid var(--maroon);
  padding: 10px 14px; border-radius: 8px;
}
.note { font-size: 0.9rem; color: var(--muted); border-top: 3px solid var(--sky); padding-top: 10px; }
ol.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; counter-reset: s; }
ol.steps li {
  counter-increment: s; display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: start;
  background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--sky); border-radius: 12px; padding: 12px;
}
ol.steps li::before {
  content: counter(s); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--maroon); color: #fff; font-weight: 700;
}
ul.list { padding-left: 20px; display: grid; gap: 8px; }

.btn {
  display: inline-block; text-align: center; font: inherit; font-weight: 600; cursor: pointer;
  border-radius: 10px; padding: 10px 16px; min-height: 44px; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); border: 0; margin-top: 16px;
}
.btn.ghost { background: transparent; color: var(--maroon); border: 1.5px solid var(--maroon); }

/* footer */
.foot {
  background: var(--navy); color: #dbe6f2; border-top: 3px solid var(--maroon);
  padding: 16px max(16px, env(safe-area-inset-left, 0px)) calc(16px + env(safe-area-inset-bottom, 0px));
  font-size: 0.85rem; text-align: center;
}
.foot p { margin: 8px auto 0; max-width: 560px; }
.foot-links { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.foot-links a { color: #fff; }

/* language sheet */
.sheet {
  border: 0; border-top: 4px solid var(--sky); border-radius: 18px 18px 0 0;
  margin: auto 0 0; width: 100%; max-width: 100%; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--paper); color: var(--ink);
}
@media (min-width: 560px) { .sheet { margin: auto; max-width: 420px; border-radius: 18px; } }
.sheet::backdrop { background: rgba(10, 20, 40, 0.5); }
.sheet h2 { margin-top: 0; }
.lang-options { display: grid; gap: 8px; }
.lang-option {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  font: inherit; color: inherit; background: var(--paper); cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 48px;
}
.lang-option[aria-checked="true"] { background: var(--sky-soft); border-color: var(--maroon); }
.sheet .btn { width: 100%; }

/* Sign-in */
.btn.wide { display: flex; justify-content: center; width: 100%; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.form { display: grid; gap: 6px; margin-top: 8px; }
.form label { font-weight: 600; margin-top: 8px; }
.form input {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--line); border-top: 3px solid var(--sky); border-radius: 10px;
  padding: 10px 12px; min-height: 48px; width: 100%; box-sizing: border-box;
}
.form input:focus { border-color: var(--navy); outline: none; }
.code-input { font-size: 1.5rem; letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; }
.error {
  background: var(--maroon-soft); border-left: 4px solid var(--maroon); color: var(--ink);
  border-radius: 8px; padding: 10px 12px; margin: 10px 0 0;
}
.strong { font-weight: 700; overflow-wrap: anywhere; }
.tight { margin: 2px 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row .btn { flex: 1 1 140px; justify-content: center; }

.or { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 20px 0 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.or + .btn { margin-top: 12px; }

/* Rides */
.card {
  background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--sky);
  border-radius: 12px; padding: 12px 14px; margin: 12px 0;
}
.card p { margin: 4px 0; }
.card.mine { border-top-color: var(--maroon); background: var(--maroon-soft); }
.card.match.good { border-left: 4px solid var(--navy); }
.card.match.possible { border-left: 4px solid var(--sky); }
.tag { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--maroon); }
.route { font-size: 1.25rem; font-weight: 800; letter-spacing: 0.04em; color: var(--accent); }
.match-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.badge { font-size: 0.8rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.badge.good { background: var(--navy); color: #fff; }
.badge.possible { background: var(--sky-soft); color: var(--ink); border: 1px solid var(--sky); }
.pill { display: inline-block; font-size: 0.8rem; border-radius: 999px; padding: 2px 10px; background: var(--maroon); color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip, .chip-radio label {
  display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); text-decoration: none; cursor: pointer;
}
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-radio input:checked + label { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip-radio input:focus-visible + label { outline: 2px solid var(--maroon); outline-offset: 2px; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--navy); border-radius: 10px; overflow: hidden; margin: 12px 0; }
.tab { text-align: center; padding: 10px; text-decoration: none; color: var(--accent); font-weight: 600; }
.tab.on { background: var(--navy); color: #fff; }

.form .label { font-weight: 600; margin: 8px 0 0; }
.form select {
  font: inherit; color: var(--ink); background: var(--paper); min-height: 48px; padding: 8px 12px;
  border: 1.5px solid var(--line); border-top: 3px solid var(--sky); border-radius: 10px;
}
.form .row input { flex: 1 1 140px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400 !important; }
.check input { width: 22px; height: 22px; min-height: 0; padding: 0; border: 0; margin-top: 2px; flex: none; accent-color: var(--maroon); }
ul.plain { list-style: none; padding: 0; margin: 0; }

/* Bottom tabs for signed-in pages */
.tabbar {
  position: sticky; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--navy); border-top: 3px solid var(--sky);
}
.tabbar a { text-align: center; padding: 12px 4px; color: #dbe6f2; text-decoration: none; font-weight: 600; }
.tabbar a.on { color: #fff; box-shadow: inset 0 -3px 0 var(--maroon); }
.tabbar[hidden] { display: none; }
