/* 07 Ledger — the docked workbench. Cool grey-green paper, a teal "go" colour, columns that fold to strips. */
:root {
  --bg: #e9ebe6;
  --panel: #f7f8f5;
  --panel-2: #eef0eb;
  --panel-3: #e3e6df;
  --line: #d3d7cf;
  --line-strong: #aeb4a9;
  --text: #1e2422;
  --muted: #6d746f;
  --go: #1f6f78;
  --go-soft: rgba(31, 111, 120, 0.12);
  --accent: #d5006c;
  --accent-soft: rgba(213, 0, 108, 0.1);
  --primary: #1e2422;
  --primary-text: #fff;
  --radius: 6px;
  --shadow: 0 10px 30px rgba(20, 30, 25, 0.16);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --rail-w: 250px;
  --side-w: 340px;
  --strip-w: 44px;
}
body { background: var(--bg); color: var(--text); font-size: 12.5px; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--display-font); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h4 { font-size: 12.5px; margin: 10px 0 4px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.spacer { flex: 1; }
.eyebrow { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--go); }
:focus-visible { outline: 2px solid var(--go); outline-offset: 1px; }
.no-motion *, .no-motion *::before, .no-motion *::after { transition: none !important; animation: none !important; }
kbd.inline { margin: 0; padding: 0 4px; font-size: 10px; }
.btn.go { background: var(--go); border-color: var(--go); color: #fff; font-weight: 600; }
.btn.go:hover:not(:disabled) { background: #17565d; border-color: #17565d; }
.btn.go.big { width: 100%; justify-content: center; padding: 9px 12px; font-size: 14px; margin-top: 6px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }
.btn.fold { padding: 4px; color: var(--muted); border-color: transparent; background: transparent; }
.btn.fold:hover:not(:disabled) { background: var(--panel-2); }
button.link { color: var(--go); }
.seg-btn.on { background: var(--go); color: #fff; }
.toggle.on { color: var(--go); border-color: var(--go); }
input[type="range"] { accent-color: var(--go); }
.impact.hot { background: var(--go-soft); color: var(--go); }
.chip { text-transform: none; font-weight: 500; }
.chip.size-metropolis, .chip.size-city { background: #e8dcc2; color: #5a4310; }
.chip.size-town { background: #dde8e4; color: #1f6f78; }
.chip.kind-lair { background: #f3d9d5; color: #7a1410; }
.chip.kind-ruin, .chip.kind-cave, .chip.kind-mine { background: #ebe1cf; color: #5c4a2a; }
.chip.kind-inn, .chip.kind-tavern { background: #f6e3c8; color: #7a4f16; }
.chip.kind-temple, .chip.kind-shrine { background: #ebdff0; color: #5c3a6e; }
.progress { background: rgba(247, 248, 245, 0.96); }
.progress-bar { background: var(--go); opacity: 0.85; }
.toast { border-left-color: var(--go); }
.toasts { bottom: 46px; right: 356px; }

/* ---- shell ---- */
.app { height: 100vh; }
.screen-world { display: grid; grid-template-columns: var(--rail-w) 1fr var(--side-w); height: 100%; }
.screen-world:has(.rail.folded) { grid-template-columns: var(--strip-w) 1fr var(--side-w); }
.screen-world:has(.side.folded) { grid-template-columns: var(--rail-w) 1fr var(--strip-w); }
.screen-world:has(.rail.folded):has(.side.folded) { grid-template-columns: var(--strip-w) 1fr var(--strip-w); }

/* rail */
.rail { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); overflow: hidden; }
.rail-full { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.rail.folded .rail-full { display: none; }
.rail-strip, .side-strip { display: none; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; height: 100%; }
.rail.folded .rail-strip, .side.folded .side-strip { display: flex; }
.strip-btn { width: 32px; height: 32px; display: grid; place-items: center; border: none; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.strip-btn:hover { background: var(--panel-2); color: var(--text); }
.strip-btn.on { background: var(--go-soft); color: var(--go); }
.rail-dots { display: flex; flex-direction: column; gap: 6px; }
.rail-dots .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 700 11px var(--ui-font); border: 1.5px solid var(--line-strong); background: none; color: var(--muted); cursor: pointer; }
.rail-dots .dot:disabled { opacity: 0.45; cursor: default; border-style: dashed; }
.rail-dots .dot.current { background: var(--go); border-color: var(--go); color: #fff; }
.rail-dots .dot.cached { background: var(--go-soft); border-color: var(--go); color: var(--go); }
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 8px 4px; }
.rail-world { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 6px; }
.stages-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 4px 10px 8px; }
.stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.stage { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 9px 8px 9px 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; transition: border-color .15s; }
.stage:hover { border-color: var(--line-strong); }
.stage.current { border-color: var(--go); box-shadow: inset 3px 0 0 var(--go); }
.stage.idle { cursor: default; opacity: 0.62; background: transparent; border-style: dashed; }
.stage-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 600 11px var(--ui-font); color: var(--muted); border: 1.5px solid var(--line-strong); background: var(--panel); }
.stage.current .stage-num, .stage.cached .stage-num { background: var(--go); border-color: var(--go); color: #fff; }
.stage.cached .stage-num { background: #7fa4a8; border-color: #7fa4a8; }
.stage-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.stage-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.stage-name { font-family: var(--display-font); font-weight: 600; font-size: 14px; }
.pill { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 999px; white-space: nowrap; }
.pill.current { background: var(--go); color: #fff; }
.pill.cached { background: var(--go-soft); color: var(--go); }
.pill.idle { background: var(--panel-2); color: var(--muted); }
.stage-choice { font-size: 12.5px; line-height: 1.3; }
.stage-meta { font-size: 11px; display: flex; align-items: center; gap: 2px; }
.stage-hint { font-size: 11.5px; line-height: 1.35; font-style: italic; }
.rail-thumb { width: 100% !important; height: 88px !important; margin-top: 5px; }
.thumb { position: relative; border-radius: 6px; overflow: hidden; background: #e6e8e2; border: 1px solid var(--line); flex: none; }
.thumb .mapsvg { cursor: default; }
.thumb .mapsvg .lbl, .thumb .mapsvg .layer-labels, .thumb .mapsvg .glyphs-tree, .thumb .mapsvg .coast-glow, .thumb .mapsvg .sym, .thumb .mapsvg .road-casing, .thumb .mapsvg .road-trail { display: none; }
.thumb .mapsvg .road-major { stroke-width: 1px; } .thumb .mapsvg .road-minor { stroke-width: 0.6px; }
.thumb .mapsvg .river { stroke-width: 0.9px !important; } .thumb .mapsvg .kingdom-border { stroke-width: 1px; stroke-dasharray: none; }
.thumb:empty::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, #e6e8e2 0 6px, #dde0d8 6px 12px); opacity: 0.7; }
/* position (mini-map in the rail) */
.position-card { flex: none; border-top: 1px solid var(--line); background: var(--panel-2); padding: 8px 10px 10px; }
.position-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 4px; }
.position { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.mini-head { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.mini-head .mini-title { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-head .btn.small { padding: 2px 8px; font-size: 11px; }
.mini-head .btn.primary { background: var(--go); border-color: var(--go); }
.mini-map { height: 150px; background: var(--panel-2); }
.position.moving .mini-map { height: 260px; }
.position:not(.moving) .mini-map .mapsvg { pointer-events: none; cursor: default; }
.mini-map .mapsvg { box-shadow: none; }
.mini-map .mapsvg .preview-frame { stroke: var(--accent); stroke-dasharray: none; }
.mini-map .mapsvg .preview-corners, .mini-map .mapsvg .preview-cross { stroke: var(--accent); }
.mini-map .mapsvg .handle-box { stroke: var(--accent); }
.mini-map .mapsvg .preview-mask { fill-opacity: 0.4; }

/* centre */
.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 8px; background: var(--panel); border-bottom: 1px solid var(--line); }
.up-btn { height: 30px; padding: 0 10px 0 8px; font-weight: 600; gap: 4px; }
.crumb-wrap { min-width: 0; overflow: hidden; flex: 0 1 auto; }
.breadcrumb { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
.crumb-label { overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.crumb-scale { color: var(--go); }
.topbar .row { flex-wrap: nowrap; flex: none; }
.topbar .btn { flex: none; }
.chips { display: flex; align-items: center; gap: 4px; padding: 5px 10px; background: var(--panel-2); border-bottom: 1px solid var(--line); overflow-x: auto; }
.chips::before { content: 'Show'; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; margin-right: 6px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 12px; cursor: pointer; white-space: nowrap; }
.fchip .sw { width: 8px; height: 8px; border-radius: 2px; background: var(--line-strong); }
.fchip.on { color: var(--text); border-color: var(--line-strong); background: #fff; }
.fchip.on .sw { background: var(--go); }
.fchip.na { opacity: 0.4; }
.fchip kbd { margin-left: 2px; padding: 0 4px; font-size: 9.5px; }
.mapwrap { position: relative; flex: 1; min-height: 0; background: #dfe3dc; }
.mapwrap > .mapsvg-container { position: absolute; inset: 0; }
.mapsvg .hl-hov.hl-t-kingdom, .mapsvg .hl-hov.hl-t-continent, .mapsvg .hl-hov.hl-t-ocean, .mapsvg .hl-hov.hl-t-coast, .mapsvg .hl-hov.hl-t-district, .mapsvg .hl-hov.hl-t-floor, .mapsvg .hl-hov.hl-t-ice_cap, .mapsvg .hl-hov.hl-t-ground_patch { display: none; }
.mapsvg.picking { cursor: crosshair; }
.mapsvg .preview-mask { fill-opacity: 0.25; }
.pick-hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: var(--go); color: #fff; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow); pointer-events: none; z-index: 5; }
.infostrip { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 3px 12px; background: rgba(247, 248, 245, 0.94); border-top: 1px solid var(--line); backdrop-filter: blur(6px); font-size: 12.5px; }
.infostrip.sticky { border-top-color: var(--accent); box-shadow: inset 0 2px 0 rgba(213, 0, 108, 0.25); }
.infostrip .strip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.infostrip .strip-type { color: var(--muted); }
.infostrip .strip-name { font-weight: 700; }
.infostrip.sticky .strip-name { color: var(--accent); }
.infostrip .strip-hover { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32%; }
.infostrip .strip-btns { display: flex; gap: 4px; }
.infostrip .btn { padding: 3px 8px; font-size: 11.5px; }
.coords { color: var(--muted); white-space: nowrap; }
.progress-wrap { top: 46px; }

/* side */
.side { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); overflow: hidden; }
.side-full { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.side.folded .side-full { display: none; }
.side-tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.side-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 6px; border: none; border-bottom: 2px solid transparent; background: none; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 12px; }
.side-tab:hover { color: var(--text); }
.side-tab.on { color: var(--go); border-bottom-color: var(--go); background: var(--panel); }
.side-body { position: relative; flex: 1; min-height: 0; }
.tab { position: absolute; inset: 0; overflow: auto; }
.tab-choices { overflow: hidden; }
.choices { position: absolute; inset: 0; overflow: auto; display: flex; flex-direction: column; }
.choices.covered { visibility: hidden; overflow: hidden; }
.choices-head { padding: 12px 14px 6px; }
.choices-head h2 { font-size: 21px; margin-top: 2px; }
.choices-content { padding: 0 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.lead { margin: 0 4px 2px; line-height: 1.4; }
.card { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); transition: border-color .12s, background .12s; }
.card.cand { cursor: pointer; flex-wrap: wrap; }
.card.cand:hover { border-color: var(--line-strong); background: #fff; }
.card.cand.selected { border-color: var(--go); box-shadow: 0 0 0 1px var(--go); background: #fbfcfa; }
.card.custom { border-style: dashed; }
.card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.card-title { font-family: var(--display-font); font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-facts { font-size: 11.5px; line-height: 1.35; }
.card .thumb { width: 96px; height: 96px; }
.cand-edit { flex-basis: 100%; border-top: 1px dashed var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.cand-edit input[type="range"] { width: 100%; }
.cand-edit p { margin: 0; }
.card.anywhere { align-items: center; border-style: dashed; color: var(--muted); }
.card.anywhere .icon { color: var(--go); }
.card.current-region { background: var(--go-soft); border-color: transparent; }
.card.battle-spot { flex-direction: column; gap: 8px; background: var(--panel-2); border-color: transparent; }
.card.battle-spot .card-title .icon { color: var(--go); }
.card.battle-spot.picking { outline: 2px dashed var(--go); outline-offset: -2px; }
.card.battle-spot.placed { background: #fbfcfa; border-color: var(--go); }
.picking-msg { display: inline-flex; align-items: center; gap: 5px; color: var(--go); font-weight: 600; }
.steppers { gap: 10px; }
.stepper { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.stepper input { width: 58px; }
.filter-row { padding: 0 4px; color: var(--muted); }
.filter-row select { flex: 1; }
.section { border-top: 1px solid var(--line); }
.section summary { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px 4px; cursor: pointer; list-style: none; font-family: var(--display-font); font-weight: 600; font-size: 14px; }
.section summary::-webkit-details-marker { display: none; }
.section summary .count { font: 500 11px var(--ui-font); color: var(--muted); background: var(--panel-2); border-radius: 999px; padding: 1px 7px; }
.section.active-floor summary { color: var(--go); }
.rows { list-style: none; margin: 0; padding: 0 0 4px; }
.row-item { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 8px; border-radius: 6px; cursor: pointer; border-left: 3px solid transparent; }
.row-item:hover, .row-item.hovered { background: var(--panel-2); }
.row-item.selected { background: var(--accent-soft); border-left-color: var(--accent); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.row-title .icon { color: var(--muted); flex: none; }
.row-title .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 11px; margin-top: 1px; padding-left: 19px; }
.row-item .btn.go.small { opacity: 0; transition: opacity .12s; padding: 3px 9px; }
.row-item:hover .btn.go.small, .row-item.selected .btn.go.small, .row-item.hovered .btn.go.small { opacity: 1; }
.lock-ic { color: #8a5a1e; }
.rows .empty { padding: 4px 8px 8px; }
.inline-info { padding: 6px 4px; }
.inline-info .map-info h2 { font-size: 16px; }
.inspector { position: absolute; inset: 0; background: var(--panel); overflow: auto; padding: 10px 14px 16px; animation: slide-in .18s ease-out; }
@keyframes slide-in { from { transform: translateX(24px); } to { transform: none; } }
.back-btn { display: inline-flex; align-items: center; gap: 4px; border: none; background: none; padding: 4px 6px 10px 0; color: var(--go); font-weight: 600; cursor: pointer; }
.inspector .el-head h2 { font-size: 22px; }
.inspector .el-head .close { display: none; }
.inspector .el-nav .btn.primary { background: var(--go); border-color: var(--go); }
.focus-vars { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.focus-vars .var-row:first-child { border-top: none; }
.focus-foot { justify-content: space-between; margin-top: 6px; }
#tab-find { padding: 10px 12px; display: flex; flex-direction: column; }
#tab-find .element-list { flex: 1; min-height: 0; }
#tab-refine { padding: 0 0 12px; }
.refine-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 12px 14px 8px; }
.refine-head h3 { font-size: 16px; }
.refine-head p { margin: 2px 0 0; line-height: 1.35; }
.refine-actions { padding: 0 12px 8px; }
.vars-wrap { padding: 0 12px; }
.var-group { background: var(--panel); }

/* popovers */
.layers-pop { display: flex; flex-direction: column; gap: 8px; max-width: 340px; }
.layers-pop h3 { font-size: 14px; }
.layers { display: flex; gap: 4px; flex-wrap: wrap; }
.about { width: 440px; font-size: 12.5px; line-height: 1.45; }
.about h3 { font-size: 16px; margin-bottom: 4px; }
.about p { margin: 0 0 8px; }
.about ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; }
.about li b { color: var(--go); }

/* ---- world list ---- */
.screen-list { display: flex; flex-direction: column; height: 100%; }
.list-top { display: flex; align-items: center; justify-content: space-between; height: 52px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: block; width: 24px; height: 24px; border-radius: 6px; background: linear-gradient(135deg, var(--go), #3aa0a8); }
.brand h1 { font-size: 16px; }
.list-body { flex: 1; min-height: 0; overflow: auto; }
