:root {
  --bg: #06111c;
  --panel: #0c1c2b;
  --panel2: #11283b;
  --panel3: #173550;
  --line: #1e3d57;
  --text: #dbe8f1;
  --muted: #86a2b8;
  --dim: #5b7890;
  --accent: #3fd0c9;
  --accent2: #2aa39d;
  --good: #6ee7a0;
  --bad: #ff6b6b;
  --warn: #ffc857;
  --gold: #f5c451;
  --research: #b9a6ff;
  --sea1: #0f3654;
  --sea2: #071d31;
  --land: #3a4f43;
  --land-stroke: #7fb49c;
  --shelf: #1d6488;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 var(--font); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; }
p { margin: .5em 0; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.num { font-variant-numeric: tabular-nums; }

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* ---------------------------------------------------------- top bar */
#topbar { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: linear-gradient(#0d2030, #0a1a28); border-bottom: 1px solid var(--line); flex-wrap: wrap; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo { width: 30px; height: 30px; flex: none; }
.brand b { font-size: 15px; letter-spacing: .02em; white-space: nowrap; }
.brand small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.clock { display: flex; align-items: center; gap: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 4px 3px 12px; }
.clock .date { font-variant-numeric: tabular-nums; min-width: 104px; font-weight: 600; line-height: 1.15; }
.clock .date small { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .03em; }
.clock .date small.paused { color: var(--warn); }
.clock .date small.running { color: var(--accent); }
.speed { display: flex; gap: 2px; }
.speed button { background: transparent; border: 0; border-radius: 999px; padding: 6px 10px; color: var(--muted); font-size: 13px; letter-spacing: -.08em; }
.speed button.on { background: var(--accent); color: #032; font-weight: 700; }
.speed button:hover:not(.on) { background: var(--panel3); color: var(--text); }
.stats { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.stat { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px; min-width: 88px; }
.stat label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat span { font-weight: 650; font-variant-numeric: tabular-nums; }
.stat.alert { border-color: var(--bad); background: #3a1418; }
.stat svg { display: block; margin-top: 1px; }
.iconbtn { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; width: 34px; height: 34px; display: grid; place-items: center; }
.iconbtn:hover { border-color: var(--accent); }

/* ---------------------------------------------------------- layout */
#main { flex: 1; display: flex; min-height: 0; }
#mapwrap { position: relative; flex: 1; min-width: 0; overflow: hidden; background: var(--sea2); }
#mapcanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; }
#map.dragging { cursor: grabbing; }
#side { width: 390px; flex: none; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; }
#tabs { display: flex; border-bottom: 1px solid var(--line); background: #0a1824; }
#tabs { overflow-x: auto; scrollbar-width: none; }
#tabs button { flex: 1 1 auto; background: transparent; border: 0; padding: 10px 3px 9px; color: var(--muted); font-size: 12px; border-bottom: 2px solid transparent; white-space: nowrap; }
#tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
#tabs button:hover { color: var(--text); }
#tabs .badge { margin-left: 3px; min-width: 15px; height: 15px; font-size: 9.5px; vertical-align: 1px; }
#sidebody { flex: 1; overflow-y: auto; padding: 12px 14px 24px; }


/* ---------------------------------------------------------- map */
.land { fill: var(--land); stroke: var(--land-stroke); stroke-width: 3; stroke-linejoin: round; }
.shelf { fill: none; stroke: var(--shelf); stroke-width: 60; stroke-linejoin: round; opacity: .5; }
.grat { stroke: #2a5675; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .35; fill: none; }
.route { stroke: var(--accent); stroke-width: 1.2; vector-effect: non-scaling-stroke; stroke-dasharray: 4 5; opacity: .35; fill: none; }
.town circle { fill: #e8f1f6; stroke: #0b1a26; stroke-width: 1.5; }
.town text { fill: #eef5f8; font-size: 12px; paint-order: stroke; stroke: #1d2a24; stroke-width: 3px; stroke-linejoin: round; font-weight: 600; }
.town.s3 text { font-size: 14px; }
.town.s1 text { font-size: 11px; font-weight: 500; }
#map.far .town.s1 { display: none; }
.sealabel { fill: #6fa3c6; font-style: italic; letter-spacing: .18em; font-size: 12px; pointer-events: none; }
.sealabel.s2 { font-size: 14px; }
.sealabel.s3 { font-size: 17px; letter-spacing: .4em; }
.sealabel.landlbl { fill: #9cbfae; letter-spacing: .25em; font-style: normal; text-transform: uppercase; font-size: 11px; }
.pin { cursor: pointer; }
.pin .head { stroke: #fff; stroke-width: 1.6; }
.pin .ico { fill: none; stroke: #0b1a26; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pin .shadow { fill: rgba(0,0,0,.35); }
.pin:hover .head, .pin.sel .head { stroke: var(--accent); stroke-width: 2.4; }
.pin.teaser .head { fill: #0c1c2b; stroke-dasharray: 3 2.5; stroke-width: 1.6; }
.pin.teaser .ico { stroke: currentColor; }
.pin.teaser { opacity: .85; }
.pin .ring { fill: none; stroke: var(--accent); stroke-width: 2; opacity: 0; }
.pin.sel .ring { opacity: 1; }
.pin.expiring .head { animation: blink 1.2s ease-in-out infinite; }
.pin .badge-c { fill: #0b1a26; stroke: #fff; stroke-width: 1.2; }
.pin .badge-t { fill: #fff; font-size: 9.5px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.pin .fault-c { fill: var(--bad); stroke: #fff; stroke-width: 1.2; }
.pin .pulse { fill: none; stroke: var(--bad); stroke-width: 2; animation: pulse 1.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.pin .renew-c { fill: var(--good); stroke: #fff; stroke-width: 1.2; }
.pin.funding .head { fill: var(--gold); }
.pin.funding.pending .head { fill: #8c7a3b; }
.pin.funding.locked .head { fill: #3b4d5c; stroke: #8aa; stroke-dasharray: 3 2; }
.pin .kr { fill: #3a2a00; font-size: 8.5px; font-weight: 800; text-anchor: middle; dominant-baseline: central; }
.pin.funding.locked .kr { fill: #cde; }
.pin.hq .head { fill: var(--accent); }
.pin.active .site { stroke-width: 3; fill: #0c1c2b; }
.cluster .cc { fill: #0c1c2b; stroke: #cfe3ee; stroke-width: 2; }
.cluster:hover .cc { stroke: var(--accent); }
.cluster .ct { fill: #fff; font-size: 11px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.cluster .seg { fill: none; stroke-width: 4; }
@keyframes pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
@keyframes blink { 50% { opacity: .55; } }

#mapctrl { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 4px; }
#mapctrl button { width: 34px; height: 34px; background: rgba(12,28,43,.9); border: 1px solid var(--line); border-radius: 8px; font-size: 18px; line-height: 1; }
#mapctrl button:hover { border-color: var(--accent); }
#legend { position: absolute; left: 12px; bottom: 26px; background: rgba(9,22,34,.88); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 12px; color: var(--muted); display: grid; grid-template-columns: auto auto; gap: 2px 14px; max-width: 330px; }
#legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
#legend .t { grid-column: 1 / -1; color: var(--text); font-weight: 600; margin-bottom: 2px; display: flex; justify-content: space-between; }
#legend .t button { background: none; border: 0; color: var(--muted); padding: 0; }
#legend.min > :not(.t) { display: none; }
#attrib { position: absolute; right: 8px; bottom: 4px; font-size: 10px; color: var(--dim); }
#toasts { position: absolute; left: 50%; transform: translateX(-50%); bottom: 60px; display: flex; flex-direction: column; gap: 5px; align-items: center; pointer-events: none; width: min(460px, 70%); }
.toast { pointer-events: auto; color: var(--text); font-size: 12.5px; background: rgba(12,28,43,.95); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 6px 10px; box-shadow: 0 6px 24px rgba(0,0,0,.4); animation: tin .25s ease-out; cursor: pointer; width: 100%; }
.toast.bad { border-left-color: var(--bad); }
.toast.good { border-left-color: var(--good); }
.toast.money { border-left-color: var(--gold); }
.toast.research { border-left-color: var(--research); }
.toast.out { opacity: 0; transition: opacity .5s; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------- card */
#card { position: absolute; right: 12px; top: 12px; width: 380px; max-height: calc(100% - 24px); overflow-y: auto; background: rgba(12,28,43,.97); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.5); padding: 14px 16px 16px; }
#card .x, .modal .x { position: absolute; right: 10px; top: 8px; background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; padding: 4px; }
#card .x:hover, .modal .x:hover { color: var(--text); }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--panel3); color: var(--text); white-space: nowrap; }
.chip.sector { background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--c); }
.chip.ok { background: rgba(110,231,160,.14); color: var(--good); }
.chip.no { background: rgba(255,107,107,.14); color: var(--bad); }
.chip.warn { background: rgba(255,200,87,.14); color: var(--warn); }
.chip.res { background: rgba(185,166,255,.14); color: var(--research); }
.chip.gold { background: rgba(245,196,81,.15); color: var(--gold); }
button.chip { border: 0; }
button.chip:hover { filter: brightness(1.25); }
.card-title { font-size: 17px; margin: 8px 24px 2px 0; line-height: 1.25; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 10px 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.box { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.box h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.box.hl { border-color: var(--accent2); background: rgba(63,208,201,.06); }
.box.warnbox { border-color: #6b5520; background: rgba(255,200,87,.06); }
.box.badbox { border-color: #6b2a2a; background: rgba(255,107,107,.07); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.sp { justify-content: space-between; }
.btn { white-space: nowrap; background: var(--panel3); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; font-weight: 600; font-size: 13px; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #03241f; border-color: var(--accent); }
.btn.primary:hover:not(:disabled) { background: #5ee3dc; }
.btn:disabled, .btn.primary:disabled, .btn.danger:disabled, .btn.gold:disabled { background: transparent; color: var(--dim); border-color: var(--line); border-style: dashed; opacity: 1; }
#pausebar { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: min(640px, 70%); background: rgba(12,28,43,.96); border: 1px solid var(--warn); border-radius: 999px; padding: 5px 6px 5px 14px; font-size: 13px; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
#pausebar[hidden] { display: none; }
#pausebar > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.btn.danger { background: transparent; border-color: #6b2a2a; color: var(--bad); }
.btn.gold { background: var(--gold); color: #3a2a00; border-color: var(--gold); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.block { width: 100%; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.why { font-size: 12px; color: var(--warn); margin-top: 6px; }
.bar { height: 6px; background: #0a1824; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.cond > i { background: var(--good); }
.bar.cond.mid > i { background: var(--warn); }
.bar.cond.low > i { background: var(--bad); }
.bar.res > i { background: var(--research); }
.bar.gold > i { background: var(--gold); }
.bar.lg { height: 9px; }

/* ---------------------------------------------------------- sidebar content */
.sec { margin: 4px 0 16px; }
.sec > h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.item { display: block; width: 100%; text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; margin-bottom: 6px; }
button.item:hover { border-color: var(--accent2); }
.item .t { font-weight: 600; display: flex; align-items: center; gap: 7px; }
.item .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--c, var(--accent)); }
.dot.hollow { background: transparent; border: 2px dashed var(--c); }
.empty { color: var(--dim); font-size: 13px; padding: 6px 0 10px; }
.goal { margin-bottom: 10px; }
.goal .row { font-size: 13px; margin-bottom: 4px; }
.phase-lock { border: 1px dashed var(--line); border-radius: 10px; padding: 12px; text-align: center; color: var(--muted); }
.phase-lock b { color: var(--text); display: block; font-size: 14px; }
.tasks .task { font-size: 12.5px; margin-bottom: 7px; }
.tasks .task .row { margin-bottom: 3px; }
.robotrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
.robotrow .bar { grid-column: 1 / -1; margin-top: 4px; }
.mods { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 3px; }
.mod { font-size: 10px; padding: 1px 5px; border-radius: 4px; background: #0a1824; color: var(--muted); border: 1px solid var(--line); }
.status { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--panel3); white-space: nowrap; }
.status.leased { background: rgba(63,208,201,.15); color: var(--accent); }
.status.idle { background: rgba(255,255,255,.08); }
.status.fault { background: var(--bad); color: #fff; font-weight: 700; }
.status.servicing, .status.refit, .status.refurbish, .status.building { background: rgba(255,200,87,.15); color: var(--warn); }
.loglist .l { font-size: 12.5px; padding: 6px 0 6px 10px; border-left: 3px solid var(--line); margin-bottom: 4px; }
.loglist .l.bad { border-color: var(--bad); }
.loglist .l.good { border-color: var(--good); }
.loglist .l.money { border-color: var(--gold); }
.loglist .l.research { border-color: var(--research); }
.loglist .l .d { color: var(--dim); font-size: 11px; display: block; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 13px; }
.switch { width: 38px; height: 22px; border-radius: 99px; background: var(--panel3); border: 1px solid var(--line); position: relative; flex: none; padding: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: left .15s; }
.switch.on { background: var(--accent2); }
.switch.on::after { left: 18px; background: #fff; }
.badge { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; font-size: 10.5px; font-weight: 700; background: var(--accent); color: #032; }
.badge.bad { background: var(--bad); color: #fff; }

/* ---------------------------------------------------------- modal */
#modal { position: fixed; inset: 0; background: rgba(3,10,16,.72); display: grid; place-items: center; z-index: 50; padding: 16px; }
#modal[hidden] { display: none; }
.modal { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(620px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 18px 20px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal.wide { width: min(1400px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; overflow: hidden; padding-bottom: 12px; }
.modal h2 { font-size: 19px; margin-right: 30px; }
.modal .sub { color: var(--muted); margin-top: 3px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 8px 0; }
.choice { text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font-size: 12.5px; }
.choice b { display: block; font-size: 13px; }
.choice small { color: var(--muted); display: block; }
.choice.on { border-color: var(--accent); background: rgba(63,208,201,.1); box-shadow: inset 0 0 0 1px var(--accent); }
.choice.req { border-color: #6b5520; }
.choice:disabled { opacity: .4; }
.summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button { width: 28px; height: 28px; border-radius: 6px; background: var(--panel3); border: 1px solid var(--line); }

/* tech tree */
.treewrap { flex: 1; overflow: auto; margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; background: radial-gradient(ellipse at top, #0e2335, #08141f); position: relative; min-height: 0; }
.tree { position: relative; }
.tree svg { position: absolute; inset: 0; pointer-events: none; }
.tree .edge { fill: none; stroke: #2b4b66; stroke-width: 2; }
.tree .edge.done { stroke: var(--accent2); }
.tree .edge.far { stroke-dasharray: 5 5; opacity: .45; }
.treewrap, #sidebody, #card, .modal { scrollbar-color: #2b4b66 transparent; scrollbar-width: thin; }
.catlbl { position: absolute; top: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.node { position: absolute; width: 156px; height: 82px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; text-align: left; font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.node b { font-size: 12.5px; line-height: 1.2; }
.node .meta { color: var(--muted); font-size: 11px; margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.node.done { border-color: var(--accent2); background: #0f2f35; }
.node.available { border-color: #47708f; }
.node.available:hover, .node.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.node.locked { opacity: .5; }
.node.active { border-color: var(--research); }
.node .need { position: absolute; top: -8px; right: -6px; background: var(--warn); color: #3a2a00; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 1px 6px; }
.node .bar { margin-top: 3px; }
.treedetail { margin-top: 10px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-height: 86px; }
.treedetail h3 { font-size: 15px; }

/* sidebar blocks */
.techbtn { display: block; width: 100%; text-align: left; border-radius: 12px; padding: 10px 12px 11px; margin-bottom: 16px; border: 1px solid var(--research); background: linear-gradient(135deg, rgba(185,166,255,.14), rgba(185,166,255,.04)); }
.techbtn:hover { background: rgba(185,166,255,.2); }
.techbtn .lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--research); margin-bottom: 4px; font-weight: 700; }
.techbtn .row { margin-bottom: 5px; font-size: 13.5px; }
.techbtn.idle { border-color: var(--warn); background: rgba(255,200,87,.08); animation: idlepulse 1.6s ease-in-out infinite; }
.techbtn.idle .lbl { color: var(--warn); }
@keyframes idlepulse { 50% { box-shadow: 0 0 0 4px rgba(255,200,87,.15); } }
.fund { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; padding: 8px 10px; margin-bottom: 6px; background: rgba(245,196,81,.07); border: 1px solid rgba(245,196,81,.35); border-radius: 10px; font-size: 13px; }
.fund .linkbtn, .fund > span:first-child { grid-column: 1; text-align: left; color: var(--text); font-size: 13px; text-decoration: none; font-weight: 600; }
.fund .linkbtn:hover { text-decoration: underline; }
.fund .muted { grid-column: 1; font-size: 12px; }
.fund .btn { grid-column: 2; grid-row: 1 / span 2; }
.sec > h3 .chip { font-size: 11px; }
/* map: reach & funding */
.pin.far { filter: grayscale(1); opacity: .5; }
.pin.funding.no .head { fill: #6b6b5a; }
.pin.funding.no { opacity: .65; }
.pin .goldpulse { fill: none; stroke: var(--gold); stroke-width: 2.5; animation: pulse 1.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
/* tree rows */
.branchlbl { position: absolute; left: 12px; width: 136px; display: flex; align-items: center; font-size: 12px; font-weight: 700; color: var(--c); border-left: 3px solid var(--c); padding-left: 9px; text-transform: uppercase; letter-spacing: .05em; line-height: 1.25; }
.node { width: 150px !important; height: 74px !important; border-left: 3px solid var(--c) !important; }
.tree .edge { stroke-width: 3; }
/* starter */
.modal.starter { width: min(980px, 100%); }
.starters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
.startercard { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 22px 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 16%, transparent), var(--panel2)); transition: transform .15s, border-color .15s, box-shadow .15s; }
.startercard:hover { transform: translateY(-4px); border-color: var(--c); box-shadow: 0 12px 30px color-mix(in srgb, var(--c) 25%, transparent); }
.starticon { width: 84px; height: 84px; fill: none; stroke: var(--c); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 6px; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--c) 50%, transparent)); }
.startercard .stype { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--c); font-weight: 700; }
.startercard b { font-size: 20px; }
.startercard .stech { font-size: 13px; color: var(--text); background: var(--panel3); border-radius: 99px; padding: 2px 10px; }
.startercard .stext { font-size: 13px; color: var(--muted); line-height: 1.45; margin-top: 4px; }
.startercard .srobot { font-size: 12px; color: var(--text); }
.startercard .sfirst { font-size: 12px; color: var(--good); margin-top: auto; padding-top: 8px; }
@media (max-width: 760px) { .starters { grid-template-columns: 1fr; } .starticon { width: 56px; height: 56px; } }

.waitbtn { display: flex; justify-content: space-between; align-items: center; width: 100%; margin: -6px 0 16px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--accent2); background: rgba(63,208,201,.1); font-size: 13px; }
.waitbtn span { color: var(--accent); font-weight: 600; }
.waitbtn:hover { background: rgba(63,208,201,.18); }
.treedetail { min-height: 120px; }

/* tutorial */
#tut { position: fixed; left: 16px; bottom: 16px; z-index: 70; width: min(360px, calc(100vw - 32px)); background: #10283b; border: 1px solid var(--warn); border-radius: 12px; padding: 12px 14px; box-shadow: 0 12px 40px rgba(0,0,0,.6); }
#tut[hidden] { display: none; }
#tut p { margin: 4px 0 10px; font-size: 14px; line-height: 1.45; }
.tut-n { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--warn); }
.linkbtn { background: none; border: 0; color: var(--muted); font-size: 12px; text-decoration: underline; padding: 0; }
.linkbtn:hover { color: var(--text); }
body.tutorial #legend, body.tutorial #toasts, body.tutorial #pausebar { display: none !important; }
body.modal-open #tut { left: auto; right: 40px; bottom: auto; top: 70px; }
.tut-hl { outline: 2px solid var(--warn) !important; outline-offset: 2px; animation: tuthl 1.1s ease-in-out infinite; border-radius: 8px; position: relative; z-index: 2; }
@keyframes tuthl { 50% { outline-color: rgba(255,200,87,.25); box-shadow: 0 0 0 6px rgba(255,200,87,.18); } }
.pin.tut .ring { opacity: 1; stroke: var(--warn); stroke-width: 3; animation: tutring 1.1s ease-in-out infinite; }
@keyframes tutring { 50% { stroke-opacity: .25; } }

/* During the tutorial, nothing blinks except the step's target */
body.tutorial .pin .pulse, body.tutorial .pin .goldpulse { display: none; }
body.tutorial .pin.expiring .head, body.tutorial .techbtn.idle { animation: none; }
body.tut-target .pin.tut .ring { animation: none; opacity: 0; }

/* title */
#title { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(ellipse at 30% 20%, rgba(63,208,201,.18), transparent 60%),
  radial-gradient(ellipse at 80% 90%, rgba(255,200,87,.08), transparent 50%), #051019; overflow: auto; }
#title[hidden] { display: none; }
.titlecard { width: min(620px, 100%); }
.titlecard h1 { font-size: clamp(40px, 9vw, 72px); letter-spacing: .12em; font-weight: 800; line-height: 1; background: linear-gradient(90deg, #e9f6ff, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.titlecard .tag { color: var(--accent); letter-spacing: .3em; text-transform: uppercase; font-size: 12.5px; margin: 10px 0 18px; }
.titlecard p { color: #b8cad8; font-size: 15px; line-height: 1.55; }
.titlecard input { width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; color: var(--text); font: inherit; font-size: 16px; margin: 6px 0 14px; }
.titlecard input:focus { outline: none; border-color: var(--accent); }
.titlecard .btn { padding: 11px 20px; font-size: 15px; }
.phases { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 20px 0; }
.phases div { border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; font-size: 11.5px; color: var(--muted); }
.phases div b { display: block; color: var(--text); font-size: 12.5px; }
.phases div.cur { border-color: var(--accent); background: rgba(63,208,201,.08); }
@media (max-width: 520px) { .phases { grid-template-columns: repeat(2, 1fr); } }
kbd { font: 11px var(--mono); background: var(--panel3); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

/* ---------------------------------------------------------- small screens (keep last) */
@media (max-width: 900px) {
  html, body { overflow: auto; }
  #app { height: auto; min-height: 100vh; }
  #main { flex-direction: column; }
  #mapwrap { height: 58vh; flex: none; }
  #side { width: 100%; border-left: 0; border-top: 1px solid var(--line); }
  #sidebody { overflow: visible; }
  #topbar { gap: 8px; padding: 8px 10px; }
  .brand { flex: 1; }
  .brand small { display: none; }
  #topbar .iconbtn { order: 1; }
  .clock { order: 2; width: 100%; justify-content: space-between; }
  .stats { order: 3; margin-left: 0; width: 100%; flex-wrap: nowrap; gap: 4px; }
  .stat { flex: 1; min-width: 0; padding: 3px 6px; }
  .stat label { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stat span { font-size: 12.5px; }
  .stat small, .stat svg { display: none; }
  #legend { display: none; }
  #toasts { width: 92%; }
  #card { left: 8px !important; right: 8px !important; width: auto !important; top: 8px; max-height: calc(100% - 16px); }
}
