:root {
  color-scheme: dark;
  --ink: #e9f0eb;
  --muted: #aebfc1;
  --paper: #1b2e35;
  --white: #233940;
  --line: #466069;
  --soft: #2c464e;
  --accent: #efba83;
  --positive: #a6deaa;
  --negative: #ffac95;
  --shadow: 0 8px 24px #09181a6e;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
button, select, input { font: inherit; }
button {
  min-height: 34px; color: inherit; cursor: pointer; border-radius: 8px; border: 1px solid transparent;
  background: transparent; padding: 5px 11px; white-space: nowrap;
}
button:hover { background: var(--soft); }
button:focus-visible, input:focus-visible, select:focus-visible, canvas:focus-visible { outline: 3px solid #c26743; outline-offset: 2px; }
button[aria-pressed="true"] { background: #e5ebdb; color: #22483a; border-color: #d1dac7; font-weight: 700; }
button:disabled { cursor: default; opacity: .45; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.topbar {
  flex: none; min-height: 62px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px;
  background: #234238; color: #fcf9e9; padding: 8px 20px; border-bottom: 1px solid #334f43;
}
.identity { display: flex; gap: 10px; align-items: center; font-size: 21px; font-weight: 800; letter-spacing: .05em; white-space: nowrap; }
.crest { width: 32px; height: 32px; display: flex; align-items: end; justify-content: center; gap: 2px; border-radius: 8px; background: #f0e4bd; padding-bottom: 7px; transform: rotate(-5deg); }
.crest i { width: 5px; height: 10px; background: #416249; border-radius: 1px 1px 0 0; }
.crest i:nth-child(2) { height: 16px; }
.crest i:nth-child(3) { height: 12px; }
.stats { display: flex; justify-content: center; gap: clamp(14px, 4vw, 54px); }
.stats > div { min-width: 57px; }
.stats span, .stats strong { display: block; }
.stats span { color: #d7e0c9; font-size: 11px; }
.stats strong { font-size: 19px; font-weight: 720; font-variant-numeric: tabular-nums; margin-top: 1px; }
.stats .negative { color: #ffb7a1; }
.top-actions { display: flex; gap: 6px; }
.top-actions button { border-color: #a6b9a44f; color: #fcf9e9; }
.top-actions button:hover { background: #ffffff19; }
#game { display: grid; grid-template-columns: minmax(0,1fr) 304px; flex: 1; min-height: 0; }
#game.map-only { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr); }
#game.map-only #panel { display: none; }
#map-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #b4c9a5; }
#map { display: block; width: 100%; height: 100%; touch-action: none; outline-offset: -4px; }
#map.building { cursor: crosshair; }
#map.pan-mode { cursor: grab; }
#map.panning { cursor: grabbing; }
.map-head { position: absolute; top: 18px; left: 19px; right: 18px; pointer-events: none; display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.map-name { background: #fffdf0f4; padding: 11px 15px 12px; border: 1px solid #ffffffa8; border-radius: 12px; min-width: 155px; box-shadow: var(--shadow); }
.map-name p, .map-name > span { color: var(--muted); font-size: 11px; }
.map-name h1 { margin: 2px 0 3px; font-size: 24px; line-height: 1.1; letter-spacing: .035em; }
.layers { pointer-events: auto; display: flex; flex-wrap: wrap; background: #fffdf3f7; gap: 2px; padding: 4px; border-radius: 10px; box-shadow: var(--shadow); }
.layers button { min-height: 30px; padding: 3px 8px; font-size: 12px; }
.map-tools { position: absolute; bottom: 16px; right: 17px; display: grid; gap: 3px; padding: 4px; background: #fffdf5f5; border: 1px solid #e5e8d9; border-radius: 10px; box-shadow: var(--shadow); }
.map-tools button { min-height: 28px; padding: 1px 5px; font-size: 12px; border-radius: 5px; }
.camera-presets, .camera-step, .camera-extra { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; align-items: center; }
.camera-presets { background: #e9eee2; padding: 1px; border-radius: 6px; }
.camera-presets button:hover { background: #f9fbf5; }
.camera-presets button[aria-pressed="true"] { background: #fffdf7; border-color: #d6dfcf; }
.camera-step { grid-template-columns: 29px 51px 29px; justify-content: center; text-align: center; }
.camera-step > button:not(#map-direction) { font-size: 18px; line-height: 1; }
.camera-step output { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.camera-extra { grid-template-columns: 1fr 1.4fr; border-top: 1px solid #e0e6d7; padding-top: 2px; }
.map-tools, .navigator, .legend, .coordinates { translate: 0 calc(0px - var(--plan-inset, 0px)); }
#map-direction span { display: inline-block; color: #a65236; transform: rotate(45deg); font-weight: 800; }
#map-direction[data-orientation="1"] span { transform: rotate(-45deg); }
#map-direction[data-orientation="2"] span { transform: rotate(-135deg); }
#map-direction[data-orientation="3"] span { transform: rotate(135deg); }
.navigator { position: absolute; left: 18px; bottom: 15px; display: grid; padding: 4px; width: 127px; border: 1px solid #e5e8d9; border-radius: 10px; background: #fffdf5f5; box-shadow: var(--shadow); }
#minimap-toggle { min-height: 24px; font-size: 11px; padding: 0 5px; text-align: left; font-weight: 700; }
#minimap-toggle span { float: right; }
#minimap-body { display: grid; gap: 3px; }
#minimap { width: 100%; height: auto; border-radius: 5px; touch-action: none; cursor: crosshair; }
.navigator-note { color: var(--muted); text-align: center; font-size: 10px; }
.legend, .coordinates, .draft-hint { position: absolute; left: 151px; bottom: 16px; background: #fffdf1ed; border-radius: 6px; padding: 5px 8px; font-size: 11px; pointer-events: none; }
.coordinates { left: auto; right: 143px; bottom: 14px; padding: 4px 7px; }
.draft-hint { left: 50%; transform: translateX(-50%); bottom: 50px; background: #203d36f2; color: #fffdf5; box-shadow: var(--shadow); max-width: 60%; text-align: center; }
.draft-hint.invalid { background: #763c30f5; }
.coordinates:empty { display: none; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 3px; }
.legend span + span { margin-left: 10px; }
.notice {
  position: absolute; bottom: 44px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 110px);
  padding: 10px 14px; color: var(--white); background: #223d35f2; border-radius: 8px; box-shadow: var(--shadow);
  font-size: 13px; pointer-events: none;
}
#panel { background: var(--paper); display: flex; flex-direction: column; min-height: 0; border-left: 1px solid #a2ac96; }
.panel-tabs { display: flex; gap: 3px; padding: 12px 11px 9px; border-bottom: 1px solid var(--line); flex: none; }
.panel-tabs button { flex: 1; padding: 4px; min-height: 33px; font-size: 13px; }
#panel-content { padding: 15px 16px 20px; overflow-y: auto; overscroll-behavior: contain; }
#panel-content h2 { margin-bottom: 6px; font-size: 21px; }
#panel-content h3 { margin: 17px 0 8px; font-size: 13px; }
#panel-content p, #dialog-content p { color: var(--muted); line-height: 1.6; }
.panel-label { font-size: 11px; font-weight: 700; color: var(--accent) !important; margin-bottom: 5px; }
.card { margin-top: 12px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 11px; }
.card strong { display: block; }
.card p { font-size: 12px; margin-top: 4px; }
.card button { margin-top: 8px; }
.card button + button { margin-left: 4px; }
.card.active { border-color: #d0a17b; background: #fff7e5; }
.card.complete { background: #eef3e6; }
#city-career { margin-top: 16px; }
#city-career h3 > span { float: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.milestone { margin-top: 8px; }
.milestone small, .milestone-trail { font-size: 11px; color: var(--muted); }
.milestone-trail { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; padding: 0; margin: 7px 0; }
.milestone-trail li { padding: 3px 5px; border: 1px solid #e0e6d7; border-radius: 4px; }
.milestone-trail li[data-state="claimed"] { background: #e2eddc; color: #24583d; }
.milestone-trail li[data-state="claimed"]::before { content: "✓ "; }
.milestone-trail li:is([data-state="active"], [data-state="ready"]) { background: #fbf0da; color: #81522e; }
#panel-content .next-step { color: var(--positive); }
.delta { display: block; font-size: 11px; }
.lot-preview {
  display: grid; grid-template-columns: minmax(0,1.45fr) minmax(0,1fr); align-items: center;
  gap: 7px; margin: 10px 0 12px; padding: 4px 10px 4px 2px;
  border: 1px solid #d4ded4; border-radius: 10px;
  background: radial-gradient(ellipse at 25% 35%, #f6f8eb, #e2ebe0 82%);
}
.lot-preview canvas { display: block; width: 100%; height: auto; }
.lot-preview figcaption strong, .lot-preview figcaption span { display: block; }
.lot-preview figcaption strong { font-size: 13px; line-height: 1.4; }
.lot-preview figcaption span { color: var(--muted); font-size: 11px; margin-top: 3px; }
.edition { margin-top: 14px; font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; }
.action { background: #e8ede0; border: 1px solid #d1dbca; min-height: 32px; padding-inline: 9px; }
.action:hover { background: #dbe6d5; }
.primary { background: #315e48; border-color: #315e48; color: #fffdf4; font-weight: 700; }
.primary:hover { background: #244f3a; }
.readouts { display: grid; gap: 0; margin: 8px 0; }
.readouts > div { display: flex; justify-content: space-between; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.readouts dt { color: var(--muted); font-size: 12px; }
.readouts dd { margin: 0; font-weight: 650; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.good { color: var(--positive); }
.negative { color: var(--negative); }
.demand-row { display: grid; grid-template-columns: 31px 1fr 35px; align-items: center; gap: 7px; margin: 7px 0; font-size: 11px; }
.demand-track { height: 6px; background: #e2e5d9; border-radius: 8px; overflow: hidden; }
.demand-track i { display: block; height: 100%; background: #5a926a; }
.demand-row[data-zone="shop"] i { background: #5288aa; }
.demand-row[data-zone="work"] i { background: #c58c4d; }
.panel-control { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; font-size: 12px; }
.panel-control select, .panel-control input { max-width: 114px; border: 1px solid #cdd6c7; border-radius: 5px; background: var(--white); color: var(--ink); padding: 5px; }
#construction { position: relative; flex: none; background: var(--white); border-top: 1px solid #b4beaa; z-index: 2; box-shadow: 0 -4px 24px #17332615; }
.bottom-bar { min-height: 60px; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 16px max(5px,env(safe-area-inset-bottom)); }
.build-tools { display: flex; gap: 5px; }
.build-tools button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 41px; padding: 5px 12px; }
.tool-symbol { display: grid; place-items: center; width: 22px; height: 22px; font-size: 19px; color: #466b55; }
.tool-symbol.road { color: #536166; transform: rotate(-27deg); }
.tool-symbol.zoning { color: #4b8b64; }
.tool-symbol.service { color: #9b6848; font-size: 16px; }
.tool-symbol.bus { color: #527e93; }
.tool-symbol.land { color: #806b45; }
.history-controls { display: flex; gap: 2px; margin-right: auto; margin-left: 2px; padding-left: 8px; border-left: 1px solid var(--line); }
.history-controls button { min-width: 32px; padding: 2px 6px; font-size: 18px; line-height: 1; }
.clock-controls { display: flex; align-items: center; gap: 4px; }
.clock-controls > span { font-size: 12px; white-space: nowrap; padding-right: 8px; }
.clock-controls button { min-width: 30px; min-height: 32px; padding-inline: 5px; }
.tool-options { min-height: 42px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 5px; padding: 5px 18px; background: #f7f8ef; align-items: center; }
.tool-options button { font-size: 12px; min-height: 30px; }
.tool-options p { color: var(--muted); font-size: 11px; padding-left: 6px; line-height: 1.4; }
.plan-bar { position: absolute; inset: auto 0 100%; min-height: 56px; border-top: 1px solid #d6c5a0; padding: 7px 16px; background: #f6ecce; display: flex; gap: 6px; align-items: center; }
.plan-bar > div { flex: 1; min-width: 0; }
.plan-bar p { font-size: 12px; margin-top: 3px; color: #594e3d; }
#plan-cancel { border-color: #d6c5a0; }
dialog {
  padding: 0; border: 1px solid #cad1bf; color: var(--ink); background: var(--paper);
  box-shadow: 0 20px 65px #1a342a55; border-radius: 14px; width: min(535px,calc(100% - 26px)); max-height: min(740px,86dvh);
}
dialog::backdrop { background: #152b2580; }
dialog > header { display: flex; justify-content: space-between; align-items: center; padding: 14px 15px 11px 20px; border-bottom: 1px solid var(--line); }
dialog > header h2 { font-size: 21px; }
dialog > header button { font-size: 22px; line-height: 1; }
#dialog-content { padding: 16px 20px 20px; }
#dialog-content .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
#dialog-content .first-project-actions button { flex: 1; min-width: max-content; min-height: 44px; }
#dialog-content .card { margin-top: 10px; }
#dialog-content table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13px; }
#dialog-content td, #dialog-content th { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--line); }
#dialog-content .help-list { padding-left: 18px; line-height: 1.65; }
#dialog-content li + li { margin-top: 6px; }
@media (max-width: 850px) {
  #game { grid-template-columns: minmax(0,1fr) 245px; }
  .topbar { padding-inline: 10px; gap: 10px; }
  .stats { gap: 10px; }
  .stats strong { font-size: 15px; }
  .identity { font-size: 16px; }
  .map-head { left: 10px; top: 10px; right: 10px; }
  .build-tools button { padding-inline: 7px; }
}
@media (max-width: 620px) {
  .topbar { grid-template-columns: auto 1fr; min-height: 79px; gap: 3px 8px; padding: 5px 8px; }
  .identity { font-size: 16px; }
  .crest { width: 25px; height: 25px; padding-bottom: 4px; }
  .top-actions { justify-self: end; }
  .top-actions button { min-height: 28px; padding-inline: 7px; font-size: 12px; }
  .stats { grid-row: 2; grid-column: 1/-1; justify-content: space-between; padding-inline: 3px; }
  .stats strong { font-size: 14px; }
  #game { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(94px, 27%); }
  #panel { border-left: 0; border-top: 1px solid var(--line); }
  .panel-tabs { padding: 3px 7px; }
  .panel-tabs button { min-height: 25px; padding: 2px; }
  #panel-content { padding: 8px 11px; }
  #panel-content h2 { font-size: 16px; }
  .map-name { min-width: 0; padding: 5px 8px; }
  .map-name h1 { font-size: 16px; }
  .map-name p, .map-name > span { display: none; }
  .layers { gap: 0; padding: 2px; }
  .layers button { font-size: 11px; padding-inline: 4px; min-height: 24px; }
  .map-tools { right: 6px; bottom: 6px; gap: 2px; }
  .map-tools button { min-height: 28px; font-size: 11px; }
  .camera-step { grid-template-columns: 25px 41px 25px; }
  .navigator { left: 6px; bottom: 6px; width: 100px; }
  .navigator:has(#minimap-body[hidden]) { width: 65px; }
  .legend { left: 9px; bottom: 42px; }
  .navigator:has(#minimap-body:not([hidden])) + .legend { left: 111px; bottom: 6px; max-width: calc(100% - 225px); }
  .draft-hint { bottom: 37px; }
  .coordinates { display: none; }
  .bottom-bar { flex-wrap: wrap; padding: 3px 6px; gap: 3px; }
  .build-tools { width: 100%; justify-content: space-between; gap: 2px; }
  .build-tools button { flex: 1; min-height: 32px; gap: 3px; font-size: 11px; padding: 1px; }
  .tool-symbol { width: 15px; height: 16px; font-size: 14px; }
  .clock-controls { margin-left: auto; }
  .clock-controls button { min-height: 25px; }
  .history-controls { margin-left: 3px; padding-left: 0; border-left: 0; }
  .history-controls button { min-height: 25px; min-width: 30px; }
  .tool-options { padding: 3px 6px; gap: 2px; min-height: 31px; }
  .tool-options p { flex-basis: 100%; }
  .tool-options button { min-height: 25px; padding: 2px 5px; }
  .plan-bar { flex-wrap: wrap; justify-content: end; padding: 4px 6px; }
  .plan-bar > div { flex-basis: 100%; }
  .plan-bar button { min-height: 29px; padding-inline: 6px; }
}

/* The world stays edge to edge. Management and construction are overlays. */
body { background: #14252b; -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.topbar { min-height: 48px; padding: 4px 14px; gap: 12px; background: #13252c; border-color: #52747a; }
.identity { font-size: 16px; gap: 8px; letter-spacing: .02em; }
.crest { width: 26px; height: 26px; padding-bottom: 5px; border-radius: 6px; background: #b7ded0; transform: none; }
.crest i { background: #315b58; }
.stats { gap: clamp(18px,4vw,64px); }
.stats span { color: #9fbcc1; }
.stats strong { font-size: 17px; }
.top-actions button { min-height: 30px; color: var(--ink); border-color: #67858a76; }
#panel-toggle[aria-expanded="true"] { background: #29444e; border-color: #5c8086; }
button[aria-pressed="true"] { color: #eefeff; background: #305461; border-color: #7ac0c6; }
button:focus-visible, select:focus-visible { outline-color: #a2e7f3; }
#game { position: relative; display: block; overflow: hidden; isolation: isolate; }
#map-wrap { position: absolute; inset: 0; }
#map { background: #517c80; }
#panel {
  position: absolute; z-index: 2; width: min(319px, 34vw); max-height: calc(100% - 124px);
  top: 51px; right: 12px; border: 1px solid #8caaae7a; border-radius: 11px;
  background: #182a31f7; box-shadow: 0 10px 27px #0716195c; overflow: hidden;
}
.panel-tabs { background: #233a43; padding: 5px; gap: 2px; }
.panel-tabs button { min-height: 31px; padding: 4px 2px; }
#panel-content { padding: 11px 13px 15px; scrollbar-color: #577078 #1b2e35; }
#panel-content h2 { font-size: 19px; letter-spacing: .015em; }
#panel-content h3 { margin-top: 14px; color: #dce6e4; }
.card { background: #243a41; border-color: #4a6569; margin-top: 9px; border-radius: 7px; }
.card.active { background: #383934; border-color: #a98a65; }
.card.complete { background: #254541; border-color: #507f74; }
.action { color: var(--ink); background: #324a52; border-color: #516f79; }
.action:hover { background: #3b626e; }
.primary { background: #bde3d2; border-color: #bde3d2; color: #172d2f; }
.primary:hover { background: #d3f2e4; }
.readouts > div { border-color: #496269; }
.panel-control select, .panel-control input, #density-select, #service-layer {
  color: var(--ink); background: #263e46; border: 1px solid #6d8a90; border-radius: 5px; padding: 4px 6px;
}
.map-head { inset: 10px 12px auto 12px; align-items: center; }
.map-name, .layers, .map-tools, .navigator, .legend, .coordinates {
  background: #182c34f2; color: var(--ink); border: 1px solid #91adae7a; box-shadow: var(--shadow);
}
.map-name { min-width: 105px; padding: 5px 9px; border-radius: 7px; }
.map-name h1 { font-size: 16px; margin: 0; }
.map-name > span { font-size: 10px; color: #b8d1d1; }
#first-project {
  position: absolute;
  top: 66px;
  left: 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 7px;
  box-shadow: var(--shadow);
}
#game:not(.map-only) #first-project { display: none; }
.layers { border-radius: 7px; gap: 2px; padding: 3px; }
.layers button { min-height: 27px; }
#service-layer { align-self: center; min-height: 26px; max-width: 115px; font-size: 12px; }
.camera-presets { background: #203c45; }
.camera-presets button:hover, .camera-presets button[aria-pressed="true"] { background: #365661; border-color: #73979d; }
.camera-extra { border-color: #4b6670; }
#map-direction span { color: #ffc587; }
.map-tools { right: 12px; bottom: 12px; }
.navigator { left: 12px; bottom: 12px; width: 119px; }
.navigator:has(#minimap-body[hidden]) { width: 77px; }
.legend { left: 140px; }
.notice { background: #15282eef; border: 1px solid #74989a; color: #f4fcf9; }
.lot-preview { background: radial-gradient(ellipse at 25% 35%, #4f6b6a, #2a4147 82%); border-color: #57747a; }
.milestone-trail li { border-color: #526970; }
.milestone-trail li[data-state="claimed"] { color: #c1ebce; background: #34554a; }
.milestone-trail li:is([data-state="active"],[data-state="ready"]) { color: #ffe0a9; background: #5a5142; }
.demand-track { background: #3b545b; }
#construction { background: #142830; border-color: #648187; box-shadow: 0 -6px 18px #0a1e2761; }
.bottom-bar { min-height: 52px; gap: 8px; padding-inline: 12px; }
.build-tools { gap: 3px; }
.build-tools button { min-height: 38px; padding-inline: 11px; border-color: #57757a4d; background: #233a43; }
.build-tools button[aria-pressed="true"] { background: #365d68; border-color: #88bdc5; }
.tool-symbol { color: #a5d6dd; }
.tool-symbol.road { color: #bbced1; }
.tool-symbol.zoning { color: #9bdbb8; }
.tool-symbol.service { color: #f6c09c; }
.tool-symbol.bus { color: #a4d4e2; }
.tool-symbol.land { color: #e6c791; }
.tool-options { position: absolute; bottom: 100%; left: 11px; right: 11px; z-index: 2; border: 1px solid #6d9099; border-radius: 8px 8px 0 0; background: #1d343deF; padding: 4px 8px; box-shadow: var(--shadow); }
.tool-options p { font-size: 12px; }
.tool-options .panel-control { margin: 0 4px; }
.plan-bar { bottom: calc(100% + var(--tools-height, 0px)); left: 11px; right: 11px; border: 1px solid #9c9d7d; border-radius: 8px; background: #293c3def; box-shadow: var(--shadow); }
.plan-bar p { color: #ccdad5; }
#plan-cancel { border-color: #687d80; }
dialog { color: var(--ink); background: #1b3038; border-color: #718d96; }
dialog::backdrop { background: #0b1a247f; }
.comparison-routes { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
.metric-strip { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; margin: 9px 0; }
.metric-strip > div { display: grid; gap: 3px; text-align: center; padding: 6px 2px; border-radius: 5px; background: #2c444a; }
.metric-strip strong { font-size: 15px; }
.metric-strip span { color: var(--muted); font-size: 10px; }
.route-name::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; background: #88cdd6; }
.route-name.metro::before { background: #d6b4ff; }
.next-month-active { color: #bce8da; background: #305461; }
@media (min-width: 900px) {
  #panel { width: 315px; }
  .map-tools { right: 339px; }
  #game.map-only .map-tools { right: 12px; }
  .coordinates { right: 472px; }
  #game.map-only .coordinates { right: 145px; }
}
@media (min-width: 701px) and (max-width: 899px) {
  .map-tools { right: calc(34vw + 24px); }
  #game.map-only .map-tools { right: 12px; }
}
.service-budget { border-bottom: 1px solid #486069; padding-bottom: 6px; }
.service-budget .panel-control { margin: 6px 0 2px; }
.service-budget small { color: var(--muted); font-variant-numeric: tabular-nums; }
.fiscal-bars { position: relative; display: flex; gap: 4px; height: 62px; padding: 0 4px; background: #172c33; border-radius: 5px; }
.fiscal-bars::before { position: absolute; content: ""; inset: 50% 0 auto; border-top: 1px solid #638184; }
.fiscal-bars span { position: relative; flex: 1; }
.fiscal-bars i { position: absolute; inset-inline: 2px; height: max(1px,var(--value)); border-radius: 2px; }
.fiscal-bars .gain i { bottom: 50%; background: #9bceae; }
.fiscal-bars .loss i { top: 50%; background: #dc9b80; }
@media (max-width: 700px) {
  .topbar { grid-template-columns: auto 1fr; min-height: 65px; gap: 2px 8px; padding: 4px 8px; }
  .stats { grid-row: 2; grid-column: 1/-1; justify-content: space-between; gap: 3px; }
  .stats strong { font-size: 13px; }
  .top-actions { justify-self: end; }
  .top-actions button { min-height: 26px; font-size: 11px; }
  #panel { top: auto; bottom: 6px; left: 7px; right: 7px; width: auto; max-height: min(35%, 252px); }
  .panel-tabs { padding: 2px 4px; }
  .panel-tabs button { min-height: 24px; font-size: 11px; }
  #panel-content { padding: 6px 10px 8px; }
  #panel-content h2 { font-size: 16px; }
  .map-tools, .navigator, .legend { bottom: calc(min(35%, 252px) + 10px); }
  #game.map-only :is(.map-tools,.navigator,.legend) { bottom: 6px; }
  .map-head { inset: 6px 7px auto; gap: 4px; }
  .map-name { min-width: 0; padding: 4px 5px; }
  .map-name h1 { font-size: 13px; }
  .map-name > span { display: none; }
  #first-project { top: 44px; left: 7px; }
  .layers { gap: 0; padding: 2px; }
  .layers button { font-size: 10px; min-height: 24px; padding: 1px 3px; }
  #service-layer { min-height: 23px; font-size: 10px; max-width: 77px; }
  .navigator { left: 7px; width: 93px; }
  .map-tools { right: 7px; }
  .bottom-bar { gap: 2px; padding-inline: 6px; flex-wrap: wrap; }
  .build-tools { width: 100%; }
  .build-tools button { flex: 1; min-height: 31px; padding-inline: 2px; }
  .tool-options, .plan-bar { left: 5px; right: 5px; }
}
@media (max-height: 490px) {
  #panel { max-height: calc(100% - 68px); }
  .map-tools { gap: 1px; }
  .map-tools button { min-height: 23px; }
}
#map-3d { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; outline-offset: -3px; }
#map-3d:active { cursor: grabbing; }
.map-tools #camera-3d { border-color: #608a92; font-weight: 700; background: #27444b; }
.map-tools #camera-3d[aria-pressed="true"] { background: #4e827c; border-color: #a8dbcf; }
.free-camera :is(.camera-presets,.camera-step,.camera-extra,.navigator) { display: none; }
.lane-editor { display: grid; gap: 9px; margin-block: 10px; }
.lane-editor fieldset { margin: 0; padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; min-width: 0; }
.lane-editor legend { color: var(--muted); padding-inline: 4px; }
.lane-editor label { display: flex; justify-content: space-between; gap: 4px; align-items: center; margin-block: 3px; }
.lane-editor select { color: var(--ink); background: #263e46; border: 1px solid #6d8a90; border-radius: 5px; padding: 3px; }
.cargo-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 11px; }
.cargo-table th, .cargo-table td { border-bottom: 1px solid var(--line); text-align: right; padding: 5px 2px; }
.cargo-table th:first-child { text-align: left; }
@media (max-width: 700px) {
  .build-tools button { font-size: 10px; gap: 2px; }
  .build-tools .tool-symbol { width: 13px; }
}
#entry-screen {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 22px;
  background:
    radial-gradient(ellipse at 25% 25%, #42646db0, transparent 55%),
    linear-gradient(145deg, #192e35, #132329);
}
.entry-card {
  width: min(100%, 440px);
  display: grid;
  gap: 18px;
  padding: clamp(20px, 4vw, 38px);
  border: 1px solid #7a9d9b;
  border-radius: 13px;
  background: #20363e;
  color: #ecf8f3;
  box-shadow: 0 16px 50px #0005;
}
.entry-card h1 { font-size: clamp(25px, 5vw, 37px); line-height: 1.3; }
#entry-status { min-height: 3em; color: #c1d9d7; line-height: 1.55; }
#entry-progress { width: 100%; height: 12px; accent-color: #a6ddd3; }
.entry-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.entry-actions button { min-height: 44px; }
.entry-actions a { color: #c1d9d7; padding: 8px 0; }

#panel.panel-moved { inset: var(--panel-y) auto auto var(--panel-x); }
.panel-toolbar {
  display: flex;
  flex: none;
  align-items: center;
  gap: 5px;
  padding: 3px 5px;
  background: #24414b;
  color: #d9f0ec;
  border-bottom: 1px solid #628087;
}
.panel-toolbar button { min-height: 27px; padding: 3px 6px; font-size: 11px; }
.panel-toolbar [data-panel-grip] {
  flex: 1;
  text-align: start;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.panel-toolbar [data-panel-grip]:active { cursor: grabbing; }
.panel-toolbar [data-panel-reset]:disabled { opacity: .5; cursor: default; }
@media (pointer: coarse) { .panel-toolbar button { min-height: 36px; } }

/* Coastal planning palette. The controls stay visually separate from the map. */
:root {
  --paper: #172c40;
  --white: #233e52;
  --soft: #2b4960;
  --line: #537282;
  --ink: #fff5e8;
  --muted: #bed0d5;
  --accent: #ffce99;
  --shadow: 0 8px 24px #0b213059;
}
body { background: #142c40; }
.topbar {
  background: linear-gradient(110deg,#152c43,#1f3b4b 65%,#172e45);
  border-color: #547785;
}
.identity { font-weight: 760; }
.crest { background: #ffdaa6; }
.crest i { background: #204b56; }
.stats span { color: #bfd4db; }
.stats strong { color: #fff7e7; }
.stats strong.negative { color: #ffb7a1; }
#map { background: #173748; }
.map-name, .layers, .map-tools, .navigator, .legend, .coordinates, #panel {
  background: #182e43f5;
  border-color: #9dc2cb87;
}
.map-name { border-left: 3px solid #ffc899; }
.map-name h1 { font-weight: 760; letter-spacing: .07em; }
.map-name > span, .navigator-note { color: #bdd8db; }
#panel .panel-tabs, .panel-toolbar { background: #21394e; }
.card { background: #243f51; border-color: #537887; }
.card.active { background: #3a3c42; border-color: #b98766; }
.card.complete { background: #254849; }
.action { background: #2c495d; border-color: #607b8a; }
.action:hover { background: #3b586c; }
.primary { color: #242e3e; background: #ffcf96; border-color: #ffcf96; }
.primary:hover { background: #ffe0af; }
#first-project { gap: 12px; border-radius: 9px; }
button[aria-pressed="true"], .camera-presets button[aria-pressed="true"] {
  color: #fffaef; background: #305972; border-color: #91c3cc;
}
#construction { background: #182e44; border-color: #628798; }
.build-tools button { background: #233b52; border-color: #7596a663; }
.build-tools button[aria-pressed="true"] { background: #335870; border-color: #9ecbd2; }
#dialog-content .metric-strip > div { background: #2c4a5b; }
#entry-screen { background: radial-gradient(ellipse at 25% 30%, #30515d, #12273c 75%); }
.entry-scene {
  width: min(100%, 1070px); min-height: 390px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(304px, 1fr);
  overflow: hidden; border: 1px solid #99b7bc75; border-radius: 22px; box-shadow: 0 24px 80px #0617358f;
}
.entry-art { display: block; width: 100%; height: 100%; min-height: 0; object-fit: cover; object-position: 50% 52%; }
.entry-card {
  min-width: 0; width: 100%; min-height: 100%; align-content: center; gap: 15px;
  border: 0; border-radius: 0; background: linear-gradient(155deg,#203e53,#152d45 80%); box-shadow: none;
}
.entry-card h1 { font-size: clamp(32px, 4.3vw, 60px); line-height: 1.13; font-weight: 780; letter-spacing: .04em; }
.entry-intro { color: #ffd9a5; font-size: 15px; letter-spacing: .04em; }
#entry-status { min-height: 2.8em; color: #d6e2e2; }
#entry-progress { accent-color: #f9c389; }
.entry-actions a { color: #e0e9ea; text-underline-offset: .24em; }
@media (max-width: 740px) {
  #entry-screen { padding: 14px; }
  .entry-scene { max-width: 500px; min-height: 0; grid-template-columns: 1fr; }
  .entry-art { height: min(34dvh, 256px); }
  .entry-card { gap: 10px; padding: 20px; }
}
@media (min-width: 741px) and (max-height: 500px) {
  #entry-screen { padding: 12px; }
  .entry-scene { min-height: min(365px, calc(100dvh - 24px)); }
  .entry-card { padding: 18px; gap: 9px; }
}

/* Phones: controls stay compact but become finger-sized and readable (was 24–28px tall with 10–11px text). */
@media (max-width: 700px) {
  .top-actions button { min-height: 36px; min-width: 36px; font-size: 12px; }
  .stats span, .stats small { font-size: 12px; }
  .layers button { min-height: 34px; font-size: 12px; padding: 2px 5px; }
  #service-layer { min-height: 34px; font-size: 12px; max-width: 92px; }
  .map-tools button { min-height: 36px; min-width: 36px; font-size: 12px; }
  .panel-tabs button { min-height: 34px; font-size: 12px; }
  .panel-toolbar button { min-height: 36px; font-size: 12px; }
  .build-tools button { min-height: 40px; font-size: 12px; }
  .bottom-bar button { min-height: 36px; min-width: 36px; }
  .navigator button { min-height: 36px; font-size: 12px; }
}
@media (max-width: 360px) {
  .layers button { padding: 2px 3px; }
  #service-layer { max-width: 78px; }
  .bottom-bar button { min-width: 0; }
}
