:root {
    --bg:        #0a0b0e;
    --panel:     #101217;
    --panel-2:   #161920;
    --raised:    #1c2029;
    --input:     #0c0e12;
    --line:      rgba(255,255,255,0.07);
    --line-2:    rgba(255,255,255,0.13);

    --text:      #eef0f4;
    --muted:     #99a0ae;
    --faint:     #626a7a;

    --amber:     #f5b229;
    --amber-dim: rgba(245,178,41,0.13);
    --amber-glow:rgba(245,178,41,0.38);
    --amber-deep:#c98a0e;

    --ok:        #3ddc97;
    --ok-dim:    rgba(61,220,151,0.14);
    --bad:       #e5574d;
    --bad-dim:   rgba(229,87,77,0.15);
    --blue:      #5aa7ff;
    --blue-dim:  rgba(90,167,255,0.14);

    --display: 'Saira', 'Segoe UI', system-ui, sans-serif;
    --body:    'Inter', 'Segoe UI', system-ui, sans-serif;
    --mono:    'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;

    --radius:    10px;
    --radius-sm: 6px;
    --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--body);
    font-size: 14px;
    color: var(--text);
    background: transparent;
    height: 100vh;
    overflow: hidden;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }


/* ── The meter ──────────────────────────────────────────────────────────── */

/* One corner for everything that speaks while you drive. Never give this a
   transform, filter or perspective: #summary.full is fixed inset:0 and a
   containing block here would render the end-of-shift card in the corner. */
#dock {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
}
#dock > * { pointer-events: auto; }

/* A moulded box. Fixed size in every state — the inset top highlight is the
   whole "this is a physical thing" trick, and there is deliberately no
   backdrop-filter: over a transparent page CEF paints that region black. */
#meter {
    position: relative;
    width: 300px;
    background: var(--panel);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.06),
        0 14px 34px rgba(0,0,0,.55);
    animation: fadeUp .26s var(--ease) both;
}

/* Band one: the sign. Carries the whole state in a colour and one word, so it
   reads in peripheral vision without being looked at. */
.mtr-head {
    height: 28px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--panel-2);
    border-bottom: 1px solid var(--line);
    font-family: var(--display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--faint);
}

.mtr-state { white-space: nowrap; }
.mtr-flags { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.mtr-flags .pill { font-size: 9px; padding: 1px 6px; letter-spacing: .08em; }
#meter-vehicle { color: inherit; opacity: .7; font-size: 10px; letter-spacing: .06em; }

.mtr-pips { display: flex; gap: 3px; }
.pip {
    width: 4px; height: 4px;
    border-radius: 1px;
    background: currentColor;
    display: block;
}
.pip.spent { opacity: .25; }

/* Band two: the well. Recessed below the body, which with the band above it is
   what reads as glass over a display. */
.mtr-read {
    padding: 12px 14px 10px;
    background: var(--bg);
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "big aux" "cap aux";
    row-gap: 2px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,.5);
}

/* Tabular figures are not a nicety here: $148 to $149 must not move a pixel
   while the driver is reading it at speed. */
.mtr-big {
    grid-area: big;
    font-family: var(--display);
    font-size: 46px;
    font-weight: 700;
    line-height: .95;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
    color: var(--amber);
    text-shadow: 0 0 18px var(--amber-glow);
}

/* The big number means something different in every state, and an unlabelled
   big number is a guess. */
.mtr-cap {
    grid-area: cap;
    font-family: var(--display);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--faint);
}

.mtr-aux {
    grid-area: aux;
    align-self: center;
    justify-self: end;
    text-align: right;
    display: grid;
    gap: 3px;
}
.mtr-aux b {
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

/* Band three: one line of context. Always drawn, even with no fare, so the
   unit's height never changes. */
.mtr-route {
    height: 30px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--line);
}
.mtr-to {
    font-size: 11.5px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mtr-to strong { font-family: var(--display); font-size: 12px; color: var(--amber); font-weight: 600; }
.mtr-to .mtr-cmd { font-family: var(--mono); color: var(--amber); font-size: 11px; }
.mtr-eta { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--faint); white-space: nowrap; }

/* ── States ─────────────────────────────────────────────────────────────── */
/* A state light does not fade, so none of these carry a transition. */

#meter.s-hire  .mtr-head { background: var(--amber-dim); color: var(--amber); }
#meter.s-hire  .dot { background: var(--amber); box-shadow: 0 0 8px var(--amber-glow); }

#meter.s-call  .mtr-head { background: var(--blue-dim); color: var(--blue); }
#meter.s-call  .dot { background: var(--blue); animation: pulse 1.5s ease-in-out infinite; }
#meter.s-call  .mtr-big { color: var(--blue); text-shadow: 0 0 18px rgba(90,167,255,.32); }

#meter.s-board .mtr-head { background: var(--blue-dim); color: var(--blue); }
#meter.s-board .dot { background: var(--blue); }

/* The strongest idea in the design: a cab's roof lamp goes OUT when it is
   hired and the meter lights up. The band inverting is that flip, in one
   gesture, legible without reading a word. */
#meter.s-hired .mtr-head { background: var(--amber); color: #15120a; }
#meter.s-hired .dot { background: #15120a; box-shadow: none; }
#meter.s-hired .mtr-flags .pill { background: rgba(0,0,0,.22); color: #15120a; border-color: rgba(0,0,0,.25); }

#meter.s-paid  .mtr-head { background: var(--ok-dim); color: var(--ok); }
#meter.s-paid  .dot { background: var(--ok); }
#meter.s-paid  .mtr-big { color: var(--ok); text-shadow: 0 0 18px rgba(61,220,151,.3); }

/* The pickup running out. The colour is the alarm; there is no beep. */
#meter.s-alarm .mtr-head { background: var(--bad-dim); color: var(--bad); }
#meter.s-alarm .dot { background: var(--bad); animation: pulse 1s ease-in-out infinite; }
#meter.s-alarm .mtr-big { color: var(--bad); text-shadow: 0 0 18px rgba(229,87,77,.34); }

/* Anything still reaching for the old class finds the hired look. */
#meter.running .mtr-head { background: var(--amber); color: #15120a; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .35; }
}

/* ── One-shots ──────────────────────────────────────────────────────────── */

/* The number rolls over when its meaning changes. */
#meter.flip .mtr-big { animation: mtrFlip .14s var(--ease) both; }
@keyframes mtrFlip {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* A star lost. The cab takes a hit and the meter jolts — today the cost of
   driving badly is invisible until the summary card. */
#meter.knock .mtr-head { animation: mtrKnock .5s var(--ease) both; }
#meter.knock .dot { animation: mtrKnockDot .5s var(--ease) both; }
@keyframes mtrKnock {
    0%   { background: rgba(229,87,77,.4); }
    100% { }
}
@keyframes mtrKnockDot {
    0%, 100% { transform: scale(1); }
    40%      { transform: scale(1.9); }
}

/* Paid. One wash across the glass. */
#meter.settle .mtr-read { animation: mtrSettle .08s linear both; }
@keyframes mtrSettle {
    from { background: #2a2e36; }
    to   { background: var(--bg); }
}

/* ── The receipt ────────────────────────────────────────────────────────── */
/* A fare completing docks above the meter instead of throwing a card over the
   middle of the screen while you are driving. Ending a shift still gets the
   screen — you have parked, and it is the end of something. */
#summary.dock {
    position: static;
    inset: auto;
    display: block;
    background: none;
    backdrop-filter: none;
    place-items: initial;
}
#summary.dock .summary-card {
    width: 300px;
    padding: 14px 16px;
    animation: slideIn .26s var(--ease) both;
}
#summary.dock .summary-card h2 { font-size: 13px; margin-bottom: 10px; }
#summary.dock .summary-rows { margin-bottom: 10px; gap: 6px; }
#summary.dock .summary-rows div { font-size: 11.5px; padding-bottom: 6px; }
#summary.dock #summary-close {
    width: auto;
    padding: 5px 12px;
    font-size: 11px;
    margin-left: auto;
    display: block;
}

/* ── Hail offers ────────────────────────────────────────────────────────── */

#hails {
    position: fixed;
    top: 22px;
    right: 22px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}


.hail {
    width: 250px;
    background: rgba(16,18,23,.95);
    border: 1px solid var(--line-2);
    border-left: 2px solid var(--amber);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    /* No backdrop-filter. Over a transparent page CEF has nothing to blur and
       paints the filtered region black instead — a box far bigger than the
       card, because the shadow goes opaque with it. */
    box-shadow: 0 10px 24px rgba(0,0,0,.45);
    animation: slideIn .26s var(--ease) both;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: none; }
}

.hail b { font-size: 13px; font-family: var(--display); }
.hail p { font-size: 11px; color: var(--muted); margin-top: 2px; }
.hail .cmd { font-family: var(--mono); font-size: 11px; color: var(--amber); margin-top: 7px; display: block; }

.hail .timer { height: 2px; background: var(--amber); margin-top: 9px; border-radius: 2px; transform-origin: left; }

/* ── Fare summary ───────────────────────────────────────────────────────── */

#summary {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(4,5,7,.72);
}

.summary-card {
    width: min(400px, 90vw);
    background: var(--panel);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: 0 30px 80px rgba(0,0,0,.7);
    animation: panelIn .24s var(--ease) both;
}

.summary-card h2 {
    font-family: var(--display);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 14px;
}

.summary-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }

.summary-rows div {
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.summary-rows div:last-child { border-bottom: 0; }
.summary-rows span:first-child { color: var(--muted); }
.summary-rows span:last-child { font-family: var(--mono); }
.summary-rows div.total span:last-child { color: var(--amber); font-size: 15px; font-weight: 700; }

#summary-close {
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: var(--amber-dim);
    border: 1px solid rgba(245,178,41,.4);
    color: var(--amber);
    font-family: var(--display);
    font-weight: 600;
    letter-spacing: .04em;
    transition: all .16s var(--ease);
}

#summary-close:hover { background: rgba(245,178,41,.22); border-color: var(--amber); }
