:root {
  --paper: #F1F3EF;      /* cool concrete */
  --surface: #FFFFFF;
  --ink: #18211D;
  --muted: #5B6660;
  --line: #D3D9D3;
  --go: #0A6B4A;         /* go green */
  --go-dark: #06513A;
  --plate: #F4C20D;      /* number-plate yellow */
  --alert: #B42318;
  --radius-s: 8px;
  --radius-l: 18px;
  --wide: 125%;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--go); }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--go); outline-offset: 2px; border-radius: 4px; }

/* ---------- top bar ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; max-width: 480px; margin: 0 auto;
}
.brand {
  font-weight: 800; font-stretch: var(--wide); font-size: 18px; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none;
}
.wallet-chip {
  font-weight: 700; font-size: 15px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 14px;
}

main { max-width: 480px; margin: 0 auto; padding: 4px 20px 120px; }

/* ---------- type ---------- */
h1 { font-size: 30px; line-height: 1.1; font-weight: 800; font-stretch: var(--wide); letter-spacing: -0.02em; margin: 18px 0 8px; }
h2 { font-size: 20px; font-weight: 750; font-stretch: 110%; margin: 28px 0 10px; }
p { margin: 0 0 12px; max-width: 34em; }
.muted { color: var(--muted); }
.small { font-size: 15px; }

/* ---------- the number plate: the bike's identity everywhere ---------- */
.plate {
  display: inline-flex; align-items: center; gap: 14px;
  background: var(--plate); color: #111;
  border: 3px solid #111; border-radius: 10px;
  padding: 10px 22px;
  font-weight: 900; font-stretch: var(--wide); font-size: 34px; letter-spacing: 0.04em; line-height: 1;
  position: relative;
}
.plate::before, .plate::after {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: #111; opacity: .55;
}
.plate.small-plate { font-size: 18px; padding: 6px 12px; border-width: 2px; border-radius: 7px; gap: 8px; }
.plate.small-plate::before, .plate.small-plate::after { width: 4px; height: 4px; }

.bike-hero { margin: 22px 0 6px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 14px 0 4px; color: var(--muted); font-size: 15px; }
.facts b { color: var(--ink); font-weight: 650; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.status-dot.ok { background: var(--go); }
.status-dot.busy { background: var(--alert); }

/* ---------- choices (time plans, top-up amounts) ---------- */
.choices { display: grid; gap: 10px; margin: 8px 0 0; }
.choice {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-s);
  padding: 16px 18px; cursor: pointer; text-align: left; width: 100%;
}
.choice .t { font-weight: 650; }
.choice .p { font-weight: 800; font-stretch: 110%; }
.choice[aria-pressed="true"] { border-color: var(--go); box-shadow: inset 0 0 0 1px var(--go); }
.amounts { grid-template-columns: repeat(3, 1fr); }
.amounts .choice { justify-content: center; font-weight: 750; }

/* ---------- buttons ---------- */
.btn {
  display: block; width: 100%; border: 0; border-radius: var(--radius-s); cursor: pointer;
  padding: 17px 18px; font-weight: 750; font-size: 18px; text-align: center; text-decoration: none;
  background: var(--go); color: #fff;
}
.btn:active { background: var(--go-dark); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 2px solid var(--line); }
.btn.danger { background: var(--surface); color: var(--alert); border: 2px solid #E8C3BF; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.link-btn { background: none; border: 0; color: var(--go); font-weight: 650; padding: 10px 0; cursor: pointer; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--paper) 75%, rgba(241,243,239,0));
}
.dock-inner { max-width: 440px; margin: 0 auto; display: grid; gap: 10px; }

/* ---------- fields ---------- */
label { display: block; font-weight: 650; margin: 16px 0 6px; }
.field {
  width: 100%; padding: 15px 16px; font-size: 20px; border-radius: var(--radius-s);
  border: 2px solid var(--line); background: var(--surface);
}
.field:focus { border-color: var(--go); outline: none; }
.code-field { letter-spacing: 0.4em; font-weight: 750; text-align: center; font-size: 26px; }
.row-input { display: flex; gap: 10px; }
.row-input .btn { width: auto; padding: 0 20px; }

/* ---------- lists ---------- */
.list { display: grid; gap: 2px; background: var(--line); border-radius: var(--radius-s); overflow: hidden; margin: 6px 0; }
.list-item { background: var(--surface); padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.list-item .sub { color: var(--muted); font-size: 14px; }
.amount-pos { color: var(--go); font-weight: 700; }
.amount-neg { color: var(--ink); font-weight: 700; }

/* ---------- ride screen: the timer ring ---------- */
.ride { text-align: center; padding-top: 6px; }
.ring-wrap { position: relative; width: min(78vw, 300px); aspect-ratio: 1; margin: 22px auto 10px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 14; }
.ring .track { stroke: #DDE2DD; }
.ring .bar { stroke: var(--go); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke .3s; }
.ring.low .bar { stroke: var(--plate); }
.ring.parked .bar { stroke: var(--muted); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.time-left { font-weight: 850; font-stretch: var(--wide); font-size: clamp(42px, 13vw, 58px); letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.ride-state { margin-top: 8px; font-weight: 650; color: var(--muted); }

/* ---------- progress steps (unlocking) ---------- */
.steps { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: center; color: var(--muted); }
.steps li::before { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.steps li.doing { color: var(--ink); font-weight: 650; }
.steps li.doing::before { border-color: var(--go); border-top-color: transparent; animation: spin .8s linear infinite; }
.steps li.done { color: var(--ink); }
.steps li.done::before { background: var(--go); border-color: var(--go); }
.steps li.fail { color: var(--alert); font-weight: 650; }
.steps li.fail::before { background: var(--alert); border-color: var(--alert); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- notices ---------- */
.notice { background: var(--surface); border-left: 4px solid var(--plate); border-radius: 4px; padding: 12px 14px; margin: 14px 0; font-size: 15px; }
.notice.error { border-left-color: var(--alert); }
.notice.good { border-left-color: var(--go); }
.dev-code { font-weight: 800; letter-spacing: .2em; }

.summary { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; background: var(--surface); border-radius: var(--radius-s); padding: 16px; margin: 16px 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 700; text-align: right; }

/* ---------- sheet + toast ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(24,33,29,.45); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto;
  background: var(--paper); border-radius: var(--radius-l) var(--radius-l) 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); max-height: 88dvh; overflow: auto;
  animation: up .22s ease-out;
}
.sheet-panel h1 { margin-top: 0; font-size: 24px; }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 30;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 15px;
  max-width: calc(100vw - 40px);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
