:root {
  --navy: #0f2a44;
  --navy-2: #1b3d5f;
  --bg: #eef3f8;
  --card: #ffffff;
  --text: #1a2633;
  --muted: #66788a;
  --line: #dbe4ee;
  --ice: #2f80ed;
  --ice-soft: #e3efff;
  --driver: #0f8a5f;
  --rider: #d9480f;
  --either: #7048e8;
  --whistler: #1c64c8;
  --cypress: #2b8a3e;
  --grouse: #c92a2a;
  --amber: #e67700;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 38px; height: 38px; border-radius: 10px; }
.top h1 { margin: 0; font-size: 18px; letter-spacing: .5px; }
.top p { margin: 2px 0 0; font-size: 12px; opacity: .75; }
.lang { background: var(--navy-2); color: #fff; border: 1px solid #ffffff33; border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.demo { margin: 0; padding: 6px 16px; font-size: 12px; color: var(--muted); background: #fff8e1; border-bottom: 1px solid #f3e3a8; }

/* filters */
.filters { padding: 12px 16px 4px; display: grid; gap: 8px; }
.seg { display: flex; background: #dfe7f0; border-radius: 999px; padding: 3px; }
.seg .chip { flex: 1; border: 0; background: transparent; }
.seg .chip.on { background: #fff; box-shadow: 0 1px 3px #0002; color: var(--navy); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; white-space: nowrap;
}
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.wkend:not(.on) { color: var(--ice); border-color: #b9d3f7; }
.chip.m-whistler.on { background: var(--whistler); border-color: var(--whistler); }
.chip.m-cypress.on { background: var(--cypress); border-color: var(--cypress); }
.chip.m-grouse.on { background: var(--grouse); border-color: var(--grouse); }

/* cards */
.list { padding: 8px 16px; display: grid; gap: 10px; }
.card {
  position: relative; overflow: hidden;
  background: var(--card); border-radius: var(--radius); padding: 12px 14px;
  box-shadow: 0 1px 2px #0f2a4414, 0 2px 10px #0f2a440d; cursor: pointer;
  display: grid; gap: 6px;
}
.card:active { transform: scale(.99); }
.card.is-closed { opacity: .55; }
.card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.badge, .mtn { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; }
.badge.driver { background: #e6f6ef; color: var(--driver); }
.badge.rider { background: #fff0e8; color: var(--rider); }
.badge.either { background: #f0ebff; color: var(--either); }
.mtn { color: #fff; }
.mtn.whistler { background: var(--whistler); }
.mtn.cypress { background: var(--cypress); }
.mtn.grouse { background: var(--grouse); }
.date { margin-left: auto; font-weight: 700; color: var(--navy); }
.row { font-size: 14px; }
.times { display: flex; gap: 16px; }
.times em { font-style: normal; font-size: 11px; color: #fff; background: var(--navy-2); border-radius: 4px; padding: 1px 5px; margin-right: 4px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 13px; }
.meta .full { color: var(--grouse); font-weight: 600; }
.meta .price { margin-left: auto; color: var(--text); font-weight: 700; font-size: 15px; }
.who { font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px; }
.who b { color: var(--text); }
.ribbon {
  margin: -12px -14px 2px; padding: 4px 14px; font-size: 12px; font-weight: 600;
  background: #e6f6ef; color: var(--driver);
}
.ribbon.amber { background: #fff4e0; color: var(--amber); }
.ribbon.grey { background: #eceff2; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty.small { padding: 10px; font-size: 13px; }

/* mine */
.sec { font-size: 15px; margin: 18px 16px 8px; color: var(--navy); }
.mine-block { margin: 0 16px 16px; }
.mine-actions { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; font-size: 13px; }
.mcount { font-weight: 600; color: var(--navy); }
.matches { display: grid; gap: 8px; padding-left: 12px; border-left: 3px solid var(--ice-soft); }
.link { background: none; border: 0; color: var(--ice); padding: 4px; font-size: 13px; }
.reset { display: block; margin: 24px auto; color: var(--muted); }
#view > .card { margin: 0 16px 10px; }

/* form */
.form { padding: 8px 16px 16px; }
.form h2 { font-size: 18px; margin: 8px 0 12px; color: var(--navy); }
fieldset { border: 0; margin: 0 0 12px; padding: 12px 14px; background: #fff; border-radius: var(--radius); }
legend { float: left; width: 100%; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.sublabel { font-weight: 600; font-size: 14px; margin: 14px 0 8px; }
legend + * { clear: both; }
input:not([type=radio]):not([type=checkbox]), select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fbfcfe; color: var(--text); margin-top: 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ice); outline-offset: 0; border-color: transparent; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill input, .role-card input { position: absolute; opacity: 0; pointer-events: none; }
.pill span {
  display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 14px; background: #fbfcfe; cursor: pointer;
}
.pill input:checked + span { background: var(--navy); color: #fff; border-color: var(--navy); }
.pill input:focus-visible + span { outline: 2px solid var(--ice); }
.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.role-card span {
  display: grid; gap: 2px; text-align: center; padding: 12px 6px; border-radius: 12px;
  border: 2px solid var(--line); cursor: pointer;
}
.role-card small { color: var(--muted); font-size: 12px; }
.role-card.driver input:checked + span { border-color: var(--driver); background: #e6f6ef; }
.role-card.rider input:checked + span { border-color: var(--rider); background: #fff0e8; }
.role-card.either input:checked + span { border-color: var(--either); background: #f0ebff; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 44px; height: 40px; border: 0; background: #f1f5f9; font-size: 20px; }
.stepper output { width: 44px; text-align: center; font-weight: 700; font-size: 16px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; }
.check input { width: 20px; height: 20px; }
.money { display: flex; align-items: center; gap: 6px; }
.money span { font-size: 18px; font-weight: 700; margin-top: 8px; }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.warn { margin: 8px 0 0; font-size: 13px; color: var(--amber); }
.err { color: var(--grouse); font-weight: 600; text-align: center; }
.primary {
  width: 100%; border: 0; border-radius: 12px; padding: 14px; font-size: 16px; font-weight: 700;
  background: var(--ice); color: #fff;
}
.legal { font-size: 12px; color: var(--muted); text-align: center; margin: 10px 0 0; }

/* bottom nav */
.tabs {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px;
  display: flex; justify-content: space-around; align-items: flex-end;
  background: #fff; border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 6;
}
.tabs button { border: 0; background: none; display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 12px; min-width: 80px; }
.tabs .ico { font-size: 20px; }
.tabs button.on { color: var(--navy); font-weight: 600; }
.tabs .fab .ico {
  width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ice); color: #fff; font-size: 26px; margin-top: -24px; box-shadow: 0 4px 12px #2f80ed55;
}

/* modal */
.modal { position: fixed; inset: 0; background: #0f2a4466; z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  position: relative; width: 100%; max-width: 560px; background: var(--bg);
  border-radius: 18px 18px 0 0; padding: 40px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 90vh; overflow-y: auto;
}
.sheet .card { cursor: default; }
.x { position: absolute; top: 6px; right: 10px; border: 0; background: none; font-size: 28px; color: var(--muted); }
.contact {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 12px; padding: 12px 14px; background: #fff; border-radius: var(--radius); font-size: 14px;
}
.ghost {
  border: 1px solid var(--ice); color: var(--ice); background: #fff; border-radius: 999px;
  padding: 6px 14px; font-size: 13px; text-decoration: none; display: inline-block;
}
.book { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.book .primary { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 20;
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: 0 4px 14px #0004; max-width: 90vw; text-align: center;
}

/* disclaimer */
.disclaimer {
  margin-top: 12px; padding: 12px 14px; background: #fff8e1; border: 1px solid #f3e3a8;
  border-radius: var(--radius); font-size: 12px; color: #5c4a00; line-height: 1.55;
}
.disclaimer b { font-size: 13px; }
.disclaimer ul { margin: 6px 0 0; padding-left: 18px; }
.agree { margin: 12px 4px; }
.legal.foot { padding: 4px 24px 16px; }
.trip { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: #fff4e0; color: var(--amber); }

/* credit line */
.credit { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 16px 20px; letter-spacing: .3px; }
.credit a { color: var(--navy-2); font-weight: 600; text-decoration: none; }

/* feedback */
.fb-link { font-size: 13px; font-weight: 600; margin: 0 6px 6px; }
.fb-h { margin: 0 0 4px; font-size: 18px; color: var(--navy); }
.sheet textarea { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; }
.fb-send { margin-top: 4px; }
.hint.center { text-align: center; }
.link.danger { color: var(--grouse); }
.sheet .disclaimer:first-of-type { margin-top: 0; }
.sheet input { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 0 0 10px; }
.fb-sub { font-size: 15px; color: var(--navy); margin: 20px 0 4px; }
.pay-btn { display: block; text-align: center; margin-top: 10px; padding: 12px; border-radius: 12px; font-weight: 700; text-decoration: none; color: #fff; }
.pay-btn.paypal { background: #0070ba; }
.pay-btn.kofi { background: #ff5e5b; }
.hint.pending { font-style: italic; }
.primary:disabled { opacity: .6; }
.seat-ctl { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding: 8px 12px; background: #fff; border-radius: 12px; font-size: 13px; }
.stepper button:disabled { opacity: .35; }
.ml-box { margin: 10px 0; padding: 10px 12px; background: #fff; border: 1px dashed var(--ice); border-radius: 10px; font-size: 12px; word-break: break-all; color: var(--navy-2); }
.mine-actions .link { margin-left: 8px; }
.danger-btn { background: var(--grouse); margin-top: 12px; }
.demo.admin { background: #ffe8e8; border-color: #f5c2c2; color: var(--grouse); font-weight: 600; }
.demo .link { font-size: 12px; padding: 0; }
#contactBox { display: grid; gap: 10px; }
.c-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.c-row .ghost + .ghost { margin-left: 4px; }
