/* Deep Cut: page shell and HUD. Industrial quarry look: charcoal steel, safety yellow, hi-vis accents. */

@font-face { font-family: "Big Shoulders"; src: url("../fonts/big-shoulders-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Big Shoulders"; src: url("../fonts/big-shoulders-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --coal: #16181a;
  --steel: #1f2225;
  --steel-2: #282c30;
  --steel-3: #353a3f;
  --line: #3d4348;
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f1eee6;
  --muted: #a8aaa4;
  --dim: #7d807b;
  --yellow: #f6c419;
  --yellow-hi: #ffd84a;
  --yellow-ink: #1a1500;
  --orange: #ff7a1a;
  --good: #63d471;
  --warn: #ffb020;
  --bad: #ff5644;
  --info: #7cc4f0;
  --panel: rgba(25, 28, 31, 0.94);
  --panel-solid: #1c1f22;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.35);
  --radius: 10px;
  --head: "Big Shoulders", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hazard: repeating-linear-gradient(-45deg, var(--yellow) 0 9px, #17181a 9px 18px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0f1112; color: var(--text); font-family: var(--body); font-size: 14px; line-height: 1.4; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#ui > *, #hud > * { pointer-events: auto; }
#hud { position: absolute; inset: 0; pointer-events: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.ico { width: 18px; height: 18px; flex: none; vertical-align: -4px; }
kbd { font-family: var(--body); font-size: 10.5px; font-weight: 700; line-height: 1; padding: 2px 4px; min-width: 16px; text-align: center; border-radius: 3px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.16); border-bottom-width: 2px; color: var(--muted); display: inline-block; }
small { font-size: 12px; }
.num { font-family: var(--head); font-weight: 800; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.pos, .tone-good { color: var(--good); }
.neg, .tone-bad { color: var(--bad); }
.warn, .tone-warn { color: var(--warn); }
.tone-info { color: var(--info); }
.muted { color: var(--muted); }
h1, h2, h3, h4, h5 { font-family: var(--head); font-weight: 800; letter-spacing: 0.03em; margin: 0; text-transform: uppercase; }
h4 { font-size: 16px; margin: 14px 0 8px; color: var(--yellow); }
h4 small { text-transform: none; font-family: var(--body); font-weight: 400; letter-spacing: 0; }
p { margin: 0 0 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.nowrap { white-space: nowrap; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; padding: 6px 12px; border-radius: 7px;
  background: var(--steel-3); border: 1px solid #4a5056; color: var(--text); font-weight: 700; transition: background 0.12s, transform 0.06s, border-color 0.12s; text-align: left; }
.btn:hover:not(:disabled) { background: #434950; border-color: #5b6269; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--yellow); border-color: var(--yellow-hi); color: var(--yellow-ink); }
.btn.primary:hover:not(:disabled) { background: var(--yellow-hi); }
.btn.primary kbd { color: var(--yellow-ink); background: rgba(0, 0, 0, 0.12); border-color: rgba(0, 0, 0, 0.2); }
.btn.hi { border-color: var(--yellow); box-shadow: inset 0 0 0 1px rgba(246, 196, 25, 0.35); }
.btn.on { background: rgba(246, 196, 25, 0.18); border-color: var(--yellow); color: var(--yellow-hi); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.btn.danger { background: var(--bad); border-color: #ff7c6d; color: #1d0503; }
.btn.danger kbd { color: #1d0503; background: rgba(0, 0, 0, 0.12); }
.btn.danger-ghost { background: transparent; border-color: rgba(255, 86, 68, 0.45); color: #ff8b7d; }
.btn.danger-ghost:hover:not(:disabled) { background: rgba(255, 86, 68, 0.12); }
.btn.small { min-height: 28px; padding: 3px 9px; font-size: 13px; }
.btn.big { min-height: 58px; padding: 10px 18px; font-size: 18px; justify-content: flex-start; }
.btn.big .ico { width: 24px; height: 24px; }
.btn.big span { display: flex; flex-direction: column; flex: 1; font-family: var(--head); font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; font-size: 21px; line-height: 1.05; }
.btn.big small { font-family: var(--body); text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; opacity: 0.8; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--muted); padding: 0; flex: none; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.link { background: none; border: none; color: var(--info); padding: 0; font-weight: 700; display: inline-flex; gap: 5px; align-items: center; }
.link:hover { text-decoration: underline; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--coal); }
.seg button { border: none; background: transparent; padding: 5px 11px; font-weight: 700; color: var(--muted); display: inline-flex; gap: 5px; align-items: center; min-height: 30px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.seg button.on { background: var(--yellow); color: var(--yellow-ink); }
.seg.small button { min-height: 26px; padding: 3px 9px; font-size: 13px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
  background: rgba(255, 255, 255, 0.08); color: var(--muted); border: 1px solid rgba(255, 255, 255, 0.1); }
.chip .ico { width: 13px; height: 13px; vertical-align: -2px; }
.chip.tone-good { background: rgba(99, 212, 113, 0.14); border-color: rgba(99, 212, 113, 0.35); }
.chip.tone-warn { background: rgba(255, 176, 32, 0.14); border-color: rgba(255, 176, 32, 0.35); }
.chip.tone-bad { background: rgba(255, 86, 68, 0.16); border-color: rgba(255, 86, 68, 0.4); }
.chip.tone-info { background: rgba(124, 196, 240, 0.14); border-color: rgba(124, 196, 240, 0.35); }

/* bars */
.bar { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.09); overflow: hidden; margin: 3px 0 8px; }
.bar i { display: block; height: 100%; border-radius: 4px; transition: width 0.3s; }
.bar-good i { background: var(--good); } .bar-warn i { background: var(--warn); } .bar-bad i { background: var(--bad); }
.bar-info i { background: var(--info); }
.bar-yellow i { background: var(--hazard); background-size: 25px 25px; }

/* key-value rows */
.kvs { display: flex; flex-direction: column; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line-soft); align-items: baseline; }
.kv > span { color: var(--muted); }
.kv > b { text-align: right; font-weight: 700; }
.kv > b small { font-weight: 400; color: var(--muted); display: block; }
.warn-line { color: var(--warn); font-size: 13px; display: flex; gap: 6px; align-items: flex-start; margin: 6px 0; }
.warn-line .ico { color: var(--warn); }
.hint-line { color: var(--info); font-size: 13px; display: flex; gap: 6px; align-items: flex-start; margin: 6px 0; }

/* fields */
.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.field > span { font-weight: 700; }
.field > span b { color: var(--yellow); font-family: var(--head); font-size: 17px; letter-spacing: 0.03em; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; cursor: pointer; }
.check small { margin-left: 4px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--yellow); margin: 0; flex: none; }
input[type="range"] { width: 100%; accent-color: var(--yellow); height: 22px; }
select { font: inherit; color: var(--text); background: var(--coal); border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; min-height: 34px; width: 100%; }
select:hover { border-color: #5b6269; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(6px); }

/* ---------- title screen ---------- */
#title { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: auto;
  background: radial-gradient(ellipse at 30% 40%, rgba(15, 17, 18, 0.15), rgba(15, 17, 18, 0.75) 70%), linear-gradient(180deg, rgba(10, 11, 12, 0.1), rgba(10, 11, 12, 0.6)); }
.title-card { width: min(560px, calc(100vw - 32px)); padding: 0 32px 26px; background: rgba(22, 24, 26, 0.88); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); backdrop-filter: blur(10px); overflow: hidden; }
.hazard { height: 12px; margin: 0 -32px 26px; background: var(--hazard); }
.title-kicker { font-family: var(--head); font-weight: 600; text-transform: uppercase; letter-spacing: 0.22em; color: var(--yellow); font-size: 14px; }
.title-name { font-size: clamp(64px, 12vw, 112px); line-height: 0.86; margin: 6px 0 14px; letter-spacing: 0.01em; color: var(--text); }
.title-name span { color: var(--yellow); margin-left: 0.18em; }
.pitch { font-size: 16.5px; color: #d7d5cd; max-width: 46ch; margin-bottom: 20px; }
.title-buttons { display: flex; flex-direction: column; gap: 10px; }
.title-buttons .btn kbd { margin-left: auto; }
.credits { color: var(--dim); font-size: 12px; margin: 18px 0 0; }
.title-help { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); }
.title-help .window { position: relative; inset: auto; transform: none; max-height: calc(100vh - 60px); }

/* ---------- top bar ---------- */
#topbar { position: absolute; top: 0; left: 0; right: 0; height: 56px; display: flex; align-items: stretch; gap: 2px; padding: 0 10px 0 0;
  background: linear-gradient(180deg, #1d2023, #16181a); border-bottom: 1px solid #000; box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4); }
#topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 4px; background: var(--hazard); background-size: 25px 25px; opacity: 0.9; pointer-events: none; }
#topbar.paused::after { background: repeating-linear-gradient(-45deg, var(--orange) 0 9px, #17181a 9px 18px); }
.tb-brand { display: flex; align-items: center; padding: 0 16px; font-family: var(--head); font-weight: 800; font-size: 25px; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--yellow); color: var(--yellow-ink); clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%); padding-right: 26px; margin-right: 4px; }
.tb-brand span { margin-left: 5px; color: #000; }
.tb-cell { display: flex; flex-direction: column; justify-content: center; padding: 4px 12px; border: none; background: transparent; text-align: left; position: relative; min-width: 0; border-right: 1px solid var(--line-soft); }
button.tb-cell:hover { background: rgba(255, 255, 255, 0.05); }
.tb-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.tb-label .ico { width: 13px; height: 13px; vertical-align: -2px; }
.tb-label kbd { font-size: 9px; padding: 1px 3px; }
.tb-cell b { font-size: 17px; white-space: nowrap; }
.tb-sitename { font-family: var(--head); font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; font-size: 19px !important; }
.tb-moneyval { font-size: 25px !important; line-height: 1; color: var(--yellow-hi); }
.tb-moneyval.neg { color: var(--bad); }
.tb-money { min-width: 132px; }
.tb-io { display: flex; gap: 8px; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.tb-repval { font-size: 21px !important; color: var(--yellow-hi); }
.tb-clockval { font-size: 20px !important; }
.tb-weather { flex-direction: row; align-items: center; gap: 9px; max-width: 280px; }
.tb-wicon .ico { width: 26px; height: 26px; color: var(--yellow); }
.tb-weather.raining .tb-wicon .ico { color: var(--info); }
.tb-wtext { display: flex; flex-direction: column; min-width: 0; }
.tb-wtext b { font-size: 14px !important; }
.tb-wtext small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-spacer { flex: 1; }
.flashes { position: absolute; left: 12px; top: 52px; display: flex; flex-direction: column; gap: 2px; pointer-events: none; }
.flash { font-family: var(--head); font-weight: 800; font-size: 17px; padding: 1px 7px; border-radius: 5px; background: rgba(16, 18, 20, 0.85); animation: flash 1.8s ease-out forwards; white-space: nowrap; }
@keyframes flash { 0% { opacity: 0; transform: translateY(-6px); } 12% { opacity: 1; transform: none; } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(10px); } }
.tb-speeds { display: flex; align-items: center; gap: 3px; padding: 0 8px; }
.spd { position: relative; width: 44px; height: 40px; border-radius: 7px; border: 1px solid var(--line); background: var(--steel-2); display: grid; place-items: center; padding: 0 0 8px; }
.spd b { font-family: var(--head); font-weight: 800; font-size: 17px; }
.spd kbd { position: absolute; bottom: 2px; font-size: 8.5px; padding: 0 3px; border: none; background: none; color: var(--dim); }
.spd:hover { background: var(--steel-3); }
.spd.on { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow-hi); }
.spd.on kbd { color: rgba(0, 0, 0, 0.55); }
.spd[data-speed="0"].on { background: var(--orange); border-color: #ff9b52; }
.tb-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 58px; border: none; background: transparent; font-size: 11px; color: var(--muted); border-left: 1px solid var(--line-soft); }
.tb-btn .ico { width: 21px; height: 21px; color: var(--text); }
.tb-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.tb-save.ok { color: var(--good); }
.tb-save.ok .ico { color: var(--good); }
.dropdown { position: absolute; top: 62px; right: 10px; width: 260px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 30; }
.dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: none; background: transparent; border-radius: 6px; text-align: left; font-weight: 700; }
.dropdown button kbd { margin-left: auto; }
.dropdown button:hover { background: rgba(255, 255, 255, 0.07); }
.dropdown hr { border: none; border-top: 1px solid var(--line); margin: 5px 0; }

/* ---------- tool bar ---------- */
#toolbar { position: absolute; left: 10px; top: 72px; width: 78px; display: flex; flex-direction: column; gap: 4px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.tool { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 7px; border: 1px solid transparent; border-radius: 8px; background: transparent; font-size: 11.5px; font-weight: 700; color: #d9d7d0; line-height: 1.1; }
.tool .ico { width: 25px; height: 25px; }
.tool kbd { position: absolute; top: 3px; right: 3px; font-size: 9px; padding: 1px 3px; }
.tool:hover { background: rgba(255, 255, 255, 0.07); }
.tool.on { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow-hi); }
.tool.on kbd { color: rgba(0, 0, 0, 0.6); background: rgba(0, 0, 0, 0.1); border-color: rgba(0, 0, 0, 0.15); }
.flyout { position: absolute; left: 98px; width: 400px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; z-index: 25; }
.flyout h4 { margin: 4px 6px 8px; display: flex; justify-content: space-between; align-items: baseline; }
.build-item { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; text-align: left; }
.build-item:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--line); }
.build-item.locked { opacity: 0.55; }
.bi-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 8px; background: var(--steel-3); color: var(--yellow); flex: none; }
.bi-icon .ico { width: 24px; height: 24px; }
.bi-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.bi-text small { color: var(--muted); line-height: 1.3; }
.bi-cost { display: flex; flex-direction: column; align-items: flex-end; font-family: var(--head); font-weight: 800; font-size: 16px; color: var(--yellow-hi); white-space: nowrap; }
.bi-cost.neg { color: var(--bad); }
.bi-cost small { font-family: var(--body); font-weight: 400; color: var(--dim); font-size: 11px; }

/* map views */
#views { position: absolute; left: 100px; top: 72px; display: flex; gap: 5px; align-items: center; flex-wrap: wrap; max-width: calc(100vw - 470px); }
.views-label { font-family: var(--head); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; color: #e7e4dc;
  background: rgba(20, 22, 24, 0.78); padding: 7px 9px; border-radius: 7px; display: inline-flex; gap: 6px; align-items: center; }
#views .chip { cursor: pointer; padding: 6px 10px 6px 8px; font-size: 13px; background: rgba(22, 24, 26, 0.86); border-color: var(--line); color: #ddd9d0; gap: 6px; }
#views .chip .ico { width: 15px; height: 15px; }
#views .chip:hover { background: rgba(48, 52, 56, 0.95); color: #fff; }
#views .chip.on { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow-hi); }
#legend { position: absolute; left: 100px; top: 112px; width: 340px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
#legend h5 { font-size: 14px; display: flex; gap: 6px; align-items: center; margin-bottom: 7px; color: var(--yellow); }
#legend p { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.lg-grad { height: 12px; border-radius: 3px; }
.lg-ticks { display: flex; justify-content: space-between; font-size: 11.5px; color: #d6d3cb; margin-top: 3px; }
.lg-swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 12.5px; }
.lg-swatches i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(255, 255, 255, 0.2); }

/* ---------- dock ---------- */
#dock { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 3px; padding: 5px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.dock-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 70px; padding: 7px 2px 5px; border: 1px solid transparent; border-radius: 8px; background: transparent; font-size: 11.5px; font-weight: 700; color: #d9d7d0; }
.dock-btn .ico { width: 22px; height: 22px; }
.dock-btn kbd { position: absolute; top: 3px; right: 4px; font-size: 9px; padding: 1px 3px; }
.dock-btn:hover { background: rgba(255, 255, 255, 0.07); }
.dock-btn.on { background: rgba(246, 196, 25, 0.16); border-color: var(--yellow); color: var(--yellow-hi); }
.badge { position: absolute; top: -6px; left: 6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--yellow); color: var(--yellow-ink); font-style: normal; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--coal); }
.badge.bad { background: var(--bad); color: #fff; }

/* ---------- right column: selection and guide ---------- */
#rightcol { position: absolute; right: 10px; top: 72px; bottom: 96px; width: 340px; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
#rightcol > * { pointer-events: auto; }
#selpanel { padding: 12px 14px 14px; overflow-y: auto; flex: 0 1 auto; min-height: 0; }
#selpanel > p { color: #d8d5cd; }
.sel-head { display: flex; align-items: center; gap: 10px; margin: -2px 0 10px; }
.sel-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 9px; background: var(--yellow); color: var(--yellow-ink); flex: none; }
.sel-icon .ico { width: 26px; height: 26px; }
.sel-title { flex: 1; min-width: 0; }
.sel-title h3 { font-size: 22px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-title small { color: var(--muted); }
.status { font-size: 15px; font-weight: 700; color: var(--text) !important; background: rgba(255, 255, 255, 0.05); border-left: 3px solid var(--yellow); padding: 7px 10px; border-radius: 0 6px 6px 0; }
.flag { border-radius: 8px; padding: 8px 10px; margin: 8px 0; border: 1px solid; }
.flag b { display: flex; gap: 6px; align-items: center; margin-bottom: 3px; }
.flag p { font-size: 13px; color: #dedbd3; margin-bottom: 6px; }
.flag p:last-child { margin-bottom: 0; }
.flag.tone-bad { background: rgba(255, 86, 68, 0.12); border-color: rgba(255, 86, 68, 0.45); }
.flag.tone-info { background: rgba(124, 196, 240, 0.1); border-color: rgba(124, 196, 240, 0.35); }
.flag.tone-info b { color: var(--info); }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.btn-grid .btn { justify-content: flex-start; font-size: 13px; padding: 6px 9px; }
.list-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.04); border: 1px solid transparent; margin: 3px 0; text-align: left; }
button.list-row:hover { border-color: var(--line); }
.list-row small { margin-left: auto; color: var(--muted); }
.core-wrap h4 { display: flex; gap: 6px; align-items: center; }
.core { display: flex; gap: 12px; }
.core-col { width: 30px; height: 210px; border-radius: 5px; overflow: hidden; display: flex; flex-direction: column; border: 2px solid #55595e; flex: none; box-shadow: inset 6px 0 8px rgba(255, 255, 255, 0.12), inset -6px 0 8px rgba(0, 0, 0, 0.35); }
.core-col i { display: block; width: 100%; flex: none; }
.core-labels { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.core-labels b { display: block; }
.core-labels small { color: var(--muted); }
.ore { color: var(--good); font-family: var(--head); font-size: 15px; }

#guide { padding: 12px 14px; flex: none; margin-top: auto; border-color: rgba(246, 196, 25, 0.55); background: linear-gradient(180deg, rgba(40, 36, 16, 0.95), rgba(26, 27, 26, 0.95)); }
.guide-head { display: flex; align-items: center; justify-content: space-between; margin: -4px -6px 4px 0; }
.guide-kicker { font-family: var(--head); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--yellow); font-size: 12.5px; display: flex; gap: 5px; align-items: center; }
#guide h3 { font-size: 22px; margin-bottom: 4px; }
#guide p { color: #e4e0d5; font-size: 13.5px; }
.guide-dots { display: flex; gap: 4px; margin: 8px 0 10px; }
.guide-dots i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); }
.guide-dots i.done { background: var(--yellow); }
.guide-dots i.now { background: var(--yellow-hi); box-shadow: 0 0 8px rgba(246, 196, 25, 0.8); }

/* ---------- alerts ---------- */
#alerts { position: absolute; left: 10px; bottom: 10px; width: 390px; max-width: calc(100vw - 500px); display: flex; flex-direction: column-reverse; gap: 6px; pointer-events: none; }
#alerts > * { pointer-events: auto; }
.alerts-head { display: flex; gap: 6px; }
.alerts-toggle, .problems { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--muted); }
.alerts-toggle:hover { color: var(--text); }
.problems { background: var(--bad); border-color: #ff8b7d; color: #fff; animation: pulse-bad 1.6s ease-in-out infinite; }
.problems b { font-family: var(--head); font-size: 18px; line-height: 1; }
@keyframes pulse-bad { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 86, 68, 0.6); } 50% { box-shadow: 0 0 0 6px rgba(255, 86, 68, 0); } }
.alerts-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
#alerts.expanded .alerts-list { max-height: 50vh; overflow-y: auto; pointer-events: auto; }
.alert { pointer-events: auto; position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 7px 10px 7px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); font-size: 13.5px; transition: opacity 0.6s; animation: alert-in 0.25s ease-out; }
@keyframes alert-in { from { opacity: 0; transform: translateX(-10px); } }
.alert.click { cursor: pointer; }
.alert.click:hover { border-color: #5b6269; background: rgba(40, 44, 48, 0.96); }
.alert.old { opacity: 0.55; }
.lv-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; border-radius: 8px 0 0 8px; background: var(--info); }
.lv-good .lv-bar { background: var(--good); } .lv-warn .lv-bar { background: var(--warn); } .lv-bad .lv-bar { background: var(--bad); }
.lv-bad { border-color: rgba(255, 86, 68, 0.5); }
.alert.pulse { animation: alert-in 0.25s ease-out, pulse-bad 0.8s ease-in-out 3; }
.al-text { flex: 1; }
.al-site { color: var(--yellow); }
.alert time { color: var(--dim); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 2px; }

/* ---------- tool hint, cursor tip, zone popup ---------- */
#toolhint { position: absolute; left: 410px; right: 470px; bottom: 10px; width: fit-content; margin-inline: auto; min-height: 60px; display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 0;
  background: var(--panel); border: 1px solid var(--yellow); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
#toolhint > b { align-self: stretch; display: flex; align-items: center; padding: 0 14px; margin: -8px 0; background: var(--yellow); color: var(--yellow-ink); font-family: var(--head); font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; font-size: 17px; white-space: nowrap; }
#toolhint > span { font-size: 13.5px; color: #e6e2d8; }
#cursortip { position: fixed; left: 0; top: 0; pointer-events: none !important; z-index: 40; max-width: 300px; padding: 7px 10px; display: flex; flex-direction: column; gap: 2px;
  background: rgba(18, 20, 22, 0.94); border: 1px solid var(--line); border-left: 3px solid var(--yellow); border-radius: 6px; font-size: 13px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45); }
#cursortip.tone-bad { border-left-color: var(--bad); }
#cursortip.tone-warn { border-left-color: var(--warn); }
#cursortip .warn-line { margin: 2px 0 0; }
.popup { position: absolute; width: 340px; padding: 12px 14px 14px; background: var(--panel-solid); border: 1px solid var(--yellow); border-radius: 12px; box-shadow: var(--shadow); z-index: 28; }
.popup header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.popup h3 { font-size: 21px; display: flex; gap: 7px; align-items: center; color: var(--yellow); }
.zp-stats { background: rgba(255, 255, 255, 0.04); border-radius: 8px; padding: 4px 10px; }
.zp-exc { display: flex; flex-direction: column; max-height: 130px; overflow-y: auto; }
.zp-exc .check { margin: 3px 0; }

/* ---------- windows ---------- */
.window { position: absolute; left: 50%; top: 76px; transform: translateX(-50%); width: min(720px, calc(100vw - 40px)); max-height: calc(100vh - 176px); display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); z-index: 20; overflow: hidden; }
.window.wide { width: min(900px, calc(100vw - 40px)); }
.window > header { display: flex; align-items: center; gap: 14px; padding: 10px 10px 0 18px; background: linear-gradient(180deg, #24282c, #1c1f22); border-bottom: 1px solid var(--line); position: relative; }
.window > header::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--hazard); background-size: 25px 25px; }
.window > header h2 { font-size: 25px; display: flex; gap: 8px; align-items: center; padding: 6px 0 10px; white-space: nowrap; }
.window > header h2 .ico { color: var(--yellow); width: 22px; height: 22px; }
.window > header .icon-btn { margin-left: auto; align-self: flex-start; margin-top: 6px; }
.tabs { display: flex; gap: 2px; align-self: flex-end; }
.tab { border: 1px solid transparent; border-bottom: none; background: transparent; padding: 8px 13px; border-radius: 8px 8px 0 0; font-weight: 700; color: var(--muted); }
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.tab.on { background: var(--panel-solid); border-color: var(--line); color: var(--yellow); margin-bottom: -1px; }
.window-body { padding: 14px 18px 18px; overflow-y: auto; }
.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.empty .ico { width: 40px; height: 40px; color: var(--dim); margin-bottom: 8px; }
.empty.small { padding: 14px; border: 1px dashed var(--line); border-radius: 8px; }
.empty.small p { margin: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table td small { display: block; color: var(--muted); }
.table td .chip + small { margin-top: 3px; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: rgba(255, 255, 255, 0.04); }
.table tr.on td { background: rgba(246, 196, 25, 0.08); }
.table td.ic { width: 34px; color: var(--yellow); }
.table td.ic .ico { width: 24px; height: 24px; }
.table td.wear { width: 90px; }
.table td.wear .bar { margin: 2px 0; }
.table.num td:not(:first-child), .table.num th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; border: 1px solid rgba(255, 255, 255, 0.2); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 10px; }
.buy-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--steel); }
.buy-card.locked { opacity: 0.6; }
.buy-card .kvs { flex: 1; font-size: 13px; }
.bc-head { display: flex; gap: 10px; align-items: center; }
.bc-head .ico { width: 34px; height: 34px; color: var(--yellow); }
.bc-head b { font-family: var(--head); font-size: 19px; text-transform: uppercase; letter-spacing: 0.03em; display: block; line-height: 1.05; }
.bc-head small { color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-col > div > h4:first-child { margin-top: 0; }
.contract { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--steel); }
.contract.active { border-left: 4px solid var(--yellow); }
.contract.urgent { border-left-color: var(--bad); }
.ct-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 4px; }
.ct-head b { font-family: var(--head); font-size: 18px; text-transform: uppercase; letter-spacing: 0.03em; }
.ct-facts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 6px 0; }
.ct-facts span { display: flex; flex-direction: column; background: rgba(0, 0, 0, 0.2); border-radius: 6px; padding: 4px 6px; }
.ct-facts small { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.ct-facts b { font-family: var(--head); font-size: 16px; }
.zone-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.zone-row { display: grid; grid-template-columns: 1fr 140px auto; gap: 14px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--steel); }
.zr-main b { font-family: var(--head); font-size: 18px; text-transform: uppercase; }
.zr-main small { display: block; color: var(--muted); }
.zr-prog { display: flex; flex-direction: column; }
.zr-prog b { font-family: var(--head); font-size: 16px; text-align: right; }
.zr-btns { display: flex; gap: 5px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.stat { background: var(--steel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; display: flex; flex-direction: column; }
.stat > small:first-child { color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.stat b { font-family: var(--head); font-size: 25px; font-weight: 800; color: var(--yellow-hi); line-height: 1.1; }
.stat b.neg { color: var(--bad); }
.stat small + small, .stat b + small { color: var(--muted); }
.daychart { display: flex; gap: 6px; height: 120px; align-items: stretch; padding: 6px 0; border-bottom: 1px solid var(--line); }
.dc-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dc-bars { flex: 1; width: 100%; display: flex; gap: 3px; align-items: flex-end; justify-content: center; }
.dc-bars i { width: 40%; max-width: 18px; border-radius: 3px 3px 0 0; min-height: 1px; }
i.in { background: var(--good); } i.out { background: var(--bad); }
.dc-day small { color: var(--dim); font-size: 11px; }
.legend-line { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.legend-line i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.legend-line i.out { margin-left: 10px; }
.site-card { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 18px 14px 14px; background: var(--steel); display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.site-card.here { border-color: var(--yellow); }
.site-card.locked { opacity: 0.65; }
.sc-band { position: absolute; left: 0; right: 0; top: 0; height: 7px; background: var(--site); }
.site-card h3 { font-size: 23px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.site-card p { color: #d9d6ce; font-size: 13.5px; }
.site-card .kvs { font-size: 13px; flex: 1; }
.settings { display: flex; flex-direction: column; gap: 4px; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 10px 12px; border-radius: 8px; background: var(--steel); cursor: pointer; }
.setting > span { display: flex; flex-direction: column; }
.setting small { color: var(--muted); }
.setting input[type="range"] { width: 220px; }
input.switch { appearance: none; -webkit-appearance: none; width: 44px; height: 24px; border-radius: 12px; background: var(--steel-3); border: 1px solid var(--line); position: relative; cursor: pointer; transition: background 0.15s; }
input.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #cfcdc6; transition: transform 0.15s; }
input.switch:checked { background: var(--yellow); border-color: var(--yellow-hi); }
input.switch:checked::after { transform: translateX(20px); background: var(--yellow-ink); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.help-grid section h3 { font-size: 19px; color: var(--yellow); display: flex; gap: 7px; align-items: center; margin-bottom: 6px; }
.help-grid ol, .help-grid ul { margin: 0; padding-left: 20px; }
.help-grid li { margin-bottom: 5px; }
.help-grid p { color: #dcd9d1; }
.keys { width: 100%; border-collapse: collapse; font-size: 13px; }
.keys td { padding: 4px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.keys td:first-child { color: var(--muted); padding-right: 10px; white-space: nowrap; }
.keys kbd { color: var(--text); }

/* ---------- driving HUD ---------- */
#drivehud { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(560px, calc(100vw - 40px)); padding: 0 14px 12px; background: var(--panel-solid); border: 2px solid var(--yellow); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.dh-top { display: flex; align-items: center; gap: 10px; margin: 0 -14px 10px; padding: 8px 10px 8px 0; background: rgba(246, 196, 25, 0.1); border-bottom: 1px solid rgba(246, 196, 25, 0.35); }
.dh-badge { align-self: stretch; margin: -8px 0; display: flex; align-items: center; gap: 6px; padding: 0 12px; background: var(--yellow); color: var(--yellow-ink); font-family: var(--head); font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; font-size: 15px; }
.dh-name { font-family: var(--head); font-size: 20px; text-transform: uppercase; letter-spacing: 0.04em; flex: 1; }
.dh-gauges { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 8px; }
.gauge { background: var(--coal); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; display: flex; flex-direction: column; align-items: center; }
.gauge small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.gauge b.num { font-size: 36px; line-height: 1; color: var(--yellow-hi); }
.gauge b.num.warn { color: var(--warn); } .gauge b.num.neg { color: var(--bad); }
.gauge.wide { align-items: stretch; }
.gauge.wide b { font-size: 16px; margin: 4px 0 2px; }
.dh-stuck { margin-top: 8px; padding: 7px 10px; border-radius: 8px; background: rgba(255, 86, 68, 0.15); border: 1px solid rgba(255, 86, 68, 0.5); font-weight: 700; display: flex; gap: 6px; align-items: center; animation: pulse-bad 1.2s infinite; }
.dh-keys { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 10px; font-size: 13px; color: var(--muted); }
.dh-keys kbd { color: var(--text); margin-right: 2px; }
body.driving #toolbar, body.driving #views, body.driving #legend, body.driving #dock, body.driving #toolhint { opacity: 0.35; pointer-events: none; }

/* ---------- modal and toasts ---------- */
#modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); pointer-events: auto; z-index: 60; }
.modal-card { width: min(440px, calc(100vw - 32px)); padding: 20px 22px 18px; background: var(--panel-solid); border: 1px solid var(--line); border-top: 5px solid var(--yellow); border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.modal-card.danger { border-top-color: var(--bad); }
.modal-card h2 { font-size: 26px; margin-bottom: 8px; }
.modal-card p { color: #dcd9d1; margin-bottom: 18px; }
#toasts { position: fixed; top: 124px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none !important; z-index: 50; }
.toast { padding: 9px 16px; border-radius: 9px; background: rgba(22, 24, 26, 0.96); border: 1px solid var(--line); border-left: 4px solid var(--info); box-shadow: var(--shadow); font-weight: 700; font-size: 14px; animation: alert-in 0.2s ease-out; transition: opacity 0.4s, transform 0.4s; max-width: min(560px, calc(100vw - 40px)); }
.toast-good { border-left-color: var(--good); } .toast-warn { border-left-color: var(--warn); } .toast-bad { border-left-color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(-8px); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #4a5056 transparent; }

/* ---------- smaller screens ---------- */
@media (max-width: 1360px) {
  .tb-weather { max-width: 200px; }
  .tb-clock .tb-label, .tb-rep .tb-label { letter-spacing: 0.04em; }
}
@media (max-width: 1220px) {
  .tb-brand { font-size: 0; padding: 0 22px 0 12px; }
  .tb-brand span { font-size: 0; }
  .tb-brand::before { content: "DC"; font-size: 24px; }
  .tb-weather .tb-wtext small { display: none; }
  .tb-btn span { display: none; }
  .tb-btn { width: 44px; }
  #rightcol { width: 300px; }
  #views { max-width: calc(100vw - 430px); }
  .two-col, .help-grid { grid-template-columns: 1fr; }
}
@media (max-height: 760px) {
  .tool { padding: 6px 2px 5px; }
  .tool .ico { width: 21px; height: 21px; }
}
