:root { --safe-top: env(safe-area-inset-top); --safe-right: env(safe-area-inset-right); --safe-bottom: env(safe-area-inset-bottom); --safe-left: env(safe-area-inset-left); }
:root {
  --ink: #f2eee4;
  --muted: #b4afa3;
  --panel: rgba(16, 18, 26, 0.9);
  --gold: #e9b44c;
  --rim: rgba(233, 180, 76, 0.38);
  --line: rgba(255, 255, 255, 0.14);
  --red: #b3241f;
  /* The bundled Inter (same as the start screens): Trebuchet MS is missing on Android and Linux. */
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { touch-action: none; margin: 0; height: 100%; overflow: hidden; background: #27231e; color: var(--ink); }
[hidden] { display: none !important; }
html { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input { -webkit-user-select: text; user-select: text; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button {
  font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 12px; cursor: pointer; touch-action: manipulation;
}
button:hover { background: rgba(255, 255, 255, 0.16); }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button.primary { background: linear-gradient(#f2c460, #c6861f); color: #1b1407; border-color: transparent; font-weight: 700; }
button[aria-pressed="true"], .tabs button.active { background: var(--ink); color: #1a1a1a; font-weight: 700; }

.center { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; }
.card { width: min(360px, 100%); padding: 24px; background: var(--panel); border-radius: 12px; }
.card h1 { margin: 0 0 8px; font-size: 32px; }
/* #1050 text for screen readers and search engines only (the logo's own words); no visual change */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.card p { margin: 0 0 16px; color: var(--muted); line-height: 1.4; }
.card .note { margin: 12px 0 0; font-size: 13px; }
.error { color: #ff9c8f !important; }
#test-login { width: 100%; }
#online { white-space: nowrap; background: #1f7fb0; border-color: transparent; font-weight: 700; }
#name-login { display: grid; gap: 10px; }
#name-login[hidden] { display: none; }
#name-login input { width: 100%; min-height: 44px; padding: 0 12px; font: inherit; font-size: 16px; color: var(--ink); background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 8px; }

#creator .panel {
  position: fixed; top: 16px; left: 16px; bottom: 16px; width: 330px; padding: 18px;
  background: var(--panel); border-radius: 12px; display: flex; flex-direction: column;
}
.panel h2 { margin: 0 0 8px; }
#choices { flex: 1; overflow-y: auto; min-height: 0; padding-right: 4px; }
.choice { margin-bottom: 13px; }
.choice > span { display: block; margin-bottom: 5px; font-size: 13px; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 6px; }
.row button { padding: 7px 10px; font-size: 14px; text-transform: capitalize; }
.row .swatch { width: 34px; height: 34px; padding: 0; border-width: 2px; }
.row .swatch[aria-pressed="true"] { border-color: var(--ink); outline: 2px solid var(--ink); outline-offset: 1px; }
#ride { margin-top: 12px; padding: 12px; font-size: 17px; }


.coins b { color: #f2c14e; }

#prompt {
  position: fixed; left: 50%; bottom: 112px; transform: translateX(-50%); margin: 0; padding: 10px 16px;
  background: var(--panel); border-radius: 8px; font-weight: 700; white-space: nowrap;
}
#stunt, #event {
  position: fixed; left: 50%; top: 118px; transform: translateX(-50%); min-width: 240px; padding: 10px 16px;
  background: var(--panel); border-radius: 10px; text-align: center;
}
#stunt b, #event b { display: block; font-size: 18px; }
#stunt span, #event span { color: #f2c14e; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
#event { top: 16px; left: 16px; transform: none; text-align: left; min-width: 180px; }
.balance { height: 8px; margin-top: 6px; border-radius: 4px; background: linear-gradient(90deg, #3a3f3a 0 38%, #5fd06a 38% 72%, #e44a3b 72%); overflow: hidden; position: relative; }
.balance i { position: absolute; top: 0; bottom: 0; width: 4px; background: #fff; left: 0; }

#keys { position: fixed; z-index: 32; left: 16px; top: 16px; width: 330px; max-height: calc(100% - 140px); overflow-y: auto; }
#keys h2, #activity h2 { margin: 0 0 10px; }
#keys dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; font-size: 14px; }
#keys dt { font-weight: 700; }
#keys dd { margin: 0; color: var(--muted); }
#keys .keys-touch, #keys #keys-close { display: none; }   /* #1009 only on touch screens (below) */

/* #400: the tuning shop styles live in the "#400 step 2" block at the end of this file. */
.coins-line { margin: 0; padding: 5px 10px; border-radius: 999px; background: var(--panel); font-size: 13px; color: var(--muted); white-space: nowrap; }
.coins-line b { color: #f2c14e; font-size: 15px; }
.tabs { display: flex; flex: none; gap: 4px; }

#activity-list { max-height: 62vh; overflow-y: auto; touch-action: pan-y; }
#activity-list button { display: block; width: 100%; margin-bottom: 8px; text-align: left; }
#activity-list small { display: block; color: var(--muted); }

/* The big map: a square frame the square village fills, zoom with wheel, pinch or the + / - buttons (map.js). */
#map { position: fixed; inset: 0; z-index: 30; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; align-content: center; gap: 12px; padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left)); background: rgba(10, 11, 12, 0.72); }
.map-frame { position: relative; width: min(100%, calc(100vh - 100px)); width: min(100%, calc(100dvh - 100px - var(--safe-top) - var(--safe-bottom))); aspect-ratio: 1; }
#bigmap { display: block; width: 100%; height: 100%; border-radius: 14px; border: 1px solid var(--rim); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); cursor: grab; touch-action: none; }
#bigmap:active { cursor: grabbing; }
.map-zoom { position: absolute; right: 10px; top: 10px;   /* top: at the bottom they covered the Schatzsucher-Hütte label (owner screenshot) */ display: grid; gap: 8px; }
.map-zoom button { width: 44px; height: 44px; padding: 0; border-color: var(--rim); background: var(--panel); font-size: 24px; font-weight: 700; line-height: 1; }
#close-map { min-height: 44px; padding: 0 18px; border-color: var(--rim); background: var(--panel); font-weight: 700; }
@media (max-height: 500px) {
  .map-frame { width: min(100%, calc(100vh - 32px)); width: min(100%, calc(100dvh - 32px - var(--safe-top) - var(--safe-bottom))); }
  #close-map { position: fixed; top: calc(16px + var(--safe-top)); right: calc(16px + var(--safe-right)); }
}

.touch { display: none; }
#logout-phone { display: none; }

@media (pointer: coarse) {
  .touch { display: block; }
  #logout { display: none; }
  #logout-phone { display: block; width: 100%; margin-top: 8px; }
  .pad-top button { font-size: 12px; padding: 0 2px; min-width: 52px; }
  .pad-left, .pad-right, .pad-top, .pad-tricks { position: fixed; display: flex; gap: 8px; }
  .pad-left { left: calc(16px + var(--safe-left)); bottom: calc(16px + var(--safe-bottom)); }
  .pad-right { right: calc(16px + var(--safe-right)); bottom: calc(16px + var(--safe-bottom)); flex-wrap: wrap; width: 148px; }
  .pad-top { right: calc(16px + var(--safe-right)); bottom: calc(176px + var(--safe-bottom)); }
  .pad-tricks { left: calc(16px + var(--safe-left)); bottom: calc(112px + var(--safe-bottom)); flex-wrap: wrap; width: 160px; gap: 6px; }
  .pad-tricks button { font-size: 11px; min-width: 48px; padding: 0 2px; }
  .touch button { touch-action: none; min-width: 44px; min-height: 44px; background: var(--panel); }
  .pad-left button { width: min(100px, 23vw); height: 84px; font-size: 22px; }
  .pad-right button { width: 70px; height: 70px; font-size: 14px; }
  #prompt { bottom: auto; top: 160px; white-space: normal; max-width: calc(100% - 32px); }
  #stunt { top: 200px; }
}
@media (max-width: 640px) {
  #creator .panel { top: auto; left: 16px; right: 16px; bottom: calc(16px + var(--safe-bottom)); width: auto; height: auto; max-height: 64%; }
  .tabs button { padding: 6px 9px; }
  #keys { top: 118px; left: 16px; right: 16px; width: auto; }
}

/* One HUD per state. Set on #hud by applyHudState() in main.js. */
#hud:is([data-state="foot"], [data-state="parked"], [data-state="riding"]) #stunt { display: none; }
#hud:is([data-state="wheelie"], [data-state="stoppie"]) #prompt { display: none; }
#stunt-hint { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }

@media (pointer: coarse) {
  .touch .ready { background: #2f9e44; animation: ready 1.1s ease-in-out infinite; }
  @keyframes ready { 50% { transform: scale(1.07); } }
  #hud[data-state="parked"] #pad-gas { background: #2f9e44; animation: ready 1.1s ease-in-out infinite; }

  #prompt { max-width: 46vw; top: 64px; font-size: 13px; }
  #hud:is([data-state="wheelie"], [data-state="stoppie"]) #stunt { top: calc(8px + var(--safe-top)); }
  .touch .trick { display: none; }
  #stick { display: none; }
  #hud[data-state="foot"] :is(.blink, .pad-left, .pad-right, .pad-icons) { display: none; }
  #hud[data-state="foot"] #stick { display: block; position: fixed; left: calc(20px + var(--safe-left)); bottom: calc(20px + var(--safe-bottom)); width: 136px; height: 136px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); border: 2px solid rgba(255, 255, 255, 0.35); touch-action: none; pointer-events: auto; }
  #stick-knob { position: absolute; left: 38px; top: 38px; width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); }

  #hud[data-state="parked"] :is([data-key="lift"], [data-key="front"]) { display: none; }
  #hud[data-moving="true"] #mount, #hud[data-moving="true"] [data-press="KeyR"] { display: none; }

  #hud[data-state="wheelie"] .trick { display: block; min-width: 62px; min-height: 52px; font-size: 13px; background: rgba(242, 193, 78, 0.28); }
  #hud[data-state="wheelie"] :is(.blink, .pad-top, [data-key="front"]) { display: none; }
  #hud[data-state="wheelie"] [data-key="brake"] { background: rgba(228, 74, 59, 0.45); }

  #hud[data-state="stoppie"] :is(.blink, .pad-top, [data-key="gas"], [data-key="lift"]) { display: none; }
  #hud[data-state="stoppie"] [data-key="front"] { background: rgba(242, 193, 78, 0.28); }
}

/* In the air: balance and tricks only. #990 Heben becomes "Salto" (Hoch / Runter only lean the bike now). */
@media (hover: none), (max-width: 900px) {
  #hud[data-state="air"] #stunt { top: calc(8px + var(--safe-top)); }
  #hud[data-state="air"] .trick { display: block; min-width: 62px; min-height: 52px; font-size: 13px; background: rgba(242, 193, 78, 0.35); }
  #hud[data-state="air"] :is(.blink, .pad-top, [data-key="front"]) { display: none; }
  #hud[data-state="air"] [data-key="lift"] { background: rgba(242, 193, 78, 0.35); }
  #hud[data-state="air"] [data-key="gas"] { background: rgba(95, 208, 106, 0.45); }
  #hud[data-state="air"] [data-key="brake"] { background: rgba(228, 74, 59, 0.45); }
}

/* Fishing: the view stays open, only a meter at the side and one big button. */
#fish-note { position: fixed; top: calc(10px + var(--safe-top)); left: 50%; transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px; background: var(--panel); font-size: 14px; white-space: nowrap; }
#fish-close { position: fixed; top: calc(10px + var(--safe-top)); right: calc(12px + var(--safe-right)); }
#fish-button { position: fixed; right: calc(20px + var(--safe-right)); bottom: calc(20px + var(--safe-bottom)); width: 120px; height: 120px; border-radius: 50%; font-size: 16px; touch-action: none; }
#fish-button.ready { background: #2f9e44; }
#cast-meter { position: fixed; right: calc(20px + var(--safe-right)); bottom: calc(150px + var(--safe-bottom)); width: 120px; height: 16px; border-radius: 8px; overflow: hidden; border: 2px solid #fff; background: linear-gradient(90deg, #39424e 0 80%, #2f9e44 80% 96%, #f2c14e 96% 100%); }
#cast-fill { display: block; height: 100%; width: 100%; background: rgba(255, 255, 255, 0.75); transform-origin: left; }
#fish-meter { position: fixed; left: calc(20px + var(--safe-left)); top: 70px; bottom: 30px; display: flex; gap: 6px; }
.fish-track { position: relative; width: 34px; border-radius: 8px; background: rgba(22, 23, 24, 0.7); overflow: hidden; }
#fish-zone { position: absolute; left: 0; right: 0; background: rgba(228, 74, 59, 0.6); }
#fish-zone.on { background: rgba(95, 208, 106, 0.8); }
#fish-spot { position: absolute; left: 4px; right: 4px; height: 8px; margin-bottom: -4px; border-radius: 4px; background: #f2c14e; }
.fish-catch { position: relative; width: 10px; border-radius: 5px; background: rgba(22, 23, 24, 0.7); overflow: hidden; }
#fish-progress { position: absolute; left: 0; right: 0; bottom: 0; background: #f2c14e; }

/* Menu button: opens a small list under the top bar. */
#menu { position: fixed; z-index: 33; display: grid; gap: 6px; min-width: 132px; padding: 6px; border-radius: 10px; background: var(--panel); }
#menu button, #menu a { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.08); color: var(--ink); font-size: 14px; text-align: left; text-decoration: none; }


/* The one top instrument panel. Everything scales from --u so it fits any phone, either way up. */
/* #1031 --cl-h is the dashboard itself; --top-h is where the lanes under it start: the Sommer-Bonus badge (44 px, hangs under the dashboard)
   pushes every lane (prompt, goal, pills, left column, toasts) down by --badge-h so nothing sits on it. 0 on short sideways phones. */
:root { --top-w: min(calc(100vw - 12px), 100vh, 640px); --u: calc(var(--top-w) / 100); --cl-h: calc(var(--u) * 30); --top-h: calc(var(--cl-h) + var(--badge-h, 0px)); }
:root:has(#hud:not([hidden]) #sb-badge:not([hidden])) { --badge-h: 62px; }   /* #1081 badge 46 px + 6 px gap + 10: notices were 1 px into its touch box */
.icon { width: 1.5em; height: 1.5em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#cluster {
  position: fixed; top: calc(6px + var(--safe-top)); left: 50%; transform: translateX(-50%); width: var(--top-w); height: var(--cl-h);
  display: grid; grid-template-columns: calc(var(--u) * 9.5) calc(var(--u) * 30) 1fr calc(var(--u) * 23) calc(var(--u) * 9); gap: calc(var(--u) * 1);
  align-items: center; padding: 0 calc(var(--u) * 2.2); font-variant-numeric: tabular-nums;
}
#cluster::before {
  content: ""; position: absolute; inset: calc(var(--u) * 3.2) 0; border-radius: calc(var(--u) * 11); z-index: -1;
  background: linear-gradient(rgba(38, 41, 50, 0.92), rgba(9, 10, 15, 0.94)); border: 1px solid var(--rim);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.14), 0 calc(var(--u) * 0.8) calc(var(--u) * 2.4) rgba(0, 0, 0, 0.5);
}
#cluster::after {
  content: ""; position: absolute; left: 12%; right: 38%; bottom: calc(var(--u) * 3.2); height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent); box-shadow: 0 0 calc(var(--u) * 1.4) var(--gold);
}
#cluster button { padding: 0; background: linear-gradient(rgba(58, 62, 74, 0.9), rgba(18, 20, 27, 0.95)); }
.c-left { display: grid; gap: calc(var(--u) * 1.6); }
.chip {
  display: flex; align-items: center; justify-content: center; gap: calc(var(--u) * 1); height: calc(var(--u) * 8.6); border-radius: calc(var(--u) * 4.3);
  font-size: calc(var(--u) * 3.2); background: linear-gradient(rgba(58, 62, 74, 0.9), rgba(18, 20, 27, 0.95)); border: 1px solid var(--rim); color: var(--ink);
}
.chip b { font-size: calc(var(--u) * 5.4); font-style: italic; }
#engine-button { color: rgba(255, 255, 255, 0.3); border-color: var(--line); }
#engine-button.on { color: #6fe36a; }
.c-gauge {
  position: relative; width: calc(var(--u) * 30); height: calc(var(--u) * 30); border-radius: 50%; color: var(--ink);
  background: radial-gradient(circle, #1b1e26 0 52%, #06070b 100%); border: calc(var(--u) * 0.6) solid #b9b2a2;
  box-shadow: 0 0 0 calc(var(--u) * 0.4) var(--gold), 0 0 calc(var(--u) * 3) rgba(233, 180, 76, 0.55);
}
#dial { position: absolute; inset: 0; width: 100%; height: 100%; }
#dial line { stroke: #fff; stroke-width: 1.5; }
#dial line.major { stroke-width: 3; }
#dial text { fill: #f4f1e8; font: italic 700 15px Inter, system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; }
#dial .redline { fill: none; stroke: #e63a2e; stroke-width: 4; }
#dial circle { fill: #4b4f58; stroke: #15171c; stroke-width: 2; }
#needle { fill: var(--gold); }
#speed { position: absolute; left: 0; right: 0; top: 60%; text-align: center; font-size: calc(var(--u) * 6.4); font-style: italic; line-height: 1; }
.unit { position: absolute; left: 0; right: 0; top: 77%; text-align: center; font-size: calc(var(--u) * 2.2); color: var(--muted); }
#odo { position: absolute; left: 22%; right: 22%; top: 87%; text-align: center; font-size: calc(var(--u) * 2.1); font-variant-numeric: tabular-nums; color: #f4f1e8; background: #000; border-radius: calc(var(--u) * 0.5); }
.lamp { position: absolute; font-size: calc(var(--u) * 2.8); color: rgba(255, 255, 255, 0.14); line-height: 1; }
#lamp-left { left: 24%; top: 66%; }
#lamp-right { right: 24%; top: 66%; }
#lamp-head { left: 50%; top: 27%; transform: translateX(-50%); }
#lamp-left.on, #lamp-right.on { color: #ffa63d; }
#lamp-head.on { color: #7fb6ff; }
.c-mid { display: grid; gap: calc(var(--u) * 1.6); min-width: 0; font-size: calc(var(--u) * 3); }
.c-fuel { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: calc(var(--u) * 1); row-gap: calc(var(--u) * 0.8); }
.c-fuel span { text-align: right; white-space: nowrap; }
.fuel { grid-column: 1 / -1; height: calc(var(--u) * 2.2); border-radius: calc(var(--u) * 1.1); background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.fuel i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #f2c460, #e0931f); }
.fuel.low i { background: #e44a3b; }
.c-row { display: flex; gap: calc(var(--u) * 0.8); }
.coins { flex: 1; display: flex; align-items: center; gap: calc(var(--u) * 0.8); min-width: 0; color: #f2c14e; font-weight: 700; }
.coins i { width: calc(var(--u) * 2.6); height: calc(var(--u) * 2.6); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe9a8, #d9981f); flex: none; }
/* clock (#137): in-game time beside the coins; small, muted, tabular digits. On foot it sits under the coins. */
.hud-clock { flex: none; display: flex; align-items: center; gap: calc(var(--u) * 0.5); color: #d9dde6; font-weight: 600; font-size: 0.86em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud-muted { color: #f2a65a; }
.hud-muted[hidden] { display: none; }
.hud-clock .icon { width: 1.05em; height: 1.05em; }
.hud-clock .sun { color: #f2c14e; }
.hud-clock .moon { color: #9fb8ff; display: none; }
.hud-clock.night .sun { display: none; }
.hud-clock.night .moon { display: inline; }
/* The coins column is narrow on the bike: the clock wraps onto its own line under the coins instead of overlapping. */
.c-row:has(.hud-clock) { flex-wrap: wrap; row-gap: calc(var(--u) * 0.3); }
.c-row:has(.hud-clock) .coins { flex: 1 0 auto; }
#hud[data-state="foot"] .c-row { flex-direction: column; align-items: flex-start; gap: calc(var(--u) * 0.4); }
#hud[data-state="foot"] .coins { flex: none; }
/* clock (#137): sideways phones on the bike leave the middle column only ~50 px (the map overlapped fuel and coins):
   the fuel and clock icons give way, the fuel bar and the numbers stay. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  #hud:not([data-state="foot"]) :is(.c-fuel svg, .hud-clock .icon) { display: none; }
  #hud:not([data-state="foot"]) #cluster { grid-template-columns: max(44px, calc(var(--u) * 9.5)) calc(var(--u) * 30) 1fr calc(var(--u) * 15) max(44px, calc(var(--u) * 9)); }
  #hud:not([data-state="foot"]) #minimap { width: calc(var(--u) * 15); }
}
#bike-button { display: flex; align-items: center; gap: calc(var(--u) * 0.6); height: calc(var(--u) * 7); padding: 0 calc(var(--u) * 1.4); border-radius: calc(var(--u) * 3.5); font-size: calc(var(--u) * 3); }
#minimap { width: calc(var(--u) * 25); height: calc(var(--u) * 21); border-radius: calc(var(--u) * 6); border: 2px solid var(--rim); cursor: pointer; justify-self: end; }
#hud:is([data-state="wheelie"], [data-state="stoppie"], [data-state="air"]) :is(.c-mid, #minimap) { display: none; }
#hud:is([data-state="wheelie"], [data-state="stoppie"], [data-state="air"]) #speed { color: #f2c14e; }
#hud:is([data-state="wheelie"], [data-state="stoppie"], [data-state="air"]) #cluster { width: calc(var(--u) * 52); grid-template-columns: auto auto auto; }
/* #1031 the Menü button stays during wheelie / stoppie / air (it used to vanish with them: on a slow tablet the bike counts as airborne
   on every bump, so the button was "not visible" most of the ride; the pads, coins and map still step away). */
#hud #prompt, #hud #stunt, #hud #event { top: calc(var(--top-h) + 12px + var(--safe-top)) !important; bottom: auto; }
#hud #event { left: 50%; transform: translateX(-50%); text-align: center; }
#hud #stunt { top: calc(var(--top-h) + 58px + var(--safe-top)) !important; }
@media (max-height: 600px) and (orientation: landscape) {
  /* Short landscape screens: the rider fills the middle, so the trick panel sits compact in the free top-right corner. */
  #hud #stunt { top: calc(14px + var(--safe-top)) !important; left: auto; right: calc(16px + var(--safe-right)); transform: none; min-width: 0; width: 220px; padding: 8px 12px; }
  #stunt b { font-size: 16px; }
  #stunt span { font-size: 20px; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  /* Landscape phones keep the toasts in that corner: the panel goes just under them, clear of the trick buttons. */
  #hud #stunt { top: calc(var(--top-h) + 22px + var(--safe-top)) !important; }
}

/* Same glass and gold on every panel and button. */
.card, .panel, #prompt, #toast, #stunt, #event, #menu, .shop-bar, #shop-dock, #fish-note, #fish-meter { border: 1px solid var(--rim); border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }
button { border-radius: 12px; }
#toggle-menu {
  position: fixed; right: calc(16px + var(--safe-right)); top: calc(var(--top-h) + 14px + var(--safe-top)); width: 46px; height: 46px; padding: 0; display: grid; place-items: center;
  border-radius: 14px; background: linear-gradient(rgba(44, 47, 56, 0.86), rgba(14, 16, 22, 0.88));
}
#menu { right: calc(16px + var(--safe-right)); left: auto; min-width: 170px; overflow-y: auto; touch-action: pan-y; }
#clock { margin: 2px 4px; color: var(--muted); font-variant-numeric: tabular-nums; }

@media (pointer: coarse) {
  :root { --big: 84px; --small: min(46px, 11vw); }
  .touch button {
    min-width: 0; min-height: 0; padding: 0 2px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    background: linear-gradient(rgba(44, 47, 56, 0.82), rgba(14, 16, 22, 0.86)); box-shadow: inset 0 1px rgba(255, 255, 255, 0.12), 0 3px 8px rgba(0, 0, 0, 0.4);
  }
  .touch .ready { background: #2f9e44; }
  .pad-left button { width: min(92px, 21vw); height: var(--big); }
  .pad-right, .pad-icons { display: grid; grid-template-columns: min(92px, 21vw) min(92px, 21vw); gap: 8px; width: auto; right: calc(16px + var(--safe-right)); flex-wrap: nowrap; }
  .pad-right button { width: auto; height: var(--big); font-size: 14px; font-weight: 700; }
  [data-key="front"], [data-key="brake"] { grid-column: 1; grid-row: 1; }
  [data-key="lift"], [data-key="gas"] { grid-column: 2; grid-row: 1; }
  .pad-icons { position: fixed; bottom: calc(24px + var(--big) + var(--safe-bottom)); }
  .pad-icons button { height: 54px; font-size: 11px; font-weight: 700; flex-direction: row; gap: 5px; }
  .touch .held { background: rgba(242, 193, 78, 0.5); }
  #light-button.on { color: #7fb6ff; }
  #toggle-menu { top: auto; bottom: calc(86px + var(--big) + var(--safe-bottom)); width: var(--small); height: var(--small); }
  #hud[data-state="foot"] #toggle-menu { bottom: calc(16px + var(--safe-bottom)); }
  .pad-top { bottom: calc(86px + var(--big) + var(--safe-bottom)); right: calc(22px + var(--small) + var(--safe-right)); gap: 8px; }
  .pad-top button { height: var(--small); padding: 0 12px; font-size: 13px; font-weight: 700; flex-direction: row; gap: 6px; }
  #action-button:not(.ready) { display: none; }
  .pad-tricks { bottom: calc(24px + var(--big) + var(--safe-bottom)); width: auto; flex-wrap: nowrap; }
  .pad-tricks .blink { width: var(--small); height: var(--small); }
  .trick .icon, .pad-tricks .trick { font-size: 11px; }
  #hud[data-state="foot"] .pad-top { bottom: calc(16px + var(--safe-bottom)); }
}

#menu button, #menu a { display: flex; align-items: center; gap: 8px; }
#fish-button, #fish-close { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
#fish-close { flex-direction: row; }

/* The action button only appears when there is something to do, and it cannot be missed. */
@media (pointer: coarse) {
  #action-button:not(.ready) { display: none; }
  .touch #action-button.ready {
    position: fixed; left: auto; right: calc(12px + var(--safe-right)); bottom: calc(220px + var(--big) + var(--safe-bottom)); width: 84px; height: 84px; border-radius: 50%; padding: 0;
    flex-direction: column; gap: 4px; font-size: 14px; color: #1b1407; font-weight: 700; background: linear-gradient(#f7cf6a, #cf8d20); border: 2px solid #fff3c9;
    box-shadow: 0 0 22px rgba(242, 193, 78, 0.8); animation: none;
  }
  .touch #action-button .icon { width: 28px; height: 28px; }
  #hud[data-moving="true"] #station-button { display: none; }
  #hud:is([data-state="wheelie"], [data-state="air"]) .trick { display: flex; flex-direction: column; gap: 2px; min-width: 66px; min-height: 58px; }
  #hud[data-state="wheelie"] .trick .icon, #hud[data-state="air"] .trick .icon { width: 24px; height: 24px; }
}
#fish-button .icon { display: none; width: 30px; height: 30px; }
#fish-button[data-stage="ready"] [data-for="ready"], #fish-button[data-stage="cast"] [data-for="cast"], #fish-button[data-stage="wait"] [data-for="wait"],
#fish-button[data-stage="bite"] [data-for="bite"], #fish-button[data-stage="fight"] [data-for="fight"], #fish-button[data-stage="caught"] [data-for="caught"],
#fish-button[data-stage="lost"] [data-for="lost"] { display: block; }
#fish-spot { left: 0; right: 0; height: 26px; margin-bottom: -13px; background: none; color: #ffd566; display: grid; place-items: center; }
#fish-spot .icon { width: 26px; height: 26px; stroke-width: 2.2; }
#fish-hook { position: absolute; left: 30px; bottom: -6px; color: #ffd566; }
#fish-close { background: var(--panel); }

/* On foot the speedo, gear and engine lamp go; fuel, coins, Moped button and map stay. */
#hud[data-state="foot"] :is(.c-left, .c-gauge) { display: none; }
#hud[data-state="foot"] #cluster { grid-template-columns: 1fr calc(var(--u) * 25); height: calc(var(--u) * 24); }
#hud[data-state="foot"] #cluster::after { display: none; }
#hud[data-state="foot"] .c-mid { padding-left: calc(var(--u) * 2); }

/* Coins earned: pops in at the corner, sparkles, fades away. */
#coin-pops { position: fixed; z-index: 20; right: calc(10px + var(--safe-right)); top: calc(var(--top-h) + 14px + var(--safe-top)); display: grid; gap: 6px; justify-items: end; pointer-events: none; }
.pop {
  position: relative; display: grid; grid-template-columns: auto auto; column-gap: 6px; align-items: center; max-width: 58vw; padding: 6px 12px 6px 8px;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--rim); animation: pop-in 0.35s cubic-bezier(0.2, 1.6, 0.4, 1), pop-out 0.4s ease-in 1.8s forwards;
}
.pop i { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff0b8, #e0a01f 70%); box-shadow: 0 0 10px rgba(242, 193, 78, 0.9); animation: coin-spin 0.6s ease-out; }
.pop b { color: #ffd566; font-size: 18px; line-height: 1; }
.pop small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; line-height: 1.2; text-align: right; }
.pop u { position: absolute; left: 19px; top: 17px; width: 6px; height: 6px; background: #fff3c9; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); opacity: 0; animation: spark 0.7s ease-out forwards; }
@keyframes pop-in { from { transform: translateX(40px) scale(0.6); opacity: 0; } }
@keyframes pop-out { to { transform: translateX(30px); opacity: 0; } }
@keyframes coin-spin { from { transform: rotateY(540deg); } }
@keyframes spark { 0% { opacity: 1; transform: scale(1.4); } 100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(0.3) rotate(90deg); } }
@media (max-width: 640px) {
  #fish-note { left: calc(10px + var(--safe-left)); right: 118px; transform: none; text-align: center; border-radius: 14px; white-space: normal; }
}
#hud:is([data-state="parked"], [data-state="foot"]) #power-button { display: none; }

/* Tablets: bigger pads under the thumbs, further in from the corners. */
@media (pointer: coarse) and (min-width: 768px) and (min-height: 600px) {
  :root { --big: 118px; --small: 62px; --top-w: min(calc(100vw - 12px), 100vh, 720px); }
  .pad-left { left: calc(28px + var(--safe-left)); bottom: calc(28px + var(--safe-bottom)); gap: 12px; }
  .pad-left button { width: 132px; }
  .pad-right, .pad-icons { grid-template-columns: 132px 132px; gap: 12px; right: calc(28px + var(--safe-right)); }
  .pad-right { bottom: calc(28px + var(--safe-bottom)); }
  .pad-right button { font-size: 17px; }
  .pad-right .icon, .pad-left .icon { width: 36px; height: 36px; }
  .pad-icons { bottom: calc(40px + var(--big) + var(--safe-bottom)); }
  .pad-icons button { height: 68px; font-size: 13px; }
  .pad-top, #toggle-menu { bottom: calc(120px + var(--big) + var(--safe-bottom)); }
  .pad-top { right: calc(40px + var(--small) + var(--safe-right)); }
  .pad-top button { font-size: 15px; }
  .pad-tricks { left: calc(28px + var(--safe-left)); bottom: calc(40px + var(--big) + var(--safe-bottom)); gap: 10px; }
  .pad-tricks .trick { font-size: 13px; }
  #hud[data-state="foot"] #stick { left: calc(36px + var(--safe-left)); bottom: calc(36px + var(--safe-bottom)); transform: scale(1.3); transform-origin: left bottom; }
  #fish-button { width: 150px; height: 150px; right: calc(32px + var(--safe-right)); bottom: calc(32px + var(--safe-bottom)); }
  #cast-meter { width: 150px; right: calc(32px + var(--safe-right)); bottom: calc(196px + var(--safe-bottom)); }
}

#shop-led .swatch[aria-pressed="true"] { outline: 3px solid #f2c14e; outline-offset: 1px; }   /* #400: the rest of the old shop rules moved to the end */
.hud-round { position: absolute; z-index: 5; right: 12px; width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 21px; }
#emoji-open { top: calc(var(--hud-top, 150px) + 52px); }
#led-ring { top: calc(var(--hud-top, 150px) + 104px); }
#led-ring[aria-pressed="true"] { color: #f2c14e; }
#emoji-row { position: absolute; z-index: 6; right: 62px; top: calc(var(--hud-top, 150px) + 52px); display: grid; grid-template-columns: repeat(4, 44px); gap: 6px; padding: 8px; border-radius: 14px; background: rgba(16, 18, 26, 0.82); }
#emoji-row[hidden] { display: none; }
#emoji-row button { width: 44px; height: 44px; padding: 0; font-size: 24px; background: transparent; }
#emoji-open { touch-action: none; }
#emoji-row button.picked { background: #f2c14e; transform: scale(1.25); }
#emoji-open img, #emoji-row img { width: 28px; height: 28px; pointer-events: none; }

/* The emoji and LED buttons stack right above the menu button, wherever that one sits. */
#emoji-open, #led-ring, #emoji-row { position: fixed; bottom: auto; }
#emoji-open, #led-ring { right: calc(16px + var(--safe-right)); }
#emoji-row { right: calc(70px + var(--safe-right)); }
#emoji-open, #emoji-row { top: calc(var(--top-h) + 68px + var(--safe-top)); }
#led-ring { top: calc(var(--top-h) + 120px + var(--safe-top)); }
@media (pointer: coarse) {
  #hud { --menu-bottom: calc(86px + var(--big) + var(--safe-bottom)); }
  #hud[data-state="foot"] { --menu-bottom: calc(16px + var(--safe-bottom)); }
  #emoji-open, #led-ring, #emoji-row { top: auto; }
  #emoji-open, #emoji-row { bottom: calc(var(--menu-bottom) + var(--small) + 8px); }
  #led-ring { bottom: calc(var(--menu-bottom) + var(--small) + 60px); }
}
@media (pointer: coarse) and (min-width: 768px) and (min-height: 600px) {
  #hud { --menu-bottom: calc(120px + var(--big) + var(--safe-bottom)); }
}

/* The controls stay readable but let the road show through. */
@media (pointer: coarse) {
  .touch button, #toggle-menu, .hud-round {
    background: linear-gradient(rgba(44, 47, 56, 0.16), rgba(14, 16, 22, 0.22));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  }
  .touch .icon { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7)); }
  .touch .held { background: rgba(242, 193, 78, 0.5); }
  .touch .ready { background: rgba(47, 158, 68, 0.5); }
}

/* Menu and moped stats stand above each other at the right end of the top bar. */
.c-buttons { display: grid; gap: calc(var(--u) * 1.6); }
#cluster .c-buttons button {
  position: static; width: calc(var(--u) * 9); height: calc(var(--u) * 9); padding: 0; display: grid; place-items: center;
  border-radius: calc(var(--u) * 3.2); font-size: calc(var(--u) * 3.2); border: 1px solid var(--rim);
}
#cluster .c-buttons button > :not(svg:first-child) { display: none; }
#minimap { width: calc(var(--u) * 23); }
@media (pointer: coarse) {
  #emoji-open, #emoji-row { bottom: var(--menu-bottom); }
  #led-ring { bottom: calc(var(--menu-bottom) + var(--small) + 8px); }
}
#hud[data-state="foot"] #cluster { grid-template-columns: 1fr calc(var(--u) * 23) calc(var(--u) * 9); }

/* The fuel bar stands upright at the left of the middle block and fills from the bottom. */
.c-mid { grid-template-columns: calc(var(--u) * 2.4) auto 1fr; column-gap: calc(var(--u) * 1.2); }
.c-fuel { display: contents; }
.c-fuel span { grid-column: 3; grid-row: 1; align-self: center; }
.c-fuel svg { grid-column: 2; grid-row: 1; align-self: center; }
.fuel { grid-column: 1; grid-row: 1 / 3; height: auto; display: flex; flex-direction: column; justify-content: flex-end; }
.fuel i { height: 100%; background: linear-gradient(0deg, #e0931f, #f2c460); flex: none; }
.c-row { grid-column: 2 / -1; grid-row: 2; }
#event.hurry #event-time { color: #ff5a4a; font-weight: 700; }

/* Gas and lift, brake and front form one tall button each: slide up over the chevron to pull a trick. */
@media (pointer: coarse) {
  .touch { --pad-bottom: 16px; }
  .pad-icons { gap: 8px; bottom: calc(var(--pad-bottom) + var(--big) + var(--safe-bottom)); }
  .pad-right button { border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; box-shadow: none; }
  .pad-icons button { border-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; box-shadow: none; }
  .pad-right button { position: relative; }
  .pad-right button::before {
    content: ''; position: absolute; left: 50%; top: -6px; width: 14px; height: 14px; margin-left: -7px; pointer-events: none;
    border-left: 3px solid rgba(255, 255, 255, 0.75); border-top: 3px solid rgba(255, 255, 255, 0.75); transform: rotate(45deg);
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
  }
  .pad-right [data-key="brake"]::before { display: none; }
  /* Sliding from gas to brake starts a burnout. */
  .pad-right [data-key="gas"]::after {
    content: ''; position: absolute; left: -11px; top: 50%; width: 14px; height: 14px; margin-top: -7px; pointer-events: none;
    border-left: 3px solid rgba(255, 255, 255, 0.75); border-bottom: 3px solid rgba(255, 255, 255, 0.75); transform: rotate(45deg);
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
  }
  #hud:is([data-state="parked"], [data-state="stoppie"], [data-state="air"]) [data-key="gas"]::before { display: none; }
  #hud:not([data-state="stopped"], [data-state="riding"]) [data-key="gas"]::after { display: none; }
  .pad-top { right: calc(16px + var(--safe-right)); }
  #emoji-open, #emoji-row { bottom: calc(var(--menu-bottom) + var(--small) + 8px); }
  #led-ring { bottom: calc(var(--menu-bottom) + (var(--small) + 8px) * 2); }
}
@media (pointer: coarse) and (min-width: 768px) and (min-height: 600px) {
  .touch { --pad-bottom: 28px; }
  .pad-top { right: calc(28px + var(--safe-right)); }
}

/* #872 The clothes shop (Modeladen, dress-shop.js): the rider stands free and big, everything for sale sits in one dock.
   Wide screens: a column on the right. Portrait phones: the lower half. Category buttons wrap, cards and colour dots
   sit in a vertical grid; only the list scrolls, and only up and down. Nothing ever scrolls sideways. */
#dress { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
#dress-dock {
  position: absolute; pointer-events: auto; display: flex; flex-direction: column; gap: 8px; right: 0; top: 0; bottom: 0; width: min(48vw, 440px); overflow: hidden;
  padding: calc(10px + var(--safe-top)) calc(10px + var(--safe-right)) calc(10px + var(--safe-bottom)) 10px;
  background: rgba(16, 18, 24, 0.86); border-left: 1px solid var(--rim); color: var(--ink);
}
.dress-head { display: flex; align-items: center; gap: 10px; flex: none; }
.dress-head h2 { margin: 0 auto 0 0; font-size: 18px; }
#dress-dock .ui-icon { display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; }
#dress-dock .ui-icon svg { width: 100%; height: 100%; }
#dress-close { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; flex: none; }
#dress-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(46px, 1fr)); gap: 4px; flex: none; }
#dress-tabs .ds-tab { position: relative; display: grid; justify-items: center; align-content: center; gap: 1px; min-width: 0; min-height: 52px; padding: 4px 1px; font-size: 12px; font-weight: 600; line-height: 1.1; }
#dress-tabs .ds-tab > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#dress-tabs .ds-tab .ds-pic svg { width: 26px; height: 26px; }
#dress-tabs .ds-tab[aria-pressed="true"] { background: #f2c14e; color: #1a1a1a; border-color: transparent; }
#dress-tabs .ds-tab.pending::after { content: ''; position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: #ff8c3a; box-shadow: 0 0 0 2px rgba(16, 18, 24, 0.9); }
#dress-parts { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; display: grid; align-content: start; gap: 12px; padding: 2px 3px 4px; margin: 0 -3px; }
.ds-block h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 6px; font-size: 14px; font-weight: 700; }
.ds-block h3 small { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.ds-pic { display: grid; place-items: center; line-height: 0; }
.ds-pic svg { width: 40px; height: 40px; }
.ds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.ds-card { position: relative; display: grid; justify-items: center; align-content: start; gap: 3px; min-width: 0; min-height: 100px; padding: 8px 5px 7px; border-radius: 12px; text-align: center; font-size: 13px; line-height: 1.2; }
.ds-card .ds-name { max-width: 100%; overflow-wrap: anywhere; hyphens: auto; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-weight: 600; }
.ds-card[aria-pressed="true"] { background: rgba(242, 193, 78, 0.2); color: var(--ink); border: 2px solid #f2c14e; padding: 7px 4px 6px; }
.ds-state { display: inline-flex; align-items: center; gap: 3px; margin-top: auto; font-size: 12px; font-weight: 700; white-space: nowrap; }
.ds-state .ui-icon, .ds-block h3 small .ui-icon, #dress-total .ui-icon { width: 14px; height: 14px; }
.ds-price { display: inline-flex; align-items: center; gap: 2px; color: #f2c14e; font-weight: 700; }
.ds-price .ui-icon { width: 14px; height: 14px; }
.ds-state.broke { color: #ff8c7d; }
.ds-state.on { color: #10121a; background: #7fd68a; border-radius: 999px; padding: 1px 7px 1px 4px; }
.ds-state.mine { color: #9fdcaa; }
.ds-dots { display: grid; grid-template-columns: repeat(auto-fill, 44px); gap: 8px; justify-content: start; padding: 3px; }
.ds-dot { position: relative; width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%; background: var(--dot) !important; border: 2px solid rgba(255, 255, 255, 0.28); }
.ds-dot[aria-pressed="true"] { outline: 3px solid #f2c14e; outline-offset: 2px; border-color: #10121a; }
.ds-dot.locked::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: 13px; height: 13px; border-radius: 50%; background: radial-gradient(circle, #f2c14e 0 3px, #b9861f 3.5px 100%); box-shadow: 0 0 0 2px rgba(16, 18, 24, 0.9); }
.ds-dot.worn::before { content: ''; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px #10121a; }
.dress-pay { display: flex; align-items: center; gap: 8px; flex: none; padding-top: 8px; border-top: 1px solid var(--line); }
#dress-undo { display: inline-flex; align-items: center; gap: 4px; flex: none; min-height: 48px; padding: 0 10px; font-size: 13px; }
#dress-total { display: grid; flex: 1; min-width: 0; margin: 0; gap: 1px; line-height: 1.2; }
#dress-total b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#dress-total small { font-size: 12px; color: var(--muted); }
#dress-total.broke small { color: #ff8c7d; font-weight: 700; }
#dress-total.ds-done b { color: #7fd68a; }
#dress-total.ds-pop { animation: ds-pop 0.45s ease-out; }
@keyframes ds-pop { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
#dress-go { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none; min-width: 112px; min-height: 48px; padding: 0 16px; font-size: 16px; }
#dress-go .ui-icon { width: 18px; height: 18px; }
#dress-go.broke { background: #4a453d; color: #d8d0c2; }
@media (orientation: portrait) {
  #dress-dock { left: 0; top: auto; width: auto; height: 47%; border-left: 0; border-top: 1px solid var(--rim); border-radius: 16px 16px 0 0;
    padding: 10px calc(10px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(10px + var(--safe-left)); }
  .ds-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}
/* Low landscape phones: smaller cards, so a whole row and the colours fit above the bar. */
@media (orientation: landscape) and (max-height: 480px) {
  #dress-dock { gap: 6px; padding-top: calc(6px + var(--safe-top)); padding-bottom: calc(6px + var(--safe-bottom)); }
  .dress-head h2 { font-size: 16px; }
  #dress-tabs .ds-tab { min-height: 46px; }
  #dress-tabs .ds-tab .ds-pic svg { width: 22px; height: 22px; }
  .ds-card { min-height: 86px; padding-top: 6px; }
  .ds-pic svg { width: 32px; height: 32px; }
  .dress-pay { padding-top: 6px; }
}
/* A new rider picks only this, the rest comes from the clothes shop. */
#choices.start { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: none; }
#choices.start button { padding: 18px 8px; font-size: 16px; font-weight: 700; }
#choices.start button[aria-pressed="true"] { outline: 3px solid #f2c14e; outline-offset: 1px; }

/* The angler's hut: picture, name and what it does, one row each. */
#angler { position: fixed; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(8, 12, 16, 0.35); }
#angler-dock {
  display: flex; flex-direction: column; gap: 10px; width: min(560px, calc(100vw - 20px)); max-height: min(640px, calc(100vh - 20px)); padding: 12px;
  background: rgba(16, 18, 24, 0.9); border: 1px solid var(--rim); border-radius: 14px; color: var(--ink);
}
#angler-tabs { display: flex; gap: 6px; flex: none; }
#angler-tabs button { flex: 1; padding: 8px; font-size: 14px; }
#angler-tabs button[aria-pressed="true"] { background: #f2c14e; color: #1a1a1a; }
#angler-list { flex: 0 1 auto; min-height: 0; overflow-y: auto; touch-action: pan-y; display: grid; align-content: start; gap: 8px; font-size: 14px; }
.angler-empty { margin: 0; padding: 22px 12px; text-align: center; color: var(--muted); }
.angler-card { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--rim); border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.angler-card.active { border-color: #f2c14e; }
.angler-card img { flex: none; width: 56px; height: 56px; object-fit: contain; }
.angler-card div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.angler-card small { color: var(--muted); }
.angler-card button { flex: none; padding: 7px 10px; font-size: 13px; }

/* Helmet and goggles buttons sit to the left of the emoji. */
#helmet-toggle, #goggles-toggle { position: fixed; bottom: auto; top: calc(var(--top-h) + 68px + var(--safe-top)); }
#helmet-toggle { right: calc(16px + var(--safe-right) + 54px); }
#goggles-toggle { right: calc(16px + var(--safe-right) + 108px); }
#helmet-toggle.wait, #goggles-toggle.wait { opacity: 0.45; }   /* #911 riding: shown dimmed, a tap says stop first */
@media (pointer: coarse) {
  #helmet-toggle, #goggles-toggle { top: auto; bottom: calc(var(--menu-bottom) + var(--small) + 8px); }
}
/* #1081 PC: the key sits on the button (O helmet, P goggles), the button is a bit bigger and brighter (a player did not find how to put the helmet back on). */
@media (pointer: fine) {
  #helmet-toggle, #goggles-toggle { width: 48px; height: 48px; border-color: var(--gold); }
  #helmet-toggle { right: calc(16px + var(--safe-right) + 58px); }
  #goggles-toggle { right: calc(16px + var(--safe-right) + 116px); }
  #helmet-toggle::before, #goggles-toggle::before { content: attr(data-keycap); position: absolute; right: -4px; bottom: -4px; min-width: 18px; padding: 1px 4px; border-radius: 6px; background: var(--gold); color: #1b1407; font: 800 12px/16px system-ui, sans-serif; text-align: center; pointer-events: none; }
  #helmet-toggle.off:not(.wait), #goggles-toggle.off:not(.wait) { box-shadow: 0 0 0 3px rgba(242, 193, 78, 0.55); }   /* off and free to change: the ring says "put it back on" */
}

/* Tablets and sideways phones: the top bar moves to the left, clear of the buttons on the right. */
@media (pointer: coarse) and (orientation: landscape), (pointer: coarse) and (min-width: 768px) {
  #cluster { left: calc(6px + var(--safe-left)); transform: none; }
}

/* Small sideways phones: the round action button sits top right, off the HUD and the pads. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .touch #action-button.ready { left: auto; right: calc(10px + var(--safe-right)); transform: none; bottom: auto; top: calc(8px + var(--safe-top)); width: 84px; height: 84px; }
}
/* #1031 sideways phones have no height to spare under the dashboard: the Sommer-Bonus badge sits beside it, under the emoji buttons. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  :root:has(#hud:not([hidden]) #sb-badge:not([hidden])) { --badge-h: 0px; }
  #sb-badge { left: calc(var(--top-w) + 18px + var(--safe-left)) !important; top: calc(66px + var(--safe-top)) !important; }
}
#hud[data-state="foot"] #minimap { height: calc(var(--u) * 16); }

/* R13: the next goal, a slim line under the top panel. A prompt steps below it; races and tricks hide it. */
#goal {
  position: fixed; z-index: 15; left: 50%; transform: translateX(-50%); top: calc(var(--top-h) + 8px + var(--safe-top));
  display: flex; align-items: center; gap: 6px; width: max-content; max-width: min(calc(100vw - 150px), 460px); padding: 5px 12px; margin: 0;   /* #949 width: max-content, else a fixed box at left 50% has only half the screen (195 px on a phone) and cuts the text */
  border: 1px solid var(--rim); border-radius: 999px; background: rgba(16, 18, 26, 0.62); color: var(--ink);
  font-size: 13px; line-height: 1.25; text-align: left; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}
#goal span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#goal .icon { width: 1.2em; height: 1.2em; color: var(--gold); }
#hud:has(#goal:not([hidden]):not(.docked)) #prompt { top: calc(var(--top-h) + 58px + var(--safe-top)) !important; }
#goal.on { border-color: #ffe04a; }
#goal.on .icon { color: #ffe04a; }
#hud:is([data-state="wheelie"], [data-state="stoppie"], [data-state="air"]) #goal { display: none; }
@media (max-width: 500px) { #goal { font-size: 12px; padding: 4px 10px; max-width: calc(100vw - 132px); } }

/* R16 daily goals board (daily.js). Used in the menu card and later on the garage Tafel. */
.daily { display: grid; gap: 8px; }
.daily h3 { margin: 6px 0 0; font-size: 15px; color: var(--gold); }
.daily-goal { position: relative; display: grid; gap: 5px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.daily-goal.done { border-color: var(--rim); background: rgba(233, 180, 76, 0.1); }
.daily-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.daily-head b { font-size: 15px; line-height: 1.25; }
.daily-coins { flex: none; color: var(--gold); font-weight: 700; }
.daily-bar { height: 6px; overflow: hidden; border-radius: 3px; background: rgba(255, 255, 255, 0.12); }
.daily-bar i { display: block; height: 100%; background: var(--gold); }
.daily-goal small, .daily-note { color: var(--muted); font-size: 12px; line-height: 1.35; }
#activity-list .daily-swap, .daily-swap { justify-self: start; width: auto; margin: 2px 0 0; padding: 6px 12px; font-size: 13px; }
.daily-empty { margin: 0; color: var(--muted); }

/* R22 trick combos (combo.js): big but brief, left of the bike, no box, clicks pass through. */
#combo {
  position: fixed; z-index: 35; left: calc(20px + var(--safe-left)); top: 50%; transform: translateY(-50%); pointer-events: none;
  max-width: calc(30vw - 28px); transform-origin: left center; color: #fff; font-weight: 800; line-height: 1.15;   /* #996 left of the road (the road zone starts at 30 % of the width) */
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6), 0 0 10px rgba(0, 0, 0, 0.65);
}
#combo[hidden] { display: none; }
#combo b, #combo small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#combo span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#combo b { font-size: clamp(22px, 3.4vw, 40px); color: #f2c14e; }
#combo span { font-size: clamp(13px, 1.9vw, 19px); }
#combo small { font-size: clamp(12px, 1.6vw, 15px); color: #f2c14e; font-weight: 700; }
#combo[data-kind="done"] b { color: #7ee07e; }
#combo[data-kind="lost"] b, #combo[data-kind="lost"] small { color: #ff7a6b; }
#combo.pop-in { animation: combo-pop 0.25s ease-out; }
@keyframes combo-pop { from { scale: 1.2; opacity: 0.4; } to { scale: 1; opacity: 1; } }
/* #996 phones (portrait and landscape): no room left of the road, so it is a compact two-line label centred in the top lane under the notices (hud-layers.js stacks it below them). */
@media (max-width: 640px), (max-height: 500px) {
  #combo { left: 50%; top: calc(var(--lane) + var(--lane-intro) + var(--lane-prompt) + 104px); transform: translateX(-50%); transform-origin: center top; text-align: center; max-width: min(300px, calc(100vw - 2 * var(--lane-side, 60px))); }
  #combo { padding: 4px 12px 5px; border-radius: 12px; background: rgba(16, 18, 26, 0.5); }
  #combo b { display: inline-block; font-size: 20px; vertical-align: baseline; }
  #combo small { display: inline-block; margin-left: 8px; font-size: 12px; vertical-align: baseline; }
  #combo span { font-size: 12px; -webkit-line-clamp: 1; }
}
@media (max-height: 500px) and (orientation: landscape) { #combo { top: calc(64px + var(--safe-top, 0px)); } }

/* R3 delivery jobs (jobs.js): a big cancel button in the timer box, easy to hit with a thumb. */
#event #job-cancel { display: inline-block; vertical-align: middle; margin: 0 0 0 12px; min-height: 36px; padding: 4px 14px; font-size: 14px; }
#event #job-cancel[hidden] { display: none; }
/* The job box says what to do ("Anhalten!"); the prompt would sit behind it. */
#hud:has(#job-cancel:not([hidden])) #prompt { display: none; }
/* R18 Fahrer-Ruf: on a level-up the toast glows gold and stars fly out around it (reputation-ui.js); the board. */
#toast.rep-glow .note:first-child { border-color: var(--gold); box-shadow: 0 0 22px rgba(242, 193, 78, 0.75); animation: note-pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes note-pop { from { transform: scale(0.6); opacity: 0; } }

/* ---- Notifications: toast() in main.js, one style, one place, one layer order ----
   #460 STACKING ORDER (z-index, low to high): world 0 · HUD 1–8 · pills/prompt/job timer 15 · coin pops, photo 20–21 ·
   panels and menus 30–35 (map, home PC 30; clique, garage 31; activity menus, daily/book/Ruf, keys 32; phone menu 33) ·
   intro arrow 36 · dialogs and results 41–44 · TOASTS 50 · full screens (login, servers) 60 · celebrate 70.
   A message the player must read is therefore never behind a menu. With a menu open the toast moves to the top edge
   (below the bar in the shop and photo mode) so the menu's own buttons (sticky bars, Schließen) stay free.
   Lane under the dashboard, top to bottom: intro tip → goal or village pill → prompt → toasts (phones and small
   screens). Big screens and landscape phones put the toasts in the free top-right corner beside the dashboard. */
body { --lane: calc(var(--top-h) + 8px + var(--safe-top)); --lane-intro: 0px; --lane-pill: 0px; --lane-prompt: 0px; }
body:has(#intro-tip:not([hidden])) { --lane-intro: calc(var(--intro-h, 70px) + 8px); }
body:has(#vev:not([hidden]):not(.docked)), body:not(:has(#intro-tip:not([hidden]))):has(#goal:not([hidden]):not(.docked)) { --lane-pill: 44px; }
body:has(#hud:not([hidden]) #prompt:not([hidden])) { --lane-prompt: 48px; }
#hud #prompt, #hud #event { z-index: 15; }
body > #intro-tip { z-index: 19; }
body:has(#home-pc:not([hidden])) > #intro-tip { z-index: 31; }
#activity { z-index: 32; }
#toast {
  position: fixed; z-index: 50; left: 50%; right: auto; bottom: auto; transform: translateX(-50%);   /* #460 z 50: above every panel and dialog (<=44), below full screens (60+) */
  top: calc(var(--lane) + var(--lane-intro) + var(--lane-pill) + var(--lane-prompt)) !important;
  width: min(calc(100vw - 24px), 460px); max-width: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none;
  background: none; border: 0; border-radius: 0; box-shadow: none; color: var(--ink); white-space: normal; text-align: left;
}
#toast .note {
  pointer-events: auto; cursor: pointer; display: flex; align-items: center; gap: 9px; max-width: 100%; box-sizing: border-box;
  padding: 8px 14px; border: 1px solid var(--rim); border-radius: 14px; background: rgba(16, 18, 26, 0.88);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); font-size: 15px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere;
  animation: note-in 0.22s ease-out; transition: opacity 0.22s, transform 0.22s;
}
#toast .note::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
#toast .note > span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3;   /* #949 3 lines: the long messages were cut after 2 */ -webkit-box-orient: vertical; }
#toast .note[data-count]::after { content: attr(data-count); flex: none; padding: 0 6px; border-radius: 8px; background: rgba(242, 193, 78, 0.2); color: var(--gold); font-size: 0.85em; }
#toast .note.important { border-color: var(--gold); color: #ffe7a8; }
#toast .note.out { opacity: 0; transform: translateY(-6px); }
@keyframes note-in { from { opacity: 0; transform: translateY(-8px) scale(0.97); } }
@media (pointer: coarse), (max-width: 640px) {
  #toast { max-height: 18vh; overflow: hidden; gap: 4px; }   /* #949 room for two notes of 3 lines */
  #toast .note { padding: 6px 12px; font-size: 14px; border-radius: 12px; }
  #prompt { max-width: calc(100vw - 24px); }
}
@media (pointer: fine) and (min-width: 1180px) and (min-height: 600px), (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  #toast {
    left: auto; right: calc(16px + var(--safe-right)); transform: none; top: calc(14px + var(--safe-top)) !important;
    width: min(420px, calc((100vw - var(--top-w)) / 2 - 36px)); max-height: calc(var(--top-h) + 4px); overflow: hidden; align-items: flex-end;
  }
}
@media (pointer: fine) and (min-width: 1180px) and (min-height: 600px) { #toast .note { font-size: 16px; padding: 9px 16px; } }
/* Phone menu open: the pills under it would only peek out around it. */
@media (pointer: coarse) {
  body:has(#hud #menu:not([hidden])) :is(#vev, #goal, #intro-arrow, #vev-top, #mp-rank, #vev-light, #vev-vote) { visibility: hidden; }   /* #999 the ranking lists too */
  #hud #menu { background: rgba(13, 15, 21, 0.97); }
  /* #460 A menu is open: the toast sits at the very top of the screen (over the sheet's title, never over its buttons) instead of waiting behind it. */
  body:has(:is(#activity, #map, #keys, #home-pc, #photo-result):not([hidden])) #toast { top: calc(6px + var(--safe-top)) !important; bottom: auto; max-height: 18vh; }   /* #460 */
  body:has(#photo:not([hidden])) #toast { top: calc(72px + var(--safe-top)) !important; }   /* #460 below the photo mode's close button */
  body:has(#shop:not([hidden])) #toast { top: calc(64px + var(--safe-top)) !important; }   /* #460 below the shop bar (Zurück) */
  /* #460 landscape phone: the close button of the map is at the top centre, so its toasts wait at the bottom edge */
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  body:has(#map:not([hidden])) #toast { top: auto !important; bottom: calc(8px + var(--safe-bottom)); left: 50%; right: auto; transform: translateX(-50%); align-items: center; }   /* #460 */
}
.rep-up { position: fixed; z-index: 41; width: 0; height: 0; pointer-events: none; }
.rep-up u { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; background: #ffe39a; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); opacity: 0; animation: spark 1s ease-out forwards; }
@keyframes rep-in { from { transform: translateX(-50%) scale(0.6); opacity: 0; } }
.rep-board { display: grid; gap: 8px; }
.rep-board h3 { margin: 6px 0 0; }
.rep-unlock:not(.done) { opacity: 0.6; }

/* R21 split time at each race gate: big, brief, green when faster than your best, red when slower. */
/* #996 (feedback #117: "versperrt ganze Sicht"): never in the middle of the road. A small chip beside the race card in the
   top lane (phones: under it, see the media rules below), 1,8 s, fades in and out. */
#split { position: fixed; z-index: 35; left: calc(50% + 150px); top: calc(var(--top-h) + 22px + var(--safe-top)); white-space: nowrap; padding: 3px 14px; border-radius: 10px; font-size: 24px; font-weight: 800;
  font-variant-numeric: tabular-nums; color: #fff; background: rgba(40, 40, 40, 0.85); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); pointer-events: none; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); animation: split-show 1.8s ease both; }
@keyframes split-show { 0% { opacity: 0; scale: 0.85; } 10% { opacity: 1; scale: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
#split[data-state="faster"] { background: rgba(28, 150, 64, 0.92); }
#split[data-state="slower"] { background: rgba(200, 40, 32, 0.92); }
#split[hidden] { display: none; }

/* R17 Sammelbuch (collection-ui.js), in the menu card. */
#activity .card:has(.book) { width: min(560px, 100%); }
.book { display: grid; gap: 8px; }
.book-head { display: grid; gap: 6px; }
.book-head b { font-size: 17px; color: var(--gold); }
.book-tabs { overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; touch-action: pan-x; }
.book-tabs button { flex: none; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
#activity-list .book-tabs button, #activity-list .book-titles button { display: inline-block; width: auto; margin: 0; }
.book-page { display: grid; gap: 8px; min-height: 40vh; align-content: start; }
.book-info b { font-size: 15px; }
.book-sets, .book-titles, .book-stickers { display: flex; flex-wrap: wrap; gap: 6px; }
.book-set { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 4px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--muted); }
.book-set.done { border-color: var(--rim); color: var(--gold); }
.book-set img { width: 18px; height: 18px; }
.book-set:not(.done) img { filter: grayscale(1) opacity(0.5); }
.book-group { margin: 4px 0 0; font-size: 13px; color: var(--gold); }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
#activity-list .book-tile { position: relative; display: grid; justify-items: center; gap: 3px; width: auto; margin: 0; padding: 6px 4px; text-align: center; border-radius: 10px; }
.book-tile.owned { border-color: var(--rim); }
.book-tile.picked { outline: 2px solid var(--ink); outline-offset: 1px; }
.book-art { position: relative; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 8px; }
.book-art img { max-width: 100%; max-height: 100%; }
.book-art .book-emoji { width: 30px; height: 30px; }
.book-art.swatch { width: 44px; height: 44px; margin: 6px; border-radius: 50%; background: var(--part, #8a8a8a); box-shadow: inset 0 -6px 10px rgba(0, 0, 0, 0.35), inset 0 4px 8px rgba(255, 255, 255, 0.25); }
.book-art.swatch .book-emoji { width: 22px; height: 22px; }
/* Missing: a dark shadow of the thing. */
.book-tile.missing .book-art img { filter: brightness(0) opacity(0.55); }
.book-tile.missing .book-art.swatch { background: #15161a; box-shadow: none; }
.book-tile.missing .book-name { color: var(--muted); }
.book-name { font-size: 11px; line-height: 1.2; overflow-wrap: anywhere; }
.book-medal { position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.4); }
.book-new { position: absolute; top: 2px; right: 2px; padding: 1px 5px; border-radius: 6px; font-size: 10px; font-style: normal; font-weight: 700; color: #1a1a1a; background: var(--gold); }
/* Part pictures (assets/book/parts.webp) on a cream card. Owned: full colour, gold rim and a tick; missing: a faint
   shadow of the part on a dark card. The rarity sits under the name in the fish colours. */
.book-art.part { width: 64px; height: 64px; background: #fff8ec; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08); }
.book-art.part.swatch { width: 44px; height: 44px; margin: 10px; background: var(--part, #8a8a8a); }
.book-sprite { position: absolute; inset: 2px; background-repeat: no-repeat; }
#activity-list .book-tile.owned { background: rgba(233, 180, 76, 0.16); border: 2px solid var(--gold); }
#activity-list .book-tile.missing { background: rgba(255, 255, 255, 0.03); border: 1px dashed rgba(255, 255, 255, 0.18); }
.book-tile.missing .book-art.part { background: rgba(255, 248, 236, 0.07); box-shadow: none; }
.book-tile.missing .book-sprite { filter: brightness(0) invert(1) opacity(0.28); }
.book-tile.owned .book-name { font-weight: 700; }
.book-tile .book-name { font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-rank { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; line-height: 1.1; color: var(--rank); }
.book-rank::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--rank); }
.book-tile.missing .book-rank { opacity: 0.8; }
.book-have { position: absolute; top: 3px; left: 3px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 12px; color: #1a1a1a; background: var(--gold); }
.book-sticker { display: inline-grid; justify-items: center; gap: 2px; width: 70px; padding: 6px 2px; border-radius: 12px; border: 3px solid #fff; background: var(--sticker); transform: rotate(-4deg); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4); }
.book-sticker:nth-child(even) { transform: rotate(3deg); }
.book-sticker img { width: 28px; height: 28px; }
.book-sticker small { font-size: 9px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.book-sticker.missing { background: #15161a; border-color: rgba(255, 255, 255, 0.15); box-shadow: none; }
.book-sticker.missing img { filter: brightness(0) opacity(0.5); }
.book-sticker.missing small { color: var(--muted); }
.book-sticker.can-pick { cursor: pointer; }
.book-sticker.on-bike { outline: 3px solid #e9b44c; outline-offset: 2px; }
.book-sticker.picked { transform: rotate(0deg) scale(1.08); box-shadow: 0 0 0 3px #fff, 0 3px 10px rgba(0, 0, 0, 0.5); }
.book-sticker-action { display: grid; gap: 4px; }
.book-sticker-button { justify-self: start; }
.book-titles button.active { background: var(--gold); color: #1a1a1a; font-weight: 700; }

/* R18 Fahrer-Ruf: tricks the rider has not unlocked yet stay hidden; locked jobs on the board are greyed. */
#hud .trick.locked { display: none !important; }
#activity-list button.locked { opacity: 0.55; filter: grayscale(1); }

/* R6 races against other players (mprace.js): lobby, invite, live ranking, results. */
#mp-lobby { position: fixed; z-index: 42; right: calc(12px + var(--safe-right)); top: calc(var(--top-h) + 150px + var(--safe-top)); width: min(300px, calc(100vw - 24px)); padding: 14px 16px; }
#mp-lobby h2, #mp-result h2 { margin: 0; font-size: 18px; }
.mp-sub { margin: 2px 0 6px !important; color: var(--gold) !important; font-weight: 700; }
.mp-clock { margin: 0 0 8px !important; font-variant-numeric: tabular-nums; }
.mp-riders { margin: 0 0 10px; padding-left: 22px; display: grid; gap: 4px; }
.mp-riders li { display: flex; gap: 6px; align-items: center; }
.mp-host { font-size: 12px; color: var(--muted); }
.mp-badge { padding: 1px 6px; border-radius: 6px; background: #3f6f45; color: #e8f5e4; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.mp-buttons { display: flex; gap: 8px; }
.mp-buttons button { flex: 1; }
.mp-buttons button:disabled { opacity: 0.5; cursor: default; }
#mp-invite { position: fixed; z-index: 42; left: 50%; transform: translateX(-50%); bottom: calc(150px + var(--safe-bottom)); display: grid; grid-template-columns: 1fr auto auto; gap: 2px 10px; align-items: center;
  padding: 10px 12px 10px 16px; max-width: calc(100vw - 24px); background: var(--panel); border: 1px solid var(--rim); border-radius: 16px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }
#mp-invite b { grid-column: 1; }
#mp-invite span { grid-column: 1; grid-row: 2; color: var(--muted); font-size: 13px; }
#mp-invite button { grid-row: 1 / span 2; min-height: 44px; }
#mp-invite .mp-no { min-width: 44px; }
#mp-rank { position: fixed; z-index: 34; left: calc(12px + var(--safe-left)); top: calc(var(--top-h) + 70px + var(--safe-top)); margin: 0; padding: 6px 10px; list-style: none; min-width: 170px;
  background: rgba(13, 15, 21, 0.78); border-radius: 12px; font-variant-numeric: tabular-nums; pointer-events: none; }
#mp-rank li { display: grid; grid-template-columns: 24px 1fr auto; gap: 6px; padding: 2px 0; font-size: 15px; }
#mp-rank li b { color: var(--gold); }
#mp-rank li i { font-style: normal; color: var(--muted); }
#mp-rank li.me span { font-weight: 800; color: #fff; }
#mp-result { position: fixed; z-index: 43; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 24px)); padding: 18px; display: grid; gap: 12px; }
.mp-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.mp-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 400; padding: 4px 6px; }
.mp-table td { padding: 6px; border-top: 1px solid var(--line); }
.mp-table td span + .mp-badge { margin-left: 6px; }
.mp-table tr.me td { color: var(--gold); font-weight: 700; }
@media (max-width: 640px) {
  #mp-rank { top: calc(var(--top-h) + 150px + var(--safe-top)); min-width: 140px; padding: 4px 8px; }
  #mp-rank li { font-size: 13px; grid-template-columns: 20px 1fr auto; }
}

/* R23 village events (village-events.js): the pill takes the next-goal spot, the live top list sits left, results in the middle. */
#vev {
  position: fixed; z-index: 15; left: 50%; transform: translateX(-50%); top: calc(var(--top-h) + 8px + var(--safe-top));
  display: flex; align-items: center; gap: 6px; width: max-content; max-width: min(calc(100vw - 150px), 480px); padding: 6px 14px; margin: 0;   /* #949 */
  border: 1px solid #f2c14e; border-radius: 999px; background: rgba(40, 24, 8, 0.78); color: #fff4d6;
  font-size: 13px; font-weight: 700; line-height: 1.25; text-align: left; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35); font-variant-numeric: tabular-nums;
}
#vev span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#vev.live { border-color: #ffe04a; background: rgba(120, 60, 0, 0.82); animation: vev-glow 1.6s ease-in-out infinite; }
#vev.on { outline: 2px solid #ffe04a; }
@keyframes vev-glow { 50% { box-shadow: 0 0 16px rgba(255, 210, 60, 0.7); } }
/* The intro tip (intro.js) uses the same spot: the pill moves below it. */
body:has(#intro-tip:not([hidden])) #vev { top: calc(var(--top-h) + 16px + var(--intro-h, 70px) + var(--safe-top)); }
/* Tip, pill and prompt all at once (new rider during an event): stack them instead of overlapping. */
body:has(#intro-tip:not([hidden])):has(#vev:not([hidden]):not(.docked)) #hud #prompt { top: calc(var(--top-h) + 58px + var(--intro-h, 70px) + var(--safe-top)) !important; }
body:has(#vev:not([hidden]):not(.docked)) #prompt { top: calc(var(--top-h) + 58px + var(--safe-top)) !important; }
#vev-top { position: fixed; z-index: 34; left: calc(12px + var(--safe-left)); top: calc(var(--top-h) + 70px + var(--safe-top)); margin: 0; padding: 6px 10px; list-style: none; min-width: 160px;
  background: rgba(13, 15, 21, 0.78); border-radius: 12px; font-variant-numeric: tabular-nums; pointer-events: none; }
#vev-top li { display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; padding: 2px 0; font-size: 14px; }
#vev-top li.vev-head { display: block; color: var(--gold); font-weight: 800; font-size: 13px; }
#vev-top li b { color: var(--gold); }
#vev-top li i { font-style: normal; color: var(--muted); }
#vev-top li.me span { font-weight: 800; color: #fff; }
body:has(#mp-rank:not([hidden])) #vev-top { display: none; }
/* #999 A menu or shop is open: the in-world lists and pills (fish ranking, race ranking, event, goal ...) never draw on top of it. */
body:has(:is(#shop, #dress, #angler, #creator, #activity, #map, #keys, #home-pc, #photo-result, #chat-rules, #player-list, #clip-sheet, #invite):not([hidden])) :is(#vev-top, #mp-rank, #vev, #goal, #vev-light, #vev-vote, #stunt, #event, #split, #chat-list, #to-moped) { visibility: hidden; }
#vev-result { position: fixed; z-index: 43; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 24px)); padding: 18px; display: grid; gap: 12px; }
#vev-result[hidden] { display: none; }
#vev-result h2 { margin: 0; font-size: 18px; }
#vev-result .vev-none { margin: 0; }
@media (max-width: 640px) {
  #vev { font-size: 12px; padding: 4px 10px; max-width: calc(100vw - 132px); }
  #vev-top { top: calc(var(--top-h) + 150px + var(--safe-top)); min-width: 130px; padding: 4px 8px; }
  #vev-top li { font-size: 13px; grid-template-columns: 20px 1fr auto; }
}

/* ---- HUD and panels polish (WP-E): thumb-sized targets, a lower desktop dashboard, one panel look (as the notification pills) ---- */
/* Desktop: a smaller dashboard keeps the horizon and the banners in view (a mouse needs no 44 px targets). */
@media (pointer: fine) { :root { --top-w: min(calc(100vw - 12px), 100vh, 440px); } }
/* Touch: every dashboard button at least 44 px. */
@media (pointer: coarse) {
  :root { --small: 48px; }
  #cluster { grid-template-columns: max(44px, calc(var(--u) * 9.5)) calc(var(--u) * 30) 1fr calc(var(--u) * 21) max(44px, calc(var(--u) * 9)); }
  #cluster::before { inset: calc(var(--u) * 1.4) 0; }
  .c-left, .c-buttons { gap: 4px; }
  .chip, #cluster .c-buttons button { min-width: 44px; min-height: 44px; }
  #minimap { width: calc(var(--u) * 21); }
  #hud[data-state="foot"] #cluster { grid-template-columns: 1fr calc(var(--u) * 21) max(44px, calc(var(--u) * 9)); }
  /* Engine off only while standing: at speed the button would sit right where the thumb rests (the dashboard one still works). */
  #hud[data-moving="true"] #power-button { display: none; }
  /* Blinkers, light and horn wrap upwards instead of running into the brake. */
  .pad-tricks { flex-wrap: wrap-reverse; align-content: flex-start; max-width: calc(100vw - 54px - 2 * min(92px, 21vw) - var(--safe-left) - var(--safe-right)); }
  #menu button, #menu a { min-height: 44px; }
}
/* On foot fuel means nothing: only coins, the map and the buttons stay. */
#hud[data-state="foot"] .c-fuel { display: none; }
#hud[data-state="foot"] .c-row { grid-row: 1 / 3; align-self: center; }
#hud[data-state="foot"] .c-mid { font-size: calc(var(--u) * 3.6); }

/* Volume slider in the menu, under "Ton aus". */
#menu .menu-range { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.08); }
#look-sens { flex: 1; min-width: 0; margin: 0; accent-color: var(--gold); touch-action: none; }
#menu .menu-range > span { font-size: 14px; white-space: nowrap; }
#menu .look-sens-value { font-size: 13px; min-width: 2.6em; text-align: right; font-weight: 600; }
#volume { flex: 1; min-width: 0; margin: 0; accent-color: var(--gold); touch-action: none; }

/* Daily, book, Ruf, races, jobs: the list scrolls inside the card and fades out above a full-width close button. */
#activity { padding: calc(12px + var(--safe-top)) calc(12px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(12px + var(--safe-left)); }
#activity .card { display: flex; flex-direction: column; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px - var(--safe-top) - var(--safe-bottom)); padding: 18px; border-radius: 14px; background: rgba(16, 18, 26, 0.94); }
#activity h2 { flex: none; }
#activity-list { flex: 1 1 auto; min-height: 0; max-height: none; margin: 0 -6px; padding: 0 6px 18px;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent); }
#activity-list > button { min-height: 44px; }
#activity-close { flex: none; width: 100%; min-height: 44px; margin-top: 6px; font-weight: 700; border-color: var(--rim); }
.book-tabs { flex-wrap: wrap; overflow: visible; }
.book-page { min-height: 0; }
@media (max-height: 500px) {
  #activity .card { width: min(620px, 100%); padding: 12px 16px; }
  #activity .card:has(.book) { width: min(680px, 100%); }
  #activity h2 { margin-bottom: 6px; font-size: 18px; }
  /* Phone landscape: the book's head, bar and tabs fit in two slim rows, so the grid starts above the fold. */
  #activity .card:has(.book) { padding: 8px 14px; }
  #activity .card:has(.book) h2 { display: none; }
  #activity .card:has(.book) #activity-close { min-height: 38px; margin-top: 4px; }
  .book { gap: 6px; }
  .book-head { grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
  .book-head b { font-size: 14px; }
  .book-head b::before { content: 'Sammelbuch · '; color: var(--ink); }
  .book-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .book-tabs button { padding: 4px 9px; font-size: 12px; }
  .book-info { display: block; padding: 5px 10px; }
  .book-info b { font-size: 13px; }
  #activity-list .book-info b, #activity-list .book-info small { display: inline; }
  .book-info small { margin-left: 8px; }
  .book-set { padding: 1px 8px 1px 3px; font-size: 11px; }
  .book-page { gap: 6px; }
}
/* Ruf: earned steps get a green tick, locked ones a lock and fade back. */
.rep-unlock.done { border-color: rgba(111, 227, 106, 0.45); background: rgba(111, 227, 106, 0.08); }
.rep-unlock.done .daily-coins { color: #7fd68a; }
.rep-unlock:not(.done) { opacity: 0.55; background: rgba(255, 255, 255, 0.03); }
.rep-unlock:not(.done) .daily-coins { color: var(--muted); }
/* Races: the medal you hold and what each medal pays. */
.medal-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
#activity-list .medal-row i { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 4px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; font-style: normal; color: var(--muted); }
.medal-row i::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--m); opacity: 0.45; }
#activity-list .medal-row i.got { border-color: var(--m); color: var(--ink); font-weight: 700; }
.medal-row i.got::before { opacity: 1; box-shadow: 0 0 6px var(--m); }
.medal-badge { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 50%; background: var(--m); box-shadow: 0 0 6px var(--m); vertical-align: -1px; }
.m0 { --m: #f2c14e; } .m1 { --m: #c9ced6; } .m2 { --m: #c9844a; }
#keys { border-radius: 14px; }

/* ---- Moped Sommer: login and the server screens (public/js/worlds-ui.js) ---- */
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 800; font-display: swap; src: url(/assets/fonts/bricolage-800-latin.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400 700; font-display: swap; src: url(/assets/fonts/inter-latin.woff2) format('woff2'); }
:root { --ms-ink: #1B2430; --ms-panel: #263142; --ms-line: #34404F; --ms-edge: #4A5668; --ms-cream: #FFF8EC; --ms-sun: #F5B82E;
  --ms-red: #E2483D; --ms-sky: #2E7BD1; --ms-grass: #4E9A3E; --ms-soft: #C9CFD8; --ms-dim: #B8C0CC; }
.logo { display: block; width: 100%; height: auto; font-family: 'Bricolage Grotesque', system-ui, sans-serif; font-size: 62px; font-weight: 800; letter-spacing: 1px; }

/* The village in summer (assets/login-bg.svg, flat low-poly like the game); `cover` from the bottom keeps the road and moped on phones too. */
#login { background: #2a2a33;  /* #804 key art now comes from .lg-art (was assets/login-bg.svg) */ font-family: Inter, system-ui, sans-serif; overflow: hidden auto; place-items: safe center; }
/* #804 phone landscape: the card is taller than the screen – #login scrolls, the art stays put behind it */
#login .lg-art { position: fixed; }
#login .card { position: relative; z-index: 2; width: min(440px, 100%); padding: 40px 40px 32px; background: var(--ms-cream); color: var(--ms-ink);
  border: 0; border-radius: 20px; box-shadow: 0 18px 48px rgba(10, 30, 60, 0.28); display: flex; flex-direction: column; align-items: center; gap: 18px; }
#login .card h1 { margin: 0; width: min(340px, 100%); color: var(--ms-ink); }
#login .card p { margin: 0; color: #3A4555; text-align: center; font-size: 16px; line-height: 1.5; }
#login .card .fine { font-size: 12px; color: #5D6673; }
#login .card .note { font-size: 13px; color: #5D6673; }
#login .error { color: #B3241F !important; }
#google-button { min-height: 44px; display: grid; place-items: center; width: 100%; }
#login .or { width: 100%; display: flex; align-items: center; gap: 12px; color: #6A7380; font-size: 13px; }
#login .or::before, #login .or::after { content: ''; flex: 1; height: 1px; background: #D9CDB8; }
#login .link { min-height: 44px; background: none; border: 0; color: var(--ms-ink); font: 600 15px Inter, system-ui, sans-serif; text-decoration: underline; }
#login .link:hover { color: var(--ms-red); }
#name-login { width: 100%; }
#login #name-login input { color: var(--ms-ink); background: #fff; border: 2px solid #D9CDB8; border-radius: 12px; min-height: 48px; }
#login #name-login input:focus { outline: 3px solid var(--ms-sun); outline-offset: 1px; }
#login button.primary { min-height: 52px; border-radius: 12px; background: var(--ms-sun); color: var(--ms-ink); font: 700 16px Inter, system-ui, sans-serif; }
#login #test-login { color: var(--ms-ink); border-color: #D9CDB8; }
#login .legal a { color: var(--ms-ink); font-weight: 600; text-decoration: underline; text-decoration-color: #D9CDB8; text-underline-offset: 3px; padding: 6px 4px; }
#login .legal a:hover, #login .legal a:focus-visible { color: var(--ms-red); text-decoration-color: currentColor; }
/* The legal links at the foot of the in-game menu: small text links, not menu buttons. */
#menu .menu-legal { margin: 2px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
#menu .menu-legal a { display: inline-block; min-height: 0; padding: 6px 4px; border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
#menu .menu-legal a:hover, #menu .menu-legal a:focus-visible { color: var(--ink); }
/* The rider screen for new players: a cream card like the login, the rider stays free in view. */
#creator .panel { bottom: auto; width: 360px; max-height: calc(100% - 32px); padding: 26px 26px 22px; gap: 0; border: 0; border-radius: 20px;
  background: var(--ms-cream); color: var(--ms-ink); font-family: Inter, system-ui, sans-serif; box-shadow: 0 18px 48px rgba(10, 30, 60, 0.28); }
#creator .creator-kicker { margin: 0 0 4px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ms-red); }
#creator .panel h2 { margin: 0 0 10px; font: 800 30px/1.1 'Bricolage Grotesque', system-ui, sans-serif; color: var(--ms-ink); }
#creator #choices { flex: none; padding: 0; }
#creator #choices p { margin: 0; font-size: 15px; line-height: 1.5; color: #3A4555; }
#creator #choices.start button { min-height: 52px; padding: 0 8px; border: 2px solid #D9CDB8; border-radius: 12px; background: #fff; color: var(--ms-ink); font: 700 15px Inter, system-ui, sans-serif; outline: 0; }
#creator #choices.start button[aria-pressed="true"] { border-color: var(--ms-sun); background: #FFF0C8; }
#creator .panel button.primary { margin-top: 18px; min-height: 52px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--ms-sun); color: var(--ms-ink); font: 700 17px Inter, system-ui, sans-serif; }
#creator .panel button.primary:hover { filter: brightness(1.05); }
#creator #logout-phone { min-height: 44px; border: 0; background: none; color: var(--ms-ink); font: 600 15px Inter, system-ui, sans-serif; text-decoration: underline; }
@media (max-width: 640px) {
  #creator .panel { top: auto; bottom: calc(16px + var(--safe-bottom, 0px)); width: auto; padding: 20px 20px 14px; }
  #creator .panel h2 { font-size: 26px; }
  #creator #logout-phone { margin-top: 4px; }
}

.ms-screen { position: fixed; inset: 0; z-index: 60; overflow-y: auto; background: var(--ms-ink); color: var(--ms-cream); font-family: Inter, system-ui, sans-serif;
  -webkit-user-select: none; user-select: none; touch-action: pan-y; }
.ms-screen h1, .ms-screen h2 { font-family: 'Bricolage Grotesque', system-ui, sans-serif; font-weight: 800; margin: 0; }
.ms-screen button { font-family: inherit; color: var(--ms-cream); cursor: pointer; }
.ms-screen input:focus, .ms-screen button:focus-visible { outline: 3px solid var(--ms-sun); outline-offset: 1px; }
.ms-wrap { max-width: 1280px; margin: 0 auto; min-height: 100%; padding: calc(28px + var(--safe-top, 0px)) 48px 32px; display: flex; flex-direction: column; gap: 24px; }
.ms-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ms-logo { width: 220px; color: var(--ms-cream); flex: none; }
.ms-logo .ms-tile { stroke: var(--ms-edge); stroke-width: 5; } /* navy tile on the navy screen: thin edge keeps the icon shape */
.ms-who { display: flex; align-items: center; gap: 12px; font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
.ms-chip { display: flex; align-items: center; gap: 8px; background: var(--ms-panel); border-radius: 999px; padding: 8px 14px; }
.ms-chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--ms-sun); }
.ms-link { min-height: 44px; background: none !important; border: 0; padding: 0 8px; font-weight: 600; font-size: 15px; text-decoration: underline; }
.ms-link:hover { color: var(--ms-sun); }
.ms-quick { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 96px; padding: 0 32px; text-align: left;
  background: var(--ms-sun) !important; color: var(--ms-ink) !important; border: 0; border-radius: 18px; }
.ms-quick:hover { filter: brightness(1.05); }
.ms-quick span { display: flex; flex-direction: column; gap: 4px; }
.ms-quick b { font-family: 'Bricolage Grotesque', system-ui, sans-serif; font-size: 34px; font-weight: 800; }
.ms-quick small { font-size: 15px; font-weight: 500; }
.ms-quick svg { width: 40px; height: 40px; flex: none; fill: none; stroke: var(--ms-ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.ms-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.ms-panel { background: var(--ms-panel); border-radius: 18px; padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; }
.ms-panel h2 { font-size: 22px; }
.ms-panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 6px; }
.ms-panel-head span { font-size: 13px; color: var(--ms-dim); }
.ms-list { gap: 0; }
.ms-server { display: grid; grid-template-columns: 24px minmax(0, 1fr) 120px 64px 120px; align-items: center; gap: 12px; min-height: 60px; border-top: 1px solid var(--ms-line); }
.ms-server.here { background: rgba(245, 184, 46, 0.08); }
.ms-server svg { width: 18px; height: 18px; fill: none; stroke: var(--ms-sun); stroke-width: 2; stroke-linecap: round; }
.ms-name { display: flex; flex-direction: column; min-width: 0; }
.ms-name b { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-name small { font-size: 12px; color: var(--ms-dim); }
.ms-fill { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ms-fill i { flex: 1; height: 6px; border-radius: 3px; background: var(--ms-line); overflow: hidden; }
.ms-fill i b { display: block; height: 6px; background: #6DB04F; }
.ms-ping { font-size: 14px; color: var(--ms-soft); }
.ms-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; vertical-align: -1px; }
.ms-bars i { width: 4px; border-radius: 1px; background: currentColor; opacity: 0.25; }
.ms-bars i:nth-child(1) { height: 5px; } .ms-bars i:nth-child(2) { height: 9px; } .ms-bars i:nth-child(3) { height: 13px; }
.ms-bars.q1 i:nth-child(-n+1), .ms-bars.q2 i:nth-child(-n+2), .ms-bars.q3 i { opacity: 1; }
.ms-quick .ms-bars { display: inline-flex; flex-direction: row; gap: 2px; }
.ms-ping .ms-bars, .ms-phone .ms-bars { color: #6DB04F; } .ms-ping .ms-bars.q1, .ms-phone .ms-bars.q1 { color: #F5B82E; }
.ms-join { min-height: 44px; border: 2px solid var(--ms-cream) !important; background: transparent !important; border-radius: 10px; font-weight: 600; font-size: 15px; }
.ms-join:hover:not(:disabled) { border-color: var(--ms-sun) !important; color: var(--ms-sun); }
.ms-join:disabled { opacity: 0.45; cursor: default; }
.ms-side { display: flex; flex-direction: column; gap: 20px; }
.ms-code label { font-size: 14px; color: var(--ms-soft); }
.ms-row { display: flex; gap: 10px; }
.ms-screen input:not([type=range]) { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 10px; border: 2px solid var(--ms-edge);
  background: var(--ms-ink); color: var(--ms-cream); font: 500 16px Inter, system-ui, sans-serif; -webkit-user-select: text; user-select: text; }
#servers-code { font-weight: 600; font-size: 18px; letter-spacing: 3px; text-transform: uppercase; }
.ms-light { min-height: 48px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--ms-cream) !important; color: var(--ms-ink) !important; font-weight: 700; font-size: 15px; }
.ms-err { margin: 0; min-height: 1.2em; color: #FF9B8A; font-size: 14px; }
.ms-err:empty { display: none; }
.ms-ghost { display: none; min-height: 52px; border-radius: 12px; border: 2px solid var(--ms-edge) !important; background: transparent !important; font-weight: 600; font-size: 15px; }
.ms-create { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 24px; text-align: left; border-radius: 18px;
  border: 2px dashed var(--ms-sun) !important; background: transparent !important; }
.ms-create span { display: flex; align-items: center; gap: 10px; font-family: 'Bricolage Grotesque', system-ui, sans-serif; font-size: 22px; font-weight: 800; }
.ms-create svg { width: 22px; height: 22px; fill: none; stroke: var(--ms-sun); stroke-width: 2.5; stroke-linecap: round; }
.ms-create small { font-size: 14px; color: var(--ms-soft); }
.ms-create:disabled { opacity: 0.5; cursor: default; }
.ms-mine p { margin: 0; font-size: 14px; color: var(--ms-soft); }
.ms-codebox { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; background: var(--ms-ink); border-radius: 10px; padding: 12px 16px; }
.ms-codebox span { font-size: 14px; color: var(--ms-soft); }
.ms-codebox b { font-weight: 700; font-size: 22px; letter-spacing: 4px; color: var(--ms-sun); }
#create-code-note b { font-size: 14px; letter-spacing: 0; }
.ms-member { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; border-top: 1px solid var(--ms-line); }
.ms-member button { min-height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--ms-edge); background: transparent; font-weight: 600; font-size: 14px; }
.ms-warn { min-height: 48px; border-radius: 10px; border: 2px solid var(--ms-red) !important; background: transparent !important; color: #FFB3A8 !important; font-weight: 700; }
.ms-center { display: grid; place-items: center; padding: 16px; }
.ms-dialog { width: min(520px, 100%); background: var(--ms-panel); border-radius: 22px; padding: 36px; display: flex; flex-direction: column; gap: 22px; }
.ms-dialog h1, .ms-dialog h2 { font-size: 32px; }
.ms-dialog p { margin: 6px 0 0; font-size: 15px; color: var(--ms-soft); }
.ms-field { display: flex; flex-direction: column; gap: 8px; border: 0; margin: 0; padding: 0; }
.ms-field label, .ms-field legend { font-size: 14px; font-weight: 600; padding: 0; }
.ms-field legend { padding-bottom: 8px; }
.ms-field > small { font-size: 12px; color: var(--ms-dim); }
.ms-between { display: flex; justify-content: space-between; }
.ms-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ms-two button { min-height: 64px; border-radius: 12px; border: 2px solid var(--ms-edge) !important; background: transparent !important; color: var(--ms-cream) !important; font-weight: 700; font-size: 15px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ms-two button small { font-size: 12px; font-weight: 500; }
.ms-two button[aria-pressed="true"] { border-color: var(--ms-sun) !important; background: #3A3320 !important; }
.ms-dialog input[type=range] { width: 100%; min-height: 32px; accent-color: var(--ms-sun); }
.ms-actions { display: flex; gap: 12px; justify-content: flex-end; align-items: center; }
.ms-gold { min-height: 52px; padding: 0 26px; border: 0; border-radius: 12px; background: var(--ms-sun) !important; color: var(--ms-ink) !important; font-weight: 700; font-size: 16px; }
.ms-gold:disabled { opacity: 0.6; }
.ms-fine { margin: 0 !important; font-size: 12px !important; color: var(--ms-dim) !important; }
@media (max-width: 760px) {
  .ms-wrap { padding: calc(20px + var(--safe-top, 0px)) 16px calc(20px + var(--safe-bottom, 0px)); gap: 16px; }
  .ms-logo { width: 150px; }
  .ms-who { gap: 4px; font-size: 13px; }
  .ms-chip { padding: 6px 12px; }
  .ms-quick { min-height: 76px; padding: 0 20px; border-radius: 16px; }
  .ms-quick b { font-size: 26px; }
  .ms-quick small { font-size: 13px; }
  .ms-quick svg { width: 30px; height: 30px; }
  .ms-grid { grid-template-columns: 1fr; gap: 16px; }
  .ms-panel { padding: 12px 16px; border-radius: 16px; }
  .ms-panel h2 { font-size: 18px; }
  .ms-server { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
  .ms-server .ms-fill, .ms-server .ms-ping { display: none; }
  .ms-server > span:first-child:empty { display: none; }
  .ms-join { padding: 0 16px; font-size: 14px; }
  .ms-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ms-side > .ms-panel { grid-column: 1 / -1; }
  .ms-code:not(.open) { display: none; }
  .ms-ghost { display: block; }
  .ms-create { padding: 0 12px; min-height: 52px; border-radius: 12px; align-items: center; justify-content: center; }
  .ms-create span { font-family: Inter, system-ui, sans-serif; font-size: 15px; font-weight: 600; }
  .ms-create span svg { display: none; }
  .ms-create small { display: none; }
  .ms-dialog { padding: 24px 18px; gap: 18px; }
  .ms-dialog h1, .ms-dialog h2 { font-size: 26px; }
  #login .card { padding: 28px 22px 22px; gap: 14px; }
}
.ms-name .ms-phone { display: none; font-size: 12px; color: var(--ms-dim); }
@media (max-width: 760px) { .ms-name .ms-phone { display: block; } .ms-name .ms-owner { display: none; } }
#servers-code::placeholder { text-transform: none; letter-spacing: 0; font-weight: 500; }
@media (max-width: 760px) {
  .ms-server { display: flex; }
  .ms-server .ms-name { flex: 1; }
  .ms-server > span:first-child:not(:empty) { flex: none; }
  .ms-quick .ms-pre, .ms-chip .ms-chip-name { display: none; }
}

/* ==== Celebrations (celebrate.js): first Simson, intro finished. Package A, review 2 #15. ==== */
#celebrate { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 50% 45%, rgba(242, 193, 78, 0.28), rgba(10, 12, 18, 0.72) 70%);
  animation: celebrate-in 0.2s ease-out; touch-action: none; cursor: pointer; }
#celebrate.out { opacity: 0; transition: opacity 0.2s; }
#celebrate canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#celebrate .card { position: relative; width: min(340px, 100%); padding: 16px 18px 12px; border: 3px solid #f2c14e; border-radius: 20px;
  background: linear-gradient(#22263a, #12141d); color: #f2eee4; text-align: center; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  animation: celebrate-pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1); }
#celebrate .pic svg { width: min(200px, 60vw); height: auto; display: block; margin: -4px auto 4px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5)); }
#celebrate h2 { margin: 2px 0 6px; font-size: 26px; line-height: 1.15; color: #f2c14e; }
#celebrate p { margin: 0 0 8px; font-size: 15px; line-height: 1.35; }
#celebrate .coins { display: inline-block; margin: 2px 0 8px; padding: 4px 12px; border-radius: 999px; background: #f2c14e; color: #1b1407;
  font-size: 18px; font-weight: 800; animation: celebrate-pop 0.5s 0.25s both cubic-bezier(0.2, 1.6, 0.4, 1); }
#celebrate small { display: block; font-size: 12px; color: #b4afa3; }
@keyframes celebrate-in { from { opacity: 0; } }
@keyframes celebrate-pop { from { transform: scale(0.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #celebrate, #celebrate .card, #celebrate .coins { animation: none; } }
/* ==== end Celebrations ==== */

/* ==== Phone touch layout v2 (WP-D, review 2 #7 #17): thumbs at the bottom corners, the middle stays free ====
   Left thumb: ◀ ▶. Right thumb: Bremse + Gas. Just above them, smaller: light/horn/blinkers left, Stopp/Heben right.
   One context slot above Gas (Aktion, Absteigen, Aus, Zur Tanke), stacked upward. Emoji, helmet, goggles and LED
   fold away behind one small "…" under the dashboard. Every target stays at least 44 px. Overrides the older blocks above. */
#hud-tray { display: contents; }
#hud-fixed { display: contents; }   /* #812 */
#hud-more { display: none; }
@media (pointer: coarse) {
  .touch { --edge: 12px; --pad-w: min(88px, 22vw); --mini: 46px; --row2: calc(var(--edge) + var(--big) + 8px + var(--safe-bottom)); }
  .pad-left { left: calc(var(--edge) + var(--safe-left)); bottom: calc(var(--edge) + var(--safe-bottom)); gap: 8px; }
  .pad-left button { width: var(--pad-w); height: var(--big); font-size: 24px; }
  .pad-right, .pad-icons { grid-template-columns: var(--pad-w) var(--pad-w); gap: 8px; right: calc(var(--edge) + var(--safe-right)); }
  .pad-right { bottom: calc(var(--edge) + var(--safe-bottom)); }
  /* No more chevrons between the buttons: every button is its own rounded key again (sliding Gas up still lifts, left still burns out). */
  .touch .pad-right button, .touch .pad-icons button { border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 16px; }
  .pad-right button::before, .pad-right [data-key="gas"]::after { content: none !important; display: none !important; }
  #pad-gas { border-color: rgba(95, 208, 106, 0.55) !important; }
  .pad-icons { bottom: var(--row2); }
  .touch .pad-icons button { height: var(--mini); font-size: 12px; flex-direction: row; gap: 5px; border-radius: 14px; }
  .pad-icons .icon { width: 18px; height: 18px; }
  /* Light, horn and blinkers: one small 2 x 2 block over the steering. */
  .pad-tricks { left: calc(var(--edge) + var(--safe-left)); bottom: var(--row2); display: grid; grid-template-columns: repeat(3, 44px); gap: 6px; /* #290 3 wide: ◁ hazard ▷ over light + horn */
    width: auto; max-width: none; flex-wrap: nowrap; align-content: end; }
  .touch .pad-tricks .blink { width: 44px; height: 44px; border-radius: 12px; font-size: 15px; color: #fff; }
  .pad-tricks #light-button, .pad-tricks [data-press="KeyB"] { order: 3; }
  .pad-tricks [data-press="KeyZ"] { order: 1; } .pad-tricks [data-press="KeyC"] { order: 2; } .pad-tricks [data-press="KeyX"] { order: 3; } /* #290 */
  .pad-tricks #light-button { order: 4; } .pad-tricks [data-press="KeyB"] { order: 5; } /* #290 */
  .pad-tricks .blink .icon { width: 20px; height: 20px; }
  #hud:is([data-state="wheelie"], [data-state="air"]) .pad-tricks { grid-template-columns: repeat(2, var(--pad-w)); }
  #hud:is([data-state="wheelie"], [data-state="air"]) .touch .trick { min-width: 0; min-height: 50px; }
  /* The context slot: one column above Gas, nearest the thumb at the bottom. */
  .touch .pad-top { position: fixed; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; left: auto;
    right: calc(var(--edge) + var(--safe-right)); bottom: calc(var(--row2) + var(--mini) + 10px); }
  #power-button { order: 1; }
  #station-button { order: 2; }
  #mount { order: 3; }
  #to-moped { order: 3; }   /* #969 */
  #action-button { order: 4; }
  .touch .pad-top button { height: 44px; min-width: 44px; padding: 0 14px; border-radius: 22px; font-size: 13px; font-weight: 700; flex-direction: row; gap: 6px;
    background: rgba(16, 18, 26, 0.72); border: 1px solid rgba(255, 255, 255, 0.18); }
  .pad-top .icon { width: 18px; height: 18px; }
  #hud .touch #action-button.ready { position: static; transform: none; width: auto; height: 52px; padding: 0 20px; border-radius: 26px;
    flex-direction: row; gap: 8px; font-size: 15px; animation: none; }
  #hud .touch #action-button .icon { width: 22px; height: 22px; }
  .touch .pad-top #mount.ready { background: #2f9e44; }
  /* On foot the joystick takes the left corner and the slot drops to the right corner. */
  #hud[data-state="foot"] .touch .pad-top { bottom: calc(20px + var(--safe-bottom)); }
  #hud[data-state="foot"] #stick { left: calc(20px + var(--safe-left)); bottom: calc(20px + var(--safe-bottom)); }

  /* "…": emoji, helmet, goggles, LED wait folded under the dashboard, at the left. */
  #hud-more { display: grid; place-items: center; position: fixed; z-index: 6; left: calc(10px + var(--safe-left)); right: auto;
    top: calc(var(--top-h) + 10px + var(--safe-top)); bottom: auto; width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 20px; line-height: 1; }
  #hud.more-open #hud-more { color: #1b1407; background: #f2c14e; }
  /* #812 emoji + report are always out (column at the left, under the dashboard); "…" under them holds helmet, goggles, LED only
     and disappears when none of those is shown. */
  #hud-fixed { display: flex; flex-direction: column; gap: 8px; position: fixed; z-index: 6; left: calc(10px + var(--safe-left)); top: calc(var(--top-h) + 10px + var(--safe-top)); }
  #hud #hud-fixed .hud-round { position: static; inset: auto; width: 44px; height: 44px; }
  #hud-more { top: calc(var(--top-h) + 114px + var(--safe-top)); }   /* #812 */
  #hud:not(:has(#hud-tray > :not([hidden]))) #hud-more { display: none; }   /* #812 */
  #hud-tray { display: flex; flex-direction: column; gap: 8px; position: fixed; z-index: 6; left: calc(10px + var(--safe-left)); top: calc(var(--top-h) + 166px + var(--safe-top)); }
  #hud:not(.more-open) #hud-tray { display: none; }
  #hud #hud-tray .hud-round { position: static; inset: auto; width: 44px; height: 44px; }
  #hud #emoji-row { left: calc(62px + var(--safe-left)); right: auto; top: calc(var(--top-h) + 10px + var(--safe-top)); bottom: auto; }
  #hud:is([data-state="wheelie"], [data-state="stoppie"], [data-state="air"]) :is(#hud-more, #hud-tray, #hud-fixed, #emoji-row) { display: none; }

  /* #1009 Steuerung: a touch screen gets the touch list (the keyboard list means nothing there). */
  #keys .keys-keyboard { display: none; }
  #keys .keys-touch, #keys #keys-close { display: grid; }
  #keys #keys-close { display: block; width: 100%; margin-top: 12px; }

  /* A menu or panel open: the pads step away so nothing shows through it (and no thumb hits them). */
  body:has(#menu:not([hidden]), #clique-panel:not([hidden]), #activity:not([hidden]), #map:not([hidden]), #garage-visit:not([hidden])) :is(.touch, #hud-more, #hud-tray, #hud-fixed, #emoji-row) { visibility: hidden; }
}
#hud #menu { background: rgba(13, 15, 21, 0.98); }

/* Short portrait phones (360 x 740): slightly lower pads. */
@media (pointer: coarse) and (orientation: portrait) and (max-height: 760px) {
  :root { --big: 76px; }
}

/* On foot only coins, the map and the two buttons: a small pill, not a bar across the screen. */
#hud[data-state="foot"] #cluster { width: calc(var(--u) * 62); }
#hud[data-state="foot"] .c-mid { padding-left: calc(var(--u) * 3); }

/* Sideways phones: a smaller dashboard (about a quarter of the height), and the hints under it at the left, beside the rider. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  :root { --top-w: min(310px, 80vh); --big: 74px; }
  #hud[data-state="foot"] #cluster { width: calc(var(--u) * 66); }
  #hud #goal, #vev { left: calc(6px + var(--safe-left)); transform: none; max-width: calc(var(--top-w) + 40px); }
  #hud#hud #prompt#prompt#prompt { left: calc(6px + var(--safe-left)); transform: none; max-width: calc(var(--top-w) + 40px); white-space: normal; font-size: 13px; padding: 8px 12px; }
  body:not(:has(#intro-tip:not([hidden]))) #hud#hud #prompt#prompt#prompt { top: calc(var(--top-h) + 8px + var(--safe-top)) !important; }
  body:not(:has(#intro-tip:not([hidden]))):has(#goal:not([hidden]):not(.docked), #vev:not([hidden]):not(.docked)) #hud#hud #prompt#prompt#prompt { top: calc(var(--top-h) + 52px + var(--safe-top)) !important; }
  /* "…" sits beside the dashboard at the top, the tray opens to its right (the right side belongs to the context slot). */
  /* #812 landscape: emoji + report side by side beside the dashboard, "…" after them, its tray after that. */
  #hud-fixed { flex-direction: row; left: calc(var(--top-w) + 18px + var(--safe-left)); top: calc(14px + var(--safe-top)); }
  #hud[data-state="foot"] #hud-fixed { left: calc(var(--u) * 66 + 18px + var(--safe-left)); }
  #hud-more { left: calc(var(--top-w) + 124px + var(--safe-left)); top: calc(14px + var(--safe-top)); }
  #hud[data-state="foot"] #hud-more { left: calc(var(--u) * 66 + 124px + var(--safe-left)); }
  #hud-tray { flex-direction: row; left: calc(var(--top-w) + 176px + var(--safe-left)); top: calc(14px + var(--safe-top)); }
  #hud[data-state="foot"] #hud-tray { left: calc(var(--u) * 66 + 176px + var(--safe-left)); }
  #hud #emoji-row { left: calc(var(--top-w) + 18px + var(--safe-left)); right: auto; top: calc(66px + var(--safe-top)); }
  #hud[data-state="foot"] #emoji-row { left: calc(var(--u) * 66 + 18px + var(--safe-left)); }
}

/* Tuning: the tab rows scroll sideways, and a fade at the right edge says there is more. */
#shop-chips, #shop-list { padding-right: 28px;   /* #400 */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
/* ==== end Phone touch layout v2 ==== */

/* ==== Shops and rider creator (work package F) ==== */
/* Rider creator: tabs per piece of clothing, colour swatches, a dice; the rider stands big in the Modeladen room. */
#creator #choices.creator-pick { display: grid; gap: 12px; flex: none; padding: 0; }
#creator .cr-sets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#creator .cr-sets button { min-height: 44px; border: 2px solid #D9CDB8; border-radius: 12px; background: #fff; color: var(--ms-ink); font: 700 15px Inter, system-ui, sans-serif; }
#creator .cr-sets button[aria-pressed="true"] { border-color: var(--ms-sun); background: #FFF0C8; }
#creator .cr-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: #EFE4D0; }
#creator .cr-tabs button { min-height: 40px; padding: 0 4px; border: 0; border-radius: 9px; background: none; color: #5A6372; font: 700 14px Inter, system-ui, sans-serif; white-space: nowrap; }
#creator .cr-tabs button[aria-selected="true"] { background: #fff; color: var(--ms-ink); box-shadow: 0 1px 4px rgba(10, 30, 60, 0.16); }
#creator .cr-zone { display: grid; gap: 6px; }
#creator #choices .cr-label { margin: 0; font-size: 13px; font-weight: 700; color: #5A6372; }
#creator .cr-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
#creator .cr-dot { aspect-ratio: 1; width: 100%; min-height: 0; padding: 0; border: 2px solid rgba(10, 30, 60, 0.18); border-radius: 50%; cursor: pointer; }
#creator .cr-dot[aria-pressed="true"] { outline: 3px solid var(--ms-sun); outline-offset: 2px; border-color: #fff; }
#creator .cr-random { justify-self: start; min-height: 40px; padding: 0 14px; border: 2px solid #D9CDB8; border-radius: 12px; background: #fff; color: var(--ms-ink); font: 700 14px Inter, system-ui, sans-serif; }
#creator #choices .cr-note { margin: 0; font-size: 13px; line-height: 1.4; color: #5A6372; }
@media (max-width: 640px) {
  #creator .panel { max-height: 58%; padding: 16px 16px 8px; overflow-y: auto; }
  #creator .creator-kicker { font-size: 11px; }
  #creator .panel h2 { margin-bottom: 8px; font-size: 22px; }
  #creator #choices.creator-pick { gap: 9px; }
  #creator .cr-swatches { grid-template-columns: repeat(8, 1fr); gap: 7px; }
  #creator .cr-dot { width: 100%; }
  #creator #choices .cr-note { display: none; }
  #creator .panel button.primary { margin-top: 12px; min-height: 48px; }
  #creator #logout-phone { min-height: 36px; margin-top: 0; }
}
/* ==== end Shops and rider creator ==== */

/* ==== UX pass 2026-11-07: readable and tappable on phones (art bible §7: text >= 14 px, targets >= 44 px, contrast >= 4.5:1) ==== */
/* Green "go" buttons (Start, Aufsteigen, Aufheben, fish bite): a deeper green so the cream label reads (was #2f9e44, 2.97:1; now 5.1:1). */
@media (pointer: coarse) {
  .touch .ready, #hud[data-state="parked"] #pad-gas, .touch .pad-top #mount.ready { background: #1E7A36; color: #FFF8EC; }
}
#fish-button.ready { background: #1E7A36; color: #FFF8EC; }
/* Legal links (login card, menu foot): 14 px and a 44 px tall tap area. */
#login .legal a, #menu .menu-legal a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; font-size: 14px; }
#menu .menu-legal { font-size: 14px; }
/* Menu rows: a full 44 px also with a mouse. */
#menu button, #menu a { min-height: 44px; }
@media (pointer: coarse) {
  /* Dashboard: fuel and coins at 14 px; the odometer (also in "Mein Moped") and the km/h label were 8 px and are left out. */
  .c-mid, #hud .coins { font-size: max(14px, calc(var(--u) * 3)); }
  /* #693 the odometer and the km/h label are back on phones (12 px, own rows in the dial; hidden in 6dbb511 for being 8 px). */
  #speed { top: 53%; }   /* #693 */
  .c-gauge .unit { top: 72%; font-size: 12px; line-height: 1; }   /* #693 */
  #odo { left: 12%; right: 12%; top: 82%; font-size: 12px; line-height: 1.15; white-space: nowrap; }   /* #693 */
  /* The hint under the dashboard: wider and 14 px, and the toasts leave room for two lines of it, so they never cover it. */
  #hud #prompt { font-size: 14px; max-width: calc(100vw - 120px); }
  body:has(#hud:not([hidden]) #prompt:not([hidden])) { --lane-prompt: 66px; }
  /* Goal and village-event pill: 14 px, 44 px tall (they are buttons: a tap shows the way). */
  #goal, #vev { font-size: 14px; line-height: 1.2; min-height: 44px; padding: 4px 12px; }
  .touch .pad-top button { font-size: 14px; }
  /* Panels (Tagesziele, Sammelbuch, Ruf, Aufträge, Werkstatt, Mein Moped): small lines 14 px, buttons 44 px. */
  #activity-list small, #activity-list .daily-note, #activity-list .daily-goal small { font-size: 14px; }
  #activity-list .daily-swap, .daily-swap { min-height: 44px; padding: 0 16px; font-size: 14px; }
  #activity-list .book-tabs button, .book-tabs button { min-height: 44px; padding: 0 12px; font-size: 14px; }
  .book-set, .book-tile .book-name { font-size: 14px; }
  .book-rank { font-size: 14px; }
  /* Tuning: tabs, chips and buttons 44 px, prices 14 px. */
  #shop-leave, #shop-buy, #shop-led > button { min-height: 44px; }   /* #400 */
  .coins-line { font-size: 14px; }   /* #400: shop cards and chips: see the #400 block at the end */
  /* Modeladen: see the #872 block (44 px everywhere already). */
  #angler-close { width: 44px; height: 44px; }
  /* Anglerhütte: tabs and card buttons 44 px. */
  #angler-tabs button, .angler-card button { min-height: 44px; font-size: 14px; }
  #fish-close { min-height: 44px; }
  /* Login and server screens: the small grey lines at 14 px. */
  #login .card .fine, #login .card .note { font-size: 14px; }
  .ms-who, .ms-chip, .ms-panel-head span, .ms-quick small, .ms-name .ms-phone { font-size: 14px; }
}
/* Rider creator (every new player's first screen): 6 swatches a row at 44 px, 44 px tabs and links, kicker in Signalrot (3.6:1 → 5.6:1). */
#creator .creator-kicker { color: #B8322A; }
@media (pointer: coarse) {
  #creator .cr-swatches { grid-template-columns: repeat(6, 1fr); gap: 8px; }
  #creator .cr-dot { min-height: 44px; max-width: 52px; justify-self: center; }
  #creator .cr-tabs button, #creator .cr-random, #creator #logout-phone { min-height: 44px; }
  #creator .creator-kicker { font-size: 14px; }
  #creator #choices .cr-label { font-size: 14px; }
}
/* Mouse screens too: nothing under 12 px (prices, ranks, odometer). */
@media (pointer: fine) {
  .book-rank { font-size: 12px; }
  .c-gauge .unit, #odo { font-size: max(12px, calc(var(--u) * 2.2)); }
}
/* ==== end UX pass ==== */

/* ==== UX fix pass 2 (2026-11-07): rider visible above the panels, a short menu, the start-screen moped, fuel next to the map ==== */
/* Menu: the everyday rows on top; "Einstellungen" folds sound, graphics, full screen, keys, station, Discord and log out. */
#menu:not(.more) .menu-set { display: none !important; }
#menu #menu-more { margin-top: 4px; }
#menu #menu-more .menu-chev { margin-left: auto; font-size: 14px; transition: transform 0.15s; }
#menu.more #menu-more .menu-chev { transform: rotate(180deg); }
#menu.more #menu-more { background: rgba(242, 193, 78, 0.16); border-color: rgba(242, 193, 78, 0.5); }
#menu .menu-set { margin-left: 12px; }
#menu #online { font-size: 14px; }

/* Rider creator on a phone: one compact card (about a third of the screen), colours in one sideways row,
   the dice next to the title, Losfahren and Abmelden side by side; the rider stands above it, head to shoes. */
@media (max-width: 640px) {
  #creator .panel { display: grid; grid-template-columns: 1fr auto; align-content: start; column-gap: 10px; max-height: 50%; padding: 14px 14px 10px; }
  #creator .panel > :is(.creator-kicker, h2, #choices) { grid-column: 1 / -1; }
  #creator .creator-kicker { margin: 0; }
  #creator .panel h2 { margin: 0 0 8px; font-size: 22px; }
  #creator #choices.creator-pick { gap: 8px; }
  #creator .cr-zone { gap: 2px; }
  #creator .cr-swatches { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; touch-action: pan-x pan-y; scrollbar-width: none; padding: 5px 5px 6px;
    margin: 0 -5px; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  #creator .cr-swatches::-webkit-scrollbar { display: none; }
  #creator .cr-dot { flex: 0 0 44px; width: 44px; height: 44px; min-height: 44px; max-width: none; }
  #creator .cr-random { position: absolute; top: 14px; right: 14px; }
  #creator .panel button.primary { grid-column: 1; margin-top: 8px; }
  #creator #logout-phone { grid-column: 2; align-self: end; min-height: 48px; margin: 8px 0 0; padding: 0 6px; }
}
/* Dashboard on a phone: the map a little narrower, so "7,7 L" has room and never touches it. */
@media (pointer: coarse) {
  #cluster { grid-template-columns: max(44px, calc(var(--u) * 9.5)) calc(var(--u) * 30) 1fr calc(var(--u) * 19) max(44px, calc(var(--u) * 9)); }
  #minimap { width: calc(var(--u) * 19); }
  .c-mid { padding-right: 6px; column-gap: calc(var(--u) * 0.9); }
}
/* Desktop start screen: the card moves to the left third, so the S51 on the village road (centre of login-bg.svg) is in view. */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  #login.center { justify-items: start; padding-left: max(6vw, 32px); }
}
/* #804 Login + start screen use the loader's key art (same files, so already cached). A soft veil keeps the cream card readable. */
.lg-art, .lg-art img { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.lg-art img { display: block; object-fit: cover; object-position: 66% 50%; }
#login::before { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(90% 70% at 50% 50%, rgba(20, 16, 14, 0.34), rgba(20, 16, 14, 0.12) 70%), linear-gradient(180deg, rgba(20, 16, 14, 0.18), rgba(20, 16, 14, 0.38)); }
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  #login::before { background: linear-gradient(90deg, rgba(20, 16, 14, 0.5), rgba(20, 16, 14, 0.12) 55%, rgba(20, 16, 14, 0) 80%); }
}
@media (orientation: landscape) and (max-height: 500px) { .lg-art img { object-position: 66% 62%; } }
/* #804 Start screen (worlds list): the same art, fixed behind the scrolling panels, darkened so the panels and the yellow button stay clear. */
#servers .sv-art, #servers .sv-art img { position: fixed; }
#servers::before { content: ''; position: fixed; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, rgba(27, 36, 48, 0.66), rgba(27, 36, 48, 0.54) 45%, rgba(27, 36, 48, 0.74)); }
#servers .ms-wrap { position: relative; z-index: 2; }
/* ==== end UX fix pass 2 ====

/* ==== Mopedtreff events (village-events.js): sprint start light, beauty vote card ==== */
#vev-light { position: fixed; z-index: 44; left: 50%; top: calc(var(--top-h, 120px) + 64px + var(--safe-top, 0px)); transform: translateX(-50%);
  display: flex; gap: 10px; padding: 10px 14px; border-radius: 16px; background: rgba(27, 36, 48, 0.9); border: 1px solid var(--ms-edge, #4a5668); pointer-events: none; }
#vev-light[hidden] { display: none; }
#vev-light i { width: 34px; height: 34px; border-radius: 50%; background: #3a4150; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5); }
#vev-light i.red { background: #ff3b2e; box-shadow: 0 0 14px #ff3b2e; }
#vev-light i.green { background: #3dff7a; box-shadow: 0 0 18px #3dff7a; }
#vev-vote { position: fixed; z-index: 42; left: 50%; bottom: calc(150px + var(--safe-bottom, 0px)); transform: translateX(-50%); width: min(340px, calc(100vw - 24px));
  padding: 12px 14px; display: grid; gap: 10px; text-align: center; background: var(--ms-panel, #263142); color: var(--ms-cream, #fff8ec); }
#vev-vote[hidden] { display: none; }
#vev-vote .vev-stars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#vev-vote .vev-star { min-height: 48px; border-radius: 12px; border: 0; background: var(--ms-sun, #f5b82e); color: var(--ms-ink, #1b2430); font: 800 18px system-ui, sans-serif; cursor: pointer; }
#vev-vote .vev-star:disabled { opacity: 0.45; cursor: default; }
/* ==== end Mopedtreff events ==== */

/* Discord button in the lobby (open beta) */
#lobby-discord { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; margin-top: 10px; border-radius: 10px; background: #5865F2; color: #fff; font-weight: 700; text-decoration: none; box-sizing: border-box; }
#lobby-discord:hover, #lobby-discord:focus-visible { background: #4752C4; }

/* ==== #199/#207 one notice lane on phones (portrait) ====
   Top to bottom under the dashboard: intro tip → ONE open card (event pill, goal pill or Schnitzeljagd card; the
   others are chips in the left dock, notice-dock.js) → prompt → toasts. The lane keeps 60 px free on both sides, so it
   never covers the left column (…, emoji, helmet, glasses, feedback, dock chips) or the right-side buttons. With a
   prompt or an open card only ONE toast shows (max 2 notices + the open card); toast() folds open pills on phones. */
@media (pointer: coarse) and (orientation: portrait), (max-width: 640px) {
  body { --lane-side: calc(60px + max(var(--safe-left, 0px), var(--safe-right, 0px))); }
  #toast { width: calc(100vw - 2 * var(--lane-side)); top: calc(var(--lane) + var(--lane-intro) + var(--lane-event, 0px) + var(--lane-pill) + var(--lane-card, 0px) + var(--lane-prompt)) !important; }
  body #hud #prompt#prompt { top: calc(var(--lane) + var(--lane-intro) + var(--lane-event, 0px) + var(--lane-pill) + var(--lane-card, 0px)) !important; width: max-content; max-width: calc(100vw - 2 * var(--lane-side)); }   /* #949 width: max-content: see #goal */
  /* #949 the goal and village pills start right of the round buttons and use all the width to the right edge (the right column is free at their height): 320 px on a 390 phone instead of 270 */
  #vev, #goal { left: var(--lane-side); transform: none; max-width: calc(100vw - var(--lane-side) - 10px - var(--safe-right, 0px)); }
  body:has(#hud:not([hidden]) #prompt:not([hidden])) #toast .note:nth-child(n+2),
  body:has(.hunt-card:not([hidden]), #vev:not([hidden]):not(.docked), #goal:not([hidden]):not(.docked)) #toast .note:nth-child(n+2) { display: none; }
  body:has(#hud:not([hidden]) #prompt:not([hidden])):has(.hunt-card:not([hidden]), #vev:not([hidden]):not(.docked), #goal:not([hidden]):not(.docked)) #toast { visibility: hidden; }
  .hunt-card.hunt-card { left: 50%; transform: translateX(-50%); top: calc(var(--lane) + var(--lane-intro) + var(--lane-event, 0px)); width: calc(100vw - 2 * var(--lane-side)); max-width: 300px; font-size: 13px; padding: 6px 10px 7px; }
  .hunt-card .hunt-riddle { margin-top: 3px; }
  .hunt-card .hunt-head { gap: 6px; }
  .hunt-card .hunt-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hunt-card .hunt-dots { gap: 3px; }
  .hunt-card .hunt-dots i { width: 7px; height: 7px; }
  .hunt-card .hunt-row .hunt-x { flex: none; min-width: 44px; min-height: 44px; margin-block: -8px; }   /* #1057 a 44 px target; the negative margin keeps the card as low as before */
  .hunt-card .hunt-row { margin-top: 4px; }
  .hunt-card .hunt-row button { min-height: 32px; padding: 6px 10px; }
  /* The Login-Serie card (streak.js, closes itself after 7 s) sat on the dashboard at 64 px: it takes the lane too. */
  body #streak-card { top: calc(var(--lane) + var(--lane-intro)); width: calc(100vw - 2 * var(--lane-side)); max-width: 340px; }
}
/* Panels and menus open: the dock hides with the other HUD bits. */
body:has(#hud[hidden], #menu:not([hidden]), #clique-panel:not([hidden]), #activity:not([hidden]), #map:not([hidden]), #garage-visit:not([hidden])) :is(#note-dock, .hunt-card) { visibility: hidden; }
body:has(#hud:is([data-state="wheelie"], [data-state="stoppie"], [data-state="air"])) #note-dock { visibility: hidden; }

/* #802 Loading screen (index.html): full-bleed key art from the game, the wordmark on the light sky, one quiet strip on
   the dark road below (no card). Only the thin progress line moves (5 updates a second from the inline script, eased by a
   short transform transition): a full-screen animation would make the GPU redraw the whole picture while it compiles the
   world's shaders (#232 measured that in tools/perf/phone.mjs). The art fades in once when it has arrived.
   Text contrast: ink wordmark on a cream veil over the sky (> 10:1), cream text on a dark veil over the road (> 9:1). */
#loading { display: block; padding: 0; overflow: hidden; color: var(--ms-cream); font-family: Inter, system-ui, sans-serif;
  /* the picture's own colours while it is on its way: sky, roofs, road */
  background: linear-gradient(180deg, #d6cdd5 0%, #c7a8ae 38%, #6a4c3c 62%, #331e18 100%); }
.ld-art, .ld-art img { position: absolute; inset: 0; width: 100%; height: 100%; }
.ld-art img { display: block; object-fit: cover; object-position: 66% 50%; opacity: 0; transition: opacity 0.5s ease-out; }
.ld-art.ld-in img { opacity: 1; }
#loading::before, #loading::after { content: ''; position: absolute; left: 0; right: 0; pointer-events: none; }
#loading::before { top: 0; height: 34%; background: linear-gradient(180deg, rgba(255, 248, 236, 0.62), rgba(255, 248, 236, 0.28) 45%, rgba(255, 248, 236, 0)); }
#loading::after { bottom: 0; height: 46%; background: linear-gradient(0deg, rgba(22, 14, 12, 0.92), rgba(22, 14, 12, 0.72) 38%, rgba(22, 14, 12, 0)); }
.ld-card { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  padding: max(28px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
.ld-mark { margin: 0; width: min(300px, 76vw); color: var(--ms-ink); }
/* a soft warm halo keeps the ink letters clear where a roof or chimney runs behind them */
.ld-logo { filter: drop-shadow(0 0 1.5px rgba(255, 244, 226, 0.95)) drop-shadow(0 0 10px rgba(255, 240, 214, 0.75)); }
.ld-foot { width: min(440px, 100%); display: grid; gap: 10px; }
.ld-step { margin: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 15px; font-weight: 600;
  letter-spacing: 0.01em; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.ld-step #load-pct { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 500; color: rgba(255, 248, 236, 0.78); }
.ld-bar { height: 3px; border-radius: 2px; background: rgba(255, 248, 236, 0.22); overflow: hidden; }
.ld-bar > div { height: 100%; background: var(--ms-sun); transform-origin: left; transform: scaleX(0); transition: transform 0.2s linear; }
.ld-tip { min-height: 2.9em; margin: 2px 0 0; font-size: 14px; line-height: 1.45; color: rgba(255, 248, 236, 0.86); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.ld-slow { display: grid; gap: 12px; justify-items: start; }
.ld-slow[hidden] { display: none; }
.ld-slow p { margin: 0; font-size: 15px; line-height: 1.45; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.ld-slow button.primary { min-height: 44px; padding: 0 24px; border: 0; border-radius: 12px; background: var(--ms-sun); color: var(--ms-ink);
  font: 700 15px Inter, system-ui, sans-serif; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); cursor: pointer; }
.ld-slow button.primary:focus-visible { outline: 3px solid var(--ms-cream); outline-offset: 2px; }
/* Slow: the note takes the tip's place, so the strip does not grow. Failed: "Hoppla" as the headline, the picture dims. */
#loading:has(#load-slow:not([hidden])) .ld-tip { display: none; }
.ld-failed .ld-bar, .ld-failed .ld-tip, .ld-failed #load-pct { display: none; }
.ld-failed #load-step { font: 800 30px/1.1 'Bricolage Grotesque', Inter, system-ui, sans-serif; letter-spacing: 0; }
.ld-failed .ld-art img { filter: saturate(0.6); }
/* Wide screens: wordmark top left in the open sky above the roofs, strip bottom left, the moped (right third of the
   wide picture) stays clear. */
@media (orientation: landscape) {
  .ld-card { align-items: flex-start; padding-left: max(40px, env(safe-area-inset-left)); padding-right: max(40px, env(safe-area-inset-right)); padding-bottom: max(32px, env(safe-area-inset-bottom)); }
  .ld-mark { width: clamp(220px, 24vw, 380px); }
  /* warm low-sun glow behind the mark, dark corner under the strip; both stay off the moped */
  #loading::before { right: auto; width: 56%; height: 40%; background: radial-gradient(100% 100% at 0 0, rgba(255, 240, 214, 0.62), rgba(255, 240, 214, 0.3) 45%, rgba(255, 240, 214, 0) 80%); }
  #loading::after { right: auto; width: 72%; height: 64%; background: radial-gradient(100% 100% at 0 100%, rgba(22, 14, 12, 0.9), rgba(22, 14, 12, 0.62) 45%, rgba(22, 14, 12, 0) 80%); }
}
/* Phones turned sideways: little height, so a smaller mark and a tighter strip. */
@media (orientation: landscape) and (max-height: 500px) {
  .ld-card { padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .ld-mark { width: 180px; }
  .ld-art img { object-position: 66% 62%; }   /* wheels in, the chimney below the mark */
  .ld-foot { width: min(400px, 100%); gap: 7px; }
  .ld-tip { min-height: 0; font-size: 13px; }
  .ld-failed #load-step { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { .ld-art img, .ld-bar > div { transition: none; } }
/* #232 The game picture under the loading screen is not shown, so the compositor does not redraw it with every moped step. */
body:has(#loading:not([hidden])) #view { visibility: hidden; }
/* #276 every HUD toggle shows its state: indicators keep an amber frame while on and fill in step with the bike's light; light button blue on every device; helmet/goggles struck through while off */
.blink[data-press="KeyZ"].on, .blink[data-press="KeyX"].on, .blink[data-press="KeyC"].on { outline: 2px solid #ffa63d; outline-offset: -2px; color: #ffa63d; }
.blink[data-press="KeyZ"].flash, .blink[data-press="KeyX"].flash, .blink[data-press="KeyC"].flash { background: #ffa63d; color: #1b1407; }
#light-button.on { color: #7fb6ff; outline: 2px solid #7fb6ff; outline-offset: -2px; }
.hud-round.off { opacity: 0.6; }
.hud-round.off::after { content: ""; position: absolute; left: 22%; right: 22%; top: 50%; border-top: 3px solid #ff6a5a; transform: rotate(-35deg); pointer-events: none; }
#hud #hud-tray .hud-round.off { position: relative; }
/* #281 question before a rescue/jump would end a running job, race or challenge */
.ask-box { position: fixed; left: 50%; bottom: 30%; transform: translateX(-50%); z-index: 70; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: min(86vw, 320px); padding: 12px 14px; border-radius: 14px; background: #fffdf6; color: #1b1407; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4); }
.ask-box p { flex: 1 0 100%; margin: 0 0 4px; font: 700 15px system-ui, sans-serif; text-align: center; }
.ask-box button { min-width: 96px; min-height: 44px; border: 0; border-radius: 10px; font: 700 15px system-ui, sans-serif; background: #2f7fd6; color: #fff; }
.ask-box button.alt { background: #e9e2d2; color: #1b1407; }

/* ==== #400 step 2: tuning shop v2 – icon category rail, part pictures, state cards, sticky action bar ==== */
/* Phone (portrait): bar on top, the live bike in the free stage, a bottom sheet with rail, part chips, value cards and
   the action bar. Wide screens (landscape phones, tablets across, desktop): rail left, bike in the middle, panel
   right. One DOM, the grid moves it; the camera centres the part in #shop-stage (main.js shopCamera, #400). */
#shop { position: fixed; inset: 0; display: grid; pointer-events: none; color: var(--ink);
  grid-template: "bar" auto "stage" minmax(0, 1fr) "rail" auto "dock" auto / minmax(0, 1fr); }
#shop > * { min-width: 0; pointer-events: auto; }
#shop > #shop-stage { grid-area: stage; pointer-events: none; }
#shop .ui-icon { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; }
#shop .ui-icon svg { width: 100%; height: 100%; }
/* Bar: Fertig (left), title, coins with the coin icon. */
#shop .shop-bar { position: static; grid-area: bar; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 0; box-shadow: none;
  padding: calc(8px + var(--safe-top)) calc(12px + var(--safe-right)) 8px calc(12px + var(--safe-left));
  background: linear-gradient(rgba(16, 18, 26, 0.72), rgba(16, 18, 26, 0)); }
#shop .shop-bar h2 { flex: 1; min-width: 0; margin: 0; overflow: hidden; font-size: 16px; letter-spacing: 0.06em; text-transform: uppercase; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); }
#shop #shop-leave { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 16px 0 10px; }
#shop .coins-line { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px 0 8px; }
#shop .coins-line .ui-icon { color: #f2c14e; }
/* Category rail: icon over its word; a gold dot = something fitted in that category. */
#shop-groups { grid-area: rail; display: flex; gap: 4px; padding: 8px calc(10px + var(--safe-right)) 4px calc(10px + var(--safe-left)); overflow-x: auto; scrollbar-width: none; touch-action: pan-x;
  background: rgba(16, 18, 26, 0.94); border-top: 1px solid var(--rim); border-radius: 18px 18px 0 0; }
#shop-groups::-webkit-scrollbar { display: none; }
#shop .tu-group { position: relative; flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 50px; min-height: 54px; padding: 5px 3px; border-radius: 12px; font-size: 13px; font-weight: 700; }
#shop .tu-group[aria-pressed="true"] { background: #f2c14e; border-color: #f2c14e; color: #1a1a1a; }
#shop .tu-group.tuned::after, #shop .tu-chip.tuned::after { content: ""; position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: #f2c14e; box-shadow: 0 0 0 2px rgba(16, 18, 26, 0.9); }
#shop .tu-group[aria-pressed="true"].tuned::after, #shop .tu-chip[aria-pressed="true"].tuned::after { background: #1a1a1a; box-shadow: none; }
/* The sheet: part line, part chips, stats, value cards, action bar. */
#shop #shop-dock { position: static; grid-area: dock; display: grid; gap: 8px; min-height: 0; border: 0; border-radius: 0; box-shadow: none;
  padding: 4px calc(10px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(10px + var(--safe-left)); background: rgba(16, 18, 26, 0.94); }
/* #1026 a moped without shop parts (the Schwalbe): one plain card, no rail, part line, chips, stats or buy bar */
#shop.shop-none #shop-groups, #shop.shop-none #shop-head, #shop.shop-none #shop-chips, #shop.shop-none #shop-stats, #shop.shop-none #shop-led,
#shop.shop-none #shop-act, #shop.shop-none #shop-mine-open { display: none; }
#shop.shop-none #shop-dock { align-self: start; height: auto; }
#shop .tu-none { flex: 1 1 auto; display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--rim); border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
#shop .tu-none b { color: var(--ink); font-size: 15px; line-height: 1.3; }
#shop .tu-none span { color: var(--muted); font-size: 13px; line-height: 1.3; }
#shop-head { display: flex; align-items: baseline; gap: 6px; margin: 0; overflow: hidden; color: var(--muted); font-size: 14px; white-space: nowrap; }
#shop-head b { color: var(--ink); font-size: 15px; }
#shop-head span { overflow: hidden; text-overflow: ellipsis; }
#shop #shop-chips, #shop #shop-list { display: flex; gap: 8px; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; touch-action: pan-x; padding: 2px 28px 2px 2px; }
#shop .tu-chip { position: relative; flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 48px; padding: 3px 12px 3px 4px; border-radius: 12px; font-size: 14px; white-space: nowrap; }
#shop .tu-chip[aria-pressed="true"] { background: #f2c14e; border-color: #f2c14e; color: #1a1a1a; }
#shop .tu-chip .tu-pic { width: 40px; height: 40px; }
#shop .tu-pic { position: relative; display: grid; place-items: center; flex: none; width: 64px; height: 64px; border-radius: 9px; background-color: #fff8ec; background-repeat: no-repeat;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08); color: #3a2f28; font-style: normal; }
#shop .tu-pic.stock { font-size: 13px; font-weight: 800; letter-spacing: 0.04em; }
#shop .tu-pic .dot { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; margin: 0; border-radius: 50%; background: var(--shade); border: 2px solid #10121a; box-shadow: none; }
#shop .tu-pic .dot.candy { background: radial-gradient(circle at 35% 30%, #fff 0, var(--shade) 45%, #000 130%); }
#shop .tu-pic .dot.metal { background: linear-gradient(135deg, #ffffffb0 0, var(--shade) 45%, var(--shade) 100%); }
#shop .tu-pic .dot.carbon { background: repeating-linear-gradient(60deg, #1b1c20 0 3px, #33353c 3px 5px); border-color: var(--shade); }
#shop .tu-card { position: relative; flex: none; display: grid; justify-items: center; align-content: start; gap: 4px; width: 100px; padding: 6px 6px 7px; border-radius: 12px; font-size: 13px; text-align: center; }
#shop .tu-card .tu-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#shop .tu-card[aria-pressed="true"] { outline: 3px solid #f2c14e; outline-offset: 0; }
#shop .tu-card.fitted:not([aria-pressed="true"]) { border-color: #7bdc8b; }
#shop .tu-card.locked:not([aria-pressed="true"]) .tu-pic { filter: grayscale(1) opacity(0.55); }
#shop .tu-state { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; line-height: 1; white-space: nowrap; color: var(--muted); }
#shop .tu-state .ui-icon { width: 14px; height: 14px; }
#shop .tu-state[data-need] { white-space: normal; font-size: 11px; line-height: 1.1; text-align: left; max-width: 100%; }   /* #400 step 7: 'Nur mit Scheibe' may take two lines */
#shop .tu-state[data-state="fitted"] { color: #7bdc8b; }
#shop .tu-state[data-state="price"] { color: #f2c14e; }
#shop .tu-state[data-state="broke"] { color: #ff8c7d; }
#shop [aria-pressed="true"] .tu-state { color: #3a2f28; }
#shop [aria-pressed="true"] .tu-state[data-state="fitted"] { color: #1e7a36; }
#shop [aria-pressed="true"] .tu-state[data-state="broke"] { color: #a3271c; }
#shop #shop-stats { display: flex; gap: 14px; margin: 0; overflow-x: auto; touch-action: pan-x; scrollbar-width: none; font-size: 13px; white-space: nowrap; }
#shop #shop-stats::-webkit-scrollbar, #shop #shop-chips::-webkit-scrollbar, #shop #shop-list::-webkit-scrollbar { display: none; }
#shop-stats div { display: flex; gap: 5px; }
#shop-stats dt { color: var(--muted); }
#shop-stats dd { margin: 0; font-weight: 700; color: var(--ink); }
#shop-stats .better dd { color: #7bdc8b; }
#shop-stats .worse dd { color: #ff8c7d; }
/* Action bar: what is chosen + its state on top, Zurück + the one main button below. Always at the sheet's bottom. */
#shop-act { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 8px; padding-top: 8px; border-top: 1px solid var(--line); }
#shop #shop-now { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 8px; min-width: 0; margin: 0; overflow: hidden; font-size: 15px; font-weight: 700; white-space: nowrap; }
#shop-now b { overflow: hidden; text-overflow: ellipsis; }
#shop-now small { overflow: hidden; color: var(--muted); font-size: 13px; font-weight: 400; text-overflow: ellipsis; }
#shop #shop-back { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 48px; min-height: 48px; padding: 0 12px; font-size: 14px; }
#shop #shop-buy { grid-column: 2; display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto; min-height: 48px; padding: 0 16px; font-size: 15px; }
#shop #shop-buy:disabled { background: rgba(255, 255, 255, 0.08); color: var(--muted); cursor: default; }
#shop #shop-buy[data-kind="fitted"]:disabled { color: #7bdc8b; }
#shop #shop-led { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#shop #shop-led > button:first-child { min-height: 44px; }
#shop #shop-led .swatch { width: 44px; height: 44px; }
/* Short phones (≤ 780 px tall, portrait): smaller pictures, so the bike keeps more room. */
@media (max-height: 780px) and (max-aspect-ratio: 4/3) {
  #shop .tu-group { min-height: 48px; padding-top: 3px; padding-bottom: 3px; }
  #shop .tu-chip { min-height: 44px; }
  #shop .tu-chip .tu-pic { width: 34px; height: 34px; }
  #shop .tu-card .tu-pic { width: 52px; height: 52px; }
  #shop #shop-dock { gap: 6px; }
}
@media (max-width: 440px) {
  #shop .coins-line .tu-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 400px) {
  #shop-back span { display: none; }
  #shop .tu-card { width: 92px; }
}
/* Wide screens: rail | bike | panel. Landscape phones keep the chip and card rows sideways (little height). */
@media (min-width: 600px) and (min-aspect-ratio: 4/3) {
  #shop { grid-template: "bar bar bar" auto "rail stage dock" minmax(0, 1fr) / auto minmax(0, 1fr) minmax(300px, 30vw); }
  #shop-groups { flex-direction: column; align-self: start; max-height: calc(100% - 12px); margin: 0 0 12px calc(12px + var(--safe-left)); padding: 6px;
    overflow-x: hidden; overflow-y: auto; touch-action: pan-y; border: 1px solid var(--rim); border-radius: 16px; }
  #shop .tu-group { flex: none; flex-direction: row; justify-content: flex-start; gap: 8px; min-height: 44px; padding: 4px 12px 4px 8px; font-size: 14px; }
  #shop .tu-group.tuned::after { top: 50%; right: 8px; transform: translateY(-50%); }
  #shop .tu-group { padding-right: 22px; }
  #shop #shop-dock { display: flex; flex-direction: column; gap: 8px; max-width: 420px; margin: 0 calc(12px + var(--safe-right)) 12px 0; padding: 10px 12px 12px; border: 1px solid var(--rim); border-radius: 16px; overflow: hidden; }
  #shop #shop-head, #shop #shop-chips, #shop #shop-list, #shop #shop-stats { flex: none; }
  #shop #shop-act { flex: none; margin-top: auto; }
}
/* Landscape phones (little height): the chosen name is on its card already, so the action bar is one row. */
@media (min-width: 600px) and (min-aspect-ratio: 4/3) and (max-height: 559px) {
  #shop #shop-now { display: none; }
  #shop #shop-act { padding-top: 6px; }
  #shop #shop-buy { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; padding: 0 10px; }
  #shop-back span { display: none; }
}
@media (min-width: 600px) and (min-aspect-ratio: 4/3) and (min-height: 560px) {
  #shop #shop-chips { flex-wrap: wrap; overflow: visible; padding-right: 2px; -webkit-mask-image: none; mask-image: none; }
  #shop #shop-list { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); align-content: start; overflow-x: hidden; overflow-y: auto; touch-action: pan-y; padding-right: 2px; -webkit-mask-image: none; mask-image: none; }
  #shop .tu-card { width: auto; }
  #shop #shop-stats { flex-wrap: wrap; row-gap: 4px; overflow: visible; }
}
/* ==== end #400 step 2 ==== */
/* ==== #400 step 3: finishes + swatches – the dot looks like the finish (catalogue `finish`, bike.js FINISHES) ==== */
#shop .dot.gloss { background: radial-gradient(ellipse 60% 34% at 36% 24%, #ffffffd9 0, #fff0 72%), var(--shade); }   /* #400: one sharp lacquer highlight */
#shop .dot.matte { background: var(--shade); box-shadow: inset 0 -3px 5px #0000002e; }   /* #400: flat, no highlight */
#shop .dot.metal { background: radial-gradient(circle at 30% 34%, #fff 0 0.8px, #fff0 1.4px), radial-gradient(circle at 66% 58%, #ffffffdd 0 0.8px, #fff0 1.4px),
  radial-gradient(circle at 44% 76%, #ffffffbb 0 0.7px, #fff0 1.2px), radial-gradient(circle at 72% 30%, #fff 0 0.7px, #fff0 1.2px),
  linear-gradient(135deg, #ffffffa0 0, var(--shade) 46%, color-mix(in srgb, var(--shade), #000 38%) 100%); }   /* #400: sparkle flakes + sheen */
#shop .dot.chrome { background: linear-gradient(180deg, #fff 0, #e3e9f1 28%, #8c96a3 47%, #262a31 53%, #8f99a4 78%, #f2f5f8 100%); }   /* #400: mirror with a horizon */
#shop .dot.anodised { background: repeating-linear-gradient(90deg, #ffffff14 0 1px, #fff0 1px 3px),
  conic-gradient(from 210deg, var(--shade), color-mix(in srgb, var(--shade), #fff 50%) 22%, var(--shade) 45%, color-mix(in srgb, var(--shade), #000 45%) 72%, var(--shade)); }   /* #400: dyed brushed metal, coloured highlight */
#shop .dot.duo { background: repeating-linear-gradient(90deg, #ffffff14 0 1px, #fff0 1px 3px),
  conic-gradient(from 200deg, var(--shade) 0 22%, var(--shade2) 52% 70%, var(--shade) 100%); }   /* #927 two-tone reward rims: the main colour fading into the second one */
#shop .tu-finish { flex: none; display: grid; justify-items: center; align-content: center; gap: 6px; width: 58px; padding: 4px 0 4px 6px; border-left: 2px solid #f2c14e66;
  color: #f2c14e; font-size: 12px; font-weight: 800; letter-spacing: 0.02em; }   /* #400: group heading in the card row */
#shop .tu-finish .dot { position: static; display: block; width: 30px; height: 30px; margin: 0; border-radius: 50%; border: 2px solid #10121a; }   /* #400 */
#shop .tu-finish .dot:not(.gloss, .matte, .metal, .chrome, .anodised, .candy, .carbon, .duo) { background: var(--shade); }   /* #400 */   /* #927: + duo */
#shop .tu-finish .dot.candy { background: radial-gradient(circle at 35% 30%, #fff 0, var(--shade) 45%, #000 130%); }   /* #400: same as the card dot */
#shop .tu-finish .dot.carbon { background: repeating-linear-gradient(60deg, #1b1c20 0 3px, #33353c 3px 5px); }   /* #400 */
@media (min-width: 600px) and (min-aspect-ratio: 4/3) and (min-height: 560px) {
  #shop .tu-finish { grid-column: 1 / -1; display: flex; justify-content: flex-start; width: auto; padding: 6px 0 0; border-left: 0; border-top: 1px solid #f2c14e44; }   /* #400: heading row in the grid */
  #shop .tu-finish .dot { width: 20px; height: 20px; }   /* #400 */
}
/* ==== end #400 step 3 ==== */
/* ==== #974 colour picker: one palette of big round swatches per part (tuning-ui.js swatchPalette), "Form | Farbe" steps ==== */
#shop #shop-list.tu-pal-mode { display: block; overflow: visible; }   /* #974 the palette lays itself out */
#shop .tu-palette { --sw: 32px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 5px 14px; padding: 2px 2px 0; }   /* #974 small groups share a row */
#shop .tu-pgroup { flex: 0 0 auto; display: grid; gap: 4px; min-width: 0; }   /* #974 */
#shop .tu-pgroup.wide { flex-basis: 100%; }   /* #974 */
#shop .tu-phead { display: flex; align-items: center; gap: 7px; margin: 0; color: #f2c14e; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; line-height: 16px; text-transform: uppercase; white-space: nowrap; }   /* #974 */
#shop .tu-pprice { display: inline-flex; align-items: center; gap: 2px; color: var(--ink); font-size: 12px; font-weight: 700; letter-spacing: 0; line-height: 1; text-transform: none; }   /* #974 the price, once per group */
#shop .tu-pprice .ui-icon { width: 12px; height: 12px; color: #f2c14e; }   /* #974 */
#shop .tu-pprice.broke, #shop .tu-pprice.broke .ui-icon { color: #ff8c7d; }   /* #974 too dear right now: red, as on the cards */
#shop .tu-pset { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 3px 3px; }   /* #974 */
#shop .tu-swatch { position: relative; flex: none; display: grid; justify-items: center; align-content: start; gap: 2px; width: calc(var(--sw) + 4px); min-width: 0; min-height: calc(var(--sw) + 4px); margin: 0; padding: 2px;   /* #974 hit area 36 px */
  border: 0; border-radius: 50%; background: none; color: var(--ink); font-weight: 400; transition: transform 0.12s ease-out; -webkit-tap-highlight-color: transparent; }   /* #974 the colour is the button */
#shop .tu-swatch:hover, #shop .tu-swatch[aria-pressed="true"] { background: none; color: var(--ink); }   /* #974 no button fill */
#shop .tu-swatch:active { transform: scale(0.9); }   /* #974 */
#shop .tu-swatch .dot { display: grid; place-items: center; width: var(--sw); height: var(--sw); box-sizing: border-box; border-radius: 50%; border: 2px solid #ffffff2e; font-style: normal; }   /* #974 */
#shop .tu-swatch .dot:not(.gloss, .matte, .metal, .chrome, .anodised, .candy, .carbon, .duo) { background: var(--shade); }   /* #974 */
#shop .tu-swatch .dot.candy { background: radial-gradient(circle at 35% 30%, #fff 0, var(--shade) 45%, #000 130%); }   /* #974 = the card dot */
#shop .tu-swatch .dot.carbon { background: repeating-linear-gradient(60deg, #1b1c20 0 3px, #33353c 3px 5px); border-color: var(--shade); }   /* #974 */
#shop .tu-swatch .dot.neon { border-color: #ffffffa0; box-shadow: 0 0 10px 1px color-mix(in srgb, var(--shade) 80%, transparent), inset 0 0 6px #ffffff90; }   /* #974 neon glows */
#shop .tu-swatch .dot.chrome { border-color: #ffffff70; }   /* #974 */
/* PROCOAT Pulverlack set: the colour fading to silver at the bottom, a black X slash (card, finish heading, swatch) */
#shop .tu-pic .dot.procoat, #shop .tu-finish .dot.procoat, #shop .tu-swatch .dot.procoat {
  background: linear-gradient(45deg, #0000 44%, #141018 44% 56%, #0000 56%) 50% 46% / 46% 46% no-repeat, linear-gradient(-45deg, #0000 44%, #141018 44% 56%, #0000 56%) 50% 46% / 46% 46% no-repeat,
    radial-gradient(circle at 35% 22%, #ffffffb0 0, #fff0 30%), linear-gradient(180deg, var(--shade) 0, var(--shade) 42%, #dcdee6 88%); }
/* IFACRAFT Glow: gloss black with a mint glow-paint pixel block and a soft green glow round it */
#shop .tu-pic .dot.glow, #shop .tu-finish .dot.glow, #shop .tu-swatch .dot.glow {
  background: linear-gradient(#9be8c0, #9be8c0) 30% 34% / 22% 22% no-repeat, linear-gradient(#9be8c0, #9be8c0) 70% 34% / 22% 22% no-repeat,
    linear-gradient(#9be8c0, #9be8c0) 50% 74% / 52% 16% no-repeat, radial-gradient(circle at 35% 22%, #ffffff60 0, #fff0 30%), var(--shade);
  box-shadow: 0 0 8px 1px #3dff8c60; }
#shop .tu-swatch[aria-pressed="true"] .dot { outline: 3px solid #f2c14e; outline-offset: 1px; }   /* #974 the colour being tried on: a gold ring */
#shop .tu-swatch.fitted .dot { border-color: #7bdc8b; border-width: 3px; }   /* #974 fitted: green rim + check */
#shop .tu-swatch .tu-badge { position: absolute; top: calc(var(--sw) - 13px); right: -3px; display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid #10121a; background: #7bdc8b; color: #10121a; font-style: normal; }   /* #974 */
#shop .tu-swatch .tu-badge .ui-icon { width: 11px; height: 11px; }   /* #974 */
#shop .tu-swatch.locked .tu-badge { background: #3b3f4a; color: #e8e2d4; }   /* #974 lock */
#shop .tu-swatch.owned::after { content: ""; position: absolute; top: 0; right: -1px; width: 10px; height: 10px; border-radius: 50%; background: #f2c14e; border: 2px solid #10121a; }   /* #974 bought: a gold dot */
#shop .tu-swatch > .tu-pprice { font-size: 10.5px; }   /* #974 own price (groups with mixed prices) */
#shop .tu-swatch > .tu-pprice .ui-icon { width: 10px; height: 10px; }   /* #974 */
#shop .tu-swatch.priced { width: calc(var(--sw) + 8px); margin: 0 -2px; }   /* #974 room for "1.200" */
#shop .tu-swatch.serie .dot { border: 2px dashed #ffffff66; background: #262932; color: var(--ink); font-size: 9.5px; font-weight: 800; letter-spacing: 0.01em; }   /* #974 Serie: the stock colour */
#shop .tu-swatch.serie.fitted .dot { border: 3px solid #7bdc8b; }   /* #974 */
#shop .tu-swatch.custom .dot { background: conic-gradient(#ff3030, #ffd400, #3cff3a, #10e0ff, #2a5bff, #d42aff, #ff3030); }   /* #974 Wunschfarbe */
#shop .tu-swatch.custom .dot.mixed { background: radial-gradient(circle, var(--shade) 0 36%, #fff 37% 44%, #fff0 45%), conic-gradient(#ff3030, #ffd400, #3cff3a, #10e0ff, #2a5bff, #d42aff, #ff3030); }   /* #974 the mixed colour inside */
#shop .tu-plegend { flex: 1 1 auto; align-self: flex-end; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 2px 5px; margin: 0; padding-bottom: 2px; color: var(--muted); font-size: 11px; }   /* #974 */
#shop .tu-lg { display: inline-block; width: 10px; height: 10px; margin-left: 4px; border-radius: 50%; }   /* #974 */
#shop .tu-lg.ring { box-shadow: 0 0 0 2px #f2c14e; }   /* #974 */
#shop .tu-lg.fit { border: 2px solid #7bdc8b; }   /* #974 */
#shop .tu-lg.own { width: 8px; height: 8px; background: #f2c14e; }   /* #974 */
#shop #shop-head:has(.tu-steps) { align-items: center; overflow: visible; }   /* #974 */
#shop .tu-steps { display: inline-flex; flex: none; gap: 2px; margin-left: auto; padding: 2px; border-radius: 11px; background: #ffffff14; }   /* #974 Form | Farbe */
#shop .tu-steps button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0; padding: 0 13px; border: 0; border-radius: 9px; background: none; color: var(--ink); font-size: 13.5px; font-weight: 700; }   /* #974 */
#shop .tu-steps button[aria-pressed="true"] { background: #f2c14e; color: #1a1a1a; }   /* #974 */
#shop .tu-steps .dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #10121a; }   /* #974 */
#shop .tu-steps .dot.none { background: conic-gradient(#ff3030, #ffd400, #3cff3a, #10e0ff, #2a5bff, #d42aff, #ff3030); }   /* #974 no colour fitted yet */
#shop .tu-pic.tinted { isolation: isolate; }   /* #974 a palette colour's part picture, tinted (tintPicture) */
#shop .tu-pic.tinted > .tu-tint-pic, #shop .tu-pic.tinted > .tu-tint-col { position: absolute; inset: 0; border-radius: inherit; background-repeat: no-repeat; pointer-events: none; }   /* #974 */
#shop .tu-pic.tinted > .tu-tint-pic { filter: grayscale(1) brightness(1.45) contrast(1.15); }   /* #974 the shading */
#shop .tu-pic.tinted > .tu-tint-col { background: var(--tint); mix-blend-mode: multiply; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }   /* #974 the colour, inside the part only */
@media (min-width: 600px) and (min-aspect-ratio: 4/3) and (min-height: 560px) {
  #shop .tu-palette { --sw: 38px; }   /* #974 desktop panel: a bit bigger */
}
#shop #shop-list > .tu-steps.in-list { grid-column: 1 / -1; display: flex; margin: 0 0 6px; }   /* #974 phones: Form | Farbe over the swatches */
#shop #shop-list > .tu-steps.in-list button { flex: 1 1 0; justify-content: center; min-height: 44px; }   /* #974 */
@media (min-width: 600px) and (min-aspect-ratio: 4/3) { #shop #shop-list > .tu-steps.in-list { display: none; } }   /* #974 wide screens: in the part line */
@media not ((min-width: 600px) and (min-aspect-ratio: 4/3)) {   /* #974 */
  #shop .tu-steps.in-head { display: none; }   /* #974 */
  #shop.palette-open #shop-head { display: none; }   /* #974 the palette needs the room; the buy bar names part and colour */
}
@media (max-aspect-ratio: 4/3) {   /* #974 phones upright: the whole palette on one screen – a taller sheet, slimmer part chips */
  #shop.palette-tall #shop-dock { max-height: 64vh; max-height: 64dvh; }   /* #974 */
  #shop.palette-open #shop-dock { scroll-padding-bottom: 100px; }   /* #974 (#885: 54dvh); the buy bar's height */
  #shop.palette-open .tu-chip { padding: 1px 11px; }   /* #974 words only (like #885 landscape): fewer chip rows */
  #shop.palette-open .tu-chip .tu-pic { display: none; }   /* #974 */
}
/* ==== end #974 ==== */
/* ==== #400 step 4: camera + motion + sound – action bar with hold-to-compare, stat delta bars, press/pop/slide motion ==== */
#shop-act { display: flex; flex-wrap: wrap; }   /* #400: back · compare · buy in one row (was a 2-column grid) */
#shop #shop-now { flex: 1 0 100%; }   /* #400 */
#shop #shop-buy { flex: 1 1 0; min-width: 0; }   /* #400 */
#shop #shop-compare { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 48px; padding: 0 12px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }   /* #400 */
#shop #shop-compare span { display: none; }   /* #400 icon only; aria-label + title say it */
#shop #shop-compare[aria-pressed="true"] { background: #f2c14e; border-color: #f2c14e; color: #1a1a1a; }   /* #400 */
#shop #shop-buy[aria-disabled="true"] { background: rgba(255, 255, 255, 0.08); color: var(--muted); cursor: default; }   /* #400: looks like :disabled, but a press says "no" */
#shop #shop-buy[data-kind="fitted"][aria-disabled="true"] { color: #7bdc8b; }   /* #400 */
#shop-stage { position: relative; }   /* #400 */
#shop.comparing #shop-stage::after { content: "Verbaut"; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); padding: 4px 12px; border-radius: 999px;
  background: #10121ae0; color: #7bdc8b; font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }   /* #400: what the bike shows while held */
/* stat delta bars (tuning-ui.js statBars): fitted value in ink, + green / − red piece, the width animates */
#shop .tu-stat { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; column-gap: 5px; row-gap: 3px; flex: none; min-width: 108px; }   /* #400 */
#shop .tu-stat dd { display: contents; }   /* #400 */
#shop .tu-stat b { font-weight: 700; color: var(--ink); }   /* #400 */
#shop .tu-stat small { font-size: 12px; font-weight: 800; }   /* #400 */
#shop .tu-stat.better small { color: #7bdc8b; }   /* #400 */
#shop .tu-stat.worse small { color: #ff8c7d; }   /* #400 */
#shop .tu-stat.better, #shop .tu-stat.worse { order: -1; }   /* #400 phone row: the changed stats first */
#shop .tu-bar { grid-row: 2; grid-column: 1 / -1; position: relative; display: block; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }   /* #400 */
#shop .tu-bar i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 3px; transition: width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), left 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }   /* #400 */
#shop .tu-bar .base { background: var(--ink); opacity: 0.75; }   /* #400 */
#shop .better .tu-bar .gain { background: #7bdc8b; }   /* #400 */
#shop .worse .tu-bar .gain { background: #ff8c7d; background-image: repeating-linear-gradient(135deg, #0000 0 3px, #0000003a 3px 5px); }   /* #400 a red cut, striped */
/* motion: press feedback, fitted pop, slide-in of a new part's cards, shake on "no", the sheet rising on open */
#shop .tu-card, #shop .tu-chip, #shop .tu-group, #shop #shop-buy, #shop #shop-back, #shop #shop-compare { transition: transform 0.12s ease-out; }   /* #400 (no colour fades: a state change shows at once) */
#shop .tu-card:active, #shop .tu-chip:active, #shop .tu-group:active, #shop #shop-buy:active, #shop #shop-back:active, #shop #shop-compare:active { transform: scale(0.95); }   /* #400 */
#shop .tu-card.pop { animation: tu-glow 0.7s ease-out; }   /* #400 */
#shop .tu-card.pop .tu-state { animation: tu-pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1); }   /* #400 */
#shop #shop-list.swap > * { animation: tu-in 0.26s ease-out both; }   /* #400 */
#shop #shop-list.swap > :nth-child(2) { animation-delay: 0.03s; }   /* #400 */
#shop #shop-list.swap > :nth-child(3) { animation-delay: 0.06s; }   /* #400 */
#shop #shop-list.swap > :nth-child(4) { animation-delay: 0.09s; }   /* #400 */
#shop #shop-list.swap > :nth-child(n+5) { animation-delay: 0.12s; }   /* #400 */
#shop #shop-buy.nope { animation: tu-shake 0.32s ease-in-out; }   /* #400 */
#shop:not([hidden]) #shop-dock, #shop:not([hidden]) #shop-groups { animation: tu-rise 0.3s ease-out both; }   /* #400 */
@keyframes tu-pop { 0% { transform: scale(0.4); } 100% { transform: scale(1); } }   /* #400 */
@keyframes tu-glow { 0% { box-shadow: 0 0 0 0 #7bdc8bcc; } 100% { box-shadow: 0 0 0 14px #7bdc8b00; } }   /* #400 */
@keyframes tu-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }   /* #400 */
@keyframes tu-shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }   /* #400 */
@keyframes tu-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }   /* #400 */
@media (min-width: 600px) and (min-aspect-ratio: 4/3) and (min-height: 560px) {
  #shop .tu-stat { flex: 1 1 140px; }   /* #400 desktop panel: wrapped, wider bars */
  #shop #shop-list.swap > * { animation-name: tu-up; }   /* #400 the grid slides up */
  @keyframes tu-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }   /* #400 */
}
@media (prefers-reduced-motion: reduce) {
  #shop *, #shop *::after { animation: none !important; transition: none !important; }   /* #400 no motion (the camera cuts, tuning-camera.js) */
}
/* ==== end #400 step 4 ==== */
/* ==== #400 step 5: Moped-Werkstatt v2 – icon cards in groups (Reifen / Service / Schrauben), wear gauges, in-place flip (werkstatt-ui.js) ==== */
#activity .card:has(.wk) { width: min(460px, 100%); }   /* #400 phone: nearly full width */
#activity-title .wk-title-icon { display: inline-grid; width: 26px; height: 26px; margin-right: 8px; vertical-align: -4px; color: #f2c14e; }   /* #400 */
#activity-title .wk-title-icon svg, #activity-list .wk .ui-icon svg { display: block; width: 100%; height: 100%; }   /* #400 */
#activity-list .wk { display: grid; gap: 16px; }   /* #400 */
#activity-list .wk [hidden] { display: none; }   /* #400 (small is display: block in the list) */
#activity-list .wk-group { display: grid; gap: 8px; }   /* #400 */
#activity-list .wk-head { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0 2px; }   /* #400 */
#activity-list .wk-head > .ui-icon { flex: none; width: 22px; height: 22px; color: #f2c14e; }   /* #400 */
#activity-list .wk-words { display: grid; min-width: 0; }   /* #400 */
#activity-list .wk-head b { color: #f2c14e; font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }   /* #400 */
#activity-list .wk-head small { color: var(--muted); font-size: 12px; font-weight: 400; }   /* #400 */
#activity-list .wk-cards { display: grid; gap: 8px; }   /* #400 */
#activity-list .wk-card { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-rows: auto 1fr; align-items: center; gap: 3px 11px; width: 100%; min-height: 64px; margin: 0;
  padding: 8px 10px 9px 8px; border-radius: 12px; text-align: left; transition: transform 0.12s ease-out; }   /* #400 picture | name + chip, details under them */
#activity-list .wk-card > .wk-pic { grid-row: 1 / 3; align-self: start; }   /* #400 */
#activity-list .wk-card > .wk-body { grid-column: 2 / 4; align-self: start; }   /* #400 */
#activity-list .wk-card:active { transform: scale(0.97); }   /* #400 */
#activity-list .wk-pic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; background: #fff8ec; color: #3a2f28; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08); font-style: normal; }   /* #400 cream tile, ink icon (shop .tu-pic) */
#activity-list .wk-pic .ui-icon { display: block; width: 28px; height: 28px; }   /* #400 */
#activity-list .wk-body { display: grid; gap: 4px; min-width: 0; }   /* #400 */
#activity-list .wk-name { color: var(--ink); font-size: 15px; line-height: 1.2; }   /* #400 */
#activity-list .wk-what { color: var(--muted); font-size: 12.5px; line-height: 1.25; }   /* #400 */
#activity-list .wk-gauge { display: flex; align-items: center; gap: 8px; }   /* #400 */
#activity-list .wk-bar { position: relative; flex: 1 1 auto; height: 7px; border-radius: 4px; overflow: hidden;
  background: linear-gradient(90deg, #7bdc8b2e 0 35%, #ffb02e2e 35% 70%, #ff4a3a2e 70%); }   /* #400 faint green → amber → red track at the wear.js lamp steps */
#activity-list .wk-fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 4px; background: #7bdc8b; transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }   /* #400 runs to the new value */
#activity-list .wk-gauge[data-level="warn"] .wk-fill { background: #ffb02e; }   /* #400 */
#activity-list .wk-gauge[data-level="bad"] .wk-fill { background: #ff5a4a; }   /* #400 */
#activity-list .wk-pct { display: block; flex: none; min-width: 3em; color: var(--ink); font-size: 12px; font-weight: 700; text-align: right; }   /* #400 */
#activity-list .wk-gauge[data-level="warn"] .wk-pct { color: #ffc35e; }   /* #400 */
#activity-list .wk-gauge[data-level="bad"] .wk-pct { color: #ff8c7d; }   /* #400 */
#activity-list .wk-gauge[data-level="bonus"] .wk-pct { color: #7bdc8b; }   /* #400 better than new */
#activity-list .wk-spare { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }   /* #400 */
#activity-list .wk-spare .ui-icon { flex: none; width: 14px; height: 14px; }   /* #400 */
#activity-list .wk-why { color: #f2c14e; font-size: 12px; }   /* #400 the reason, inline */
#activity-list .wk-card[data-state="broke"] .wk-why { color: #ff8c7d; }   /* #400 Dir fehlen … Münzen */
#activity-list .wk-state { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px 5px 7px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: 13px; font-weight: 800; line-height: 1; white-space: nowrap; }   /* #400 state chip (shop .tu-state) */
#activity-list .wk-state .ui-icon { display: block; width: 16px; height: 16px; }   /* #400 */
#activity-list .wk-state[data-state="price"] { border-color: #f2c14e66; background: #f2c14e14; color: #f2c14e; }   /* #400 */
#activity-list .wk-state[data-state="broke"] { border-color: #ff8c7d55; color: #ff8c7d; }   /* #400 */
#activity-list .wk-state[data-state="done"], #activity-list .wk-state[data-state="free"] { border-color: #7bdc8b66; background: #7bdc8b14; color: #7bdc8b; }   /* #400 */
#activity-list .wk-card[data-state="done"] { border-color: #7bdc8b55; }   /* #400 */
#activity-list .wk-card.locked { opacity: 1; filter: none; }   /* #400 greyed only the picture: the reason stays readable */
#activity-list .wk-card.locked .wk-pic { filter: grayscale(1) opacity(0.6); }   /* #400 */
#activity-list .wk-card.locked .wk-name { color: var(--muted); }   /* #400 */
#activity-list .wk-card.flip { animation: wk-flip 0.46s ease-in-out; }   /* #400 the card turns over; werkstatt-ui.js swaps the face at the half (230 ms) */
#activity-list .wk-card.done-pop .wk-state { animation: tu-pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1); }   /* #400 */
#activity-list .wk-card.done-pop .wk-pic { animation: tu-glow 0.7s ease-out; }   /* #400 */
#activity-list .wk-card.nope { animation: tu-shake 0.32s ease-in-out; }   /* #400 */
@keyframes wk-flip { 0% { transform: perspective(700px) rotateX(0); } 50% { transform: perspective(700px) rotateX(88deg); } 100% { transform: perspective(700px) rotateX(0); } }   /* #400 */
@media (max-width: 360px) {   /* #400 small phones: a smaller picture */
  #activity-list .wk-card { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 3px 9px; }   /* #400 */
  #activity-list .wk-pic { width: 42px; height: 42px; }   /* #400 */
}   /* #400 */
@media (min-width: 760px) {   /* #400 desktop and landscape: two cards per row */
  #activity .card:has(.wk) { width: min(880px, 100%); }   /* #400 */
  #activity-list .wk-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }   /* #400 */
}   /* #400 */
@media (prefers-reduced-motion: reduce) {   /* #400 */
  #activity-list .wk *, #activity-list .wk-card { animation: none !important; transition: none !important; }   /* #400 */
}   /* #400 */
/* ==== end #400 step 5 ==== */
/* ==== #400 step 6: Wunschfarbe (colour wheel panel, like the area-s51.de mobile panel) + "Mein Moped" sheet ==== */
#shop .tu-custom .tu-pic { background: conic-gradient(from 90deg, #f33, #ff3, #3f3, #3ff, #33f, #f3f, #f33); }   /* #400: rainbow tile */
#shop .tu-custom .tu-pic::after { content: ""; position: absolute; inset: 22%; border-radius: 50%; background: radial-gradient(circle, #fff 0, #fff0 72%); }   /* #400: white middle = the wheel */
#shop .tu-paint { position: relative; display: grid; grid-template: "wheel side" auto "value value" auto / auto minmax(0, 1fr); gap: 8px 12px; align-items: center;   /* #400 */
  padding: 8px 10px 10px; border: 1px solid var(--rim); border-radius: 14px; background: rgba(255, 255, 255, 0.05); }   /* #400 */
#shop .tu-paint[hidden] { display: none; }   /* #400 */
#shop .tu-wheel { grid-area: wheel; position: relative; width: 120px; height: 120px; border-radius: 50%; touch-action: none; cursor: crosshair; }   /* #400: 96 px on area-s51; a bit bigger for fingers */
#shop .tu-wheel:focus-visible { outline: 3px solid #f2c14e; outline-offset: 3px; }   /* #400 */
#shop .tu-wheel canvas { display: block; width: 100%; height: 100%; border-radius: 50%; }   /* #400 */
#shop .tu-handle { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #0008, 0 2px 6px #0007; pointer-events: none; }   /* #400 */
#shop .tu-paint-side { grid-area: side; display: grid; gap: 6px; min-width: 0; padding-right: 40px; }   /* #400: room for the X */
#shop .tu-paint-head { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; }   /* #400 */
#shop .tu-paint-dot { width: 28px; height: 28px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #0006; }   /* #400 */
#shop .tu-hex { display: grid; gap: 2px; font-size: 12px; color: var(--muted); }   /* #400 */
#shop .tu-hex input { width: 100%; max-width: 120px; min-height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0, 0, 0, 0.3); color: var(--ink); font: 600 15px/1 ui-monospace, monospace; }   /* #400 */
#shop .tu-paint-note { color: var(--muted); font-size: 12px; line-height: 1.3; }   /* #400 */
#shop .tu-value { grid-area: value; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }   /* #400 */
#shop .tu-value input { flex: 1; min-width: 0; height: 32px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; touch-action: pan-y; }   /* #400 */
#shop .tu-value input::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #000, var(--full, #fff)); box-shadow: inset 0 0 0 1px #fff3; }   /* #400 */
#shop .tu-value input::-moz-range-track { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #000, var(--full, #fff)); }   /* #400 */
#shop .tu-value input::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -8px; border: 3px solid #fff; border-radius: 50%; background: #f2c14e; box-shadow: 0 1px 4px #0008; }   /* #400 */
#shop .tu-value input::-moz-range-thumb { width: 22px; height: 22px; border: 3px solid #fff; border-radius: 50%; background: #f2c14e; }   /* #400 */
#shop .tu-value input:focus-visible { outline: 3px solid #f2c14e; outline-offset: 2px; border-radius: 8px; }   /* #400 */
#shop .tu-paint-close, #shop .tu-mine-close { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 12px; }   /* #400 */
/* Mein Moped: covers rail + dock on phones, the dock column on wide screens; the bike stays in view above/left. */   /* #400 */
#shop .tu-mine { grid-row: rail / dock; grid-column: 1 / -1; position: relative; display: flex; flex-direction: column; gap: 8px; max-height: 62vh; max-height: 62dvh; min-height: 0;   /* #400 */
  padding: 10px calc(12px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(12px + var(--safe-left)); background: rgba(16, 18, 26, 0.96); border-top: 1px solid var(--rim); }   /* #400 */
#shop.mine-open #shop-dock { visibility: hidden; }   /* #400: keeps the grid rows, the sheet sits on top */
#shop .tu-mine header { display: flex; align-items: center; min-height: 44px; padding-right: 50px; }   /* #400 */
#shop .tu-mine h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; letter-spacing: 0.04em; text-transform: uppercase; }   /* #400 */
#shop .tu-mine-sum { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin: 0; color: var(--muted); font-size: 14px; }   /* #400 */
#shop .tu-mine-sum b { display: inline-flex; align-items: center; gap: 5px; color: #f2c14e; font-size: 16px; }   /* #400 */
#shop .tu-mine-list { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 0; padding: 0 2px 0 0; overflow-y: auto; list-style: none; touch-action: pan-y; }   /* #400 */
#shop .tu-mine-group { grid-column: 1 / -1; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }   /* #400 */
#shop .tu-mine-row { position: relative; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 3px 8px 3px 3px; border: 1px solid var(--line); border-radius: 12px; }   /* #400 */
#shop .tu-mine-row.tuned { border-color: #7bdc8b; background: rgba(123, 220, 139, 0.08); }   /* #400 */
#shop .tu-mine-row:not(.tuned) { opacity: 0.62; }   /* #400: stock parts quieter */
#shop .tu-mine-row .tu-pic { width: 42px; height: 42px; font-size: 10px; }   /* #400 */
#shop .tu-mine-row .tu-pic .dot { width: 16px; height: 16px; right: -3px; bottom: -3px; }   /* #400 */
#shop .tu-mine-row span { display: grid; min-width: 0; line-height: 1.2; }   /* #400 */
#shop .tu-mine-row b, #shop .tu-mine-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* #400 */
#shop .tu-mine-row b { font-size: 13px; }   /* #400 */
#shop .tu-mine-row small { color: var(--muted); font-size: 12px; }   /* #400 */
#shop .tu-mine-row em { margin-left: auto; color: #f2c14e; font-size: 12px; font-style: normal; font-weight: 700; }   /* #400 */
#shop .tu-mine-photo { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; font-size: 16px; }   /* #400 */
@media (min-width: 600px) and (min-aspect-ratio: 4/3) {   /* #400 */
  #shop .tu-mine { grid-area: dock; max-width: 420px; max-height: none; margin: 0 calc(12px + var(--safe-right)) 12px 0; border: 1px solid var(--rim); border-radius: 16px; }   /* #400 */
  #shop .tu-wheel { width: 150px; height: 150px; }   /* #400: 160 px on area-s51 desktop */
}   /* #400 */
/* ==== end #400 step 6 ==== */
/* ==== #955 Auspuff-Baukasten: the card (a drawn pipe) and the builder panel over the card row ==== */
#shop .tu-pipe .tu-pic { background: linear-gradient(#fff8ec, #fff8ec); }   /* #955 */
#shop .tu-pipe .tu-pic::before { content: ""; position: absolute; left: 8%; right: 8%; top: 38%; height: 26%; border-radius: 4px 40% 40% 4px / 4px 50% 50% 4px;
  background: linear-gradient(180deg, #f4f6f9 0, #aab3be 45%, #3a3f47 60%, #c9d0d8 100%); clip-path: polygon(0 38%, 22% 38%, 38% 0, 70% 0, 82% 40%, 100% 40%, 100% 64%, 82% 64%, 70% 100%, 38% 100%, 22% 66%, 0 66%); }   /* #955 Krümmer, Bauch, Endrohr */
#shop .tu-pipe-panel { position: relative; display: grid; grid-auto-rows: max-content; gap: 4px; max-height: 46vh; max-height: 46dvh; overflow-y: auto; touch-action: pan-y; padding: 6px 8px 8px;
  border: 1px solid var(--rim); border-radius: 14px; background: rgba(255, 255, 255, 0.05); }   /* #955 */
#shop .tu-pipe-panel[hidden] { display: none; }   /* #955 */
#shop.pipe-open #shop-stats { display: none; }   /* #955 the builder's info line says what the pipe does */
#shop.pipe-open .tu-pipe-panel { flex: 1 1 auto; min-height: 0; max-height: none; }   /* #955 the panel takes the room of the stats */
@media (max-width: 599px) { #shop.pipe-open #shop-chips, #shop.pipe-open #shop-head { display: none; } }   /* #955 (+ the part heading: the builder has its own) */   /* #955 phones: the part chips make room (X closes the builder) */
@media (max-height: 500px) { #shop.pipe-open #shop-chips, #shop.pipe-open #shop-head { display: none; } #shop .tu-pipe-row.routes .tu-pipe-set > button { font-size: 11px; } }   /* #955 step 3: phones held sideways too – the chips left the builder one row of room */
/* #955 step 4: phones held sideways (844x390, 667x375): the builder fits without scrolling on the Weg tab and the moped is
   big beside it – the category list folds away while the builder is open (X brings it back), the panel runs from the
   top to the bottom of the screen (the title bar only spans the picture), and the rows are compact (32 px). */
@media (min-width: 600px) and (min-aspect-ratio: 4/3) and (max-height: 500px) {
  #shop.pipe-open #shop-groups { display: none; }   /* #955 step 4 */
  #shop.pipe-open { grid-template-columns: 0 minmax(0, 1fr) min(52vw, 420px); }   /* #955 step 4: a wider panel, the list's room goes to the picture */
  #shop.pipe-open .coins-line .tu-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }   /* #955 step 4: the shop name gets the room (screen readers still hear "Münzen") */
  body:has(#shop.pipe-open) #pov-toggle { display: none; }   /* #955 step 4: the minimap's helmet button showed through over the coins */
  #shop.pipe-open .tu-pipe-row { grid-template-columns: 58px minmax(0, 1fr); gap: 4px; }   /* #955 step 4 */
  #shop.pipe-open .tu-free .tu-pipe-row.points .tu-pipe-set { grid-template-columns: 40px 1fr 40px 40px 40px; }   /* #955 step 4 */
  #shop.pipe-open .shop-bar { grid-column: 1 / 3; }   /* #955 step 4 */
  #shop.pipe-open #shop-dock { grid-row: 1 / -1; margin-top: calc(6px + var(--safe-top)); margin-bottom: 6px; padding: 6px 8px 0; gap: 4px; }   /* #955 step 4 */
  #shop.pipe-open .tu-pipe-panel { gap: 3px; padding: 4px 6px 5px; }   /* #955 step 4 */
  #shop.pipe-open .tu-pipe-head { min-height: 32px; padding-right: 38px; font-size: 13px; line-height: 1.15; }   /* #955 step 4 */
  #shop.pipe-open .tu-pipe-info { font-size: 11px; }   /* #955 step 4 */
  #shop.pipe-open .tu-pipe-panel .tu-paint-close { top: 3px; right: 3px; width: 34px; height: 34px; }   /* #955 step 4 */
  #shop.pipe-open .tu-pipe-set > button { min-height: 32px; }   /* #955 step 4 */
  #shop.pipe-open .tu-pipe-row.routes .tu-pipe-set { gap: 3px; }   /* #955 step 4 */
  #shop.pipe-open .tu-pipe-row.routes .tu-pipe-set > button { padding: 1px 0; font-size: 10.5px; letter-spacing: -0.01em; line-height: 1; }   /* #955 step 4: "Laubbläser" fits 667 px */
  #shop.pipe-open .tu-pipe-set > button small { font-size: 10px; }   /* #955 step 4 */
  #shop.pipe-open .tu-free, #shop.pipe-open .tu-free-page { gap: 3px; }   /* #955 step 4 */
  #shop.pipe-open .tu-free-tabs > button { min-height: 30px; }   /* #955 step 4 */
  #shop.pipe-open .tu-free .tu-pipe-row.size { min-height: 30px; }   /* #955 step 4 */
  #shop.pipe-open .tu-free input[type="range"] { height: 26px; }   /* #955 step 4 */
  #shop.pipe-open .tu-pipe-fix { min-height: 30px; }   /* #955 step 4 */
  #shop.pipe-open #shop-act { padding: 5px 0 6px; }   /* #955 step 4 */
  #shop.pipe-open #shop-back, #shop.pipe-open #shop-compare, #shop.pipe-open #shop-buy { min-height: 40px; }   /* #955 step 4 */
}
#shop .tu-pipe-head { display: grid; gap: 1px; min-height: 40px; margin: 0; padding-right: 48px; font-size: 15px; line-height: 1.2; }   /* #955 room for the X */
#shop .tu-pipe-info { color: var(--muted); font-size: 12px; }   /* #955 */
#shop .tu-pipe-row { display: grid; grid-template-columns: 74px minmax(0, 1fr); align-items: center; gap: 6px; }   /* #955 */
#shop .tu-pipe-label { color: var(--muted); font-size: 12px; font-weight: 700; }   /* #955 */
#shop .tu-pipe-set { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; min-width: 0; }   /* #955 */
#shop .tu-pipe-set > button { display: grid; place-content: center; min-width: 0; min-height: 38px; padding: 2px 4px; border-radius: 10px; font-size: 13px; line-height: 1.1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* #955 */
#shop .tu-pipe-row.routes .tu-pipe-set > button { font-size: 12px; padding: 2px 1px; }   /* #955 "Laubbläser" fits a phone */
#shop .tu-pipe-set > button small { color: #f2c14e; font-size: 11px; font-weight: 700; }   /* #955 route kit price */
#shop .tu-pipe-set > button:not(.tu-pipe-dot)[aria-pressed="true"] { background: #f2c14e; border-color: #f2c14e; color: #1a1408; }   /* #955 */
#shop .tu-pipe-set > button[aria-pressed="true"] small { color: #1a1408; }   /* #955 */
#shop .tu-pipe-row.colours .tu-pipe-set { grid-auto-flow: column; grid-auto-columns: 36px; overflow-x: auto; scrollbar-width: none; touch-action: pan-x; padding: 2px; }   /* #955 35 colours scroll sideways */
#shop .tu-pipe-dot { width: 36px; min-height: 36px !important; height: 36px; margin: 1px 0; padding: 0 !important; border: 2px solid #fff6 !important; border-radius: 50% !important; }   /* #955 */
#shop .tu-pipe-dot[aria-pressed="true"] { border-color: #f2c14e !important; box-shadow: 0 0 0 2px #f2c14e; }   /* #955 */
/* #955 step 2: Freibau editor (tabs Weg / Maße / Naht / Finish) */
#shop .tu-pipe-row[hidden], #shop .tu-free[hidden], #shop .tu-free-page[hidden] { display: none; }
/* five route buttons (+ Freibau): the whole width, no label ("Laubbläser 3.800" fits); #955 step 3: on every screen (the
   desktop side panel is as narrow as a phone and cut it to "aubbläse") */
#shop .tu-pipe-row.routes { grid-template-columns: minmax(0, 1fr); }
#shop .tu-pipe-row.routes > .tu-pipe-label { display: none; }
#shop .tu-pipe-clash { color: #ff6b5e; font-size: 12px; font-weight: 700; }
#shop .tu-pipe-clash[hidden] { display: none; }
#shop .tu-pipe-fix { justify-self: start; min-height: 36px; padding: 4px 14px; border-radius: 10px; border: 1px solid #f2c14e; background: #f2c14e; color: #1a1408; font-size: 13px; font-weight: 700; }   /* #955 step 3a: Weg zu kurz → Auto-anpassen */
#shop .tu-pipe-fix[hidden] { display: none; }
#shop .tu-free { display: grid; gap: 4px; min-width: 0; }
#shop .tu-free-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
#shop .tu-free-tabs > button { min-height: 36px; padding: 2px 4px; border-radius: 10px; font-size: 13px; font-weight: 700; }
#shop .tu-free-tabs > button[aria-selected="true"] { background: #f2c14e; border-color: #f2c14e; color: #1a1408; }
#shop .tu-free-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)) 40px; }   /* #955 step 3: 5 tabs + Rückgängig */
#shop .tu-free-tabs > button { padding: 2px 1px; }   /* #955 step 3: "Finish" fits a phone with 5 tabs */
#shop .tu-free-undo { display: grid; place-items: center; }   /* #955 step 3 */
#shop .tu-free-undo:disabled { opacity: 0.35; }   /* #955 step 3: nothing to take back */
#shop .tu-free .tu-pipe-row.halterkind.off { opacity: 0.45; }   /* #955 step 3: no brackets: their kind is moot */
#shop .tu-free-page { display: grid; gap: 4px; min-width: 0; }
#shop .tu-free .tu-pipe-row.points .tu-pipe-set { grid-template-columns: 44px 1fr 44px 44px 44px; grid-auto-flow: row; }
#shop .tu-free-count { display: grid; place-items: center; font-size: 13px; font-weight: 700; }
#shop .tu-free .tu-pipe-row.pad .tu-pipe-set > button { font-size: 16px; line-height: 1; }
#shop .tu-free .tu-pipe-row.pad .tu-pipe-set > button small { color: var(--muted); font-size: 9px; font-weight: 600; }
#shop .tu-free .tu-pipe-row.size .tu-pipe-set { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr) 52px; align-items: center; }
#shop .tu-free .tu-pipe-row.size { min-height: 34px; }
#shop .tu-free .tu-pipe-row.size.off { opacity: 0.45; }
#shop .tu-free input[type="range"] { width: 100%; min-width: 0; height: 30px; margin: 0; accent-color: #f2c14e; touch-action: pan-x; }
#shop .tu-free-val { font-size: 12px; font-weight: 700; text-align: right; white-space: nowrap; }
#shop .tu-free-note { margin: 0; color: var(--muted); font-size: 12px; }
#shop .tu-free-page.finish { --sw: 34px; }
#shop .tu-free-page.finish .tu-phead { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; }
#shop .tu-free-page.finish .tu-pset { gap: 4px 6px; }
#shop .tu-free-sw { width: auto !important; min-width: 44px; }
#shop .tu-free-sw .tu-free-swname { max-width: 64px; font-size: 10px; line-height: 1.1; text-align: center; color: var(--muted); }
#shop .tu-free-page.finish .tu-pset:last-child .tu-free-swname { display: none; }   /* the palette: names on long-press (title), the dots stay big */
#shop .tu-free-sw[aria-pressed="true"] .dot { border-color: #f2c14e; box-shadow: 0 0 0 2px #f2c14e; }
#shop .tu-free-sw .dot.tint { background: linear-gradient(90deg, #d8b46a 0, #c58a4a 22%, #5d63b8 45%, #7a5aa0 58%, #b88e5c 78%, #c9c2b6 100%); }
#shop .tu-free-sw .tu-pprice { font-size: 10px; color: #f2c14e; }
/* ==== end #955 ==== */
/* #400 step 6: "Mein Moped" opener – header pill on phones (the rail has no room for a 7th button), rail button on wide screens. */
#shop #shop-mine-open { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px 0 10px; border-radius: 12px; font-size: 14px; font-weight: 700; white-space: nowrap; }   /* #400 */
#shop #shop-mine-open[aria-pressed="true"] { background: #f2c14e; border-color: #f2c14e; color: #1a1a1a; }   /* #400 */
#shop .tu-group[data-group="mine"] { display: none; }   /* #400 */
@media (max-width: 440px) {   /* #400 */
  #shop .shop-bar h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }   /* #400: the title gives way to the button */
  #shop .shop-bar { justify-content: space-between; }   /* #400 */
}   /* #400 */
@media (min-width: 600px) and (min-aspect-ratio: 4/3) {   /* #400 */
  #shop #shop-mine-open { display: none; }   /* #400 */
  #shop .tu-group[data-group="mine"] { display: flex; }   /* #400 */
}   /* #400 */
/* ==== #400 step 8: polish – visible keyboard focus on every shop control, dimmed "Verbaut · nicht sichtbar" chip; #472 toasts wait while the shop is open ==== */
#shop :is(button, input, [tabindex]):focus-visible { outline: 3px solid #f2c14e; outline-offset: 2px; }   /* #400 on the dark sheet and on the light selected card alike */
#shop [aria-pressed="true"]:focus-visible { outline-color: #fff; box-shadow: 0 0 0 5px #f2c14e; }   /* #400 a selected (cream) card: gold ring outside a white one */
#shop .tu-state.unseen { color: var(--muted); }   /* #400 fitted, but nothing to see on this bike */
#toast .note.shop-hold { visibility: hidden; }   /* #472 a notice already open when the shop opens waits out of sight (its timer runs on); main.js shows what is left on close. New toasts in the shop (coins, locks) still show */

/* #401 step 1: phone fishing HUD. Step strip under the note, cast power as a ring around the big button,
   fight meter next to the thumb (left of the button) with green / yellow / red, notices held while fishing (main.js). */
#fishing { --fb: 120px; --fr: 20px; --fbot: 20px; }   /* #401 button size, right and bottom offset (tablets: 150 / 32 / 32) */
@media (pointer: coarse) and (min-width: 768px) and (min-height: 600px) { #fishing { --fb: 150px; --fr: 32px; --fbot: 32px; } }   /* #401 */
#fish-steps { position: fixed; top: calc(52px + var(--safe-top)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; margin: 0; padding: 4px; list-style: none; border-radius: 999px; background: var(--panel); border: 1px solid var(--rim); pointer-events: none; }   /* #401 */
#fish-steps li { display: flex; align-items: center; gap: 5px; height: 32px; min-width: 32px; padding: 0 8px; justify-content: center; border-radius: 999px; color: rgba(255, 248, 236, 0.55); font-size: 13px; font-weight: 700; white-space: nowrap; }   /* #401 */
#fish-steps li .ui-icon svg { width: 20px; height: 20px; display: block; }   /* #401 */
#fish-steps li span { display: none; }   /* #401 only the current step shows its word: five words do not fit beside the Fertig button on a phone */
#fish-steps li.now { background: #f2c14e; color: #1b1b1b; padding: 0 12px 0 9px; }   /* #401 */
#fish-steps li.now span { display: inline; }   /* #401 */
#fish-steps li.done { color: #7fd48a; }   /* #401 */
#fish-steps li.now.bite { background: #2fa84f; color: #fff; animation: fish-pulse 0.45s ease-in-out infinite alternate; }   /* #401 the 0.9 s strike window */
#fish-steps li.now.lost { background: #e44a3b; color: #fff; }   /* #401 */
@keyframes fish-pulse { to { transform: scale(1.08); } }   /* #401 */
@media (prefers-reduced-motion: reduce) { #fish-steps li.now.bite { animation: none; } }   /* #401 */
@media (max-width: 640px) { #fish-steps { top: calc(68px + var(--safe-top)); left: calc(10px + var(--safe-left)); transform: none; } }   /* the note may wrap to two lines here */   /* #401 */
#cast-meter { display: none; }   /* #401 the 16-px bar is replaced by the ring in the button */
#fish-ring { position: absolute; inset: -12px; border-radius: 50%; pointer-events: none; opacity: 0; --p: 0; --c: #ffffff;
  background: conic-gradient(var(--c) calc(var(--p) * 360deg), rgba(255, 255, 255, 0.2) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 10px), #000 calc(100% - 9px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 10px), #000 calc(100% - 9px)); }   /* #401 */
#fish-button[data-stage="aim"] #fish-ring { opacity: 1; }   /* #401 */
#fish-ring.far { --c: #f2c14e; }   /* #401 past 80 %: far water, rarer fish */
#fish-button { overflow: visible; }   /* #401 */
#fish-meter { left: auto; top: auto; right: calc(var(--fr) + var(--fb) + 22px + var(--safe-right)); bottom: calc(var(--fbot) + var(--safe-bottom)); height: min(52vh, 300px); gap: 8px; padding: 6px; background: var(--panel); border-radius: 14px; }   /* #401 next to the thumb */
.fish-track { width: 46px; }   /* #401 */
.fish-catch { width: 12px; }   /* #401 */
#fish-spot { height: 30px; margin-bottom: -15px; }   /* #401 */
#fish-spot .icon { width: 30px; height: 30px; }   /* #401 */
#fish-zone { background: rgba(228, 74, 59, 0.75); }   /* #401 */
#fish-zone[data-zone="green"] { background: rgba(95, 208, 106, 0.85); }   /* #401 fish inside the zone */
#fish-zone[data-zone="yellow"] { background: rgba(242, 193, 78, 0.85); }   /* #401 fish at the edge: hold still */
#fish-zone[data-zone="red"] { background: rgba(228, 74, 59, 0.85); }   /* #401 fish outside: the line loses */
#fish-progress.low { background: #e44a3b; }   /* #401 */
#fish-hook { left: 40px; }   /* #401 */
/* #401 step 7: the rare-catch reveal (fish-reveal.js). Only transform/opacity animate (compositor), nothing lays out per frame. */
#fish-reveal { position: fixed; inset: 0; z-index: 36; overflow: hidden; --x: 50%; --y: 45%; --tc: #7bdc8b; touch-action: none; }   /* #401 */
#fish-reveal[data-tier="2"] { --tc: #6cc3ff; }   /* #401 */
#fish-reveal[data-tier="3"] { --tc: #f2c14e; }   /* #401 */
#fish-reveal.done { pointer-events: none; }   /* #401 */
#fish-reveal > * { position: absolute; pointer-events: none; opacity: 0; }   /* #401 */
#fish-reveal.beat :is(.fr-flash, .fr-glow, .fr-rays, .fr-banner, .fr-burst i) { will-change: transform, opacity; }   /* #401 own layers: rotate/scale/fade on the compositor, painted once */
#fish-reveal.beat > * { transition: opacity 0.3s; }   /* #401 */
#fish-reveal.out > * { opacity: 0 !important; transition: opacity 0.3s; }   /* #401 */
.fr-flash { inset: 0; background: radial-gradient(circle at var(--x) var(--y), rgba(255, 244, 200, 0.9), rgba(255, 214, 110, 0.35) 45%, transparent 75%); }   /* #401 */
#fish-reveal[data-tier="3"].beat .fr-flash { animation: fr-flash 0.6s ease-out both; }   /* #401 */
@keyframes fr-flash { 0% { opacity: 0.85; } 100% { opacity: 0; } }   /* #401 */
.fr-glow { left: var(--x); top: var(--y); width: 360px; height: 360px; margin: -180px 0 0 -180px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--tc) 55%, transparent), transparent 65%); }   /* #401 */
#fish-reveal:is([data-tier="2"], [data-tier="3"]).beat .fr-glow { opacity: 0.7; animation: fr-glow 1.4s ease-in-out infinite alternate; }   /* #401 */
@keyframes fr-glow { from { transform: scale(0.85); } to { transform: scale(1.1); } }   /* #401 */
.fr-rays { left: var(--x); top: var(--y); width: 640px; height: 640px; margin: -320px 0 0 -320px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 220, 120, 0.42) 0deg 7deg, transparent 7deg 22deg);
  -webkit-mask-image: radial-gradient(circle, transparent 13%, #000 24%, transparent 62%); mask-image: radial-gradient(circle, transparent 13%, #000 24%, transparent 62%); }   /* #401 clear over the fish itself */
#fish-reveal[data-tier="3"].beat .fr-rays { opacity: 0.55; animation: fr-spin 6s linear infinite; }   /* #401 */
@keyframes fr-spin { to { transform: rotate(360deg); } }   /* #401 */
.fr-burst { left: var(--x); top: var(--y); width: 0; height: 0; }   /* #401 */
#fish-reveal.beat .fr-burst { opacity: 1; }   /* #401 */
.fr-burst i { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 2px; transform: rotate(45deg) scale(0); background: #fff;
  box-shadow: 0 0 8px 2px var(--tc); }   /* #401 a little diamond */
#fish-reveal[data-tier="3"] .fr-burst i { background: #fff6cf; width: 12px; height: 12px; left: -6px; top: -6px; }   /* #401 */
#fish-reveal.beat .fr-burst i { animation: fr-spark 0.95s cubic-bezier(0.15, 0.7, 0.3, 1) var(--w) both; }   /* #401 */
@keyframes fr-spark {   /* #401 out along its angle, spinning, then gone */
  0% { transform: rotate(var(--a)) translateX(8px) rotate(45deg) scale(0.4); opacity: 1; }
  60% { opacity: 1; }
  100% { transform: rotate(var(--a)) translateX(var(--d)) rotate(225deg) scale(calc(var(--s) * 1.1)); opacity: 0; } }
#fish-reveal[data-tier="1"] .fr-burst i { animation-duration: 0.7s; }   /* #401 */
.fr-banner { left: 50%; top: max(var(--top, 0px), calc(6% + var(--safe-top))); transform: translateX(-50%); display: grid; justify-items: center; gap: 2px; width: max-content; max-width: calc(100vw - 32px); text-align: center; }   /* #401 */
#fish-reveal.beat .fr-banner { opacity: 1; animation: fr-pop 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) both; }   /* #401 */
@keyframes fr-pop { from { transform: translateX(-50%) scale(0.4); } to { transform: translateX(-50%) scale(1); } }   /* #401 */
.fr-title { font-size: clamp(20px, 6vw, 30px); font-weight: 900; line-height: 1.05; color: var(--tc); letter-spacing: 0.02em;
  text-shadow: 0 2px 0 #1b1405, 0 0 14px rgba(0, 0, 0, 0.55); -webkit-text-stroke: 1px rgba(20, 14, 2, 0.55); }   /* #401 */
#fish-reveal[data-tier="2"] .fr-title { font-size: clamp(26px, 8vw, 44px); }   /* #401 */
#fish-reveal[data-tier="3"] .fr-title { font-size: clamp(34px, 11vw, 68px); color: #ffd85a;
  background: linear-gradient(100deg, #b8801c 10%, #ffe9a0 35%, #fff9e0 45%, #f2c14e 60%, #b8801c 90%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 #3a2400) drop-shadow(0 0 12px rgba(255, 200, 70, 0.7)); text-shadow: none; -webkit-text-stroke: 0; }   /* #401 */
.fr-sub { padding: 3px 12px; border-radius: 12px; font-size: 16px; font-weight: 700; color: #fff; background: rgba(12, 14, 18, 0.62); }   /* #401 */
.fr-new { font-style: normal; font-size: 13px; font-weight: 800; padding: 2px 9px; border-radius: 9px; color: #1a1a1a; background: var(--gold); }   /* #401 */
.fr-new[hidden] { display: none; }   /* #401 */
.fr-skip { left: 50%; bottom: calc(18px + var(--safe-bottom)); transform: translateX(-50%); font-size: 12px; color: rgba(255, 255, 255, 0.8); text-shadow: 0 1px 2px #000; white-space: nowrap; }   /* #401 */
#fish-reveal.beat .fr-skip { opacity: 1; }   /* #401 */
@media (prefers-reduced-motion: reduce) { #fish-reveal.beat .fr-rays, #fish-reveal.beat .fr-glow { animation: none; } }   /* #401 */
/* #401 step 7: Sammelbuch variant slots and the per-tier counters */
.book-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; width: 100%; margin-top: 6px; }   /* #401 */
.book-slot { position: relative; display: grid; justify-items: center; gap: 1px; padding: 5px 3px 6px; border-radius: 10px; text-align: center; min-width: 0;
  background: rgba(255, 255, 255, 0.07); border: 2px solid var(--tc, rgba(255, 255, 255, 0.35)); }   /* #401 */
.book-slot[data-tier="3"]:not(.empty) { background: linear-gradient(160deg, rgba(242, 193, 78, 0.28), rgba(242, 193, 78, 0.06)); box-shadow: 0 0 10px rgba(242, 193, 78, 0.45); }   /* #401 */
.book-slot-pic { width: 100%; max-width: 96px; height: 40px; object-fit: contain; }   /* #401 */
.book-slot b { font-size: 11px; line-height: 1.15; color: var(--tc, #fff); hyphens: auto; -webkit-hyphens: auto; max-width: 100%; }   /* #401 Pracht-exemplar, Gold-schuppe (lang=de) */
#activity-list .book-slot small, .book-slot small { display: grid; margin: 0; font-size: 11px; line-height: 1.2; opacity: 0.9; }   /* #401 count and kg on their own lines */
.book-slot.empty { border-style: dashed; border-color: rgba(255, 255, 255, 0.28); background: rgba(0, 0, 0, 0.18); }   /* #401 */
.book-slot.empty .book-slot-pic { filter: brightness(0); opacity: 0.3; }   /* #401 the fish's shadow */
.book-slot.empty b, .book-slot.empty small { color: rgba(255, 255, 255, 0.55); }   /* #401 */
.book-slot-q { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 22px; font-weight: 900; color: rgba(255, 255, 255, 0.7); }   /* #401 */
.book-slot .book-new { top: -6px; right: -4px; }   /* #401 */
.book-tier { border: 1px solid var(--tc); }   /* #401 */
.book-tier.done { background: color-mix(in srgb, var(--tc) 35%, transparent); }   /* #401 */
@media (orientation: landscape) and (max-height: 500px) {   /* #401 a phone on its side: the fish fills the middle, so the banner sits low (over the legs), smaller */
  .fr-banner { top: auto; bottom: calc(26px + var(--safe-bottom)); grid-auto-flow: column; align-items: center; gap: 8px; }
  #fish-reveal[data-tier="3"] .fr-title { font-size: clamp(26px, 8vh, 34px); }
  #fish-reveal[data-tier="2"] .fr-title { font-size: clamp(22px, 7vh, 30px); }
  .fr-skip { bottom: calc(6px + var(--safe-bottom)); }
}

/* #693 Top HUD more see-through: the dashboard panel, its chips/buttons, the goal and event pills and the notices let the world
   show through. Text keeps a dark outline (text-shadow) so it stays above 4.5:1 on bright sky and on dark trees. */
#cluster::before { background: linear-gradient(rgba(38, 41, 50, 0.52), rgba(9, 10, 15, 0.58)); box-shadow: inset 0 1px rgba(255, 255, 255, 0.14), 0 calc(var(--u) * 0.8) calc(var(--u) * 2.4) rgba(0, 0, 0, 0.3); }   /* #693 */
#cluster button, .chip { background: linear-gradient(rgba(58, 62, 74, 0.55), rgba(18, 20, 27, 0.6)); }   /* #693 */
.c-gauge { background: radial-gradient(circle, rgba(27, 30, 38, 0.74) 0 52%, rgba(6, 7, 11, 0.8) 100%); }   /* #693 */
#odo { background: rgba(0, 0, 0, 0.55); }   /* #693 */
#minimap { opacity: 0.88; }   /* #693 */
#toggle-menu { background: linear-gradient(rgba(44, 47, 56, 0.55), rgba(14, 16, 22, 0.6)); }   /* #693 */
#goal { background: rgba(16, 18, 26, 0.42); }   /* #693 */
#vev { background: rgba(40, 24, 8, 0.5); }   /* #693 */
#vev.live { background: rgba(120, 60, 0, 0.55); }   /* #693 */
#toast .note { background: rgba(16, 18, 26, 0.55); }   /* #693 */
#cluster :is(b, span, svg, .coins, .hud-clock), #dial text, #goal, #vev, #toast .note { text-shadow: 0 0 3px rgba(0, 0, 0, 0.95), 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.6); }   /* #693 */
#cluster .icon, #goal .icon, #toggle-menu .icon { filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9)); }   /* #693 */
#hud #prompt { background: rgba(16, 18, 26, 0.55); text-shadow: 0 0 3px rgba(0, 0, 0, 0.95), 0 1px 2px rgba(0, 0, 0, 0.9); }   /* #693 the hint under the dashboard */

/* #819 An open map, menu or panel covers the world: the in-world action buttons (garden "Konsum: Samen & Ernte", detector,
   race/event invites) must not sit on top of it – the Konsum button hid "Karte schließen" (owner, 2026-11-11). */
body:has(#map:not([hidden]), #menu:not([hidden]), #activity:not([hidden]), #clique-panel:not([hidden]), #garage-visit:not([hidden]), #keys:not([hidden]))
  :is(#gar-act, #gar-chip, .det-ui, #mp-invite, #mp-lobby, #vev-vote) { visibility: hidden; }   /* #819 */

/* ==== #876 Quick-Chat: the speech-bubble button beside the emoji button, and its sheet of big phrase buttons ==== */
#chat-open { position: fixed; right: calc(16px + var(--safe-right)); top: calc(var(--top-h) + 224px + var(--safe-top)); touch-action: none; }
#chat-open img { width: 28px; height: 28px; pointer-events: none; }
#chat-open.on { background: #f2c14e; }
#chat-sheet { position: fixed; z-index: 16;   /* over the hints (#prompt 15) while open */
  right: calc(70px + var(--safe-right)); top: calc(var(--top-h) + 68px + var(--safe-top)); width: 480px;
  max-width: calc(100vw - 80px - var(--safe-left) - var(--safe-right)); box-sizing: border-box; display: flex; flex-direction: column; gap: 8px;
  padding: 10px; border-radius: 16px; background: rgba(16, 18, 26, 0.92); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); }
#chat-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
#chat-tabs button { min-height: 44px; padding: 4px 6px; border-radius: 12px; font-size: 14px; font-weight: 700; color: #fff;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.16); }
#chat-tabs button[aria-selected="true"] { background: #f2c14e; color: #1b1407; border-color: transparent; }
#chat-phrases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#chat-sheet .chat-phrase { min-height: 48px; padding: 6px 10px; display: flex; align-items: center; gap: 8px; text-align: left;
  border-radius: 12px; font-size: 15px; font-weight: 700; line-height: 1.2; color: #16181f; background: #fff; border: 0; overflow-wrap: anywhere; }
#chat-sheet .chat-phrase:hover { background: #fff3cf; }
#chat-sheet button.picked, #chat-sheet .chat-phrase:active { background: #f2c14e; color: #1b1407; }
.chat-phrase kbd { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font: 700 12px/1 inherit;
  color: #fff; background: #3a3f4d; }
#chat-wait { margin: 0; text-align: center; font-size: 14px; font-weight: 700; color: #f2c14e; }
@media (pointer: coarse) {
  .chat-phrase kbd { display: none; }
  /* Portrait phones: emoji, chat, feedback stand in the column at the left; the sheet opens to their right. */
  #hud #hud-fixed #chat-open { position: static; }
  #hud:has(#chat-open:not([hidden])) #hud-more { top: calc(var(--top-h) + 166px + var(--safe-top)); }
  #hud:has(#chat-open:not([hidden])) #hud-tray { top: calc(var(--top-h) + 218px + var(--safe-top)); }
  #hud #chat-sheet { left: calc(62px + var(--safe-left)); right: calc(10px + var(--safe-right)); top: calc(var(--top-h) + 10px + var(--safe-top));
    width: auto; max-width: 520px; }
  #chat-phrases { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #hud:is([data-state="wheelie"], [data-state="stoppie"], [data-state="air"]) #chat-sheet { display: none; }
  body:has(#menu:not([hidden]), #clique-panel:not([hidden]), #activity:not([hidden]), #map:not([hidden]), #garage-visit:not([hidden])) #chat-sheet { visibility: hidden; }
}
/* Sideways phones: the buttons stand in a row beside the dashboard; the sheet opens under them, 3 phrases a row. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  #hud:has(#chat-open:not([hidden])) #hud-more { left: calc(var(--top-w) + 176px + var(--safe-left)); top: calc(14px + var(--safe-top)); }
  #hud[data-state="foot"]:has(#chat-open:not([hidden])) #hud-more { left: calc(var(--u) * 66 + 176px + var(--safe-left)); }
  #hud:has(#chat-open:not([hidden])) #hud-tray { left: calc(var(--top-w) + 228px + var(--safe-left)); top: calc(14px + var(--safe-top)); }
  #hud[data-state="foot"]:has(#chat-open:not([hidden])) #hud-tray { left: calc(var(--u) * 66 + 228px + var(--safe-left)); }
  #hud #chat-sheet { left: calc(var(--top-w) + 18px + var(--safe-left)); right: calc(12px + var(--safe-right)); top: calc(66px + var(--safe-top));
    max-width: 560px; max-height: calc(100vh - 76px - var(--safe-top)); overflow-y: auto; }
  #hud[data-state="foot"] #chat-sheet { left: calc(var(--u) * 66 + 18px + var(--safe-left)); }
  #chat-phrases { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* ==== end #876 ==== */
/* ==== #876 step 4: free text – "Schreib was …" in the sheet, the typing bar at the bottom of the VISIBLE screen
   (--kb-lift = keyboard + system bar, set by public/js/keyboard-fit.js), the last messages, the rules window ==== */
#chat-write { min-height: 48px; padding: 8px 14px; border-radius: 12px; text-align: left; font-size: 16px; font-weight: 700; color: #fff;
  background: rgba(255, 255, 255, 0.08); border: 1px dashed rgba(255, 255, 255, 0.45); }
#chat-write span { color: #f2c14e; margin-right: 6px; }
#chat-write:hover { background: rgba(255, 255, 255, 0.16); }
#chat-type { position: fixed; z-index: 45; left: calc(8px + var(--safe-left)); right: calc(8px + var(--safe-right)); max-width: 620px; margin: 0 auto;
  /* #962 bottom = keyboard + system bar (--kb-lift, public/js/keyboard-fit.js) */
  bottom: calc(8px + var(--kb-lift, var(--safe-bottom))); box-sizing: border-box; padding: 8px; border-radius: 16px;
  background: rgba(16, 18, 26, 0.95); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4); }
#chat-type:not([hidden]) { display: grid; gap: 6px; }
#chat-type .chat-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
#chat-ch { flex: none; display: flex; border-radius: 12px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.2); }
#chat-ch button { min-width: 48px; min-height: 44px; padding: 0 10px; border: 0; font-size: 14px; font-weight: 700; color: #fff; background: transparent; }
#chat-ch button[aria-pressed="true"] { background: #f2c14e; color: #1b1407; }
#chat-input { flex: 1; min-width: 0; height: 44px; box-sizing: border-box; padding: 0 12px; border: 0; border-radius: 12px;
  font: 500 16px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #16181f; background: #fff; }   /* 16 px: iOS does not zoom */
#chat-input:disabled { background: #c9ccd4; }
#chat-send, #chat-x { flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; font-size: 20px; font-weight: 800; line-height: 1; }
#chat-send { color: #1b1407; background: #f2c14e; }
#chat-send:disabled { opacity: 0.5; }
#chat-x { color: #fff; background: rgba(255, 255, 255, 0.12); }
#chat-note { margin: 0; padding: 2px 4px; font-size: 14px; font-weight: 600; line-height: 1.3; color: #fff; }
#chat-note.bad { color: #ffd27a; }
#chat-list { position: fixed; z-index: 14; left: calc(16px + var(--safe-left)); bottom: calc(16px + var(--safe-bottom)); width: min(380px, calc(100vw - 32px));
  margin: 0; padding: 0; list-style: none; pointer-events: none; }
#chat-list:not([hidden]) { display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 3px; }
#chat-list.above-bar { overflow: hidden; }   /* #962 height cap is set by chat-free.js; newest message stays at the bottom */
#chat-list.above-bar { z-index: 45; }
#chat-list li { max-width: 100%; box-sizing: border-box; padding: 4px 9px; border-radius: 10px; font-size: 14px; line-height: 1.3; color: #fff;
  background: rgba(16, 18, 26, 0.74); overflow-wrap: anywhere; }
#chat-list li b { margin-right: 6px; color: #f2c14e; }
#chat-list li.mine b { color: #9fe0a0; }
#chat-list li i { margin-right: 6px; font-style: normal; font-size: 11px; font-weight: 700; text-transform: uppercase; opacity: 0.75; }
#chat-list li.dorf i { color: #8fd0ff; }
#chat-rules { position: fixed; inset: 0; z-index: 46; padding: 16px; background: rgba(0, 0, 0, 0.5); }
#chat-rules:not([hidden]) { display: grid; place-items: center; }
.chat-rules-box { width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-sizing: border-box; padding: 18px 20px;
  border-radius: 16px; background: #fffdf6; color: #1b1407; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45); }
.chat-rules-box h2 { margin: 0 0 8px; font-size: 22px; }
.chat-rules-box ul { margin: 0; padding-left: 20px; }
.chat-rules-box li { margin: 6px 0; font-size: 16px; line-height: 1.35; }
.chat-rules-box .chat-help { margin: 12px 0; padding: 8px 10px; border-radius: 10px; font-size: 14px; line-height: 1.35; background: #eaf3ff; }
.chat-rules-buttons { display: flex; gap: 10px; justify-content: flex-end; }
.chat-rules-buttons button { min-height: 48px; padding: 0 18px; border-radius: 12px; border: 0; font-size: 16px; font-weight: 800; }
#chat-rules-no { color: #1b1407; background: #ece6d6; }
#chat-rules-ok { color: #1b1407; background: #f2c14e; }
@media (pointer: coarse) {
  /* Portrait phones: the list stands above the touch controls at the left. */
  #chat-list { bottom: calc(215px + var(--safe-bottom)); width: min(320px, calc(100vw - 32px)); }
  #chat-list li { font-size: 13px; }
  .chat-rules-box { padding: 14px 16px; }
  .chat-rules-box li { margin: 4px 0; font-size: 15px; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  /* Sideways phones: between the left and the right controls, at the bottom. */
  #chat-list { left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe-bottom)); width: min(360px, 44vw); }
  #chat-list:not([hidden]) { align-items: center; }
  .chat-rules-box li { margin: 3px 0; font-size: 14px; }
  .chat-rules-box h2 { font-size: 18px; margin-bottom: 4px; }
  .chat-rules-box .chat-help { margin: 8px 0; }
}
/* ==== end #876 step 4 ==== */
/* ==== #885 tuning shop ("Mein Moped", Werkstatt): nothing scrolls sideways any more (like the Modeladen, #872) ====
   Categories and part chips WRAP into rows, the stats sit in a small grid, the cards are a vertical grid. On phones
   (portrait and landscape) the whole sheet scrolls up/down and the buy bar sticks to its bottom; on big screens
   (desktop) the card grid scrolls on its own as before. Same DOM and JS as #400 (tuning-ui.js), only the layout. */
#shop-groups { flex-wrap: wrap; overflow: visible; touch-action: manipulation; }   /* #885 */
#shop .tu-group { flex: 1 1 auto; min-width: 48px; }   /* #885 */
#shop #shop-dock { display: flex; flex-direction: column; gap: 8px; max-height: 54vh; max-height: 54dvh; overflow: hidden auto; overscroll-behavior: contain;
  touch-action: pan-y; padding-bottom: 0; scroll-padding-bottom: 76px; }   /* #885 one vertical scroll for the sheet */
#shop #shop-head, #shop #shop-chips, #shop #shop-stats, #shop #shop-list, #shop #shop-led, #shop .tu-paint { flex: none; }   /* #885 */
#shop #shop-chips { flex-wrap: wrap; gap: 6px; overflow: visible; padding: 2px; touch-action: auto; -webkit-mask-image: none; mask-image: none; }   /* #885 */
#shop .tu-chip { flex: 1 1 auto; min-width: 0; max-width: 100%; min-height: 44px; padding: 2px 10px 2px 3px; }   /* #885 */
#shop .tu-chip .tu-pic { width: 36px; height: 36px; }   /* #885 */
#shop .tu-chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }   /* #885 */
#shop #shop-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 3px 14px; overflow: visible; touch-action: auto; white-space: normal; font-size: 13px; }   /* #885 */
#shop #shop-stats[hidden] { display: none; }   /* #885 */
#shop .tu-stat { min-width: 0; row-gap: 2px; }   /* #885 */
#shop .tu-bar { height: 4px; }   /* #885 compact bars */
#shop .tu-stat dt, #shop .tu-stat b { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }   /* #885 */
#shop .tu-stat small { white-space: nowrap; }   /* #885 */
#shop #shop-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); align-content: start; gap: 6px; overflow: visible; padding: 2px;
  touch-action: auto; -webkit-mask-image: none; mask-image: none; }   /* #885 the vertical card grid */
#shop #shop-list[hidden] { display: none; }   /* #885 the colour wheel covers it */
#shop .tu-card { width: auto; min-width: 0; padding: 6px 3px 7px; font-size: 12px; }   /* #885 12 px: "Wunschfarbe" fits a phone card in one piece */
#shop .tu-card .tu-pic { width: 56px; height: 56px; }   /* #885 */
#shop .tu-card .tu-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; min-height: 2.3em; white-space: normal; line-height: 1.15; overflow-wrap: break-word; hyphens: auto; }   /* #885 two lines, not "Resonanz…" */
#shop .tu-state { max-width: 100%; }   /* #885 */
#shop .tu-finish { grid-column: 1 / -1; display: flex; justify-content: flex-start; width: auto; padding: 6px 0 0; border-left: 0; border-top: 1px solid #f2c14e44; }   /* #885 heading row in the grid */
#shop .tu-finish .dot { width: 20px; height: 20px; }   /* #885 */
#shop #shop-act { position: sticky; bottom: 0; z-index: 1; flex: none; margin-top: auto; padding: 8px 0 calc(8px + var(--safe-bottom)); background: rgb(16, 18, 26); }   /* #885 the buy bar never scrolls away */
#shop #shop-now { min-width: 0; }   /* #885 */
#shop #shop-list.swap > * { animation-name: tu-885-up; }   /* #885 cards slide up, not in from the side (a sideways slide made the sheet wider for a moment) */
@keyframes tu-885-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }   /* #885 */
@media (max-height: 780px) and (max-aspect-ratio: 4/3) {   /* #885 short phones */
  #shop #shop-dock { max-height: 56vh; max-height: 56dvh; gap: 6px; }   /* #885 */
  #shop .tu-card .tu-pic { width: 50px; height: 50px; }   /* #885 */
}
/* Wide screens: rail left (one column, scrolls up/down if it must), panel right. */
@media (min-width: 600px) and (min-aspect-ratio: 4/3) {
  #shop-groups { flex-wrap: nowrap; overflow: hidden auto; touch-action: pan-y; }   /* #885 */
  #shop .tu-group { flex: none; }   /* #885 */
  #shop #shop-dock { max-height: none; min-height: 0; padding-bottom: 0; }   /* #885 */
  #shop #shop-act { padding-bottom: 12px; background: rgb(16, 18, 26); }   /* #885 */
}
/* Landscape phones: little height, so a wider panel (3–4 cards a row) and the whole panel scrolls. */
@media (min-width: 600px) and (min-aspect-ratio: 4/3) and (max-height: 559px) {
  #shop { grid-template-columns: auto minmax(0, 1fr) min(46vw, 420px); }   /* #885 */
  #shop-groups { gap: 3px; }   /* #885 */
  #shop #shop-dock { overflow: hidden auto; scroll-padding-bottom: 64px; }   /* #885 */
  #shop #shop-act { padding-bottom: 8px; }   /* #885 */
  #shop .tu-chip { padding: 2px 12px; }   /* #885 words only: more chips a row, the cards show the pictures */
  #shop .tu-chip .tu-pic { display: none; }   /* #885 */
  #shop .tu-card .tu-pic { width: 50px; height: 50px; }   /* #885 */
}
/* Desktop and tall tablets: the card grid scrolls on its own, head, chips and stats stay put. */
@media (min-width: 600px) and (min-aspect-ratio: 4/3) and (min-height: 560px) {
  #shop #shop-dock { overflow: hidden; }   /* #885 */
  #shop #shop-list { flex: 1 1 auto; min-height: 120px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); overflow: hidden auto; touch-action: pan-y; }   /* #885 */
  #shop #shop-list.tu-pal-mode { overflow: hidden auto; touch-action: pan-y; }   /* #1106 the #974 rule (overflow: visible) beat the line above: on a 768 px desktop the Lack / Felgen palette was cut off by the dock with nothing to scroll */
  #shop .tu-card .tu-pic { width: 64px; height: 64px; }   /* #885 */
}
/* ==== end #885 ==== */
/* ==== #876 step 2: Stumm / Blockieren / Melden – the sheet after tapping a rider, the menu lists, the short notice ==== */
#rider-sheet, #chat-people { position: fixed; inset: 0; z-index: 47; padding: 12px; box-sizing: border-box; background: rgba(0, 0, 0, 0.45); }
#rider-sheet:not([hidden]), #chat-people:not([hidden]) { display: grid; place-items: end center; }
#rider-sheet .rider-box, #chat-people .rider-box { width: min(440px, 100%); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto;
  box-sizing: border-box; padding: 14px 16px calc(14px + var(--safe-bottom, 0px)); border-radius: 18px; background: #fffdf6; color: #1b1407;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45); overscroll-behavior: contain; }
.rider-box header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rider-box h2 { flex: 1; min-width: 0; margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.rider-box h3 { margin: 12px 0 6px; font-size: 16px; }
.rider-box h3 small { font-weight: 500; opacity: 0.7; }
#rider-x, #chat-people-x { flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; font-size: 24px; font-weight: 800; color: #1b1407; background: #ece6d6; }
.rider-actions:not([hidden]) { display: grid; gap: 8px; }
.rider-actions p { margin: 0; font-size: 15px; line-height: 1.35; }
.rider-actions > button { min-height: 52px; padding: 8px 14px; display: grid; gap: 2px; text-align: left; border: 0; border-radius: 14px; color: #1b1407; background: #ece6d6; }
.rider-actions > button b { font-size: 17px; }
.rider-actions > button small { font-size: 13px; line-height: 1.3; opacity: 0.8; }
.rider-box button.bad { background: #d9473a; color: #fff; }
.rider-row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.rider-row button { min-height: 48px; padding: 0 16px; border: 0; border-radius: 12px; font-size: 16px; font-weight: 800; color: #1b1407; background: #ece6d6; }
.rider-row button:disabled { opacity: 0.45; }
#rider-reasons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
#rider-reasons button { min-height: 44px; padding: 4px 8px; border-radius: 12px; border: 2px solid #d8d0bd; font-size: 15px; font-weight: 700; color: #1b1407; background: #fff; }
#rider-reasons button[aria-pressed="true"] { border-color: #d9473a; background: #ffe3df; }
#rider-rep label { font-size: 14px; font-weight: 700; }
#rider-rep label span { font-weight: 500; opacity: 0.7; }
#rider-note { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 2px solid #d8d0bd; border-radius: 12px; resize: none;
  font: 500 16px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #16181f; background: #fff; }   /* 16 px: iOS does not zoom */
.rider-help { padding: 8px 10px; border-radius: 10px; font-size: 14px; background: #eaf3ff; }
#chat-people ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
#chat-people li { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 2px 4px 2px 12px; border-radius: 12px; background: #f3eee0; }
#chat-people li span { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
#chat-people li.none { padding: 0 12px; font-size: 15px; opacity: 0.7; }
#chat-people li button { flex: none; min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px; font-size: 15px; font-weight: 700; color: #fff; background: #3a3f4d; }
#chat-list li[data-id] { pointer-events: auto; cursor: pointer; }
/* #908: ⚑ on every message of someone else = report exactly this message (opens the sheet on "Melden" with it quoted) */
#chat-list .chat-flag { margin: -4px -6px -4px 6px; min-width: 34px; min-height: 28px; padding: 0 8px; border: 0; border-radius: 8px;
  background: rgba(255, 255, 255, 0.12); color: #ffb3a8; font-size: 15px; line-height: 28px; vertical-align: middle; cursor: pointer; }
#chat-list .chat-flag:hover, #chat-list .chat-flag:focus-visible { background: rgba(229, 72, 77, 0.55); color: #fff; }
.rider-quote { margin: 0 0 8px; padding: 6px 10px; border-left: 3px solid #e5484d; border-radius: 6px; background: rgba(229, 72, 77, 0.08);
  font-style: italic; overflow-wrap: anywhere; }
#rider-toast { position: fixed; z-index: 48; left: 50%; transform: translateX(-50%); top: calc(12px + var(--safe-top, 0px)); max-width: calc(100vw - 32px);
  margin: 0; padding: 8px 14px; border-radius: 12px; font-size: 15px; font-weight: 700; color: #fff; background: rgba(16, 18, 26, 0.92); }
@media (min-width: 700px) and (pointer: fine) { #rider-sheet:not([hidden]), #chat-people:not([hidden]) { place-items: center; } }
@media (orientation: landscape) and (max-height: 500px) {
  #rider-sheet:not([hidden]), #chat-people:not([hidden]) { place-items: center; padding: 8px; }
  #rider-sheet .rider-box, #chat-people .rider-box { width: min(560px, 100%); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); padding: 10px 14px; }
  #rider-main:not([hidden]) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #rider-reasons { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rider-actions > button small { font-size: 12px; }
}
/* ==== end #876 step 2 ==== */
/* ==== #891 player list: tap the server count in the menu ==== */
#player-list { position: fixed; inset: 0; z-index: 46; padding: 12px; box-sizing: border-box; background: rgba(0, 0, 0, 0.45); }
#player-list:not([hidden]) { display: grid; place-items: end center; }
#player-list .rider-box { width: min(440px, 100%); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; overflow-x: hidden;
  box-sizing: border-box; padding: 14px 16px calc(14px + var(--safe-bottom, 0px)); border-radius: 18px; background: #fffdf6; color: #1b1407;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45); overscroll-behavior: contain; }
#player-list-x { flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; font-size: 24px; font-weight: 800; color: #1b1407; background: #ece6d6; }
#player-list-count { margin: 0 0 8px; font-size: 15px; font-weight: 700; opacity: 0.75; min-height: 20px; }
#player-list-count.warn { color: #b3261e; opacity: 1; }
#player-list-rows { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
#player-list-rows li { display: grid; gap: 4px; padding: 8px 10px; border-radius: 12px; background: #f3eee0; min-width: 0; }
#player-list-rows li[data-me] { background: #e2f0dc; }
#player-list-rows li.pl-off { opacity: 0.75; }
#player-list .pl-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
#player-list .pl-name { flex: 1; min-width: 0; font-size: 17px; overflow-wrap: anywhere; }
#player-list .pl-flag { flex: none; padding: 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 800; color: #fff; background: #3a3f4d; }
#player-list li[data-me] .pl-flag { background: #2f7d32; }
#player-list .pl-meta { margin: 0; font-size: 14px; line-height: 1.3; opacity: 0.8; min-height: 18px; }
#player-list .pl-act { display: flex; gap: 8px; margin-top: 2px; }
#player-list .pl-act button { min-height: 44px; padding: 4px 10px; border: 0; border-radius: 10px; font-size: 14px; font-weight: 800; line-height: 1.15; color: #1b1407; background: #ece6d6; }
#player-list .pl-act button[data-act="go"] { flex: 0 0 auto; min-width: 108px; color: #fff; background: #1f7fb0; }
#player-list .pl-act button[data-act="safety"] { flex: 1 1 0; min-width: 0; }
#player-list-alone[hidden] { display: none; }
#player-list-alone p { margin: 6px 0; font-size: 16px; line-height: 1.35; }
#player-list-alone button { min-height: 48px; padding: 0 16px; border: 0; border-radius: 12px; font-size: 16px; font-weight: 800; color: #fff; background: #1f7fb0; }
@media (min-width: 700px) and (pointer: fine) { #player-list:not([hidden]) { place-items: center; } }
@media (orientation: landscape) and (max-height: 500px) {
  #player-list:not([hidden]) { place-items: center; padding: 8px; }
  #player-list .rider-box { width: min(620px, 100%); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); padding: 10px 14px; }
}
/* ==== end #891 ==== */
/* ==== #883 Erfolge (achievements-ui.js): overview, area tiles, cards with tier dots, how-to + "Hinweis setzen" ==== */
#activity .card:has(.ach) { width: min(640px, 100%); }
#activity-list .ach { display: grid; gap: 8px; min-width: 0; }
#activity-list .ach h3 { margin: 6px 0 0; font-size: 14px; letter-spacing: 0.02em; color: var(--gold); }
#activity-list .ach small { color: var(--muted); }
#activity-list .ach-sum { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: rgba(233, 180, 76, 0.1); border: 1px solid var(--rim); }
#activity-list .ach-sum-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
#activity-list .ach-sum-top b { font-size: 17px; }
#activity-list .ach-tally { display: flex; gap: 10px; font-weight: 700; }
#activity-list .ach-tally span { display: inline-flex; align-items: center; gap: 4px; }
#activity-list .ach-tally i, #activity-list .ach-medals i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35); }
#activity-list .ach-bar { display: block; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
#activity-list .ach-bar.big { height: 10px; }
#activity-list .ach-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--gold); transition: width 0.3s; }
#activity-list .ach-near, #activity-list .ach-areas { display: grid; gap: 8px; min-width: 0; }
#activity-list .ach-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px; }
#activity-list button.ach-cat { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 8px; width: auto; min-width: 0; min-height: 56px; margin: 0; padding: 8px 10px; text-align: left; border-radius: 12px; }
#activity-list .ach-cat .ach-icon { grid-row: span 2; font-size: 22px; }
#activity-list .ach-cat b { min-width: 0; overflow-wrap: anywhere; font-size: 14px; line-height: 1.2; }
#activity-list .ach-cat small { font-size: 12px; }
#activity-list .ach-cat .ach-bar { grid-column: 2 / 4; }
#activity-list .ach-cat.done { border-color: var(--gold); background: rgba(233, 180, 76, 0.16); }
#activity-list button.ach-back { display: inline-flex; align-items: center; width: auto; min-height: 44px; margin: 0; padding: 0 14px; justify-self: start; font-weight: 700; border-color: var(--rim); }
#activity-list .ach-cat-title { font-size: 17px; color: var(--ink); }
#activity-list .ach-cat-title small { display: inline; font-size: 13px; font-weight: 400; }
#activity-list .ach-card { min-width: 0; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); }
#activity-list .ach-card.done { border-color: var(--gold); background: rgba(233, 180, 76, 0.12); }
#activity-list .ach-card.secret { border-style: dashed; }
#activity-list button.ach-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 56px; margin: 0; padding: 8px 10px; text-align: left; border: 0; background: none; border-radius: 12px; }
#activity-list .ach-head .ach-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; font-size: 20px; background: rgba(255, 255, 255, 0.08); }
#activity-list .ach-card.tier-0 .ach-icon { box-shadow: 0 0 0 2px #c98a4b; }
#activity-list .ach-card.tier-1 .ach-icon { box-shadow: 0 0 0 2px #c9d2dc; }
#activity-list .ach-card.tier-2 .ach-icon { box-shadow: 0 0 0 2px #f2c14e, 0 0 10px rgba(242, 193, 78, 0.5); }
#activity-list .ach-text { display: grid; gap: 3px; min-width: 0; }
#activity-list .ach-text b { font-size: 15px; overflow-wrap: anywhere; }
#activity-list .ach-text small { font-size: 13px; overflow-wrap: anywhere; }
#activity-list .ach-side { display: grid; justify-items: end; gap: 3px; text-align: right; }
#activity-list .ach-medals { display: inline-flex; gap: 3px; }
#activity-list .ach-count { font-size: 12px; white-space: nowrap; color: var(--ink) !important; }
#activity-list .ach-reward { font-size: 12px; font-weight: 700; color: var(--gold) !important; white-space: nowrap; }
#activity-list .ach-more { display: grid; gap: 6px; padding: 0 12px 12px 58px; }
#activity-list .ach-more p { margin: 0; font-size: 14px; line-height: 1.35; }
#activity-list .ach-more .ach-steps { font-size: 12px; color: var(--muted); }
#activity-list button.ach-pin { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; margin: 0; padding: 0 14px; font-weight: 700; text-align: center; color: #1a1a1a; background: var(--gold); border-color: var(--gold); border-radius: 10px; }
#activity-list button.ach-pin .icon { width: 20px; height: 20px; }
#toast.ach-glow .note:first-child { border-color: var(--gold); }
@media (max-width: 420px) {
  #activity-list .ach-more { padding-left: 12px; }
  #activity-list .ach-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (orientation: landscape) and (max-height: 500px) {
  /* Short screens: the areas first, "Fast geschafft" below them. */
  #activity-list .ach-areas { order: 1; }
  #activity-list .ach-near { order: 2; }
  #activity-list .ach-sum small { display: none; }
  #activity-list .ach-cats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  #activity-list button.ach-cat { min-height: 48px; padding: 6px 10px; }
}
/* ==== end #883 ==== */

/* ==== #887 nothing scrolls sideways any more: Sammelbuch tabs, rider creator colour swatches (like #872 / #885) ====
   Both WRAP into rows instead of a sideways strip; only vertical scrolling is left, buttons stay at least 44 px on touch screens.
   tools/check/no-side-scroll.mjs opens every panel at 390x844, 844x390 and 1280x720 and fails on any sideways scroll. */
.book-tabs, .book .book-tabs { flex-wrap: wrap; overflow: visible; touch-action: manipulation; -webkit-mask-image: none; mask-image: none; }   /* #887 */
.book-tabs button { flex: 0 1 auto; min-width: 0; max-width: 100%; }   /* #887 */
#creator .cr-swatches { display: flex; flex-wrap: wrap; gap: 8px; overflow: visible; touch-action: manipulation; padding: 5px; margin: 0 -5px;
  -webkit-mask-image: none; mask-image: none; }   /* #887 */
#creator .cr-dot { flex: 0 0 44px; width: 44px; height: 44px; min-height: 44px; max-width: none; }   /* #887 */
#creator #choices.creator-pick { overflow-x: hidden; min-width: 0; }   /* #887 */
@media (hover: none) and (pointer: coarse) {
  .book-tabs button { min-height: 44px; }   /* #887 */
}
/* ==== end #887 ==== */

/* ==== #215 HUD overlaps on a phone on its side (844x390, 800x360) and the collectable pop-up ==== */
@media (pointer: coarse) and (orientation: portrait), (max-width: 640px) {
  /* Collectable pop-up: in the notice lane, under the toasts (same side margins), not over the left column and the hint. */
  .col-pop.col-pop { left: max(var(--lane-side, 60px), 130px); right: calc(12px + var(--safe-right, 0px)); width: auto; max-width: none; box-sizing: border-box; transform: none; top: calc(var(--lane) + var(--lane-intro) + var(--lane-pill) + var(--lane-card, 0px) + var(--lane-prompt) + 18vh + 6px); animation: colpop-lane 3.4s ease forwards; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  /* The dock chips (village event, waypoint, hunt, goal) sit in one row under the round buttons, beside the dashboard: a column of them under the dashboard ran down into the blinker buttons. */
  #note-dock#note-dock { flex-direction: row; flex-wrap: nowrap; align-items: flex-start; left: calc(var(--top-w) + 24px + var(--safe-left)); top: calc(66px + var(--safe-top)) !important; max-height: none !important; max-width: none; width: calc(100vw - var(--top-w) - 48px - var(--safe-left) - var(--safe-right) - var(--lane-w)); }
  #note-dock#note-dock button { flex: 0 1 auto; height: 32px; }
  body:has(#emoji-row:not([hidden]), #chat-sheet:not([hidden])) #note-dock { visibility: hidden; }   /* the emoji / chat pickers open on this spot */
  /* Pills and the prompt stop before the card column, so the open Schnitzeljagd card can sit beside the dashboard instead of on it. */
  #hud #goal, #vev { max-width: calc(var(--top-w) + 10px); }
  #hud#hud #prompt#prompt#prompt { max-width: calc(var(--top-w) + 10px); }
  .hunt-card.hunt-card:not(.mini) {
    left: calc(var(--top-w) + 24px + var(--safe-left)); top: calc(104px + var(--safe-top)); width: min(270px, calc((100vw - var(--top-w)) / 2 - 10px - var(--safe-left) - var(--safe-right)));
    padding: 6px 10px 7px; font-size: 12.5px; transform: none;
  }
  .hunt-card:not(.mini) .hunt-riddle { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  /* The round buttons beside the dashboard (emoji, chat, report, "...", helmet, glasses [, LED ring]) sat 52 px apart and reached into the toast column: 46 px apart now, and the toast column is as wide as what is left. */
  body { --tray-end: calc(var(--top-w) + 292px + var(--safe-left)); --lane-w: min(420px, calc((100vw - var(--top-w)) / 2 - 36px)); }
  body:has(#hud.more-open) { --lane-w: min(420px, calc((100vw - var(--top-w)) / 2 - 36px), calc(100vw - var(--tray-end) - 22px - var(--safe-right))); }   /* tray open: toasts keep clear of it */
  body:has(#led-ring:not([hidden])) { --tray-end: calc(var(--top-w) + 338px + var(--safe-left)); }
  #hud #hud-fixed { gap: 2px; }
  #hud #hud-tray { gap: 2px; }
  #hud:not([data-state="foot"]) #hud-more { left: calc(var(--top-w) + 156px + var(--safe-left)); }
  #hud:not([data-state="foot"]) #hud-tray { left: calc(var(--top-w) + 202px + var(--safe-left)); }
  #hud[data-state="foot"] #hud-more { left: calc(var(--u) * 66 + 156px + var(--safe-left)); }
  #hud[data-state="foot"] #hud-tray { left: calc(var(--u) * 66 + 202px + var(--safe-left)); }
  #hud#hud:not([data-state="foot"]):has(#chat-open:not([hidden])) #hud-more { left: calc(var(--top-w) + 156px + var(--safe-left)); }
  #hud#hud:not([data-state="foot"]):has(#chat-open:not([hidden])) #hud-tray { left: calc(var(--top-w) + 202px + var(--safe-left)); }
  #hud#hud[data-state="foot"]:has(#chat-open:not([hidden])) #hud-more { left: calc(var(--u) * 66 + 156px + var(--safe-left)); }
  #hud#hud[data-state="foot"]:has(#chat-open:not([hidden])) #hud-tray { left: calc(var(--u) * 66 + 202px + var(--safe-left)); }
  #toast#toast { width: var(--lane-w); }
  /* The hint under the dashboard started 4 px inside the moped button of the dashboard. */
  body:not(:has(#intro-tip:not([hidden]))) #hud#hud #prompt#prompt#prompt { top: calc(var(--top-h) + 14px + var(--safe-top)) !important; }
  body:not(:has(#intro-tip:not([hidden]))):has(#goal:not([hidden]):not(.docked), #vev:not([hidden]):not(.docked)) #hud#hud #prompt#prompt#prompt { top: calc(var(--top-h) + 56px + var(--safe-top)) !important; }
  /* Collectable pop-up: in the notice lane (right column, under the toasts), not in the middle of the screen. */
  .col-pop.col-pop { left: auto; right: calc(16px + var(--safe-right)); top: calc(var(--top-h) + 22px + var(--safe-top)); transform: none; width: var(--lane-w); max-width: none; box-sizing: border-box; padding: 5px 8px 5px 5px; gap: 8px; font-size: 12.5px; animation: colpop-lane 3.4s ease forwards; }
  .col-pop.col-pop img { width: 36px; height: 36px; flex: none; }
  .col-pop.col-pop div { min-width: 0; line-height: 1.25; }
  .col-pop.col-pop small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
}
@keyframes colpop-lane { 0% { opacity: 0; transform: translateY(-10px); } 8% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }
/* ==== end #215 ==== */
/* ==== #894 small phones: the category bar stays one short row so the bike stays visible ==== */
@media (max-height: 780px) and (max-aspect-ratio: 4/3) {
  #shop-groups { padding-top: 5px; padding-bottom: 2px; max-height: 96px; overflow: hidden auto; }   /* #894 many categories scroll up/down inside the bar, never sideways */
  #shop .tu-group { min-height: 44px; padding-top: 2px; padding-bottom: 2px; gap: 0; }   /* #894 */
  #shop #shop-dock { max-height: 52vh; max-height: 52dvh; }   /* #894 */
}
/* ==== end #894 ==== */

/* ==== #895 Freunde einladen (public/js/invite.js) ==== */
#invite { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0, 0, 0, 0.45); padding: 12px; overflow: hidden; }
#invite .card { width: min(400px, 100%); max-height: calc(100dvh - 24px); overflow: hidden auto; display: grid; gap: 10px; padding: 16px; border-radius: 12px;
  background: #171a22; border: 1px solid var(--rim); color: var(--ink); touch-action: pan-y; }
#invite h2 { margin: 0; font-size: 18px; }
#invite p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
#invite .lead { color: var(--ink); font-size: 14px; }
#invite input { width: 100%; min-width: 0; font: inherit; font-size: 15px; color: var(--ink); background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 8px; -webkit-user-select: text; user-select: text; text-overflow: ellipsis; }
#invite .row { display: flex; gap: 8px; }
#invite .row button { flex: 1; min-height: 44px; }
#invite .row.end { justify-content: flex-end; }
#invite .row.end button { flex: none; padding: 0 16px; }
#invite .count { color: var(--gold); font-weight: 700; font-size: 14px; }
#invite .mine { color: var(--ink); }
#invite .friends { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 30vh; overflow: hidden auto; }
#invite .friends li { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--line); min-width: 0; }
#invite .friends b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#invite .friends span { color: var(--muted); white-space: nowrap; }
#invite .friends span.paid { color: var(--gold); }
#invite .small { font-size: 12px; }
/* ==== end #895 ==== */
/* ==== #896 Clip: HUD button + result sheet (public/js/clip.js) ==== */
/* Desktop: in the right-hand column under emoji (+68), LED (+120), report (+172), chat (+224). */
#clip-button { position: fixed; right: calc(16px + var(--safe-right)); top: calc(var(--top-h) + 276px + var(--safe-top)); touch-action: manipulation; }
#clip-button .icon { width: 24px; height: 24px; }
#clip-button.rec { background: radial-gradient(circle, rgba(20, 22, 30, 0.9) 0 62%, transparent 64%), conic-gradient(#e2483d var(--clip-done, 0deg), rgba(255, 255, 255, 0.28) 0);
  color: #fff; border-color: transparent; font: 800 16px/1 Inter, system-ui, sans-serif; }
#clip-button.rec::after { content: ""; position: absolute; top: 1px; right: 1px; width: 11px; height: 11px; border-radius: 50%; background: #ff3b30;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45); animation: clip-blink 1s steps(2, start) infinite; pointer-events: none; }
@keyframes clip-blink { to { visibility: hidden; } }
.clip-canvas { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0.01; pointer-events: none; z-index: -1; }
@media (pointer: coarse) {
  /* Phones: the 4th button of the column (portrait) / row (landscape) beside the dashboard; "…" and its tray move one place on. */
  #hud #hud-fixed #clip-button { position: relative; inset: auto; order: 5; }
  #hud:has(#clip-button) #hud-more { top: calc(var(--top-h) + 166px + var(--safe-top)); }
  #hud:has(#clip-button) #hud-tray { top: calc(var(--top-h) + 218px + var(--safe-top)); }
  #hud:has(#clip-button):has(#chat-open:not([hidden])) #hud-more { top: calc(var(--top-h) + 218px + var(--safe-top)); }
  #hud:has(#clip-button):has(#chat-open:not([hidden])) #hud-tray { top: calc(var(--top-h) + 270px + var(--safe-top)); }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  body:has(#clip-button) { --tray-end: calc(var(--top-w) + 338px + var(--safe-left)); }
  body:has(#clip-button):has(#led-ring:not([hidden])) { --tray-end: calc(var(--top-w) + 384px + var(--safe-left)); }
  #hud#hud#hud:has(#clip-button) #hud-more { left: calc(var(--top-w) + 202px + var(--safe-left)); top: calc(14px + var(--safe-top)); }
  #hud#hud#hud:has(#clip-button) #hud-tray { left: calc(var(--top-w) + 248px + var(--safe-left)); top: calc(14px + var(--safe-top)); }
  #hud#hud#hud[data-state="foot"]:has(#clip-button) #hud-more { left: calc(var(--u) * 66 + 202px + var(--safe-left)); }
  #hud#hud#hud[data-state="foot"]:has(#clip-button) #hud-tray { left: calc(var(--u) * 66 + 248px + var(--safe-left)); }
}
#clip-sheet { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); padding: 12px; overflow: hidden; }
#clip-sheet .card { width: min(420px, 100%); max-height: calc(100dvh - 24px); overflow: hidden auto; display: grid; gap: 10px; padding: 14px; border-radius: 12px;
  background: #171a22; border: 1px solid var(--rim); color: var(--ink); touch-action: pan-y; }
#clip-sheet h2 { margin: 0; font-size: 18px; }
#clip-sheet video { display: block; width: 100%; max-height: calc(100dvh - 250px); min-height: 0; border-radius: 8px; background: #000; object-fit: contain; }
#clip-sheet .row { display: flex; gap: 8px; }
#clip-sheet .row > * { flex: 1; min-height: 44px; }
#clip-sheet a.button { display: grid; place-items: center; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08);
  color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; }
#clip-sheet p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
#clip-sheet .reward { color: var(--gold); font-weight: 700; font-size: 14px; }
#clip-sheet .small { font-size: 12px; }
/* Sideways phones: the preview at the left, the buttons and text beside it. */
@media (orientation: landscape) and (max-height: 500px) {
  #clip-sheet .card { width: min(720px, 100%); grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-content: start; }
  #clip-sheet .card > :not(video) { grid-column: 2; }
  #clip-sheet video { grid-column: 1; grid-row: 1 / span 4; max-height: calc(100dvh - 54px); }
}
/* ==== end #896 ==== */
/* #902 Helmsicht button on the minimap's top left corner (public/js/pov.js places it) */
#pov-toggle { position: fixed; z-index: 6; right: auto; width: 32px; height: 32px; font-size: 16px; background: rgba(14, 16, 22, 0.62); border: 1px solid rgba(255, 255, 255, 0.25); color: #fff; }
#pov-toggle .icon { width: 18px; height: 18px; }
/* #1031 a thumb target of 44 px: the round button stays 32 px, the rest is a transparent ring (and the corner is kept: -6px). */
@media (pointer: coarse) {
  #pov-toggle { box-sizing: border-box; width: 44px; height: 44px; border: 6px solid transparent; background-clip: padding-box; margin: -6px 0 0 -6px; padding: 0; }
  #pov-toggle[aria-pressed="true"] { border-color: transparent; }
}
/* Phones: the minimap is only 50-80 px wide, a 44 px button on its corner would hide it. The helmet button sits under the
   dashboard at the right edge instead (sideways: beside the Sommer-Bonus badge). */
@media (pointer: coarse) and (max-width: 767px) {
  #pov-toggle { left: auto !important; right: calc(10px + var(--safe-right)) !important; top: calc(var(--cl-h) + 8px + var(--safe-top)) !important; margin: 0; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  #pov-toggle { left: calc(var(--top-w) + 200px + var(--safe-left)) !important; right: auto !important; top: calc(66px + var(--safe-top)) !important; margin: 0; }
}
#pov-toggle[hidden] { display: none; }
#pov-toggle[aria-pressed="true"] { color: #1a1a1a; font-weight: normal; background: #f2c14e; border-color: #f2c14e; }

/* #948 Helmet view (pov.js sets body.pov-view): the road ahead and the bike's own dash stay free. Other first-person
   riding games (Ride, MotoGP, Forza Horizon cockpit) keep the HUD to a small speed read-out at the edge, show no hint
   text, fade what is not needed while driving and bring buttons back at full strength when touched. The chase view is not touched. */
@media (min-height: 601px), (orientation: portrait) {
  body.pov-view #hud #stunt { top: calc(var(--top-h) + 10px + var(--safe-top)) !important; width: 176px; min-width: 0; padding: 5px 10px 6px;
    background: rgba(16, 18, 26, 0.55); box-shadow: none; }
  body.pov-view #stunt b { font-size: 13px; display: inline; margin-right: 6px; }
  body.pov-view #stunt span { font-size: 15px; }
  body.pov-view #stunt .balance { margin-top: 4px; }
  body.pov-view #stunt-hint { display: none; }
}
body.pov-view #emoji-open, body.pov-view #chat-open, body.pov-view #beta-feedback-hud, body.pov-view #clip-button { opacity: 0.35; transition: opacity 0.2s; }
body.pov-view #emoji-open:active, body.pov-view #chat-open:active, body.pov-view #beta-feedback-hud:active, body.pov-view #clip-button:active,
body.pov-view #emoji-open:hover, body.pov-view #chat-open:hover, body.pov-view #beta-feedback-hud:hover, body.pov-view #clip-button:hover { opacity: 1; }
body.pov-view #cluster { opacity: 0.85; }
@media (pointer: coarse) and (orientation: portrait) {
  /* Touch keys: one row of tricks at the bottom instead of a block over the tank; all keys fainter, full while pressed. */
  body.pov-view #hud:is([data-state="wheelie"], [data-state="air"]) .pad-tricks { grid-template-columns: repeat(3, 46px); gap: 5px; }
  body.pov-view #hud:is([data-state="wheelie"], [data-state="air"], [data-state="stoppie"]) .touch .trick { min-height: 44px; height: 44px; min-width: 0; padding: 0; font-size: 10px; }
  body.pov-view .touch .pad-left button, body.pov-view .touch .pad-right button, body.pov-view .touch .pad-icons button,
  body.pov-view .touch .pad-tricks button, body.pov-view .touch .pad-top button { opacity: 0.55; }
  body.pov-view .touch button:active, body.pov-view .touch .held, body.pov-view .touch .ready { opacity: 1; }
}

/* ==== #1099 the job / race box sits at the top-right edge on desktop too (feedback #174: "mitten im Bildschirm ... macht das oben rechts hin")
   It used to hang centred under the dashboard, right over the road ahead. Same slim two-line card as the phone rule below; the notices
   and the arrow pill make room (notices move under it, the arrow pill keeps the old slot under the dashboard). Landscape only: the narrow
   / portrait rule further down keeps its lane. tools/check/job-box-edge.mjs asserts the box never covers the road box or the HUD. */
@media (min-width: 641px) and (orientation: landscape) {
  #hud#hud #event#event {
    top: calc(14px + var(--safe-top, 0px)) !important; left: auto; right: calc(16px + var(--safe-right, 0px)); transform: none; text-align: right;
    width: max-content; min-width: 0; max-width: calc((100vw - var(--top-w)) / 2 - 28px); padding: 4px 12px; border-radius: 10px; line-height: 1.25;
  }
  #hud#hud #event#event b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #hud#hud #event#event span { font-size: 16px; }
  #hud#hud #event#event #job-cancel { min-height: 28px; padding: 2px 10px; margin-left: 8px; font-size: 12px; }
  .route-guide.route-guide { top: calc(var(--top-h) + 74px + var(--safe-top, 0px)) !important; }   /* !important: route-guide.js puts it under the race box with an inline top */
}
@media (pointer: fine) and (min-width: 1180px) and (min-height: 600px) {
  body:has(#event:not([hidden])) #toast { top: calc(14px + 58px + var(--safe-top, 0px)) !important; max-height: calc(var(--top-h) - 54px); }
}

/* ==== #954 riding cards stay out of the road ahead (phones) ====
   Discord: the job card, the race card + arrow pill, the hunt card sat big in the middle over the road, worst in the helmet
   view. While riding on a phone every card is slim and sits at the top edge or a side, never in the centre:
   landscape = the left column under the dashboard (at most 36 vw wide) and the right column under the notices; portrait =
   the lane under the dashboard. tools/check/riding-cards.mjs asserts that no card covers the central road box. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  /* Job / race card: top right (the notices move under it), two slim lines, never wider than the notices. */
  #hud#hud #event#event {
    top: calc(8px + var(--safe-top, 0px)) !important; left: auto; right: calc(8px + var(--safe-right, 0px)); transform: none; text-align: right;
    width: max-content; min-width: 0; max-width: calc((100vw - var(--top-w)) / 2 - 36px); padding: 3px 10px; border-radius: 10px; line-height: 1.2;
  }
  #hud#hud #event#event b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #hud#hud #event#event span { font-size: 14px; }
  #hud#hud #event#event #job-cancel { min-height: 26px; padding: 2px 10px; margin-left: 8px; font-size: 12px; }
  body:has(#event:not([hidden])) #toast { top: calc(56px + var(--safe-top, 0px)) !important; max-height: 70px; }
  /* The arrow pill and the open pills / hint: the left column, left of the centre line of the road. */
  .route-guide.route-guide { left: calc(6px + var(--safe-left, 0px)); transform: none; top: calc(var(--top-h) + 8px + var(--safe-top, 0px)) !important; max-width: calc(36vw - 12px); }   /* !important: route-guide.js puts it under the race box with an inline top */
  .route-guide > div { padding: 2px 8px 2px 4px; font-size: 14px; }
  .route-guide svg, .route-guide .rg-turn svg { width: 28px; height: 28px; }
  #hud#hud #goal, #vev { max-width: calc(36vw - 12px); min-height: 30px; padding: 2px 10px; font-size: 12px; }
  #hud#hud #prompt#prompt#prompt { max-width: calc(36vw - 12px); font-size: 12px; padding: 4px 10px; }
  body:has(.route-guide:not([hidden])) :is(#goal, #vev) { top: calc(var(--top-h) + 48px + var(--safe-top, 0px)) !important; }
  body:has(.route-guide:not([hidden])):not(:has(#intro-tip:not([hidden]))) #hud#hud #prompt#prompt#prompt { top: calc(var(--top-h) + 48px + var(--safe-top, 0px)) !important; }
  body:has(.route-guide:not([hidden])) .hunt-card { display: none; }   /* back after the race; a hunt card is 20 s open at most on phones */
  /* #1105 hint pill and Schnitzeljagd card share the same spot and there is no room under the card (stick / trick pads): the pill waits while the card is open */
  body:has(.hunt-card:not([hidden]):not(.mini)) #hud#hud #prompt#prompt#prompt { display: none; }
  .hunt-card.hunt-card:not(.mini) { left: calc(6px + var(--safe-left, 0px)); width: auto; max-width: calc(36vw - 12px); top: calc(var(--top-h) + 8px + var(--safe-top, 0px)); font-size: 12px; padding: 4px 9px 5px; }
  .hunt-card:not(.mini) .hunt-riddle { margin-top: 2px; -webkit-line-clamp: 3; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
  .hunt-card .hunt-row:has(button.alt:disabled) { display: none; }   /* the "Tipp in 40 s" countdown: not worth the height */
  .hunt-card .hunt-row { margin-top: 3px; }
  .hunt-card .hunt-row .hunt-x { min-height: 44px; margin-block: -10px; }   /* #1057 */
  .hunt-card .hunt-row button { min-height: 26px; padding: 3px 10px; font-size: 12px; }
}
/* #1105 800 x 360: a 3-line riddle reached the trick pads; two lines */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 380px) {
  .hunt-card:not(.mini) .hunt-riddle { -webkit-line-clamp: 2; }
}
@media (pointer: coarse) and (orientation: portrait), (max-width: 640px) {
  /* Job / race card + arrow pill: two slim lines at the top of the lane; the pills, hint and toasts sit under them. */
  /* #1107 portrait phones: the lane starts 5 px higher (still 7 px under the Sommer-Bonus badge) and the race / job lines are 4 px tighter, so
     the hint pill ends above the road box (35 % of the height, 390 x 844) and an open job card hides the Schnitzeljagd card (its chip stays in the dock). */
  body { --lane: calc(var(--top-h) + 3px + var(--safe-top)); }
  body:has(#event:not([hidden])) { --lane-event: 42px; }
  body:has(#event:not([hidden])):has(.route-guide:not([hidden])) { --lane-event: 80px; }
  body:has(#event:not([hidden])) #hud#hud #prompt#prompt { font-size: 13px; padding: 4px 10px; }
  body:has(#event:not([hidden])) .hunt-card { display: none; }
  #hud#hud #event#event {
    top: calc(var(--lane) + var(--lane-intro)) !important; left: 50%; transform: translateX(-50%); width: max-content; min-width: 0;
    max-width: calc(100vw - 2 * var(--lane-side)); padding: 3px 10px; border-radius: 10px; line-height: 1.2; text-align: center;
  }
  #hud#hud #event#event b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #hud#hud #event#event span { font-size: 14px; }
  #hud#hud #event#event #job-cancel { min-height: 26px; padding: 2px 10px; margin-left: 8px; font-size: 12px; }
  .route-guide.route-guide { top: calc(var(--lane) + var(--lane-intro) + 42px) !important; }
  .route-guide > div { padding: 2px 8px 2px 4px; font-size: 14px; }
  .route-guide svg, .route-guide .rg-turn svg { width: 28px; height: 28px; }
  #vev, #goal { top: calc(var(--top-h) + 8px + var(--safe-top, 0px) + var(--lane-event, 0px)) !important; min-height: 32px; }
  body:has(.route-guide:not([hidden])) .hunt-card { display: none; }
  .hunt-card .hunt-riddle { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .hunt-card.hunt-card { font-size: 12px; padding: 4px 9px 5px; }
  .hunt-card .hunt-row .hunt-x { min-height: 44px; margin-block: -10px; }   /* #1057 */
  .hunt-card .hunt-row:has(button.alt:disabled) { display: none; }
  .hunt-card .hunt-row { margin-top: 3px; }
  .hunt-card .hunt-row button { min-height: 24px; padding: 2px 10px; font-size: 12px; }
}
/* #954 3rd sample (Discord jason.09, 2026-11-15): the race split time ("+0,01 s") still flashed big in the middle of the road.
   On phones it is a small chip right under the race card instead. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  #split { z-index: 70; top: calc(62px + var(--safe-top, 0px)); left: auto; right: calc(8px + var(--safe-right, 0px)); transform: none; font-size: 20px; padding: 3px 12px; border-radius: 10px; }
}
@media (pointer: coarse) and (orientation: portrait), (max-width: 640px) {
  #split { left: 50%; translate: -50% 0; top: calc(var(--lane) + var(--lane-intro) + 84px); font-size: 22px; padding: 3px 14px; border-radius: 10px; }
}

/* #1031 Tablets sideways with browser bars shown (1280 x 673, 1280 x 600, 1024 x 768 ...): the left column of round buttons (emoji, chat, report,
   clip, "...") was 5 x 52 px tall under a dashboard 600+ px wide and ran into the trick pads at the bottom (KeyZ / light covered).
   Same answer as on sideways phones: the dashboard gets a little narrower and the buttons stand in a row beside it. */
@media (pointer: coarse) and (orientation: landscape) and (min-height: 501px) and (max-height: 800px) and (min-width: 900px) {
  :root { --top-w: max(300px, min(calc(100vw - 440px), 100vh, 720px)); }
  #hud #hud-fixed { flex-direction: row; left: calc(var(--top-w) + 18px + var(--safe-left)); top: calc(14px + var(--safe-top)); }
  #hud[data-state="foot"] #hud-fixed { left: calc(var(--u) * 66 + 18px + var(--safe-left)); }
  #hud#hud#hud:has(#clip-button) #hud-more { left: calc(var(--top-w) + 174px + var(--safe-left)); top: calc(14px + var(--safe-top)); }
  #hud#hud#hud:has(#clip-button) #hud-tray { flex-direction: row; left: calc(var(--top-w) + 226px + var(--safe-left)); top: calc(14px + var(--safe-top)); }
  #hud#hud#hud:has(#clip-button):has(#chat-open:not([hidden])) #hud-more { left: calc(var(--top-w) + 226px + var(--safe-left)); top: calc(14px + var(--safe-top)); }
  #hud#hud#hud:has(#clip-button):has(#chat-open:not([hidden])) #hud-tray { flex-direction: row; left: calc(var(--top-w) + 278px + var(--safe-left)); top: calc(14px + var(--safe-top)); }
  #hud#hud#hud[data-state="foot"]:has(#clip-button) #hud-more { left: calc(var(--u) * 66 + 174px + var(--safe-left)); }
  #hud#hud#hud[data-state="foot"]:has(#clip-button) #hud-tray { left: calc(var(--u) * 66 + 226px + var(--safe-left)); }
  #hud#hud#hud[data-state="foot"]:has(#clip-button):has(#chat-open:not([hidden])) #hud-more { left: calc(var(--u) * 66 + 226px + var(--safe-left)); }
  #hud#hud#hud[data-state="foot"]:has(#clip-button):has(#chat-open:not([hidden])) #hud-tray { left: calc(var(--u) * 66 + 278px + var(--safe-left)); }
  #hud #emoji-row { left: calc(var(--top-w) + 18px + var(--safe-left)); right: auto; top: calc(66px + var(--safe-top)); }
  #hud[data-state="foot"] #emoji-row { left: calc(var(--u) * 66 + 18px + var(--safe-left)); }
}

/* #1031 "Ziel" and the village pill are tappable (the goal pill shows the way): 44 px on a touch screen (the lane reserves 44 px for them). */
@media (pointer: coarse) {
  #hud#hud #goal, #vev#vev { min-height: 44px; }
}
