/* L2RPN Playground — dark cockpit theme, no external resources */
:root {
  --bg: #0b0f14;
  --panel: #121a23;
  --panel2: #0e141b;
  --edge: #1f2c3a;
  --txt: #d7e1ea;
  --dim: #7c8ea0;
  --acc: #4fc3f7;
  --ok: #3ddc84;
  --warn: #ffc447;
  --bad: #ff5c47;
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --sun: #ffd75e;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--txt);
  font-family: var(--sans); font-size: 14px;
  display: flex; flex-direction: column; overflow: hidden;
}

/* ---------- top bar ---------- */
#topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 14px; background: linear-gradient(180deg, #131c26, #0e151d);
  border-bottom: 1px solid var(--edge); flex: 0 0 auto;
}
.brand { font-weight: 800; letter-spacing: 0; font-size: 15px; color: var(--acc); }
.brand span { color: var(--dim); font-weight: 400; margin-left: 6px; letter-spacing: 0; font-size: 11px; }
.tb-group { display: flex; flex-direction: column; gap: 2px; }
.tb-group.grow { flex: 1 1 auto; min-width: 140px; }
.tb-group label { font-size: 10px; text-transform: uppercase; letter-spacing: 0; color: var(--dim); }
#chronicInput, #modelSelect {
  background: var(--panel2); color: var(--txt); border: 1px solid var(--edge);
  border-radius: 6px; padding: 5px 8px; font-family: var(--mono); font-size: 12.5px;
  min-width: 170px; max-width: 230px; outline: none;
}
#chronicInput:focus, #modelSelect:focus { border-color: var(--acc); }
#topbar { flex-wrap: wrap; }
.tb-group { min-width: 0; }

.btn {
  background: #1a2634; color: var(--txt); border: 1px solid #2b3d51;
  border-radius: 7px; padding: 7px 12px; cursor: pointer; font-size: 13px;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #223349; border-color: var(--acc); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .38; cursor: default; }
.btn.primary { background: #0f4f74; border-color: #1b74a8; font-weight: 700; letter-spacing: 0; }
.btn.primary:hover:not(:disabled) { background: #146699; }
.btn.wide { flex: 1 1 0; }
.btn.warnbtn { border-color: #6b3c2a; }
.btn.warnbtn:hover:not(:disabled) { border-color: var(--bad); background: #34211c; }
.btn.ghostbtn { padding: 7px 9px; font-family: var(--mono); }
.btn .spinner { margin-right: 6px; }

.stepline { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
#stepText { font-family: var(--mono); font-size: 12.5px; }
.ts { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.pbar { height: 5px; background: #0a1016; border-radius: 3px; overflow: hidden; border: 1px solid var(--edge); }
#pbarFill { height: 100%; width: 0%; background: linear-gradient(90deg, #2196c9, #4fc3f7); transition: width .3s; }

.rho-badge {
  display: flex; flex-direction: column; align-items: center; min-width: 86px;
  padding: 4px 12px; border-radius: 9px; border: 1px solid var(--edge);
  background: var(--panel2); transition: background .3s, border-color .3s;
}
.rho-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0; color: var(--dim); }
.rho-val { font-family: var(--mono); font-size: 21px; font-weight: 700; line-height: 1.1; }
.rho-badge.ok    { border-color: #1d5c3c; } .rho-badge.ok .rho-val { color: var(--ok); }
.rho-badge.warn  { border-color: #6e5a1e; } .rho-badge.warn .rho-val { color: var(--warn); }
.rho-badge.danger{ border-color: #7c2a1e; background: #26140f; animation: pulse-red 2s ease-in-out infinite; }
.rho-badge.danger .rho-val { color: var(--bad); }
.rho-badge.idle .rho-val { color: var(--dim); }
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 92, 71, .45); }
  50%      { box-shadow: 0 0 12px 3px rgba(255, 92, 71, .25); }
}

/* ---------- main layout ---------- */
main { flex: 1 1 auto; display: flex; min-height: 0; }
#mapwrap { flex: 1 1 auto; position: relative; background:
  radial-gradient(1200px 700px at 40% 40%, #101825 0%, #0b0f14 70%); min-width: 0; }
#map { width: 100%; height: 100%; display: block; }
#mapEmpty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; color: var(--dim);
  pointer-events: none;
}
#mapEmpty .ghost { font-size: 64px; opacity: .25; }
#mapEmpty b { color: var(--txt); }

#mapLegends {
  position: absolute; left: 10px; bottom: 8px; max-width: calc(100% - 20px);
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
}
#legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  font-size: 11px; color: var(--dim); background: rgba(11,15,20,.75);
  padding: 5px 10px; border-radius: 7px; border: 1px solid var(--edge);
}
#legend .sw { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
#legend .sw.dash { background: repeating-linear-gradient(90deg, #b79878 0 3px, transparent 3px 6px); }
#legend .sw.overload { background: #ff554f; box-shadow: 0 0 5px #ff554f66; }
.lg-overload { color: #ff968c; } .lg-critical { color: #ff7b91; font-weight: 600; }
.lg-atk { color: #ff8577; } .lg-mnt { color: #c9b458; }

#legendUnits {
  display: flex; gap: 10px; flex-wrap: wrap;
  align-items: center; font-size: 11px; color: var(--dim); background: rgba(11,15,20,.75);
  padding: 4px 10px; border-radius: 7px; border: 1px solid var(--edge); max-width: 70%;
}
#legendUnits span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
#legendUnits svg { flex: 0 0 auto; }

#mapDisplayControls {
  position: absolute; top: 8px; right: 10px; z-index: 5; display: flex; gap: 6px;
}
#unitsToggle, #motionToggle {
  display: flex; align-items: center; gap: 5px; user-select: none;
  font-size: 11px; color: var(--dim); cursor: pointer;
  background: rgba(11,15,20,.75); border: 1px solid var(--edge);
  border-radius: 7px; padding: 4px 9px;
}
#unitsToggle:hover, #motionToggle:hover { color: var(--txt); border-color: var(--acc); }
#unitsToggle input, #motionToggle input { accent-color: var(--acc); }

#tooltip {
  position: absolute; z-index: 30; pointer-events: none;
  background: rgba(9, 14, 20, .95); border: 1px solid #2b3d51; border-radius: 7px;
  padding: 7px 10px; font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  max-width: 280px; box-shadow: 0 4px 18px rgba(0,0,0,.5); white-space: pre;
}
#tooltip .t-title { color: var(--acc); font-weight: 700; }

/* ---------- SVG elements ---------- */
.pline { fill: none; transition: stroke .4s, stroke-width .4s, opacity .4s; }
.pline.down { stroke: #b79878 !important; stroke-dasharray: 7 6; opacity: .78; }
.phit { fill: none; stroke: transparent; stroke-width: 12; cursor: pointer; }
.lineg.attacked .pline { filter: drop-shadow(0 0 5px rgba(255, 60, 40, .9)); }
.risk-halo { fill: none; stroke: #ff554f; opacity: .16; display: none; pointer-events: none; }
.lineg.ovf .risk-halo { display: block; animation: overload-glow 2s ease-in-out infinite; }
.lineg.ovf .pline { animation: overload-pulse 2s ease-in-out infinite; }
.lineg.critical .risk-halo { stroke: #ff3657; opacity: .28; }
.lineg.critical .pline { filter: drop-shadow(0 0 3px #ff365790); }
.lineg.unknown .pline { stroke-dasharray: 2 4; }
@keyframes overload-pulse { 0%,100% { opacity: 1; } 50% { opacity: .72; } }
@keyframes overload-glow { 0%,100% { opacity: .14; } 50% { opacity: .3; } }
.flow-streak { fill: none; stroke: #ecf6ff; stroke-width: 1.2; stroke-linecap: round;
  stroke-dasharray: 1 19; opacity: .52; pointer-events: none; animation: flow-travel 2.5s linear infinite; }
.lineg.flow-reverse .flow-streak { animation-direction: reverse; }
@keyframes flow-travel { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -20; } }
.flow-arrow { fill: none; stroke: #e0eef8; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round;
  opacity: .8; pointer-events: none; }
.lineg.ovf .flow-streak, .lineg.ovf .flow-arrow { stroke: #ffe1de; }
.risk-label { font-family: var(--mono); font-size: 10px; font-weight: 600; fill: #ffaaa0;
  paint-order: stroke; stroke: #0b0f14; stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.lineg.critical .risk-label { fill: #ffc0cd; font-weight: 800; }
.marker { font-size: 15px; pointer-events: none; }
.marker.atk { filter: drop-shadow(0 0 4px rgba(255,60,40,.95)); }
.marker.disconnected { fill: #d1ad85; font-weight: 800; font-size: 18px; paint-order: stroke; stroke: #0b0f14; stroke-width: 3px; }
.cdtxt { font-family: var(--mono); font-size: 10px; fill: #9fb2c4; pointer-events: none; }
.subc { fill: #17222e; stroke: #56718c; stroke-width: 1.4; cursor: pointer; transition: stroke .3s, fill .3s; }
.subg:hover .subc { stroke: var(--acc); }
.subg.split .subc { stroke: var(--acc); }
.ring2 { fill: none; stroke: var(--acc); stroke-width: 1.2; opacity: .85; }
.gtick { fill: #35c39a; } .ltick { fill: #e08a4a; }
.sublbl { font-family: var(--mono); font-size: 8.5px; fill: #5b7086; pointer-events: none; }

/* ---------- unit glyph layer ---------- */
.unitg { pointer-events: none; transition: opacity .35s; }
.unitg .uhit { pointer-events: all; fill: transparent; }
.ubadge { font-family: var(--mono); font-size: 8px; fill: #8fa2b5; pointer-events: none; }
.u-solar .sun-core { fill: var(--sun); }
.u-solar .sun-ray { stroke: var(--sun); stroke-width: 1.1; stroke-linecap: round; }
.u-wind .wt-blade { stroke: #9fd8ff; stroke-width: 1.7; fill: none; stroke-linecap: round; }
.u-wind .wt-hub { fill: #9fd8ff; }
.u-hydro .hy-drop { fill: #58b0ff; }
.u-nuclear .nu-base { fill: #10161d; stroke: rgba(183,255,158,.55); stroke-width: 1; }
.u-nuclear .nu-wedge { fill: #b7ff9e; }
.u-thermal .th-body { fill: #ff9d6e; }
.u-thermal .th-flame { fill: var(--sun); }
.u-load .ld-chev { stroke: #c9c9d9; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.u-storage .bat-case { fill: #0d141c; stroke: #9aa7b4; stroke-width: 1.1; }
.u-storage .bat-cap { fill: #9aa7b4; }
.u-storage .ufill { fill: #6b7684; transition: height .3s, y .3s, fill .3s; }
.unitg.dis .ufill { fill: var(--ok); }
.unitg.chg .ufill { fill: var(--warn); }

/* ---------- sidebar ---------- */
#side {
  flex: 0 0 352px; display: flex; flex-direction: column; gap: 8px;
  padding: 8px; overflow-y: auto; background: var(--panel2);
  border-left: 1px solid var(--edge);
}
#side::-webkit-scrollbar, #eventLog::-webkit-scrollbar, #candCards::-webkit-scrollbar { width: 8px; }
#side::-webkit-scrollbar-thumb, #eventLog::-webkit-scrollbar-thumb, #candCards::-webkit-scrollbar-thumb {
  background: #24344a; border-radius: 4px; }

.panel {
  background: var(--panel); border: 1px solid var(--edge); border-radius: 8px;
  padding: 9px 10px; flex: 0 0 auto;
}
.panel.grow { flex: 1 1 120px; display: flex; flex-direction: column; min-height: 110px; }
.panel h3 {
  font-size: 10.5px; letter-spacing: 0; color: var(--dim); margin-bottom: 7px;
  display: flex; align-items: center; gap: 6px;
}
.panel h3 .xbtn { margin-left: auto; }
.xbtn {
  background: none; border: none; color: var(--dim); font-size: 15px; cursor: pointer;
  padding: 0 3px; line-height: 1;
}
.xbtn:hover { color: var(--bad); }

.deck-row { display: flex; gap: 6px; margin-bottom: 6px; }
#deckPanel > .deck-row:first-of-type {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
}
#deckPanel > .deck-row:first-of-type #scanBtn { grid-column: 1 / -1; }
.deck-row.center { justify-content: center; }
.deck-row:last-child { margin-bottom: 0; }
.auto-row { align-items: center; }

/* operator game loop */
.mission-panel { border-left: 3px solid var(--acc); }
.mission-panel h3 { margin-bottom: 5px; }
.mode-chip, .verdict-tag {
  margin-left: auto; padding: 2px 7px; border-radius: 10px;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0;
  color: #071018; background: var(--dim);
}
.mode-chip.calm, .mode-chip.complete { background: var(--ok); }
.mode-chip.warning, .mode-chip.maintenance { background: var(--warn); }
.mode-chip.attack, .mode-chip.emergency, .mode-chip.failed { background: var(--bad); color: white; }
.mission-text {
  min-height: 34px; font-size: 12.5px; line-height: 1.4; color: var(--txt);
}
.operator-row {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center;
  gap: 10px; margin-top: 6px; font-size: 11px;
}
.rank { color: var(--acc); font-weight: 700; }
.mono { font-family: var(--mono); }
.xpbar {
  height: 4px; margin-top: 5px; overflow: hidden; border-radius: 2px;
  background: #0a1016;
}
#xpFill {
  height: 100%; width: 0; background: var(--ok);
  transition: width .25s;
}
.verdict-panel { border-left: 3px solid var(--warn); }
.verdict-tag.learn { background: var(--ok); }
.verdict-tag.hold { background: var(--warn); }
.verdict-tag.abandon { background: var(--bad); color: white; }
.verdict-move {
  font-family: var(--mono); font-size: 11.5px; color: var(--acc);
  line-height: 1.4; margin-bottom: 6px; overflow-wrap: anywhere;
}
.compare-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px;
}
.compare-cell {
  padding: 5px; background: #0e161f; border: 1px solid var(--edge);
  border-radius: 5px; text-align: center;
}
.compare-cell .ck { color: var(--dim); font-size: 9px; text-transform: uppercase; }
.compare-cell .cv { display: block; margin-top: 2px; font-family: var(--mono); font-size: 12px; }
.verdict-reason {
  margin: 6px 0; color: var(--dim); font-size: 11px; line-height: 1.35;
}
.verdict-controls {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px;
}
.verdict-btn {
  min-width: 0; padding: 6px 4px; cursor: pointer;
  border: 1px solid var(--edge); border-radius: 5px;
  color: var(--txt); background: #17222e; font-size: 11px;
}
.verdict-btn.learn:hover, .verdict-btn.learn.selected { border-color: var(--ok); color: var(--ok); }
.verdict-btn.hold:hover, .verdict-btn.hold.selected { border-color: var(--warn); color: var(--warn); }
.verdict-btn.abandon:hover, .verdict-btn.abandon.selected { border-color: var(--bad); color: var(--bad); }
.note-row { display: flex; gap: 5px; margin-top: 6px; }
#verdictNote {
  min-width: 0; flex: 1 1 auto; background: #0e141b; color: var(--txt);
  border: 1px solid var(--edge); border-radius: 5px; padding: 6px 7px;
  font-family: var(--mono); font-size: 11px;
}
#verdictNote:focus { outline: none; border-color: var(--acc); }
.journal-status {
  margin-top: 5px; color: var(--dim); font-family: var(--mono);
  font-size: 9.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.applied {
  font-family: var(--mono); font-size: 11.5px; color: var(--acc);
  border-left: 3px solid var(--acc); padding: 3px 8px; margin-top: 6px;
  background: #101c28; border-radius: 0 5px 5px 0;
  animation: fadein .3s;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ask panel */
#askBody .prop-desc { font-family: var(--mono); font-size: 12.5px; color: var(--txt); margin-bottom: 5px; }
#askBody .prop-detail { font-size: 11.5px; color: var(--dim); margin-bottom: 7px; white-space: pre-wrap; font-family: var(--mono); }

/* candidate cards */
.cards { display: flex; flex-direction: column; gap: 5px; max-height: 300px; overflow-y: auto; }
.card {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  background: #17222e; border: 1px solid #263749; border-radius: 7px; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.card:hover { border-color: var(--acc); background: #1b2a3a; }
.card.invalid { opacity: .45; }
.card .kicon { font-size: 15px; width: 20px; text-align: center; flex: 0 0 auto; }
.card .cdesc { flex: 1 1 auto; font-family: var(--mono); font-size: 11px; line-height: 1.35; word-break: break-word; }
.card .cdelta { font-family: var(--mono); font-size: 10.5px; flex: 0 0 auto; }
.cdelta.good { color: var(--ok); } .cdelta.badd { color: var(--bad); } .cdelta.zero { color: var(--dim); }

.chip {
  font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 2px 7px;
  border-radius: 10px; flex: 0 0 auto; color: #08131c;
}
.chip.ok { background: var(--ok); } .chip.warn { background: var(--warn); }
.chip.danger { background: var(--bad); color: #fff; } .chip.na { background: #3a4a5c; color: #cfd8e2; }

/* lines panel */
.lineslist { display: flex; flex-direction: column; gap: 4px; max-height: 170px; overflow-y: auto; }
.linerow {
  display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11.5px;
  padding: 3px 6px; border-radius: 5px; background: #16202b; cursor: pointer;
}
.linerow:hover { background: #1c2937; }
.linerow .lid { color: var(--acc); width: 42px; }
.linerow .lst { flex: 1 1 auto; color: var(--dim); }
.linerow .lst.atk { color: #ff8577; }
.linerow .rbtn {
  background: #143a2a; border: 1px solid #1d5c3c; color: var(--ok); border-radius: 5px;
  font-size: 11px; padding: 2px 8px; cursor: pointer; font-family: var(--mono);
}
.linerow .rbtn:hover:not(:disabled) { background: #1b5038; }
.linerow .rbtn:disabled { opacity: .4; cursor: default; }

/* stats */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; margin-bottom: 6px; }
.stat { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; }
.stat .k { color: var(--dim); }
.stat .v { font-family: var(--mono); color: var(--txt); }
.stat .v.good { color: var(--ok); } .stat .v.warnv { color: var(--warn); } .stat .v.badv { color: var(--bad); }
#spark { width: 100%; height: 56px; background: #0d141c; border-radius: 6px; border: 1px solid var(--edge); }
.spark-cap { text-align: right; margin-top: 2px; }

/* event log */
#eventLog { flex: 1 1 auto; overflow-y: auto; font-size: 11.5px; min-height: 70px; }
.ev { display: flex; gap: 7px; padding: 2.5px 2px; border-bottom: 1px solid #151d27; line-height: 1.45; }
.ev .estep { font-family: var(--mono); color: var(--dim); flex: 0 0 44px; text-align: right; }
.ev .eico { flex: 0 0 16px; text-align: center; }
.ev .etxt { flex: 1 1 auto; word-break: break-word; }
.ev.attack .etxt { color: #ff8577; } .ev.trip .etxt { color: #ffab66; }
.ev.reconnect .etxt { color: #6fdca4; } .ev.death .etxt { color: var(--bad); font-weight: 700; }
.ev.action .etxt { color: #7cc7f2; } .ev.maintenance .etxt { color: #c9b458; }

.keys { text-align: center; padding: 2px 0 6px; }
.dim { color: var(--dim); } .small { font-size: 11px; }

/* ---------- overlays ---------- */
#busyVeil {
  position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  background: rgba(6, 9, 13, .82); backdrop-filter: blur(2px);
}
#busyText { color: var(--txt); font-size: 14px; font-family: var(--mono); }

.spinner {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #33475e; border-top-color: var(--acc);
  animation: spin .8s linear infinite; vertical-align: -2px;
}
.spinner.big { width: 42px; height: 42px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

#endOverlay {
  position: fixed; inset: 0; z-index: 95; display: flex;
  align-items: center; justify-content: center; background: rgba(5, 8, 12, .88);
}
.end-card {
  background: var(--panel); border: 1px solid var(--edge); border-radius: 14px;
  padding: 28px 36px; text-align: center; max-width: 460px;
  box-shadow: 0 12px 60px rgba(0,0,0,.6); animation: endpop .35s;
}
@keyframes endpop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.end-card.dead { border-color: #7c2a1e; }
.end-card.win { border-color: #1d5c3c; }
.end-icon { font-size: 52px; margin-bottom: 8px; }
.end-card h2 { font-size: 19px; letter-spacing: 0; margin-bottom: 14px; }
.end-card.dead h2 { color: var(--bad); } .end-card.win h2 { color: var(--ok); }
.end-summary { margin-bottom: 18px; }
.end-summary .stats-grid { text-align: left; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 99;
  background: #33150f; border: 1px solid #7c2a1e; color: #ffb3a8;
  padding: 9px 16px; border-radius: 8px; font-size: 13px; max-width: 70vw;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); animation: fadein .2s;
}
#toast.info { background: #10222f; border-color: #1b74a8; color: #a8d9ff; }

/* ---------- grid controls (continuous actions panel) ---------- */
#contHead { cursor: pointer; user-select: none; }
#contHead:hover { color: var(--txt); }
#contHead .caret { margin-left: auto; font-size: 12px; color: var(--dim); }
.cont-cap {
  font-size: 10px; letter-spacing: 0; text-transform: uppercase;
  color: var(--dim); margin: 7px 0 3px;
}
.cont-hint { text-transform: none; letter-spacing: 0; font-size: 10px; }
.contlist { display: flex; flex-direction: column; gap: 3px; max-height: 160px; overflow-y: auto; }
.contlist::-webkit-scrollbar { width: 8px; }
.contlist::-webkit-scrollbar-thumb { background: #24344a; border-radius: 4px; }
.crow {
  display: flex; align-items: center; gap: 6px; font-family: var(--mono);
  font-size: 12px; padding: 2px 5px; border-radius: 5px; background: #16202b;
}
.crow.touched { background: #1a2a3d; box-shadow: inset 2px 0 0 var(--acc); }
.crow .cid { color: var(--acc); flex: 0 0 62px; white-space: nowrap; }
.crow .cnow { color: var(--dim); flex: 0 0 auto; font-size: 10.5px; white-space: nowrap; }
.crow input[type=range] { flex: 1 1 40px; min-width: 36px; height: 14px; accent-color: var(--acc); }
.crow .cval { flex: 0 0 56px; text-align: right; font-size: 11px; color: var(--dim); }
.crow.touched .cval { color: var(--acc); }
.crow .cend { flex: 0 0 auto; font-size: 9px; color: var(--dim); }
.crow .crel { flex: 0 0 auto; font-size: 10px; color: var(--dim); cursor: pointer; text-decoration: underline dotted; }
.crow .crel:hover { color: var(--ok); }
.cmeter {
  display: inline-block; flex: 0 0 auto; width: 32px; height: 7px;
  background: #0d141c; border: 1px solid var(--edge); border-radius: 3px; overflow: hidden;
}
.cmeter i { display: block; height: 100%; background: #35c39a; }
.cont-foot { margin-top: 7px; }
.cont-bal { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--dim); cursor: pointer; }
.cont-bal input { accent-color: var(--acc); }
#contResult {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-top: 6px; font-family: var(--mono); font-size: 11.5px;
  animation: fadein .2s;
}
#contResult .rdesc {
  flex: 1 1 100%; color: var(--acc); font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip.dimmed { opacity: .45; }

@media (max-width: 900px) {
  html, body { height: auto; min-height: 100%; }
  body { overflow: auto; }
  main { flex-direction: column; min-height: auto; }
  #mapwrap { flex: 0 0 58vh; min-height: 430px; }
  #side {
    flex: 0 0 auto; width: 100%; max-height: none; overflow: visible;
    border-left: 0; border-top: 1px solid var(--edge);
  }
  .panel.grow { min-height: 180px; }
}

@media (max-width: 600px) {
  #topbar { gap: 8px; padding: 7px 8px; }
  .brand { width: 100%; }
  .tb-group { flex: 1 1 140px; }
  #chronicInput, #modelSelect { width: 100%; min-width: 0; max-width: none; }
  #stepBox { order: 10; flex-basis: calc(100% - 100px); }
  #mapwrap { min-height: 390px; }
  #legend { gap: 6px 10px; }
  #legendUnits { display: none; }
  #side { padding: 6px; }
  .deck-row { flex-wrap: wrap; }
  .deck-row .wide { flex-basis: 42%; }
}

/* Keep all warning information visible when motion is disabled. */
.map-motion-off .lineg.ovf .pline, .map-motion-off .risk-halo,
.map-motion-off .rho-badge.danger { animation: none !important; }
.map-motion-off .flow-streak { display: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .lineg.ovf .pline, .risk-halo, .rho-badge.danger { animation: none !important; }
  .flow-streak { display: none !important; animation: none !important; }
  .pline, .unitg, .u-storage .ufill { transition: none !important; }
}
/* Optional provenance view; kept outside operational controls. */
.benchmark-origin-link { color: #8cb6c9; font-size: 11px; text-decoration: none; padding: 5px 8px; border: 1px solid #29404e; border-radius: 5px; background: #101c25; }
.benchmark-origin-link:hover, .benchmark-origin-link:focus-visible { color: #55dec2; border-color: #55dec2; }
