:root { --bg: #f5f5f7; --panel-bg: #fbfbfd; --ink: #1d1d1f; --muted: #6e6e73; --blue: #0a84ff; --line: rgb(0 0 0 / .07); --panel: 300px; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font: 14px/1.4 Geist, -apple-system, BlinkMacSystemFont, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
.num { font-family: "Geist Mono", ui-monospace, monospace; font-weight: 600; font-variant-numeric: tabular-nums; }

/* the panel gets its own column; the 3D view only uses the space left of it, so nothing covers the splat */
.app { display: grid; grid-template-columns: minmax(0, 1fr) var(--panel); height: 100%; height: 100dvh; }
.view { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

.status { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 10px 18px; border-radius: 999px; font-weight: 600;
  background: rgb(255 255 255 / .8); backdrop-filter: blur(20px); box-shadow: 0 8px 30px rgb(0 0 0 / .12); }
.hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(20px, env(safe-area-inset-bottom)); padding: 8px 14px; border-radius: 999px;
  background: rgb(29 29 31 / .72); color: #fff; font-size: 13px; white-space: nowrap; pointer-events: none; transition: opacity .4s; }
.hint:empty { opacity: 0; }

/* ---- twin thumbsticks for walking on touch screens: a ring and knob follow each thumb,
   and two faint pads show where to put them until you start */
.stick { position: fixed; width: 140px; height: 140px; margin: -70px 0 0 -70px; border-radius: 50%; pointer-events: none; z-index: 3;
  border: 2px solid rgb(255 255 255 / .85); background: rgb(29 29 31 / .18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 6px 24px rgb(0 0 0 / .18); }
.stick i { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px; border-radius: 50%; background: #fff;
  box-shadow: 0 4px 14px rgb(0 0 0 / .25); }
.stick[hidden] { display: none; }
.pads { display: none; position: absolute; left: 0; right: 0; bottom: 24px; justify-content: space-between; padding: 0 28px; pointer-events: none; transition: opacity .3s; }
.pads span { display: grid; place-items: center; width: 104px; height: 104px; border-radius: 50%; border: 2px dashed rgb(255 255 255 / .9);
  background: rgb(29 29 31 / .14); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-shadow: 0 1px 3px rgb(0 0 0 / .4); }
.touch .view.walk .pads { display: flex; }
.touch .view.walk.steering .pads { opacity: 0; }
.touch .hint { bottom: auto; top: max(14px, env(safe-area-inset-top)); }

/* ---- panel */
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--panel-bg); border-left: 1px solid var(--line); }
.head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 18px 18px 10px; padding-top: max(18px, env(safe-area-inset-top)); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: var(--ink); text-decoration: none; }
.count { margin-left: auto; font-size: 12px; color: var(--muted); }
.sub { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 12.5px; }

.list { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 6px 10px 20px; display: flex; flex-direction: column; gap: 2px;
  scrollbar-width: thin; scrollbar-color: rgb(0 0 0 / .16) transparent;
  -webkit-mask-image: linear-gradient(transparent, #000 8px, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(transparent, #000 8px, #000 calc(100% - 24px), transparent); }
.list::-webkit-scrollbar { width: 8px; }
.list::-webkit-scrollbar-thumb { background: rgb(0 0 0 / .16); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }

.card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 7px 8px; border: 0; border-radius: 14px; background: none; cursor: pointer; text-align: left;
  transition: background .15s, box-shadow .15s; }
.card img { width: 64px; height: 44px; flex: 0 0 auto; border-radius: 10px; object-fit: cover; background: #eceef2; }
.card .txt { flex: 1; min-width: 0; }
.card b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .n { flex: 0 0 auto; font-size: 11px; color: var(--muted); }
.card[aria-current="true"] { background: #fff; box-shadow: 0 0 0 1.5px var(--blue), 0 6px 18px rgb(10 132 255 / .12); }
.card[aria-current="true"] .n { color: var(--blue); }
@media (hover: hover) { .card:not([aria-current="true"]):hover { background: rgb(0 0 0 / .04); } }
.card:focus-visible, .modes button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.modes { display: flex; gap: 6px; padding: 12px 16px; border-top: 1px solid var(--line); }
.modes button { flex: 1; min-height: 40px; border: 0; border-radius: 12px; background: #eef0f3; font-weight: 600; cursor: pointer; white-space: nowrap; }
.modes button[aria-pressed="true"] { background: var(--blue); color: #fff; }

.stream { padding: 12px 18px 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.stream .label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.stream .row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; margin-bottom: 5px; }
.stream .row.strong { font-weight: 600; margin-top: 9px; }
.stream .bar { height: 8px; border-radius: 4px; background: rgb(0 0 0 / .06); overflow: hidden; }
.stream .bar.full { background: repeating-linear-gradient(135deg, rgb(0 0 0 / .12) 0 6px, rgb(0 0 0 / .05) 6px 12px); }
.stream .bar i { display: block; height: 100%; min-width: 8px; width: 0; border-radius: 4px; background: var(--blue); transition: width .4s; }

/* narrow screens: the panel becomes a sheet under the 3D view, buildings scroll sideways */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .head { padding: 12px 16px 4px; }
  .sub { display: none; }
  .list { flex: 0 0 auto; flex-direction: row; gap: 6px; padding: 6px 12px 8px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 24px), transparent); }
  .list::-webkit-scrollbar { display: none; }
  .card { width: auto; flex: 0 0 auto; gap: 10px; padding: 6px 12px 6px 6px; }
  .card img { width: 52px; height: 36px; }
  .card small, .card .n { display: none; }
  .modes { padding: 8px 12px; }
  .stream { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; padding: 8px 16px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .stream .label { display: none; }
  .stream .row.strong { margin-top: 0; grid-column: 2; grid-row: 1; }
  .stream .bar.full { grid-column: 1; grid-row: 2; }
  .stream .bar:not(.full) { grid-column: 2; grid-row: 2; }
}
