@font-face { font-family: Overpass; font-weight: 400; font-display: swap; src: url(/vendor/fonts/overpass/overpass-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Overpass; font-weight: 600; font-display: swap; src: url(/vendor/fonts/overpass/overpass-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Overpass; font-weight: 800; font-display: swap; src: url(/vendor/fonts/overpass/overpass-latin-800-normal.woff2) format('woff2'); }
@font-face { font-family: 'Overpass Mono'; font-weight: 400; font-display: swap; src: url(/vendor/fonts/overpass-mono/overpass-mono-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Overpass Mono'; font-weight: 600; font-display: swap; src: url(/vendor/fonts/overpass-mono/overpass-mono-latin-600-normal.woff2) format('woff2'); }

:root {
  --enamel: #123d8f;
  --enamel-deep: #0c2a66;
  --road-green: #0f6b52;
  --paper: #f5f4ec;
  --ink: #14233f;
  --signal: #f2b705;
  --stop: #c23b2e;
  --glass: rgba(12, 28, 66, .84);
  --hairline: rgba(245, 244, 236, .22);
  --gut: 14px;
  --sans: Overpass, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Overpass Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--enamel-deep); color: var(--paper); font: 400 15px/1.45 var(--sans); }
h1, h2, h3, p, ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
[hidden] { display: none !important; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#cut { position: fixed; inset: 0; background: #050a18; opacity: 0; pointer-events: none; transition: opacity .32s; z-index: 5; }
#cut.dip { opacity: 1; }

/* ---- Enamel: the shared material of every sign in the city ---- */
.enamel {
  position: relative;
  background: var(--enamel);
  color: var(--paper);
  border-radius: 10px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .28), 0 10px 26px rgba(0, 0, 0, .3);
}
.enamel::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1.5px solid rgba(245, 244, 236, .86);
  border-radius: 7px;
  pointer-events: none;
}

/* ---- Landing: a street sign at the corner of the city ---- */
#landing { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; padding: 24px clamp(16px, 7vw, 96px); background: linear-gradient(90deg, rgba(6, 14, 38, .62), rgba(6, 14, 38, 0) 62%); }
.signpost { position: relative; width: min(600px, 100%); }
.signpost::before {
  content: '';
  position: absolute;
  left: 34px;
  top: -100vh;
  bottom: -100vh;
  width: 12px;
  background: linear-gradient(90deg, #39424f, #6f7a88 40%, #2c333d);
  z-index: 0;
}
.blade { position: relative; z-index: 1; border-radius: 10px; box-shadow: 0 4px 0 rgba(0, 0, 0, .3), 0 18px 34px rgba(0, 0, 0, .35); }
.blade::after { content: ''; position: absolute; inset: 5px; border: 2px solid rgba(245, 244, 236, .9); border-radius: 6px; pointer-events: none; }
.blade-main { background: var(--enamel); padding: 22px 30px 16px; }
.blade-main h1 { font-size: clamp(44px, 8.4vw, 86px); font-weight: 800; line-height: .98; letter-spacing: -.02em; }
.blade-cross { background: var(--road-green); margin: 12px 0 0 26px; padding: 13px 24px 10px; width: fit-content; max-width: calc(100% - 26px); transform: rotate(-1.1deg); transform-origin: left center; }
.blade-cross p { font-size: clamp(16px, 2.4vw, 21px); font-weight: 600; }
.plate { position: relative; z-index: 1; margin-top: 16px; background: var(--paper); color: var(--ink); border-radius: 10px; padding: 18px 20px 16px; box-shadow: 0 4px 0 rgba(0, 0, 0, .25), 0 18px 34px rgba(0, 0, 0, .3); }
.plate label { display: block; font-weight: 800; margin-bottom: 7px; }
.plate-row { display: flex; gap: 8px; }
.plate input { flex: 1; min-width: 0; height: 46px; padding: 3px 12px 0; border: 2px solid var(--ink); border-radius: 6px; background: #fff; color: var(--ink); font-family: var(--mono); font-size: 16px; }
.plate button { height: 46px; padding: 3px 18px 0; border: 0; border-radius: 6px; background: var(--enamel); color: var(--paper); font-weight: 800; white-space: nowrap; }
.plate button:hover { background: var(--enamel-deep); }
.plate-error { margin-top: 8px; color: #a32317; font-weight: 600; }
.plate-examples { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 12px; font-size: 14px; }
.plate-examples span { font-weight: 600; opacity: .7; }
.plate-examples a { font-family: var(--mono); color: var(--enamel); }

/* ---- Loading ---- */
#loading { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(6, 14, 38, .72); }
.loading-sign { width: min(560px, 100%); }
.loading-repo { font-size: clamp(26px, 5vw, 42px); font-weight: 800; line-height: 1.08; overflow-wrap: anywhere; }
.loading-stage { margin-top: 8px; font-size: 18px; color: var(--signal); font-weight: 600; }
.loading-track { height: 8px; margin-top: 14px; background: rgba(245, 244, 236, .16); border-radius: 4px; overflow: hidden; }
#loading-bar { height: 100%; width: 2%; background: var(--signal); transition: width .25s; }
.loading-file { min-height: 1.5em; margin-top: 10px; font-family: var(--mono); font-size: 13px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#loading-back { display: inline-block; margin-top: 16px; font-weight: 800; }
.fatal { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; font-size: 20px; z-index: 30; background: var(--enamel-deep); }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 4; font-size: 14px; }
#hud > * { pointer-events: auto; }
#hud.quiet > :not(#caption):not(#toast) { display: none !important; }

#title { position: absolute; top: var(--gut); left: var(--gut); padding: 12px 18px 8px; max-width: min(340px, calc(100vw - 200px)); }
#city-name { font-size: 24px; font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
#city-where { font-weight: 600; font-size: 14px; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#clock { position: absolute; top: var(--gut); right: var(--gut); padding: 11px 15px 10px; text-align: right; min-width: 166px; }
#clock-time { font-size: 24px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
#clock-day { font-size: 13px; opacity: .92; }
.clock-buttons { position: relative; z-index: 1; display: flex; gap: 3px; margin-top: 6px; justify-content: flex-end; }
.clock-buttons button { padding: 2px 6px 0; border: 1px solid rgba(245, 244, 236, .5); border-radius: 4px; background: transparent; color: var(--paper); font-size: 12px; font-weight: 600; }
.clock-buttons button.on { background: var(--paper); color: var(--enamel); }

.panel { background: var(--glass); backdrop-filter: blur(8px); border-radius: 8px; border: 1px solid var(--hairline); }

#stats { position: absolute; left: var(--gut); top: 96px; width: 226px; padding: 11px 12px; max-height: calc(100vh - 178px); overflow: auto; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 8px; }
.stat-grid strong { display: block; font-size: 19px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-grid span { font-size: 12px; opacity: .78; }
#stats h2 { margin: 11px 0 4px; font-size: 12.5px; font-weight: 600; opacity: .8; }
.stack-bar { display: flex; height: 9px; border-radius: 3px; overflow: hidden; gap: 1px; }
.key { display: flex; flex-wrap: wrap; gap: 1px 9px; margin-top: 4px; font-size: 12px; }
.key i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
#languages li { display: grid; grid-template-columns: 74px 1fr 30px; align-items: center; gap: 6px; font-size: 12px; line-height: 1.5; }
#languages .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#languages .track { height: 6px; }
#languages .fill { height: 100%; border-radius: 2px; min-width: 2px; }
#languages .pct { text-align: right; font-variant-numeric: tabular-nums; opacity: .8; }

#caption { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); width: min(620px, calc(100vw - 32px)); text-align: center; text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 2px 18px rgba(0, 0, 0, .75); animation: caption-in .35s ease-out; pointer-events: none !important; }
@keyframes caption-in { from { opacity: 0; transform: translate(-50%, 6px); } }
#caption-kicker { color: var(--signal); font-weight: 800; font-size: 15px; }
#caption-title { font-size: clamp(26px, 4vw, 40px); font-weight: 800; line-height: 1.08; overflow-wrap: anywhere; }
#caption-lines { font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }

#ticker { position: absolute; left: var(--gut); right: 232px; bottom: 54px; display: flex; align-items: stretch; max-width: 760px; height: 28px; border-radius: 5px; overflow: hidden; background: var(--glass); }
#ticker-tag { flex: none; display: flex; align-items: center; padding: 2px 9px 0; background: var(--signal); color: var(--ink); font-weight: 800; font-size: 13px; }
#ticker.alert #ticker-tag { background: var(--stop); color: var(--paper); }
#ticker.good #ticker-tag { background: var(--road-green); color: var(--paper); }
#ticker-text { flex: 1; min-width: 0; padding: 3px 10px 0; text-align: left; background: none; border: 0; color: var(--paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }


.menu { position: absolute; left: var(--gut); bottom: 94px; width: 290px; padding: 4px; background: var(--paper); color: var(--ink); border-radius: 8px; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); max-height: 62vh; overflow: auto; }
.menu button { display: grid; grid-template-columns: 22px 1fr; column-gap: 6px; width: 100%; padding: 7px 8px 5px; border: 0; border-radius: 5px; background: none; color: inherit; text-align: left; }
.menu button:hover, .menu button:focus-visible { background: #dfe5f2; }
.menu b { font-weight: 800; }
.menu kbd { grid-row: span 2; font: 600 13px var(--mono); color: var(--enamel); }
.menu small { font-size: 12.5px; opacity: .78; }

#lens-key { position: absolute; left: 250px; top: 96px; padding: 8px 11px; max-width: 280px; font-size: 13px; }
#lens-key b { display: block; }
#lens-key .ramp { height: 8px; margin: 5px 0 2px; border-radius: 3px; }
#lens-key .ends { display: flex; justify-content: space-between; font-size: 12px; opacity: .8; }
#lens-key .chips { display: flex; flex-wrap: wrap; gap: 1px 9px; margin-top: 3px; font-size: 12px; }
#lens-key .chips i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

#search-box { position: fixed; z-index: 40; top: var(--gut); left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); padding: 8px; }
#search-input { width: 100%; height: 36px; padding: 2px 9px 0; border: 0; border-radius: 5px; background: var(--paper); color: var(--ink); font-family: var(--mono); font-size: 15px; }
#search-results button { display: block; width: 100%; padding: 5px 7px 3px; border: 0; background: none; color: var(--paper); text-align: left; font-family: var(--mono); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; }
#search-results button:hover, #search-results button:focus-visible { background: var(--enamel); }

#inspector { position: absolute; right: var(--gut); top: 104px; bottom: 244px; width: 292px; padding: 11px 13px; overflow: auto; }
#inspector-close { position: absolute; top: 8px; right: 8px; z-index: 2; padding: 2px 8px 0; border: 1px solid var(--hairline); border-radius: 5px; background: var(--enamel-deep); color: var(--paper); font-size: 12px; }
.address-plate { display: flex; flex-direction: column; padding: 11px 13px 7px; margin-bottom: 9px; background: var(--paper); color: var(--ink); border-radius: 6px; box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4.5px var(--enamel); }
#i-number { font: 600 26px/1 var(--mono); color: var(--enamel); }
#i-street { font-weight: 800; overflow-wrap: anywhere; }
#i-name { font-size: 21px; font-weight: 800; line-height: 1.12; overflow-wrap: anywhere; }
#i-kind { font-size: 13.5px; opacity: .85; }
#i-path { display: block; margin-top: 4px; font: 400 13px var(--mono); overflow-wrap: anywhere; }
.i-actions { display: flex; gap: 5px; margin: 9px 0; }
.i-actions button { flex: 1; padding: 6px 4px 4px; border: 0; border-radius: 5px; background: var(--paper); color: var(--ink); font-weight: 800; font-size: 13px; }
#i-facts { display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; font-size: 13.5px; }
#i-facts dt { opacity: .78; }
#i-facts dd { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
#inspector h3 { margin: 11px 0 3px; font-size: 14px; font-weight: 800; }
#i-rules li { display: grid; grid-template-columns: 44px 1fr; gap: 5px; font-size: 13px; line-height: 1.35; padding: 1.5px 0; }
#i-rules code { font: 600 11.5px var(--mono); color: var(--signal); padding-top: 2px; }
#i-sha { font: 400 12px/1.4 var(--mono); overflow-wrap: anywhere; opacity: .85; }

#minimap-box { position: absolute; right: var(--gut); bottom: var(--gut); padding: 4px; background: var(--enamel); border-radius: 8px; box-shadow: 0 8px 22px rgba(0, 0, 0, .34); line-height: 0; }
#minimap { border-radius: 5px; cursor: crosshair; }

#toast { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 7px 14px 5px; border-radius: 6px; background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: 0 8px 22px rgba(0, 0, 0, .3); }


#tooltip { position: fixed; left: 0; top: 0; z-index: 6; max-width: 340px; padding: 6px 9px 4px; border-radius: 6px; background: var(--paper); color: var(--ink); box-shadow: 0 6px 18px rgba(0, 0, 0, .34); pointer-events: none; }
#tooltip b { display: block; font-weight: 800; overflow-wrap: anywhere; }
#tooltip span { display: block; font: 400 12px var(--mono); overflow-wrap: anywhere; }

dialog { max-width: min(600px, calc(100vw - 28px)); max-height: 82vh; padding: 20px 22px; border: 0; border-radius: 10px; background: var(--paper); color: var(--ink); overflow: auto; }
dialog::backdrop { background: rgba(5, 12, 32, .6); }
dialog h2 { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
dialog h3 { margin: 14px 0 4px; font-size: 16px; font-weight: 800; color: var(--enamel); }
dialog table { border-collapse: collapse; width: 100%; }
dialog th { text-align: left; font-weight: 800; padding: 3px 14px 3px 0; vertical-align: top; white-space: nowrap; }
dialog td { padding: 3px 0; }
dialog form { margin-top: 14px; }
dialog form button { padding: 8px 18px 6px; border: 0; border-radius: 6px; background: var(--enamel); color: var(--paper); font-weight: 800; }
#charter-rules li { display: grid; grid-template-columns: 58px 1fr; gap: 6px; padding: 1.5px 0; }
#charter-rules code { font: 600 13px var(--mono); color: var(--enamel); }

@media (max-width: 860px) {
  #stats, #lens-key { display: none; }
  #inspector { top: auto; left: var(--gut); right: var(--gut); width: auto; max-height: 52vh; }
  #minimap-box { top: 118px; bottom: auto; }
  #minimap { width: 92px !important; height: auto !important; }
  #ticker { right: var(--gut); }
  #ticker { bottom: 92px; }
  #caption { bottom: 130px; }
  #inspector { bottom: 128px; }
  #title { max-width: calc(100vw - 210px); }
  .plate-row { flex-direction: column; }
  .signpost::before { display: none; }
  #landing { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; overflow: auto; background: rgba(6, 14, 38, .35); }
  .signpost { width: 100%; }
    }

@media (prefers-reduced-motion: reduce) {
  #cut, #caption { transition: none; animation: none; }
}

/* ---- Play ---- */
#btn-play-count { font-weight: 600; margin-left: 4px; opacity: .75; }
#hud.playing #stats, #hud.playing #ticker, #hud.playing #clock, #hud.playing #lens-key, #hud.playing #tour-menu { display: none; }
#hud.playing #title { padding: 7px 12px 4px; }
#hud.playing #city-name { font-size: 15px; }
#hud.playing #city-where { font-size: 12.5px; }
#hud.playing #caption { display: none; }

#tags { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.ptag { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; will-change: transform; }
.ptag b { padding: 3px 7px 1px; border-radius: 3px; background: var(--enamel); box-shadow: inset 0 0 0 1px rgba(245, 244, 236, .8); color: var(--paper); font-size: 13px; font-weight: 800; white-space: nowrap; }
.ptag.it b { background: var(--stop); }
.ptag .bubble { padding: 3px 8px 1px; border-radius: 10px; background: var(--paper); color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; }

#play-hud { position: fixed; inset: 0; z-index: 4; pointer-events: none; font-size: 14px; }
#play-hud button, #g-quick { pointer-events: auto; }
#play-hud.watching #g-bottom, #play-hud.watching #g-prompt, #play-hud.watching #touch { display: none; }
#play-hud.is-it::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 90px rgba(194, 59, 46, .6); pointer-events: none; }

#g-top { position: absolute; top: var(--gut); left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; min-width: 300px; padding: 7px 16px 4px; border-radius: 8px; background: var(--enamel); box-shadow: inset 0 0 0 2px rgba(245, 244, 236, .85), 0 6px 18px rgba(0, 0, 0, .35); }
#g-mode { font-weight: 800; }
#g-timer { font-size: 26px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
#g-role { text-align: right; font-weight: 600; white-space: nowrap; }
#play-hud.is-it #g-top { background: var(--stop); }

#g-compass { position: absolute; top: 68px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; text-shadow: 0 1px 4px rgba(0, 0, 0, .9); font-weight: 600; }
#g-compass i { width: 0; height: 0; border-left: 13px solid transparent; border-right: 13px solid transparent; border-bottom: 26px solid var(--signal); filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .7)); }

#g-center { position: absolute; top: 30%; left: 0; right: 0; text-align: center; font-size: clamp(44px, 9vw, 96px); font-weight: 800; line-height: 1; color: var(--paper); text-shadow: 0 3px 22px rgba(0, 0, 0, .75); animation: center-in .25s ease-out; }
#g-center.it { color: #ff8a78; }
#g-center.go { color: var(--signal); }
@keyframes center-in { from { transform: scale(1.3); opacity: 0; } }

#g-board { position: absolute; top: 100px; right: var(--gut); width: 196px; padding: 6px 8px; background: var(--glass); border-radius: 8px; border: 1px solid var(--hairline); list-style: none; font-size: 13px; }
#g-board li { display: flex; justify-content: space-between; gap: 8px; padding: 1px 0; }
#g-board .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#g-board .value { font-variant-numeric: tabular-nums; opacity: .85; }
#g-board li.you { color: var(--signal); font-weight: 800; }
#g-board li.hot .name::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: #ff3a2a; }

#g-feed { position: absolute; left: var(--gut); top: 74px; display: flex; flex-direction: column; gap: 3px; max-width: 320px; font-size: 13.5px; font-weight: 600; text-shadow: 0 1px 4px rgba(0, 0, 0, .95); }
#g-feed .good { color: #8ff0b8; }
#g-feed .alert { color: #ffb4a8; }

#g-prompt { position: absolute; z-index: 2; pointer-events: auto; cursor: pointer; left: 50%; bottom: 150px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 6px 12px 4px; border-radius: 7px; background: var(--paper); color: var(--ink); font-weight: 800; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); white-space: nowrap; }
#g-prompt span { overflow: hidden; text-overflow: ellipsis; }
#g-prompt kbd, #g-item kbd { font: 600 13px var(--mono); padding: 1px 6px 0; border-radius: 4px; background: var(--enamel); color: var(--paper); }

#g-bottom { position: absolute; left: 50%; bottom: 58px; transform: translateX(-50%); display: flex; gap: 8px; align-items: stretch; max-width: calc(100vw - 240px); }
#g-item { --item: var(--hairline); position: relative; display: grid; grid-template-columns: auto 1fr auto; column-gap: 8px; align-items: center; min-width: 230px; padding: 7px 10px 5px; border-radius: 8px; background: var(--glass); border: 2px solid var(--item); }
#g-item i { grid-row: span 2; font: 600 22px var(--mono); font-style: normal; color: var(--item); width: 30px; text-align: center; }
#g-item b { font-weight: 800; }
#g-item span { grid-column: 2; font-size: 12px; opacity: .85; }
#g-item kbd { grid-column: 3; grid-row: 1 / span 2; }
#g-item .none { grid-column: 1 / -1; opacity: .6; }
#g-meter { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; align-content: center; min-width: 170px; padding: 7px 10px 5px; border-radius: 8px; background: var(--glass); border: 1px solid var(--hairline); }
#g-speed { font-variant-numeric: tabular-nums; }
#g-meter .fuel { grid-column: 1 / -1; height: 6px; margin-top: 3px; border-radius: 3px; background: rgba(245, 244, 236, .16); overflow: hidden; }
#g-fuel { display: block; height: 100%; width: 100%; background: var(--signal); }

#g-lockhint { position: absolute; left: 50%; top: 42%; transform: translateX(-50%); padding: 6px 12px 4px; border-radius: 7px; background: var(--glass); font-weight: 600; white-space: nowrap; }
#g-quick { position: absolute; left: 50%; bottom: 190px; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; width: min(520px, calc(100vw - 32px)); }
#g-quick button { padding: 6px 11px 4px; border: 0; border-radius: 16px; background: var(--paper); color: var(--ink); font-weight: 600; }
#g-quick button.emote { background: var(--road-green); color: var(--paper); }
#touch { position: absolute; inset: 0; z-index: 1; pointer-events: auto; }
#touch .zone { pointer-events: auto; }

#g-invite { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 9px 14px 7px; z-index: 2; }
#g-invite p { font-weight: 800; white-space: nowrap; }
#g-invite button, #call button { position: relative; z-index: 1; padding: 4px 11px 2px; border: 0; border-radius: 5px; background: var(--paper); color: var(--ink); font-weight: 800; }
#call { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 8px 12px 6px; border-radius: 8px; background: var(--road-green); box-shadow: 0 8px 20px rgba(0, 0, 0, .35); }
#call p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

.plate-card { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 6; width: min(420px, calc(100vw - 28px)); max-height: 80vh; overflow: auto; padding: 18px 20px; border-radius: 10px; background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 6px var(--enamel), 0 18px 40px rgba(0, 0, 0, .4); }
.plate-card h2 { font-size: 32px; font-weight: 800; line-height: 1.05; }
#g-score-rows { list-style: none; margin: 10px 0 12px; padding: 0; }
#g-score-rows li { display: grid; grid-template-columns: 24px 1fr auto; gap: 6px; padding: 3px 0; border-top: 1px solid rgba(20, 35, 63, .14); }
#g-score-rows li.you { font-weight: 800; color: var(--enamel); }
#g-score-rows .rank { font-variant-numeric: tabular-nums; opacity: .7; }
#g-score-rows .value { font-variant-numeric: tabular-nums; }
.row { display: flex; flex-wrap: wrap; gap: 6px; }
.row button, #p-phone, #p-sound, #p-copy, .play-head button { padding: 8px 13px 6px; border: 1.5px solid var(--ink); border-radius: 6px; background: transparent; color: var(--ink); font-weight: 800; }
.row button.primary, #g-score-again { background: var(--enamel); border-color: var(--enamel); color: var(--paper); }
button:disabled { opacity: .5; cursor: not-allowed; }

.landing-join { position: fixed; left: clamp(16px, 7vw, 96px); bottom: 14px; z-index: 11; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
.landing-join input { width: 96px; height: 32px; padding: 2px 8px 0; border: 0; border-radius: 5px; font: 600 15px var(--mono); }
.landing-join button { height: 32px; padding: 2px 12px 0; border: 0; border-radius: 5px; background: var(--signal); color: var(--ink); font-weight: 800; }
.landing-join p { flex-basis: 100%; color: #ffb4a8; }

/* ---- Play dialog ---- */
#play { width: min(620px, calc(100vw - 20px)); max-width: none; padding: 16px 20px 18px; }
.play-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.play-head h2 { margin: 0; }
.play-tabs { display: flex; gap: 2px; margin: 10px 0 12px; border-bottom: 2px solid var(--enamel); }
.play-tabs button { padding: 7px 15px 4px; border: 0; border-radius: 6px 6px 0 0; background: none; color: var(--ink); font-weight: 800; }
.play-tabs button[aria-selected='true'] { background: var(--enamel); color: var(--paper); }
.you { display: grid; grid-template-columns: 200px 1fr; gap: 14px; }
#p-preview { width: 200px; height: 270px; border-radius: 8px; background: linear-gradient(180deg, #123d8f, #0f6b52); }
.field { display: block; margin-bottom: 8px; font-weight: 800; font-size: 14px; }
.field input, .field select { display: block; width: 100%; height: 38px; margin-top: 3px; padding: 3px 8px 0; border: 1.5px solid var(--ink); border-radius: 6px; background: #fff; color: var(--ink); font: 600 15px var(--sans); }
.field-pair { display: grid; grid-template-columns: 1fr 90px; gap: 8px; }
.p-row { display: grid; grid-template-columns: 74px 1fr; gap: 6px; align-items: center; padding: 2px 0; }
.p-label { font-size: 12.5px; font-weight: 600; }
.p-choices { display: flex; flex-wrap: wrap; gap: 3px; }
.p-choices .swatch { width: 21px; height: 21px; padding: 0; border: 1px solid rgba(20, 35, 63, .35); border-radius: 50%; }
.p-choices .swatch[aria-checked='true'] { outline: 2.5px solid var(--enamel); outline-offset: 1.5px; }
.p-choices .word { padding: 2px 6px 0; border: 1px solid rgba(20, 35, 63, .35); border-radius: 4px; background: none; color: var(--ink); font-size: 12px; }
.p-choices .word[aria-checked='true'] { background: var(--enamel); border-color: var(--enamel); color: var(--paper); }
.fine { font-size: 13px; margin: 6px 0 8px; opacity: .82; }
.error { color: #a32317; font-weight: 600; margin: 4px 0 8px; }
#p-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.p-mode { display: flex; flex-direction: column; gap: 2px; padding: 9px 10px 7px; border: 1.5px solid var(--ink); border-radius: 7px; background: none; color: var(--ink); text-align: left; }
.p-mode b { font-size: 17px; font-weight: 800; }
.p-mode span { font-size: 12.5px; line-height: 1.3; }
.p-mode[aria-checked='true'] { background: var(--enamel); border-color: var(--enamel); color: var(--paper); }
#p-race-fields { display: grid; grid-template-columns: 1fr 220px; gap: 10px; }
#p-course-map { width: 220px; height: 150px; border-radius: 6px; }
#p-race-fields[hidden] { display: none; }
#p-code-box { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.code-show { font: 600 30px var(--mono); letter-spacing: .1em; color: var(--enamel); }
#p-join-form { margin-top: 8px; }
#p-join-form input { width: 130px; height: 38px; padding: 3px 8px 0; border: 1.5px solid var(--ink); border-radius: 6px; background: #fff; color: var(--ink); font: 600 15px var(--mono); }
#p-roster li { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: 14px; }
#p-roster span { flex: 1; font-size: 13px; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#p-roster button { padding: 2px 7px 0; border: 1px solid var(--stop); border-radius: 4px; background: none; color: var(--stop); font-size: 12px; font-weight: 800; }
#p-qr { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
#p-qr-canvas { width: 180px; height: 180px; border-radius: 6px; flex: none; }
#p-qr-url { font: 600 12.5px var(--mono); overflow-wrap: anywhere; }
#p-sound { margin-top: 10px; }

/* ---- Review desk ---- */
#desk { position: fixed; top: 0; right: 0; bottom: 0; z-index: 7; display: flex; flex-direction: column; width: min(980px, 100vw); background: var(--paper); color: var(--ink); box-shadow: -14px 0 40px rgba(0, 0, 0, .4); }
#desk-top { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px 0; background: var(--enamel); color: var(--paper); }
#desk-top [role='tablist'] { flex: 1; display: flex; gap: 2px; align-self: flex-end; }
#desk-top [role='tab'] { padding: 7px 14px 5px; border: 0; border-radius: 6px 6px 0 0; background: none; color: var(--paper); font-weight: 800; }
#desk-top [role='tab'][aria-selected='true'] { background: var(--paper); color: var(--enamel); }
#desk-call, #desk-close { margin-bottom: 6px; padding: 4px 10px 2px; border: 1px solid rgba(245, 244, 236, .6); border-radius: 5px; background: none; color: var(--paper); font-weight: 600; white-space: nowrap; }
#desk-city { flex: none; display: flex; align-items: center; gap: 8px; padding: 5px 12px 3px; background: var(--signal); font-weight: 800; font-size: 13.5px; }
#desk-city span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#desk-city button { padding: 3px 9px 1px; border: 1.5px solid var(--ink); border-radius: 5px; background: none; color: var(--ink); font-weight: 800; font-size: 13px; white-space: nowrap; }
#desk-body { flex: 1; min-height: 0; display: flex; }
#desk-tree { flex: none; display: flex; flex-direction: column; width: 250px; border-right: 1px solid rgba(20, 35, 63, .18); }
#desk-tree[hidden] { display: none; }
#desk-filter { flex: none; margin: 8px; height: 34px; padding: 2px 8px 0; border: 1.5px solid var(--ink); border-radius: 5px; background: #fff; color: var(--ink); font: 400 13.5px var(--mono); }
#desk-files { flex: 1; min-height: 0; overflow: auto; padding-bottom: 12px; }
#desk-files button { display: block; width: 100%; padding: 2px 8px 0; border: 0; background: none; color: var(--ink); text-align: left; font: 400 13px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#desk-files button:hover { background: #dfe5f2; }
#desk-files button.on { background: var(--enamel); color: var(--paper); }
#desk-files button.dir { font-weight: 600; }
.desk-none, .desk-hint { padding: 12px 14px; opacity: .78; }
#desk-main { flex: 1; min-width: 0; overflow: auto; outline: none; }
.desk-head { padding: 12px 14px 8px; }
.desk-head h3 { font-size: 19px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.desk-note { font-size: 13px; opacity: .8; margin: 3px 0; }
.desk-note:empty { display: none; }
.desk-actions { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.desk-actions button, .desk-actions a { padding: 3px 9px 1px; border: 1.5px solid var(--ink); border-radius: 5px; background: none; color: var(--ink); font-weight: 600; font-size: 13px; text-decoration: none; }
.desk-actions button.on { background: var(--ink); color: var(--paper); }
#desk-main > .desk-actions, .diffs, .talk { margin-left: 14px; margin-right: 14px; }
.crumbs { display: flex; gap: 6px; font-size: 13px; }
.crumbs button { padding: 0; border: 0; background: none; color: var(--enamel); font-weight: 800; }
.crumbs span::before { content: '/ '; opacity: .5; }
.desk-error { padding: 16px 14px; }
.desk-error p { color: #a32317; font-weight: 600; margin-bottom: 8px; overflow-wrap: anywhere; }
.desk-error button { padding: 5px 12px 3px; border: 1.5px solid var(--ink); border-radius: 5px; background: none; color: var(--ink); font-weight: 800; }
.rows { list-style: none; margin: 0; padding: 0 0 8px; }

.rows .row { display: grid; grid-template-columns: auto 1fr auto; column-gap: 8px; width: 100%; padding: 8px 14px 6px; border: 0; border-top: 1px solid rgba(20, 35, 63, .12); background: none; color: var(--ink); text-align: left; }
.rows .row:hover { background: #dfe5f2; }
.rows .row b { grid-column: 2; font-weight: 800; overflow-wrap: anywhere; }
.rows .row span { grid-column: 2; font-size: 12.5px; opacity: .78; }
.rows .row code { grid-column: 3; grid-row: 1 / span 2; font: 400 12.5px var(--mono); opacity: .8; }
.rows .row .state { grid-row: 1 / span 2; align-self: start; }
.state { display: inline-block; padding: 1px 6px 0; border-radius: 9px; background: #6a6f76; color: #fff; font-style: normal; font-size: 12px; font-weight: 800; text-transform: capitalize; }
.state.open, .state.approved { background: #1a7f48; }
.state.merged { background: #6b3fc0; }
.state.closed, .state.changes_requested { background: var(--stop); }
.state.draft { background: #6a6f76; }
.who { font-size: 13.5px; }
.who .state { margin-left: 6px; }
.prose { margin: 4px 0 0; font: 400 14px/1.45 var(--sans); white-space: pre-wrap; overflow-wrap: anywhere; }
#desk-main > .prose { margin: 0 14px 10px; }
.talk article { padding: 9px 0; border-top: 1px solid rgba(20, 35, 63, .14); }
.labels { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.labels span { --label: #888; padding: 1px 7px 0; border-radius: 9px; border: 1.5px solid var(--label); font-size: 12px; font-weight: 600; }
.pager { display: flex; gap: 6px; padding: 6px 14px 14px; }
.pager button { padding: 4px 11px 2px; border: 1.5px solid var(--ink); border-radius: 5px; background: none; color: var(--ink); font-weight: 800; }

.code { --code-bg: #0f1a30; background: var(--code-bg); color: #dfe6f3; font: 400 13px/1.55 var(--mono); overflow-x: auto; }
.code .line { position: relative; display: flex; min-width: min-content; content-visibility: auto; contain-intrinsic-size: auto 20px; }
.code .line:hover { background: rgba(245, 244, 236, .05); }
.code .line.menu-open { z-index: 4; content-visibility: visible; }
.code .ln { flex: none; width: 54px; padding: 0 9px 0 0; border: 0; background: none; color: #7f8ca6; text-align: right; font: inherit; user-select: none; }
.code button.ln { cursor: pointer; }
.code button.ln:hover { color: var(--signal); }
.code .ln.wide { width: 108px; }
.code code { flex: 1; padding-right: 16px; font: inherit; white-space: pre; tab-size: 4; }
.code .add { background: rgba(33, 196, 107, .17); }
.code .del { background: rgba(255, 74, 60, .17); }
.code .hunk { background: rgba(63, 155, 255, .15); color: #a9c7ee; }
.code .note { color: #a9b5ca; }
.code .gap { background: rgba(0, 0, 0, .25); }
.code .pair { display: grid; grid-template-columns: 1fr 1fr; min-width: min-content; }
.code .pair .line { min-width: 0; overflow: hidden; }
.diff-split code { white-space: pre-wrap; overflow-wrap: anywhere; }
.stamps { position: sticky; right: 6px; display: inline-flex; gap: 3px; padding-left: 6px; align-self: center; }
.stamps i, .stamp-menu button { --stamp: var(--signal); padding: 0 6px; border-radius: 8px; background: var(--stamp); color: var(--ink); font: 600 11.5px/1.5 var(--sans); font-style: normal; border: 0; }
.stamp-menu { position: absolute; z-index: 3; left: 58px; top: 100%; display: flex; gap: 3px; padding: 4px; border-radius: 6px; background: #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, .4); }
.diff { margin-bottom: 8px; border: 1px solid rgba(20, 35, 63, .22); border-radius: 6px; overflow: hidden; }
.diff summary { display: flex; align-items: center; gap: 7px; padding: 6px 9px 4px; cursor: pointer; background: #e9e8de; font-size: 13.5px; }
.diff summary b { flex: 1; min-width: 0; font: 600 13px var(--mono); overflow-wrap: anywhere; }
.diff summary .add { color: #157a43; font-weight: 800; }
.diff summary .del { color: #b02a1f; font-weight: 800; }
.diff > .desk-actions { margin: 5px 8px; }
.status { padding: 0 6px; border-radius: 8px; background: #6a6f76; color: #fff; font-style: normal; font-size: 11.5px; font-weight: 800; text-transform: capitalize; }
.status.added { background: #1a7f48; }
.status.removed { background: var(--stop); }
.status.modified, .status.changed { background: #a87a00; }
.status.renamed { background: #2f74c0; }
body.desk-open #hud #inspector, body.desk-open #play-hud #g-board { display: none; }
body.desk-open #minimap-box { display: none; }

/* highlight.js tokens, tuned for the dark code panel */
.hljs-comment, .hljs-quote { color: #8796b2; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-doctag { color: #7fb6ff; }
.hljs-string, .hljs-attr, .hljs-regexp, .hljs-template-variable { color: #9fe0a8; }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: #ffc266; }
.hljs-title, .hljs-section, .hljs-function .hljs-title, .hljs-title.function_, .hljs-title.class_ { color: #ffd76e; }
.hljs-type, .hljs-class .hljs-title, .hljs-params { color: #dfe6f3; }
.hljs-meta, .hljs-tag, .hljs-name { color: #d7a6ff; }
.hljs-attribute, .hljs-variable, .hljs-property { color: #8fd9e8; }
.hljs-deletion { color: #ff9d94; }
.hljs-addition { color: #9fe0a8; }

@media (max-width: 760px) {
  .you { grid-template-columns: 1fr; }
  #p-preview { justify-self: center; height: 200px; }
  #p-modes { grid-template-columns: 1fr; }
  #p-race-fields { grid-template-columns: 1fr; }
  #desk-tree { width: 150px; }
  #g-top { min-width: 0; grid-template-columns: auto auto; column-gap: 8px; padding: 5px 10px 3px; }
  #g-mode { display: none; }
  #g-timer { font-size: 21px; }
  #g-board { display: none; }
  #g-bottom { bottom: auto; top: 66px; left: var(--gut); transform: none; max-width: none; }
  #g-meter { display: none; }
  #g-item { min-width: 0; padding: 3px 7px 2px; font-size: 12px; }
  #g-item span:not(.none) { display: none; }
  #g-compass { top: 58px; font-size: 12px; }
  #g-feed { top: auto; bottom: 90px; }
  .buttons { grid-template-columns: repeat(3, 62px); }
  .buttons button { height: 54px; }
  .code .ln { width: 42px; }
}
@media (orientation: landscape) and (max-height: 480px) {
  #hud.playing #minimap-box { display: none; }
  #hud.playing #title { display: none; }
}

/* ---- City styles ---- */
.style-card { display: flex; flex-direction: column; gap: 2px; padding: 10px 11px 8px; border: 1.5px solid var(--ink); border-radius: 7px; background: none; color: var(--ink); text-align: left; }
.style-card b { font-size: 17px; font-weight: 800; }
.style-card span { font-size: 13px; line-height: 1.3; }
.style-card[aria-pressed='true'] { background: var(--enamel); border-color: var(--enamel); color: var(--paper); }
#style-note:empty { display: none; }
.style-pick { display: flex !important; align-items: center; gap: 8px; margin: 10px 0 0 !important; font-size: 14px; }
.style-pick select { height: 32px; padding: 2px 6px 0; border: 1.5px solid var(--ink); border-radius: 5px; background: #fff; color: var(--ink); font: 600 14px var(--sans); }

/* ---- Holograms ---- */
#holo-input { position: fixed; left: -9999px; top: 0; width: 10px; height: 10px; opacity: 0; }
#holo-bar { position: fixed; left: 50%; bottom: 58px; transform: translateX(-50%); z-index: 6; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; max-width: calc(100vw - 24px); padding: 7px 12px 5px; border-radius: 8px; background: var(--glass); border: 1px solid #58d6ff; }
#holo-title { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 14px var(--mono); }
#holo-hint { font-size: 13px; opacity: .85; }
#holo-bar button { padding: 3px 9px 1px; border: 1px solid var(--hairline); border-radius: 5px; background: var(--enamel-deep); color: var(--paper); font-weight: 600; font-size: 13px; white-space: nowrap; }
#holo-bar #holo-leave { background: var(--paper); color: var(--ink); font-weight: 800; }
#holo-follow[aria-pressed='true'] { border-color: #58d6ff; }
#hud.holo-focus > :not(#toast):not(#call) { display: none !important; }
body:has(#holo-bar:not([hidden])) #play-hud, body:has(#holo-bar:not([hidden])) #tags { display: none; }
.desk-mode { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.desk-mode select { height: 28px; padding: 1px 4px 0; border: 1px solid rgba(245, 244, 236, .6); border-radius: 5px; background: var(--enamel-deep); color: var(--paper); font: 600 13px var(--sans); }
#desk-mode-note { flex: none; padding: 5px 12px 3px; background: #1a5f86; color: var(--paper); font-weight: 600; font-size: 13.5px; }
#review-mode-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
@media (max-width: 760px) { #review-mode-list { grid-template-columns: 1fr; } .desk-mode { display: none; } }


/* ---- One bar for every mode ---- */
#modebar { position: fixed; z-index: 8; left: var(--gut); right: 232px; bottom: var(--gut); display: flex; align-items: center; gap: 8px; pointer-events: none; }
#modebar > * { pointer-events: auto; }
#mode-tabs { flex: none; display: flex; padding: 3px; border-radius: 8px; background: var(--enamel); box-shadow: inset 0 0 0 1.5px rgba(245, 244, 236, .8), 0 6px 16px rgba(0, 0, 0, .3); }
#mode-tabs button { height: 30px; padding: 3px 13px 0; border: 0; border-radius: 6px; background: none; color: var(--paper); font-weight: 800; font-size: 14.5px; }
#mode-tabs button:hover { background: var(--enamel-deep); }
#mode-tabs button[aria-selected='true'] { background: var(--paper); color: var(--enamel); }
.mode-tools { display: flex; align-items: center; gap: 4px; min-width: 0; }
.seg { display: flex; border: 1px solid var(--hairline); border-radius: 6px; overflow: hidden; background: var(--glass); }
.seg button { height: 32px; padding: 3px 10px 0; border: 0; background: none; color: var(--paper); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.seg button[aria-pressed='true'] { background: var(--paper); color: var(--enamel); }
.mode-tools > button, #btn-search, #btn-sound, #btn-share, #btn-more { height: 32px; padding: 3px 11px 0; border: 1px solid var(--hairline); border-radius: 6px; background: var(--glass); color: var(--paper); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.mode-tools > button:hover, #btn-search:hover, #btn-sound:hover, #btn-share:hover, #btn-more:hover { background: var(--enamel); }
#btn-play-count { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--paper); text-shadow: 0 1px 4px rgba(0, 0, 0, .8); white-space: nowrap; }
#btn-share { flex: none; }
#btn-more { flex: none; }
#more-menu { position: fixed; z-index: 8; right: 232px; bottom: 54px; left: auto; width: 270px; }
#more-menu button, #more-menu a { display: block; width: 100%; padding: 7px 9px 5px; border: 0; border-radius: 5px; background: none; color: inherit; text-align: left; text-decoration: none; }
#more-menu button:hover, #more-menu a:hover { background: #dfe5f2; }
#more-menu b { display: block; }
#tour-menu { z-index: 8; bottom: 54px; }
body.desk-open .mode-tools, body.desk-open #btn-play-count, body.desk-open #btn-search, body.desk-open #btn-sound, body.desk-open #btn-share, body.desk-open #btn-more { display: none; }
#share-url { flex: 1; min-width: 0; height: 40px; padding: 3px 9px 0; border: 1.5px solid var(--ink); border-radius: 6px; background: #fff; color: var(--ink); font: 400 13.5px var(--mono); }
@media (max-width: 980px) {
  #modebar { right: var(--gut); flex-wrap: wrap; }
  .mode-tools, #btn-play-count { display: none; }
  #more-menu { right: var(--gut); bottom: 58px; }
  #btn-share { margin-left: auto; }
  #minimap-box { bottom: 58px; }
  #ticker { bottom: 58px; right: 232px; }
}
@media (max-width: 760px) {
  #minimap-box { bottom: auto; }
  #ticker { display: none; }
  #mode-tabs button { padding: 3px 9px 0; font-size: 13.5px; }
  #btn-share { display: none; }
  #btn-more { margin-left: auto; }
  #g-bottom { top: 66px; bottom: auto; }
}

/* ---- Find ---- */
#search-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 7px 0 4px; }
#search-chips button { padding: 3px 9px 1px; border: 0; border-radius: 4px; background: transparent; color: var(--paper); font: inherit; font-size: 13px; font-weight: 600; }
#search-chips button[aria-pressed="true"] { background: var(--paper); color: var(--enamel); }
#search-results { list-style: none; margin: 0; padding: 0; max-height: min(52vh, 420px); overflow: auto; }
#search-results button { display: grid; grid-template-columns: 74px minmax(0, 1fr); column-gap: 8px; align-items: baseline; font-family: inherit; white-space: normal; }
#search-results button[aria-selected="true"] { background: var(--enamel); }
#search-results i { grid-row: span 2; font-style: normal; font-size: 12px; font-weight: 600; color: #f2d46b; }
#search-results b { font-family: var(--mono); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#search-results small { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-empty { padding: 8px 7px; font-size: 13px; }
#search-note { margin: 5px 3px 0; font-size: 12px; opacity: .78; }
body.finding #g-prompt { display: none; }

/* ---- Sound ---- */
#sound { position: fixed; z-index: 30; right: var(--gut); bottom: 58px; width: min(330px, calc(100vw - 32px)); max-height: calc(100vh - 80px); overflow: auto; padding: 12px 14px; color: var(--paper); }
#sound header { display: flex; justify-content: space-between; align-items: center; }
#sound h2 { margin: 0; font-size: 18px; }
#sound h3 { margin: 12px 0 2px; font-size: 13px; font-weight: 600; opacity: .8; }
#sound p { margin: 2px 0; }
#s-close { padding: 3px 9px 1px; border: 0; border-radius: 4px; background: var(--paper); color: var(--enamel); font: inherit; font-size: 13px; font-weight: 600; }
.s-row { display: flex; align-items: center; gap: 7px; margin: 8px 0 4px; font-size: 14px; }
.s-slider { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 8px; margin: 5px 0; font-size: 14px; }
.s-slider input { width: 100%; accent-color: #f2b705; }
#s-seed { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
#s-score { font-size: 13px; opacity: .85; }
#s-line { min-height: 1.4em; font-family: var(--mono); font-size: 12px; color: #9fe0a8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#s-file { width: 100%; height: 32px; margin-top: 6px; padding: 2px 8px 0; border: 0; border-radius: 4px; background: var(--paper); color: var(--ink); font-family: var(--mono); font-size: 14px; }
#s-results { list-style: none; margin: 3px 0 0; padding: 0; }
#s-results button { display: block; width: 100%; padding: 4px 6px 2px; border: 0; border-radius: 3px; background: none; color: var(--paper); text-align: left; font-family: var(--mono); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#s-results button:hover, #s-results button:focus-visible { background: var(--enamel); }
.s-none { font-size: 13px; padding: 3px 6px; }
.s-buttons { display: flex; gap: 6px; margin-top: 8px; }
.s-buttons button { flex: 1; height: 32px; border: 0; border-radius: 4px; background: var(--paper); color: var(--enamel); font: inherit; font-size: 13px; font-weight: 600; }

/* ---- Indoors ---- */
#inside { position: fixed; z-index: 6; top: calc(var(--gut) + 52px); left: 50%; transform: translateX(-50%); max-width: min(560px, calc(100vw - 340px)); padding: 7px 14px 5px; border-radius: 6px; background: rgba(12, 26, 54, .86); color: var(--paper); text-align: center; pointer-events: none; }
#inside p { margin: 0; }
#inside-file { font-family: var(--mono); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#inside-where { font-size: 13px; opacity: .85; }
#inside-line { position: fixed; z-index: 6; left: 50%; bottom: 112px; transform: translateX(-50%); max-width: min(760px, calc(100vw - 32px)); margin: 0; padding: 6px 12px 4px; border-radius: 5px; background: rgba(8, 12, 20, .84); color: #e8ecf4; font-family: var(--mono); font-size: 14px; white-space: pre; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
#floors-list { list-style: none; margin: 8px 0; padding: 0; max-height: 58vh; overflow: auto; }
#floors-list button { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; width: 100%; padding: 6px 8px 4px; border: 0; border-radius: 4px; background: none; color: inherit; font: inherit; text-align: left; }
#floors-list button:hover, #floors-list button:focus-visible { background: rgba(18, 61, 143, .14); }
#floors-list button[aria-current="true"] { font-weight: 800; }
#floors-list span { font-family: var(--mono); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  #inside { max-width: calc(100vw - 32px); top: 170px; }
  #btn-sound { display: none; }
}
#modebar button, .mode-tools { white-space: nowrap; flex: none; }
@media (max-width: 1240px) { #btn-play-count { display: none; } }

/* ---- City script editor ---- */
#script-editor { width: min(1180px, calc(100vw - 28px)); max-width: none; height: min(860px, 90vh); max-height: 90vh; overflow: hidden; padding: 16px 20px; }
#script-editor[open] { display: flex; flex-direction: column; gap: 10px; }
.se-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.se-bar label { display: grid; gap: 2px; font-size: 13px; font-weight: 800; }
.se-bar select { height: 34px; min-width: 132px; max-width: 190px; padding: 2px 6px 0; border: 1.5px solid var(--ink); border-radius: 6px; background: #fff; color: var(--ink); font: 600 14px var(--sans); }
.se-bar button { height: 34px; padding: 3px 12px 0; border: 1.5px solid var(--stop); border-radius: 6px; background: none; color: var(--stop); font-weight: 800; }
.se-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 32%); gap: 10px; }
.se-code { display: flex; min-width: 0; min-height: 0; border-radius: 6px; overflow: hidden; background: var(--enamel-deep); }
#se-gutter { flex: none; width: 46px; margin: 0; padding: 10px 0; overflow: hidden; background: rgba(245, 244, 236, .07); color: rgba(245, 244, 236, .56); font: 400 14px/20px var(--mono); text-align: right; user-select: none; }
#se-gutter span { display: block; padding: 0 8px 0 0; }
#se-gutter .error { background: var(--stop); color: #fff; font-weight: 600; }
#se-gutter .warning { background: var(--signal); color: var(--ink); font-weight: 600; }
#se-text { flex: 1; min-width: 0; padding: 10px 12px; border: 0; resize: none; overflow: auto; white-space: pre; background: none; color: var(--paper); font: 400 14px/20px var(--mono); tab-size: 2; caret-color: var(--signal); }
#se-text:focus-visible { outline: 3px solid var(--signal); outline-offset: -3px; }
#se-text::selection { background: rgba(242, 183, 5, .4); }
.se-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1.5px solid var(--ink); border-radius: 6px; }
.se-tabs { display: flex; flex: none; border-bottom: 1.5px solid var(--ink); }
.se-tabs button { flex: 1; padding: 7px 8px 5px; border: 0; background: none; color: var(--ink); font-weight: 800; }
.se-tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
#se-problems, #se-reference { flex: 1; min-height: 0; overflow: auto; padding: 8px; font-size: 13.5px; }
#se-problems li { margin-bottom: 6px; }
#se-problems li.clear { padding: 6px; font-weight: 600; color: var(--road-green); }
#se-problems button { display: grid; gap: 1px; width: 100%; padding: 6px 8px 5px; border: 0; border-left: 5px solid var(--signal); background: rgba(20, 35, 63, .06); color: var(--ink); text-align: left; overflow-wrap: anywhere; }
#se-problems .error button { border-left-color: var(--stop); }
#se-problems button:hover { background: rgba(20, 35, 63, .13); }
#se-reference details { margin-bottom: 6px; }
#se-reference summary { font-weight: 800; cursor: pointer; font-family: var(--mono); }
#se-reference p { margin: 4px 0; }
#se-reference dt { margin-top: 6px; font: 600 13px var(--mono); }
#se-reference dd small { display: block; opacity: .74; overflow-wrap: anywhere; }
.se-stats { font-size: 13px; }
#se-status { min-height: 1.45em; font-weight: 600; }
#se-keys { opacity: .74; }
#script-editor .se-actions button:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 760px) {
  #script-editor { height: 94vh; max-height: 94vh; padding: 12px; }
  .se-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1.3fr) minmax(0, 1fr); }
  .se-bar select { min-width: 0; max-width: 140px; }
}

/* ---- City setup ---- */
#styles { width: min(860px, calc(100vw - 28px)); max-width: none; }
.cs-tabs { display: flex; gap: 2px; margin: 10px 0 8px; border-bottom: 2px solid var(--ink); }
.cs-tabs button { padding: 8px 14px 5px; border: 0; border-radius: 6px 6px 0 0; background: none; color: var(--ink); font-weight: 800; }
.cs-tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.cs-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 8px 0; }
.cs-cards .style-card svg { width: 54px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 2px; }
.cs-swatch { display: flex; height: 26px; margin-bottom: 4px; border-radius: 4px; overflow: hidden; }
.cs-swatch i { flex: 1; }
.style-card[aria-pressed='true'] .cs-swatch { outline: 2px solid var(--paper); }
.cs-switch { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 17px; font-weight: 800; }
.cs-switch input { width: 20px; height: 20px; }
.cs-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 8px 0; }
.cs-fields .s-slider { display: grid; gap: 2px; font-weight: 600; }
.cs-fields input[type="range"] { width: 100%; }
.cs-foot { margin-top: 8px; }
.se-bar select { max-width: 164px; }
@media (max-width: 760px) { .cs-cards { grid-template-columns: 1fr 1fr; } .cs-fields { grid-template-columns: 1fr; } }

/* ---- Time machine ---- */
#timeline { position: fixed; z-index: 9; left: 50%; bottom: 70px; transform: translateX(-50%); width: min(760px, calc(100vw - 28px)); padding: 10px 12px 8px; }
.tl-top { display: flex; align-items: center; gap: 10px; }
.tl-top button { flex: none; min-width: 66px; padding: 7px 12px 5px; border: 1.5px solid var(--paper); border-radius: 6px; background: none; color: var(--paper); font-weight: 800; }
#tl-play { background: var(--signal); border-color: var(--signal); color: var(--ink); }
.tl-text { flex: 1; min-width: 0; line-height: 1.25; overflow: hidden; }
#tl-subject { white-space: nowrap; }
.tl-text b { font-weight: 800; color: var(--signal); }
.tl-text small { display: block; opacity: .82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tl-activity { display: block; width: 100%; height: 34px; margin-top: 6px; }
#tl-slider { display: block; width: 100%; margin: 0; accent-color: var(--signal); }
.i-link-list button { display: block; width: 100%; padding: 2px 0; border: 0; background: none; color: inherit; font: 400 13px var(--mono); text-align: left; text-decoration: underline; overflow-wrap: anywhere; cursor: pointer; }
#more-menu button:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 760px) { #timeline { bottom: 118px; } #tl-activity { height: 22px; } }
