/* Layout: a one-screen phone game. Game screen stacks HUD, a live map (camera follows you), a top-down drive overlay,
   and a bottom panel for picking the next stop and vehicle. Single dark asphalt look with rickshaw-art accents. */
:root {
  --ink: #14151a;          /* night asphalt */
  --asphalt: #1c1e24;
  --panel: #23262e;
  --panel-2: #2b2f39;
  --line: #3a3f4b;
  --chalk: #f4ede0;
  --dim: #a9a397;
  --pink: #ff3d7f;         /* rickshaw hood pink */
  --teal: #19b3a6;
  --yellow: #ffc93c;
  --orange: #ff7a2f;
  --blue: #4a7cf5;
  --metro: #22b8d6;
  --good: #3ecf6e;
  --bad: #f0533a;
  --display: "Galada", "Baloo Da 2", "Noto Sans Bengali", cursive;
  --body: "Baloo Da 2", "Hind Siliguri", "Noto Sans Bengali", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ink); color: var(--chalk);
  font-family: var(--body); font-size: 15px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent; overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.app {
  position: relative; height: 100%; max-width: 500px; margin: 0 auto;
  display: flex; flex-direction: column; background: var(--asphalt);
  box-shadow: 0 0 0 1px #000, 0 0 60px rgba(0,0,0,0.6);
}
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { overflow-y: auto; scrollbar-width: none; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 0 24px; gap: 14px; }

.topbtns { position: absolute; z-index: 40; top: 10px; right: max(12px, env(safe-area-inset-right, 0px)); display: flex; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(20,21,26,0.6); border: 1px solid var(--line); color: var(--chalk); backdrop-filter: blur(4px);
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .cross { display: none; }
.icon-btn.muted .cross { display: inline; }
.icon-btn.muted .waves { display: none; }
.icon-btn.muted { color: var(--dim); }

.cta {
  min-height: 52px; border: 0; border-radius: 14px; padding: 10px 18px;
  background: var(--yellow); color: #1b1407; font-weight: 800; font-size: 18px;
  box-shadow: 0 4px 0 #b88a10; transition: transform 0.08s, box-shadow 0.08s, opacity 0.2s;
}
.cta:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #b88a10; }
.cta:disabled { background: var(--panel-2); color: var(--dim); box-shadow: none; cursor: not-allowed; }
.ghost { min-height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: transparent; font-weight: 600; }
.ghost:hover { border-color: var(--dim); }
.card { background: var(--panel); border-radius: 16px; padding: 14px 16px; border: 1px solid #2f333d; }
.sec { margin: 6px 0 -4px; font-size: 16px; font-weight: 700; }
.count { color: var(--dim); font-weight: 500; font-size: 14px; }
.fine { color: var(--dim); font-size: 12.5px; margin: 0; }

/* ---------- title ---------- */
.hero { position: relative; margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); height: 230px; flex: none; overflow: hidden; }
.hero canvas { width: 100%; height: 100%; display: block; }
.hero-title { position: absolute; left: 18px; top: 28px; }
.hero-title h1 {
  margin: 0; font-family: var(--display); font-weight: 400; font-size: 58px; line-height: 1;
  color: var(--yellow); text-shadow: 3px 3px 0 var(--pink), 0 0 30px rgba(0,0,0,0.6);
  animation: wobble-in 0.7s cubic-bezier(.3,1.6,.5,1) backwards;
}
@keyframes wobble-in { from { transform: translateY(-30px) rotate(-5deg); opacity: 0; } }
.kicker { margin: 4px 0 0; font-weight: 700; letter-spacing: 0.06em; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,0.7); }
.art-strip {
  height: 14px; flex: none; margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
  background:
    linear-gradient(135deg, var(--pink) 25%, transparent 25%) 0 0 / 28px 14px,
    linear-gradient(225deg, var(--teal) 25%, transparent 25%) 0 0 / 28px 14px,
    linear-gradient(315deg, var(--yellow) 25%, transparent 25%) 0 0 / 28px 14px,
    linear-gradient(45deg, var(--blue) 25%, var(--ink) 25%) 0 0 / 28px 14px;
}
.title-body { display: grid; gap: 14px; }
.lede { margin: 0; font-size: 16px; color: #e5ddcf; }
.routes { display: grid; gap: 10px; }
.route {
  position: relative; text-align: left; border-radius: 14px; padding: 12px 14px 12px 16px;
  background: var(--panel); border: 2px solid transparent; display: grid; gap: 2px;
}
.route.sel { border-color: var(--yellow); background: #2c2a22; }
.route-name { font-weight: 800; font-size: 18px; }
.route-blurb { color: var(--dim); font-size: 13.5px; }
.route-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--dim); margin-top: 2px; }
.route-meta b { color: var(--chalk); font-weight: 600; }
.route-best { color: var(--good); font-weight: 700; }
.route::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 4px; background: var(--pink); }
.route:nth-child(2)::before { background: var(--teal); }
.route:nth-child(3)::before { background: var(--yellow); }
.route:nth-child(4)::before { background: var(--blue); }
.days { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.day { border-radius: 12px; padding: 8px 6px; background: var(--panel); border: 2px solid transparent; display: grid; gap: 0; text-align: center; }
.day b { font-size: 15px; }
.day span { font-size: 11.5px; color: var(--dim); line-height: 1.3; }
.day.sel { border-color: var(--yellow); background: #2c2a22; }
.badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.badge { display: grid; justify-items: center; gap: 4px; text-align: center; font-size: 11.5px; line-height: 1.25; color: var(--dim); }
.badge i {
  width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-style: normal;
  border: 2px dashed var(--line); color: var(--line); font-size: 19px; font-weight: 800;
}
.badge.on { color: var(--chalk); }
.badge.on i { border: 3px double var(--yellow); color: var(--yellow); background: rgba(255,201,60,0.08); transform: rotate(-6deg); }

/* ---------- home ---------- */
#scrHome { padding-top: 16px; }
.home-top { display: flex; gap: 14px; align-items: center; padding-right: 84px; }
.alarm { width: 96px; height: 96px; flex: none; }
.alarm .bells circle { fill: var(--pink); }
.alarm .legs { stroke: var(--chalk); stroke-width: 6; stroke-linecap: round; }
.alarm .face-ring { fill: var(--pink); }
.alarm .face { fill: #fff8ea; }
.alarm .hand { stroke: #1b1407; stroke-width: 4; stroke-linecap: round; transform-origin: 60px 66px; }
.alarm .hand.short { stroke-width: 5; }
.alarm .pin { fill: var(--bad); }
.alarm.ring { animation: ring 0.12s linear 14; transform-origin: 60px 70px; }
@keyframes ring { 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
.eyebrow { margin: 0; color: var(--dim); font-size: 13px; }
.home-title { margin: 0; font-size: 24px; line-height: 1.2; }
.home-time { margin: 2px 0 0; color: var(--dim); }
.home-time span { color: var(--chalk); font-weight: 700; }
.radio { display: grid; gap: 6px; }
.radio-tag { margin: 0; font-weight: 700; font-size: 13px; color: var(--yellow); display: flex; align-items: center; gap: 8px; }
.onair { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 0 rgba(240,83,58,0.6); animation: onair 1.4s infinite; }
@keyframes onair { 70% { box-shadow: 0 0 0 8px rgba(240,83,58,0); } }
.radio-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; }
.radio-list li { display: grid; grid-template-columns: 54px 1fr; gap: 8px; }
.radio-list b { color: var(--yellow); font-weight: 700; font-variant-numeric: tabular-nums; }
.weather { margin: 0; padding: 10px 14px; border-radius: 12px; background: #20303a; color: #cfe6f2; font-size: 14px; }
.prep { display: grid; gap: 8px; }
.prep-item {
  display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; text-align: left;
  border-radius: 12px; padding: 10px 12px; background: var(--panel); border: 2px solid transparent;
}
.prep-item .box { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--dim); display: grid; place-items: center; }
.prep-item.on .box { background: var(--teal); border-color: var(--teal); }
.prep-item.on .box::after { content: ""; width: 10px; height: 6px; border-left: 3px solid #fff; border-bottom: 3px solid #fff; transform: rotate(-45deg) translate(1px,-1px); }
.prep-item.fixed { opacity: 0.7; cursor: default; }
.prep-name { font-weight: 700; }
.prep-note { display: block; color: var(--dim); font-size: 12.5px; font-weight: 400; }
.prep-min { font-weight: 700; color: var(--yellow); font-variant-numeric: tabular-nums; }
.leave { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 10px; }
.leave-label { color: var(--dim); }
.leave-time { grid-row: span 2; font-size: 38px; line-height: 1; color: var(--yellow); font-variant-numeric: tabular-nums; }
.leave-left { font-weight: 700; }
.leave-left.tight { color: var(--bad); }

/* ---------- game: HUD ---------- */
.game { position: relative; }
.hud {
  flex: none; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center;
  padding: 8px max(12px, env(safe-area-inset-left, 0px)) 8px max(12px, env(safe-area-inset-left, 0px));
  padding-right: 100px; background: var(--ink); border-bottom: 1px solid #000;
}
.clock-box { background: #0b0c0f; border: 1.5px solid #2a2d35; border-radius: 10px; padding: 3px 10px 2px; min-width: 92px; text-align: center; }
.clock { font-weight: 800; font-size: 28px; line-height: 1.05; color: #7fffb0; font-variant-numeric: tabular-nums; text-shadow: 0 0 10px rgba(127,255,176,0.45); }
.clock-sub { font-size: 11.5px; color: var(--dim); white-space: nowrap; }
.clock-box.warn .clock { color: var(--yellow); text-shadow: 0 0 10px rgba(255,201,60,0.5); }
.clock-box.late .clock { color: var(--bad); text-shadow: 0 0 10px rgba(240,83,58,0.6); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.55; } }
.hud-mid { min-width: 0; display: grid; gap: 3px; }
.where { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.money { font-weight: 800; color: var(--yellow); font-variant-numeric: tabular-nums; }
.energy { width: 64px; height: 8px; border-radius: 4px; background: #000; overflow: hidden; }
.energy i { display: block; height: 100%; width: 100%; background: var(--good); transition: width 0.4s, background 0.4s; }
.tag { font-size: 11.5px; font-weight: 700; padding: 0 7px; border-radius: 10px; }
.tag.wet { background: #2a5d86; color: #d9f0ff; }
.tag.cyc { background: #5c2a3a; color: #ffd6e3; }

/* ---------- game: map ---------- */
.map-wrap { position: relative; flex: 1 1 auto; min-height: 170px; background: #23262b; overflow: hidden; }
#map { width: 100%; height: 100%; display: block; touch-action: manipulation; }
.m-ground { fill: #262a2f; }
.river { fill: none; stroke: #1f3d55; stroke-width: 18; stroke-linecap: round; }
.lake { fill: #1f3d55; }
.m-water-label { fill: #4f7894; font-size: 9px; font-family: var(--body); }
.m-casing { fill: none; stroke: #111317; stroke-width: 9; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.m-casing.fly { stroke: #4b4f58; stroke-width: 11; }
.m-road { fill: none; stroke: #3ecf6e; stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; transition: stroke 0.6s; }
.m-road.crawl { stroke-dasharray: 2 7; animation: crawl 1.6s linear infinite; }
@keyframes crawl { to { stroke-dashoffset: -18; } }
.m-exp-shadow { fill: none; stroke: #0d0e11; stroke-width: 10; vector-effect: non-scaling-stroke; }
.m-exp { fill: none; stroke: #d9d2c3; stroke-width: 4; stroke-dasharray: 10 4; vector-effect: non-scaling-stroke; }
.m-metro-casing { fill: none; stroke: #0b2a33; stroke-width: 7; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.m-metro-line { fill: none; stroke: var(--metro); stroke-width: 3.5; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.m-trail-line { fill: none; stroke: var(--yellow); stroke-width: 3; stroke-dasharray: 1 6; stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: 0.9; }
.m-sel-edge { fill: none; stroke: #fff; stroke-width: 9; opacity: 0.35; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.m-node { cursor: pointer; }
.m-hit { fill: transparent; }
.m-ring { fill: none; stroke: transparent; stroke-width: 2.5; }
.m-station { fill: #0b2a33; stroke: var(--metro); stroke-width: 2; }
.m-dot { fill: #e9e3d6; stroke: #111; stroke-width: 1.5; }
.m-label { fill: #e9e3d6; font-size: 10.5px; font-weight: 700; font-family: var(--body); text-anchor: middle; paint-order: stroke; stroke: #15171b; stroke-width: 3px; pointer-events: none; }
.m-node.option .m-ring { stroke: var(--yellow); animation: pulse-ring 1.2s ease-in-out infinite; }
.m-node.option .m-label { fill: var(--yellow); }
.m-node.selected .m-ring { stroke: #fff; stroke-width: 3.5; animation: none; }
.m-node.selected .m-dot { fill: var(--yellow); }
.m-node.here .m-label { fill: #fff; }
@keyframes pulse-ring { 50% { opacity: 0.35; } }
.m-pin.home .pin-body { fill: var(--teal); } .m-pin .pin-door { fill: #0b2a33; }
.m-pin.office .pin-body { fill: #cdd3dc; } .m-pin .pin-win { fill: #3a6df0; } .m-pin .pin-flag { fill: var(--pink); stroke: #ccc; stroke-width: 1; }
.m-incident path { fill: var(--yellow); stroke: #1b1407; stroke-width: 1.2; }
.m-incident.vip path { fill: var(--pink); }
.m-incident text { font-size: 9px; font-weight: 800; text-anchor: middle; fill: #1b1407; }
.m-player-pulse { fill: rgba(255,61,127,0.3); animation: pp 1.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pp { from { transform: scale(0.6); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.m-player-dot { fill: var(--pink); stroke: #fff; stroke-width: 2.2; }
.m-player-glyph { fill: #fff; font-size: 8.5px; font-weight: 800; text-anchor: middle; font-family: var(--body); }
.map-btn { position: absolute; left: 10px; top: 10px; border-radius: 16px; padding: 3px 12px; font-size: 13px; font-weight: 700; background: rgba(20,21,26,0.75); border: 1px solid var(--line); }
.legend { position: absolute; left: 8px; bottom: 6px; display: flex; gap: 8px; flex-wrap: wrap; font-size: 10.5px; color: #cfc8ba; background: rgba(20,21,26,0.65); padding: 2px 8px; border-radius: 8px; }
.legend i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 3px; vertical-align: middle; }
.legend i.metro { background: var(--metro); }
.toast {
  position: absolute; left: 50%; top: calc(var(--hud-h, 70px) + 12px); transform: translateX(-50%); z-index: 30; max-width: calc(100% - 24px);
  background: #fff8ea; color: #1b1407; padding: 7px 14px; border-radius: 20px; font-weight: 700; font-size: 14px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4); animation: drop 0.35s cubic-bezier(.3,1.5,.5,1); text-align: center;
}
.toast.bad { background: var(--bad); color: #fff; }
.toast.rain { background: #2a5d86; color: #fff; }
@keyframes drop { from { transform: translate(-50%, -24px); opacity: 0; } }

/* ---------- game: street ---------- */
.street-wrap { position: relative; flex: none; height: clamp(104px, 18vh, 156px); border-top: 2px solid #000; border-bottom: 2px solid #000; }
#street { width: 100%; height: 100%; display: block; }
.street-tag {
  position: absolute; left: 8px; top: 6px; max-width: calc(100% - 16px); font-size: 12px; font-weight: 700;
  background: rgba(20,21,26,0.72); padding: 1px 9px; border-radius: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- game: panel ---------- */
.panel { flex: none; background: var(--ink); padding: 10px max(12px, env(safe-area-inset-left, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)); }
#planView { display: grid; gap: 9px; }
.here-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.here-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pink); flex: none; align-self: center; }
.here-line b { font-size: 16px; white-space: nowrap; }
.here-sub { color: var(--dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dests { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
.dest {
  flex: none; display: flex; align-items: center; gap: 6px; border-radius: 18px; padding: 4px 11px 4px 9px;
  background: var(--panel); border: 1.5px solid var(--line); font-weight: 700; font-size: 14px; white-space: nowrap;
}
.dest .lv { width: 9px; height: 9px; border-radius: 50%; }
.dest .dir { color: var(--dim); font-size: 11px; font-weight: 600; }
.dest.toward .dir { color: var(--good); }
.dest.office { border-color: var(--pink); }
.dest.sel { background: #fff8ea; color: #1b1407; border-color: #fff8ea; }
.dest.sel .dir { color: #5a4b2c; }
.modes { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; min-height: 112px; scroll-snap-type: x proximity; }
.modes-empty { color: var(--dim); font-size: 14px; align-self: center; padding: 0 4px; }
.mode {
  flex: none; width: 128px; scroll-snap-align: start; text-align: left; border-radius: 14px; padding: 8px 10px;
  background: var(--panel); border: 2px solid transparent; display: grid; gap: 1px; align-content: start; position: relative;
}
.mode svg { width: 30px; height: 22px; color: var(--chalk); }
.mode-name { font-weight: 800; font-size: 14.5px; line-height: 1.2; }
.mode-time { font-weight: 800; font-size: 17px; color: var(--yellow); font-variant-numeric: tabular-nums; line-height: 1.25; }
.mode-meta { font-size: 11.5px; color: var(--dim); line-height: 1.35; }
.mode-flag { position: absolute; right: 8px; top: 8px; font-size: 10.5px; font-weight: 800; color: var(--metro); }
.mode.sel { border-color: var(--yellow); background: #2c2a22; }
.mode.off { opacity: 0.42; cursor: not-allowed; }
.mode.off .mode-time { color: var(--dim); font-size: 12px; font-weight: 600; }
.mode.metro svg { color: var(--metro); }
.go { width: 100%; min-height: 48px; font-size: 17px; }
#travelView { display: grid; gap: 7px; padding-block: 4px; }
.travel-line { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.travel-line b { font-size: 17px; white-space: nowrap; }
.travel-line span { color: var(--dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.travel-bar { height: 8px; border-radius: 4px; background: #000; overflow: hidden; }
.travel-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--yellow)); }
.travel-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#travelStatus { font-weight: 600; font-size: 14px; }
.ff { border-radius: 14px; padding: 3px 12px; border: 1.5px solid var(--line); background: transparent; font-weight: 700; font-size: 13px; }
.ff[aria-pressed="true"] { background: var(--yellow); color: #1b1407; border-color: var(--yellow); }

/* ---------- overlays ---------- */
.sheet-back { position: absolute; inset: 0; background: rgba(0,0,0,0.45); z-index: 20; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 21; background: #fff8ea; color: #1b1407;
  border-radius: 20px 20px 0 0; padding: 16px max(16px, env(safe-area-inset-left, 0px)) calc(16px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 10px; animation: up 0.3s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes up { from { transform: translateY(100%); } }
.ev-head { display: flex; align-items: center; gap: 10px; }
.ev-seal { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--pink); color: #fff; font-weight: 800; font-size: 18px; flex: none; }
.ev-who { font-weight: 800; font-size: 15px; color: #6b5a3a; }
.ev-text { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.4; }
.ev-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ev-choice { text-align: left; border-radius: 12px; padding: 9px 12px; border: 2px solid #1b1407; background: #fff; display: grid; gap: 0; }
.ev-choice b { font-size: 15px; line-height: 1.25; }
.ev-choice span { font-size: 12px; color: #6b5a3a; }
.ev-choice:first-child { background: #1b1407; color: #fff8ea; }
.ev-choice:first-child span { color: #d8c9a8; }
.ev-timer { height: 5px; border-radius: 3px; background: #e7dcc4; overflow: hidden; }
.ev-timer i { display: block; height: 100%; width: 100%; background: var(--bad); transform-origin: left; }
.ev-res { margin: 0; font-size: 16px; font-weight: 700; color: #1b1407; background: #f1e3c4; border-radius: 10px; padding: 8px 12px; }
.mini {
  position: absolute; left: 0; right: 0; top: var(--hud-h, 70px); bottom: 0; z-index: 22; background: rgba(12,13,16,0.94);
  display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 12px max(12px, env(safe-area-inset-left, 0px)) calc(14px + env(safe-area-inset-bottom, 0px));
}
.mini-head { display: grid; gap: 2px; text-align: center; }
.mini-head b { font-size: 22px; color: var(--yellow); }
.mini-head span { color: var(--dim); font-size: 14px; }
#miniCanvas { flex: 0 1 auto; height: min(56vh, 460px); width: 100%; min-height: 0; border-radius: 14px; border: 2px solid #000; touch-action: none; }
.mini .cta { min-height: 64px; font-size: 22px; }
.phone {
  position: absolute; right: max(12px, env(safe-area-inset-right, 0px)); top: calc(var(--hud-h, 70px) + 10px); z-index: 24; width: 210px;
  background: #101114; border: 2px solid #3a3f4b; border-radius: 22px; padding: 12px 14px 14px;
  box-shadow: 0 16px 30px rgba(0,0,0,0.5); animation: slidein 0.35s cubic-bezier(.3,1.4,.5,1);
}
@keyframes slidein { from { transform: translateX(120%); } }
.phone-top { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.phone-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); animation: blink 0.6s steps(2) infinite; }
.phone-text { margin: 6px 0 0; font-size: 13.5px; color: #dcd5c7; }
.achtoast {
  position: absolute; left: 50%; top: 12px; z-index: 50; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px);
  display: flex; gap: 10px; align-items: center; background: #fff8ea; color: #1b1407; padding: 8px 14px 8px 8px; border-radius: 30px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.4); animation: drop 0.4s cubic-bezier(.3,1.5,.5,1);
}
.achtoast i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 3px double #c99512; color: #a57808; font-style: normal; font-weight: 800; }
.achtoast b { display: block; }

/* ---------- end ---------- */
#scrEnd { padding-top: 22px; }
.punch { display: grid; place-items: center; }
.punch-device {
  width: 220px; border-radius: 22px; padding: 16px; background: linear-gradient(#3a3d45, #24262c); border: 2px solid #000;
  display: grid; gap: 12px; justify-items: center; box-shadow: 0 14px 30px rgba(0,0,0,0.5);
}
.punch-screen { width: 100%; background: #0d2a1a; border-radius: 10px; padding: 8px 10px; display: grid; justify-items: center; color: #7fffb0; font-variant-numeric: tabular-nums; }
.punch-label { font-size: 11px; color: #4fbf80; }
.punch-screen b { font-size: 34px; line-height: 1.1; text-shadow: 0 0 12px rgba(127,255,176,0.6); }
.punch-screen span:last-child { font-size: 11.5px; color: #4fbf80; }
.finger { position: relative; width: 64px; height: 76px; border-radius: 14px; background: #121418; display: grid; place-items: center; overflow: hidden; border: 2px solid #4a4e58; }
.finger svg { width: 40px; height: 50px; fill: none; stroke: #6f7585; stroke-width: 2; stroke-linecap: round; }
.finger .scan { position: absolute; left: 0; right: 0; height: 3px; background: var(--good); box-shadow: 0 0 12px var(--good); top: 0; opacity: 0; }
.finger.scanning .scan { opacity: 1; animation: scan 0.9s ease-in-out 2; }
.finger.scanning svg { stroke: var(--good); }
@keyframes scan { 50% { top: calc(100% - 3px); } }
.verdict { display: grid; justify-items: center; gap: 6px; text-align: center; }
.stamp {
  font-weight: 800; font-size: 30px; padding: 4px 18px 2px; border: 4px double currentColor; border-radius: 8px;
  transform: rotate(-6deg); animation: thump 0.45s cubic-bezier(.3,1.6,.5,1) backwards;
}
.stamp.ok { color: var(--good); } .stamp.late { color: var(--bad); }
@keyframes thump { from { transform: rotate(-6deg) scale(2.4); opacity: 0; } }
.verdict-title { margin: 6px 0 0; font-size: 24px; line-height: 1.25; text-wrap: balance; }
.verdict-sub { margin: 0; color: var(--dim); max-width: 34ch; }
.rank { margin: 4px 0 0; display: grid; }
.rank span { font-size: 12px; color: var(--dim); }
.rank b { font-family: var(--display); font-weight: 400; font-size: 26px; color: var(--yellow); }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.ledger dl { margin: 0; display: grid; grid-template-columns: 1fr auto; }
.ledger dt, .ledger dd { margin: 0; padding: 6px 0; border-bottom: 1px dashed #3a3f4b; }
.ledger dd { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ledger dd.bad { color: var(--bad); } .ledger dd.good { color: var(--good); }
.legs { margin: 0; padding: 0; list-style: none; display: grid; gap: 0; }
.legs li { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed #3a3f4b; }
.legs li:last-child { border-bottom: 0; }
.legs svg { width: 28px; height: 20px; }
.legs .leg-main { font-weight: 700; font-size: 14px; }
.legs .leg-sub { display: block; font-size: 12px; color: var(--dim); font-weight: 400; }
.legs .leg-min { font-weight: 800; color: var(--yellow); font-variant-numeric: tabular-nums; }
.life { background: linear-gradient(160deg, #3a1d2a, #23262e 60%); }
.life-lead { margin: 0; color: #e8dccb; }
.life-big { display: flex; align-items: baseline; gap: 8px; margin: 4px 0; }
.life-big b { font-size: 54px; line-height: 1; color: var(--pink); font-variant-numeric: tabular-nums; }
.life-big span { font-size: 20px; font-weight: 700; }
.life-note { margin: 0; color: var(--dim); font-size: 13.5px; }
.end-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.end-actions .cta { grid-column: span 2; }
.copy-status { margin: 0; text-align: center; color: var(--dim); font-size: 14px; min-height: 1.4em; }
.share-preview { width: 100%; border-radius: 12px; }

@media (max-height: 700px) {
  .street-wrap { height: 92px; }
  .modes { min-height: 104px; }
  .mode { padding: 6px 9px; }
  .clock { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- the drive (top-down, vertical) ---------- */
.drive {
  position: absolute; left: 0; right: 0; top: var(--hud-h, 70px); bottom: 0; z-index: 15; background: #16171b;
  display: flex; flex-direction: column;
}
.drive-top { padding: 8px max(12px, env(safe-area-inset-left, 0px)) 8px; display: grid; gap: 6px; background: var(--ink); border-bottom: 2px solid #000; }
.drive-line { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.drive-line b { font-size: 17px; white-space: nowrap; }
.drive-line span { color: var(--dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.drive-line .drive-speed { flex: none; color: var(--yellow); font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
.drive-stage { position: relative; flex: 1; min-height: 0; }
#driveCanvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; cursor: grab; }
.drive-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0; width: max-content; max-width: calc(100% - 24px);
  background: rgba(15,16,20,0.85); color: var(--chalk); font-size: 13px; padding: 6px 12px; border-radius: 14px; text-align: center;
  pointer-events: none; transition: opacity 0.6s;
}
.drive-hint.gone { opacity: 0; }
.drive-status {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); margin: 0; background: var(--yellow); color: #1b1407;
  font-weight: 800; padding: 6px 14px; border-radius: 16px; pointer-events: none;
}
.drive-ctrl {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; background: var(--ink); border-top: 2px solid #000;
  padding: 10px max(12px, env(safe-area-inset-left, 0px)) calc(10px + env(safe-area-inset-bottom, 0px));
}
.pad {
  min-height: 62px; border-radius: 16px; border: 2px solid var(--line); background: var(--panel); color: var(--chalk);
  font-size: 24px; font-weight: 800; touch-action: none; user-select: none; -webkit-user-select: none;
}
.pad:active { background: var(--panel-2); transform: translateY(1px); }
.pad.act { background: var(--yellow); color: #1b1407; border-color: #000; box-shadow: 0 4px 0 #b8861a; font-size: 20px; }
.pad.act:active { box-shadow: 0 1px 0 #b8861a; transform: translateY(3px); }
.drive-ctrl.metro { display: none; }
.pad-group { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.drive-ctrl .pad { min-height: 64px; padding: 0 4px; font-size: 22px; }
.drive-ctrl .pad.act { width: 70px; font-size: 16px; padding: 0; }
.pad.gas { background: #1f6b3a; border-color: #0d3a1d; color: #fff; font-size: 17px; box-shadow: 0 4px 0 #0d3a1d; }
.pad.brake { background: #7a1f1f; border-color: #3a0d0d; color: #fff; font-size: 17px; box-shadow: 0 4px 0 #3a0d0d; }
.pad.held { transform: translateY(3px); box-shadow: none; filter: brightness(1.25); }
.drive-ctrl.metro { display: none; }

/* =========================================================
   Landing screens, second pass: taller hero, ticket-style routes,
   segmented day picker, a dock that keeps the main button in reach,
   and a morning timeline on the home screen.
   ========================================================= */
body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255,201,60,0.08), transparent 60%),
    radial-gradient(900px 500px at 50% 110%, rgba(255,61,127,0.07), transparent 60%),
    var(--ink);
}
@media (min-width: 620px) {
  body::before {
    content: ""; position: fixed; inset: 0; pointer-events: none; opacity: 0.06;
    background:
      linear-gradient(135deg, var(--pink) 25%, transparent 25%) 0 0 / 56px 28px,
      linear-gradient(225deg, var(--teal) 25%, transparent 25%) 0 0 / 56px 28px,
      linear-gradient(315deg, var(--yellow) 25%, transparent 25%) 0 0 / 56px 28px,
      linear-gradient(45deg, var(--blue) 25%, transparent 25%) 0 0 / 56px 28px;
  }
  .app { border-radius: 0; }
}

/* ---------- title ---------- */
#scrTitle { padding-bottom: 0; gap: 0; }
.hero { height: clamp(300px, 50vh, 440px); }
.hero-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(20,21,26,0.55) 0%, rgba(20,21,26,0) 34%),
    linear-gradient(0deg, var(--asphalt) 0%, rgba(28,30,36,0.85) 18%, rgba(28,30,36,0) 48%);
}
.hero-title { left: max(18px, env(safe-area-inset-left, 0px)); right: 18px; top: auto; bottom: 18px; }
.hero-title h1 { font-size: clamp(54px, 15vw, 72px); line-height: 0.95; text-shadow: 3px 3px 0 var(--pink), 0 6px 30px rgba(0,0,0,0.7); }
.kicker {
  display: inline-flex; align-items: center; gap: 7px; margin: 0 0 8px; padding: 3px 11px 2px; border-radius: 20px;
  background: rgba(20,21,26,0.72); border: 1px solid rgba(255,255,255,0.12); font-size: 12.5px; letter-spacing: 0.02em; backdrop-filter: blur(4px);
}
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); animation: onair 1.4s infinite; box-shadow: 0 0 0 0 rgba(240,83,58,0.6); }
.tagline { margin: 6px 0 0; font-size: 17px; font-weight: 700; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.8); }
.art-strip { margin-top: -1px; }
.title-body { padding-top: 18px; padding-bottom: 18px; gap: 12px; }

.how { list-style: none; margin: 0 0 4px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.how li { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 12px 6px 10px; border-radius: 14px; background: var(--panel); border: 1px solid #2f333d; }
.how i { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 4px; background: rgba(255,201,60,0.12); color: var(--yellow); }
.how li:nth-child(2) i { background: rgba(25,179,166,0.14); color: var(--teal); }
.how li:nth-child(3) i { background: rgba(255,61,127,0.14); color: var(--pink); }
.how svg { width: 22px; height: 22px; }
.how b { font-size: 14px; line-height: 1.25; }
.how span { font-size: 11.5px; color: var(--dim); line-height: 1.3; }

.routes { gap: 10px; }
.route {
  --accent: var(--pink);
  padding: 13px 14px 12px 18px; gap: 6px; border-radius: 16px; border: 2px solid transparent; background: var(--panel);
  /* ticket notches on both sides */
  -webkit-mask: radial-gradient(circle 9px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle 9px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle 9px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle 9px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
  transition: transform 0.12s, background 0.2s, border-color 0.2s;
}
.route::before { background: var(--accent); top: 14px; bottom: 14px; width: 4px; left: 0; border-radius: 0 4px 4px 0; }
.route:nth-child(n)::before { background: var(--accent); }
.route:active { transform: scale(0.985); }
.route.sel { border-color: var(--accent); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 14%, var(--panel)), var(--panel) 70%); }
.t-ends { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.t-ends b { font-size: 18px; font-weight: 800; line-height: 1.2; }
.t-line { position: relative; height: 2px; background: repeating-linear-gradient(90deg, var(--dim) 0 6px, transparent 6px 11px); opacity: 0.7; }
.t-line i { position: absolute; right: -2px; top: -4px; width: 0; height: 0; border-left: 8px solid var(--dim); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.route.sel .t-line { background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 11px); opacity: 1; animation: march 0.9s linear infinite; }
.route.sel .t-line i { border-left-color: var(--accent); }
@keyframes march { to { background-position: 11px 0; } }
.route-blurb { font-size: 13px; line-height: 1.45; }
.t-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-top: 6px; border-top: 1px dashed #3a3f4b; }
.t-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: #d9d2c4; font-weight: 600; }
.t-meta span { display: inline-flex; align-items: center; gap: 4px; }
.t-meta svg { width: 14px; height: 14px; color: var(--dim); }
.diff { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--dim); }
.diff i { width: 6px; height: 12px; border-radius: 2px; background: #3a3f4b; }
.diff i.on { background: var(--accent); }
.diff em { font-style: normal; margin-left: 5px; font-weight: 700; color: #d9d2c4; }
.route-best { font-size: 12px; }

.days { display: flex; gap: 0; padding: 4px; border-radius: 14px; background: #15161b; border: 1px solid #2f333d; }
.day { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 6px; border: 0; border-radius: 10px; background: transparent; color: var(--dim); transition: background 0.2s, color 0.2s; }
.day svg { width: 18px; height: 18px; flex: none; }
.day b { font-size: 14px; white-space: nowrap; }
.day.sel { background: var(--yellow); color: #1b1407; border: 0; }
.day-note { margin: -4px 2px 0; font-size: 13px; color: var(--dim); min-height: 1.4em; }

.ach { border-radius: 14px; background: var(--panel); border: 1px solid #2f333d; }
.ach summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; font-weight: 700; }
.ach summary::-webkit-details-marker { display: none; }
.ach summary::after { content: "▾"; color: var(--dim); margin-left: 8px; transition: transform 0.2s; }
.ach[open] summary::after { transform: rotate(180deg); }
.ach summary .count { margin-left: auto; }
.ach .badges { padding: 4px 14px 14px; }

.dock {
  position: sticky; bottom: 0; z-index: 5; margin-top: auto;
  margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
  padding: 12px max(16px, env(safe-area-inset-left, 0px)) calc(12px + env(safe-area-inset-bottom, 0px));
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  background: linear-gradient(180deg, rgba(28,30,36,0.0), rgba(20,21,26,0.96) 26%); backdrop-filter: blur(6px);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.dock-sum { display: grid; min-width: 0; }
.dock-sum b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-sum span { font-size: 12.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock .cta { min-width: 168px; }

/* ---------- home ---------- */
#scrHome { padding-top: 12px; padding-bottom: 0; gap: 12px; }
.back-link { align-self: flex-start; border: 0; background: transparent; color: var(--dim); font-weight: 700; font-size: 14px; padding: 6px 0; }
.back-link:hover { color: var(--chalk); }
.home-top { padding-right: 0; margin-top: -4px; }
.alarm { width: 88px; height: 88px; }
.home-title { font-size: 25px; }

.timeline { display: grid; gap: 8px; padding: 14px 16px; }
.tl-ends { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: var(--dim); }
.tl-ends span:last-child { color: var(--yellow); }
.tl-bar { display: flex; height: 30px; border-radius: 9px; overflow: hidden; background: #0f1013; gap: 2px; }
.tl-bar i { display: block; min-width: 4px; transition: flex 0.35s cubic-bezier(.3,1.2,.5,1); }
.tl-bar i.road {
  position: relative; background: repeating-linear-gradient(-45deg, #2c7a45 0 8px, #256a3b 8px 16px);
  display: grid; place-items: center;
}
.tl-bar.tight i.road { background: repeating-linear-gradient(-45deg, #8a2a1f 0 8px, #74221a 8px 16px); }
.tl-bar i.road span { font-style: normal; font-size: 12px; font-weight: 800; color: #fff; white-space: nowrap; text-shadow: 0 1px 3px rgba(0,0,0,0.6); }
.tl-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--dim); }
.tl-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

.info-row { display: grid; gap: 10px; }
.radio { padding: 12px 14px; }
.radio-list { font-size: 13.5px; }
.weather { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; font-size: 13.5px; background: #1f2c36; color: #cfe6f2; }
.weather svg { width: 30px; height: 30px; flex: none; }
.weather b { display: block; font-size: 15px; color: #fff; }
.weather.sun { background: linear-gradient(120deg, #3a3020, #2a2620); color: #f1e2c2; }
.weather.sun svg { color: var(--yellow); }
.weather.cloud svg, .weather.rain svg { color: #9cc7e6; }

.prep { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prep-item {
  --c: var(--teal);
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto 1fr; align-items: start;
  gap: 2px 8px; padding: 12px; border-radius: 16px; text-align: left; min-height: 118px;
  background: var(--panel); border: 2px solid #2f333d; transition: border-color 0.2s, background 0.2s, transform 0.1s;
}
.prep-item:active:not(.fixed) { transform: scale(0.97); }
.p-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: #1a1c22; color: var(--dim); grid-row: 1; grid-column: 1; }
.p-icon svg { width: 22px; height: 22px; }
.prep-item .prep-min { grid-row: 1; grid-column: 2; justify-self: end; font-size: 13px; color: var(--dim); }
.prep-item .prep-name { grid-column: 1 / -1; margin-top: 8px; font-size: 15px; }
.prep-item .prep-note { grid-column: 1 / -1; font-size: 11.5px; line-height: 1.35; }
.prep-item .box { position: absolute; right: 10px; bottom: 10px; width: 20px; height: 20px; border-radius: 6px; border: 2px solid #4a4f5b; }
.prep-item.on { border-color: color-mix(in srgb, var(--c) 70%, transparent); background: linear-gradient(160deg, color-mix(in srgb, var(--c) 16%, var(--panel)), var(--panel) 75%); }
.prep-item.on .p-icon { background: var(--c); color: #14151a; }
.prep-item.on .prep-min { color: var(--yellow); }
.prep-item.on .box { background: var(--c); border-color: var(--c); }
.prep-item.on .box::after { content: ""; position: absolute; left: 5px; top: 2px; width: 5px; height: 10px; border: solid #14151a; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.prep-item.fixed { opacity: 0.85; }
.prep-item.fixed .box { display: none; }

#scrHome .dock-sum { grid-template-columns: auto auto; justify-content: start; align-items: baseline; column-gap: 8px; }
#scrHome .leave-label { grid-column: 1 / -1; font-size: 12px; color: var(--dim); }
#scrHome .leave-time { grid-row: auto; font-size: 30px; line-height: 1; }
#scrHome .leave-left { font-size: 13px; }

@media (max-width: 360px) {
  .how span { display: none; }
  .dock .cta { min-width: 140px; font-size: 16px; }
  .prep { grid-template-columns: 1fr; }
  .prep-item { min-height: 0; }
}
.prep-item .prep-note { padding-right: 24px; }
.tl-bar.warn i.road { background: repeating-linear-gradient(-45deg, #8a6a1f 0 8px, #74591a 8px 16px); }
