/* SaaSmageddon: dark glossy HUD. Blue = you, orange = rival/procurement, gold = reps & market shifts. */
:root {
  --bg: #060B1F; --card: #0F1A3E; --line: #25397A; --ink: #EEF3FF; --dim: #A3B3DE;
  --accent: #6C8CFF; --brand: #2F5BEA; --neon: #4DE3FF; --proc: #FF7A3D; --rival: #F76707; --gold: #FFC53D; --runway: #5CC577; --bad: #FF6B6B;
  --map-gray: #0E1A3D; --shadow: 0 8px 28px rgba(0, 0, 0, .55);
  --glass: linear-gradient(180deg, rgba(27, 44, 94, .92), rgba(13, 22, 53, .92));
  --edge: inset 0 1px 0 rgba(255, 255, 255, .09);
  --disp: "Chakra Petch", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1100px 520px at 75% -8%, rgba(47, 91, 234, .30), transparent 70%), radial-gradient(800px 500px at 0% 100%, rgba(77, 227, 255, .08), transparent 70%), var(--bg) fixed; }
h1, h2, h3, p { margin: 0 0 .5em; }
h2, h3 { font-family: var(--disp); }
main { max-width: 1280px; margin: 0 auto; padding: 16px; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: var(--glass); border: 1px solid var(--line); border-radius: 9px; padding: 8px 14px; cursor: pointer; box-shadow: var(--edge); transition: border-color .15s, box-shadow .15s, transform .12s, filter .15s, background .15s; }
button:hover:not(:disabled) { border-color: var(--neon); box-shadow: var(--edge), 0 0 16px rgba(77, 227, 255, .3); transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(1px) scale(.97); box-shadow: none; }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, input:focus-visible, summary:focus-visible, .btn:focus-visible { outline: 3px solid var(--neon); outline-offset: 2px; }
button.primary, .btn.primary { background: linear-gradient(180deg, #4A78FF, #2549CC); border-color: #7C9BFF; color: #fff; font-weight: 700; box-shadow: var(--edge), 0 0 22px rgba(79, 123, 255, .55); }
button.primary:hover:not(:disabled), .btn.primary:hover { filter: brightness(1.12); box-shadow: var(--edge), 0 0 32px rgba(79, 123, 255, .85); }
button.wide { width: 100%; padding: 12px; }
.x { float: right; padding: 2px 8px; border: 0; background: none; box-shadow: none; }
.card { background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: var(--edge), 0 6px 22px rgba(0, 0, 0, .35); }
.icon { padding: 4px 9px; }
.dim, small { color: var(--dim); }
.tag { color: var(--dim); font-size: 1.05rem; }
label { display: block; font-weight: 600; margin: 16px 0 8px; }
input { display: block; width: 100%; margin-top: 4px; padding: 10px; font: inherit; color: inherit; background: rgba(5, 10, 31, .8); border: 1px solid var(--line); border-radius: 9px; }
input:focus { border-color: var(--neon); }
.field { display: flex; gap: 8px; align-items: stretch; }
.field input { margin: 0; flex: 1; min-width: 0; }
.field button { white-space: nowrap; }
.hint { margin: 10px 0 0; text-align: center; font-size: .85rem; color: var(--dim); }
#reroll-all { margin-top: 14px; }
kbd { font: 700 .72rem var(--disp); padding: 1px 6px; margin-left: 4px; border-radius: 5px; border: 1px solid rgba(255, 255, 255, .45); background: rgba(0, 0, 0, .25); }

/* ---- in-game frame: everything inside 100dvh ---- */
@media (min-width: 861px) {
  body:has(#side:not([hidden])), body:has(#ending:not([hidden])) { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
  body:has(#side:not([hidden])) main { flex: 1; min-height: 0; width: 100%; max-width: none; padding: 10px 16px 14px; }
  #stage:not([hidden]):has(#side:not([hidden])) { height: 100%; display: flex; flex-direction: column; gap: 10px; }
  .layout:has(#side:not([hidden])) { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  #side { min-height: 0; overflow-y: auto; align-content: start; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
  .mapwrap:has(+ #side:not([hidden])) { container-type: size; display: grid; place-items: center; min-height: 0; }
  .mapwrap:has(+ #side:not([hidden])) #mapbox { width: min(100cqw, 100cqh * 1.92); }
}

#topbar { position: relative; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; padding: 8px 16px; background: linear-gradient(180deg, rgba(23, 38, 84, .96), rgba(10, 17, 42, .96)); border-bottom: 1px solid var(--line); box-shadow: 0 4px 24px rgba(0, 0, 0, .45), 0 1px 0 rgba(77, 227, 255, .25); }
#topbar strong { font: 700 1.3rem var(--disp); margin-right: auto; letter-spacing: .02em; text-shadow: 0 0 18px rgba(108, 140, 255, .8); }
.daychip { font: 700 1.05rem var(--disp); padding: 4px 14px; border-radius: 999px; background: rgba(47, 91, 234, .28); border: 1px solid var(--accent); box-shadow: 0 0 14px rgba(79, 123, 255, .45); }
.stat { display: grid; line-height: 1.1; min-width: 64px; }
.stat small { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; }
.stat b { font: 700 1.2rem var(--disp); font-variant-numeric: tabular-nums; }
.stat.hy b { color: var(--neon); text-shadow: 0 0 12px rgba(77, 227, 255, .6); }
.warn { color: var(--bad); text-shadow: 0 0 12px rgba(255, 107, 107, .7); animation: blinkw 1s steps(2) infinite; }
@keyframes blinkw { 50% { opacity: .55; } }
.speeds { display: flex; gap: 4px; }
.speeds button { padding: 4px 10px; font-weight: 700; }
.speeds [aria-pressed="true"] { background: linear-gradient(180deg, #4A78FF, #2549CC); border-color: #8FA8FF; color: #fff; box-shadow: 0 0 14px rgba(79, 123, 255, .7); }
.arr b { color: #6EE7A0; text-shadow: 0 0 12px rgba(110, 231, 160, .45); }
.pill { padding: 3px 12px; border-radius: 999px; border: 1px solid var(--gold); color: var(--gold); font-size: .85rem; font-weight: 700; background: rgba(255, 197, 61, .08); }

/* ---- breaking-news ticker, directly under the topbar ---- */
.ticker { display: flex; align-items: stretch; min-height: 40px; border: 1px solid #6A2A3A; border-radius: 10px; overflow: hidden; background: linear-gradient(90deg, rgba(60, 14, 30, .9), rgba(14, 22, 52, .95) 30%); box-shadow: 0 0 22px rgba(255, 77, 109, .22); }
.live { flex: none; display: flex; align-items: center; gap: 8px; padding: 0 26px 0 16px; font: 700 .9rem var(--disp); letter-spacing: .18em; color: #fff; background: linear-gradient(180deg, #FF4D6D, #C71F43); box-shadow: 0 0 20px rgba(255, 77, 109, .7); clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%); }
.live i { width: 9px; height: 9px; border-radius: 50%; background: #fff; animation: livepulse 1.1s ease-in-out infinite; }
@keyframes livepulse { 50% { transform: scale(.5); opacity: .4; } }
.crawl { flex: 1; min-width: 0; overflow: hidden; display: flex; align-items: center; padding: 0 14px; }
#feedtxt { margin: 0; white-space: nowrap; font-size: 1.05rem; font-weight: 600; color: #fff; }
#feedtxt.in { animation: crawl 5s linear both; }
@keyframes crawl { 0% { transform: translateX(60px); opacity: 0; } 6% { transform: none; opacity: 1; } 22% { transform: none; } 100% { transform: translateX(calc(-1 * var(--ov, 0px))); } }

.prompt { text-align: center; font: 700 1.3rem var(--disp); margin: 8px 0; text-shadow: 0 0 18px rgba(108, 140, 255, .8); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.layout:has(#side[hidden]) { grid-template-columns: 1fr; }
.mapwrap { position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #0D1A45, #050A1F 75%); box-shadow: 0 0 40px rgba(47, 91, 234, .25), inset 0 0 60px rgba(0, 0, 0, .55); }
.mapwrap::before { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(79, 123, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(79, 123, 255, .06) 1px, transparent 1px); background-size: 36px 36px; }
#mapscroll { display: contents; }
#mapbox { position: relative; width: 100%; aspect-ratio: 960 / 500; }
#mapbox svg, #mapbox canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#mapbox canvas { pointer-events: none; }
.ocean { fill: url(#sea); stroke: rgba(77, 227, 255, .35); stroke-width: .8; }
.country { stroke: rgba(150, 175, 255, .25); stroke-width: .5; cursor: pointer; transition: fill .5s, opacity .2s; }
.country.lit { stroke: rgba(170, 215, 255, .75); stroke-width: .7; }
.country.unassigned { fill: var(--map-gray); cursor: default; }
.country.hover { filter: brightness(1.45); }
.country.selected { stroke: #fff; stroke-width: 1.2; }
.frz { fill: url(#hatch); pointer-events: none; display: none; }
body.assigning .country:not(.deploy):not(.unassigned) { opacity: .4; cursor: not-allowed; }
body.assigning .country.deploy { cursor: copy; stroke: var(--gold); stroke-width: 1.1; animation: deploypulse 1s ease-in-out infinite; }
@keyframes deploypulse { 50% { stroke: #fff; stroke-width: 1.6; } }
body.attract { overflow: hidden; }
body.attract .mapwrap { position: fixed; inset: 0; z-index: 1; border: 0; border-radius: 0; display: grid; place-items: center; box-shadow: none; }
body.attract #mapbox { width: max(100vw, 192vh); }
body.attract #bubbles, body.attract #deploybar, body.attract #rtoast, body.attract #legend { display: none; }
#legend { position: absolute; top: 10px; left: 12px; z-index: 2; display: flex; gap: 12px; padding: 4px 12px; border-radius: 999px; background: rgba(5, 10, 31, .75); border: 1px solid var(--line); font-size: .72rem; font-weight: 600; letter-spacing: .04em; color: var(--dim); pointer-events: none; }
#legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; background: #6C8CFF; box-shadow: 0 0 8px #6C8CFF; }
#legend i.r { background: var(--rival); box-shadow: 0 0 8px var(--rival); }
#bubbles { position: absolute; inset: 0; pointer-events: none; }
.bubble { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; border-radius: 999px; padding: 7px 12px; font: 700 .95rem var(--disp); color: #fff; background: linear-gradient(180deg, #4A78FF, #2549CC); border: 2px solid #fff; box-shadow: 0 0 18px rgba(108, 140, 255, .9); animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
.bubble:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.12); }
.bubble.proc { background: linear-gradient(180deg, #F2692A, #B83A06); box-shadow: 0 0 18px rgba(255, 122, 61, .9); }
.bubble.gone { animation: popout .2s ease-out forwards; pointer-events: none; }
@keyframes popout { to { transform: translate(-50%, -50%) scale(1.6); opacity: 0; } }
@keyframes pop { from { transform: translate(-50%, -50%) scale(0); } }

/* deploy mode prompt + confirmation toast, on the map */
#deploybar { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 12px; max-width: calc(100% - 24px); padding: 6px 8px 6px 18px; border-radius: 999px; background: rgba(8, 14, 36, .94); border: 2px solid var(--gold); color: #fff; font: 700 1.05rem var(--disp); box-shadow: 0 0 26px rgba(255, 197, 61, .55); animation: pop2 .25s cubic-bezier(.3, 1.4, .5, 1); }
#deploybar button { padding: 4px 14px; border-radius: 999px; font-weight: 700; }
@keyframes pop2 { from { transform: translateX(-50%) translateY(20px); opacity: 0; } }
#rtoast { position: absolute; left: 50%; bottom: 14px; z-index: 3; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 8px 18px; border-radius: 999px; background: rgba(8, 14, 36, .94); border: 1px solid var(--gold); color: #fff; font-weight: 700; white-space: nowrap; box-shadow: 0 0 20px rgba(255, 197, 61, .45); transition: opacity .25s, transform .25s; }
#rtoast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- side panel ---- */
#side { display: grid; gap: 10px; }
#open-roadmap { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 11px; font: 700 1.05rem var(--disp); letter-spacing: .02em; }
#rm-badge { display: inline-block; min-width: 1.5em; padding: 0 7px; margin-left: 6px; border-radius: 999px; background: #fff; color: var(--brand); font-size: .9rem; text-align: center; }
#open-roadmap.has { animation: nudge 1.5s ease-in-out infinite; }
#open-roadmap.has #rm-badge { animation: badgepulse 1.5s ease-in-out infinite; }
@keyframes nudge { 50% { box-shadow: var(--edge), 0 0 0 5px rgba(108, 140, 255, .35), 0 0 34px rgba(108, 140, 255, .9); } }
@keyframes badgepulse { 50% { transform: scale(1.25); box-shadow: 0 0 14px #fff; } }
#meters { padding: 10px 14px; display: grid; gap: 9px; }
.meter { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; align-items: baseline; position: relative; }
.meter span { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.meter b { font: 700 1.1rem/1 var(--disp); font-variant-numeric: tabular-nums; }
.meter i, .trait i { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: rgba(5, 10, 31, .9); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); overflow: hidden; position: relative; display: block; }
.meter u, .trait u { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand), var(--neon)); text-decoration: none; transition: width .3s; box-shadow: 0 0 12px rgba(77, 227, 255, .8); }
#b-aware { background: linear-gradient(90deg, #7A86C9, #C9D4FF); box-shadow: 0 0 10px rgba(201, 212, 255, .5); }
#b-proc { background: linear-gradient(90deg, #C2410C, var(--proc)); box-shadow: 0 0 12px rgba(255, 122, 61, .8); }
#b-rival { background: linear-gradient(90deg, #B84A05, #FFA45C); box-shadow: 0 0 12px rgba(247, 103, 7, .9); }
.radar { overflow: visible !important; }
.radar em { position: absolute; left: 15%; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.mark { font-size: .66rem; letter-spacing: 0; text-transform: none; margin-left: 4px; opacity: .85; }
#rival-meter span { color: #FFB27A; }
#rival-meter em { left: 55%; background: var(--rival); }
.trait { display: grid; gap: 2px; margin-top: 8px; font-size: .85rem; }

/* sales */
#sales { padding: 10px 12px; }
#sales h3 { font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.chip { display: block; min-width: 0; text-align: left; padding: 6px 9px; cursor: grab; }
.chip b { display: block; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip small { display: block; font-size: .72rem; line-height: 1.25; }
.chip.on { border-color: rgba(255, 197, 61, .6); }
.chip.on small { color: var(--gold); font-weight: 600; }
.chip.idle { border-color: var(--gold); background: linear-gradient(180deg, rgba(255, 197, 61, .22), rgba(255, 197, 61, .06)); animation: idlepulse 1.3s ease-in-out infinite; }
.chip.idle small { color: #FFE08A; font-weight: 700; }
.chip[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px var(--gold), 0 0 20px rgba(255, 197, 61, .8); animation: none; }
@keyframes idlepulse { 50% { box-shadow: 0 0 0 3px rgba(255, 197, 61, .35), 0 0 18px rgba(255, 197, 61, .5); } }
#reps-help { display: block; font-size: .72rem; line-height: 1.3; }
#sales .row { margin-top: 6px; }
#sales .row button { padding: 5px 12px; font-size: .88rem; }
.mini { padding: 1px 9px; font-size: .78rem; border-color: var(--gold); color: var(--gold); font-weight: 700; }

/* region card */
#region { padding: 10px 12px; }
.rh { display: flex; justify-content: space-between; align-items: center; }
.rh h3 { margin: 0; font-size: 1.1rem; }
#region .x { float: none; }
.fl { font-size: .82rem; line-height: 1.3; margin: 2px 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rstats { display: flex; gap: 14px; margin-bottom: 4px; }
.rstats small { display: block; font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; }
.rstats b { font: 700 1.05rem var(--disp); }
.rv b { color: #FFA45C; }
.replin { margin: 4px 0 2px; font-size: .88rem; }
.traits { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.traits .trait { font-size: .7rem; margin-top: 5px; }
.traits .trait i { height: 5px; }
.freeze { color: #FFA45C; border-left: 3px solid var(--proc); padding-left: 8px; font-size: .82rem; margin: 4px 0; }

/* ---- Strategic Investments overlay ---- */
#roadmap { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; padding: 16px 20px; gap: 12px; color: #EAF0FF; background: radial-gradient(900px 400px at 50% 0%, rgba(47, 91, 234, .3), transparent 70%), rgba(5, 9, 26, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); --card: #121F43; --line: #2A3F78; --dim: #A9B8E0; --accent: #6C8CFF; }
.rm-head { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.rm-head h2 { margin: 0; font-size: 1.7rem; text-shadow: 0 0 20px rgba(108, 140, 255, .7); }
.rm-hype { display: flex; align-items: baseline; gap: 6px; }
.rm-hype b { font: 700 2.4rem/1 var(--disp); font-variant-numeric: tabular-nums; color: var(--neon); text-shadow: 0 0 20px rgba(77, 227, 255, .8); }
.rm-hype span { color: var(--dim); }
.rm-hint { margin: 0; color: var(--dim); flex: 1; }
.rm-head .x { font-size: 1.3rem; padding: 4px 10px; }
.rm-sub { display: flex; align-items: center; gap: 12px; color: var(--dim); }
.rm-sub b { color: #fff; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 6px; }
.tabs button { flex: 1; padding: 8px 4px; font: 700 .9rem var(--disp); letter-spacing: .04em; }
.tabs [aria-selected="true"] { background: linear-gradient(180deg, #4A78FF, #2549CC); border-color: #8FA8FF; color: #fff; box-shadow: 0 0 16px rgba(79, 123, 255, .6); }
#trees { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; padding: 6px; }
.tree { display: none; position: relative; flex: none; }
#roadmap[data-tab="product"] .tree[data-tree="product"], #roadmap[data-tab="gtm"] .tree[data-tree="gtm"], #roadmap[data-tab="thought"] .tree[data-tree="thought"], #roadmap[data-tab="stunts"] .tree[data-tree="stunts"] { display: block; }
.tree svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.tree path { fill: none; stroke: #34478C; stroke-width: 2; stroke-dasharray: 5 5; stroke-linejoin: round; }
.tree path.open { stroke: #6C8CFF; stroke-dasharray: none; }
.tree path.owned { stroke: var(--neon); stroke-dasharray: none; stroke-width: 2.5; filter: drop-shadow(0 0 4px var(--neon)); }
.tile { position: absolute; z-index: 1; display: grid; grid-template-rows: 1fr auto auto; gap: 3px; padding: 8px 10px; text-align: left; background: #14224A; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tile .nm { font-size: .92rem; line-height: 1.2; font-weight: 600; }
.tile .meta { display: flex; align-items: center; justify-content: space-between; font-variant-numeric: tabular-nums; }
.tile .cost { font: 700 .8rem var(--disp); padding: 1px 8px; border-radius: 999px; background: rgba(0, 0, 0, .3); color: var(--dim); }
.tile .cost::after { content: " Hype"; font-weight: 500; opacity: .8; }
.tile em { font-style: normal; font-size: .95rem; }
.tile .rq { font-size: .7rem; line-height: 1.2; color: #8EA0D4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .rq:empty { display: none; }
.tile i { display: none; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--line); }
.tile u { display: block; height: 100%; background: var(--proc); }
.tile.short i { display: block; }
.tile.short .cost { color: var(--bad); background: rgba(255, 107, 107, .14); }
.tile.afford { border-color: #9DB6FF; border-width: 2px; padding: 7px 9px; background: #1A2C5E; animation: glow 1.8s ease-in-out infinite; }
.tile.afford .cost { color: #fff; background: rgba(108, 140, 255, .45); }
.tile.owned { background: linear-gradient(180deg, #3A6BFF, #2549CC); border-color: #8FA8FF; color: #fff; }
.tile.owned .cost { color: #fff; background: rgba(255, 255, 255, .2); }
.tile.owned em { font-weight: 800; }
.tile.locked { background: #0C1636; color: #7F92C8; border-style: dashed; opacity: .85; }
.tile[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff; }
.tile.afford[aria-pressed="true"] { animation: none; box-shadow: 0 0 0 2px #fff, 0 0 18px rgba(108, 140, 255, .8); }
.tile.ship { animation: ship .6s ease-out; }
@keyframes glow { 50% { box-shadow: 0 0 18px 2px rgba(108, 140, 255, .75); } }
@keyframes ship { 0% { transform: scale(1.12); box-shadow: 0 0 30px 6px rgba(143, 168, 255, .9); } 100% { transform: none; } }
#rm-detail { display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; align-items: center; padding: 12px 16px; background: rgba(18, 31, 67, .9); border: 1px solid var(--line); border-radius: 12px; }
#rm-detail h3 { margin: 0; font-size: 1.15rem; }
#rm-detail p { margin: 0; }
#rm-detail .ship-btn { grid-row: 1 / span 4; grid-column: 2; padding: 14px 26px; font-size: 1.1rem; }
#rm-detail .ship-btn:disabled { background: #1A2C5E; border-color: var(--line); color: var(--dim); box-shadow: none; }
@media (max-width: 1099px) {
  #roadmap { padding: 12px; }
  .rm-hint { flex-basis: 100%; order: 5; font-size: .85rem; }
  .rm-head .x { margin-left: auto; }
  .tabs button { font-size: .75rem; }
  #trees { place-items: start center; }
  #rm-detail { grid-template-columns: 1fr; border-radius: 14px 14px 0 0; margin: 0 -12px -12px; border-width: 1px 0 0; padding: 12px 16px 16px; }
  #rm-detail .ship-btn { grid-row: auto; grid-column: 1; }
}

.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(2, 4, 14, .65); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; }
.modal { max-width: 480px; width: 100%; border-color: var(--accent); box-shadow: var(--edge), 0 0 50px rgba(79, 123, 255, .4); }
.choice { display: block; width: 100%; text-align: left; margin-top: 8px; font-weight: 600; }
.choice small { display: block; font-weight: 400; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }

/* ---- the one notification channel: always above everything ---- */
#notice { position: fixed; top: 120px; left: 50%; z-index: 60; transform: translate(-50%, -30px) scale(.96); opacity: 0; pointer-events: none; transition: transform .35s cubic-bezier(.2, .9, .3, 1), opacity .25s; display: flex; align-items: center; gap: 14px; width: max-content; max-width: min(760px, calc(100vw - 32px)); padding: 12px 22px 12px 12px; background: rgba(7, 13, 36, .96); color: #fff; border: 1px solid var(--nc, #4F7BFF); border-bottom-width: 4px; border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6), 0 0 30px var(--ng, rgba(79, 123, 255, .5)); }
#notice.show { opacity: 1; transform: translate(-50%, 0); }
#notice .nt-tag { flex: none; font: 700 .75rem var(--disp); font-style: normal; letter-spacing: .12em; padding: 6px 10px; border-radius: 6px; background: var(--nc, #2F5BEA); color: var(--nt, #fff); }
#notice div { display: grid; gap: 2px; min-width: 0; }
#notice .nt-title { font-size: 1.1rem; font-weight: 700; }
#notice .nt-text { color: #D6DFFA; font-size: .95rem; }
#notice .nt-text:empty { display: none; }
#notice[data-kind="rival"] { --nc: #F76707; --ng: rgba(247, 103, 7, .5); }
#notice[data-kind="event"] { --nc: #6C8CFF; }
#notice[data-kind="cycle"] { --nc: var(--gold); --nt: #1B1300; --ng: rgba(255, 197, 61, .5); padding: 12px 24px 12px 14px; gap: 16px; max-width: min(680px, calc(100vw - 32px)); }
#notice[data-kind="cycle"] .nt-title { font: 700 clamp(1.25rem, 2.2vw, 1.7rem)/1.1 var(--disp); color: var(--gold); text-shadow: 0 0 20px rgba(255, 197, 61, .6); }
#notice[data-kind="cycle"] .nt-text { font-size: .95rem; }

/* ---- title + wizard ---- */
.title, #wizbar { --card: #121F43; --line: #2A3F78; --ink: #EAF0FF; --dim: #B4C2EA; --accent: #6C8CFF; color: var(--ink); }
.title { position: fixed; inset: 0; z-index: 12; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(ellipse 70% 60% at 50% 48%, rgba(6, 11, 31, .85), rgba(6, 11, 31, .25) 75%), linear-gradient(rgba(6, 11, 31, .6), rgba(6, 11, 31, 0) 30%, rgba(6, 11, 31, .65)); }
.wordmark { margin: 0; font: 700 clamp(2rem, 8vw, 7.5rem)/1 var(--disp); letter-spacing: .06em; margin-right: -.06em; color: #fff; text-shadow: 0 0 30px rgba(77, 227, 255, .7), 0 0 80px rgba(79, 123, 255, .9), 0 4px 0 #2F5BEA; animation: wmglow 3.2s ease-in-out infinite; }
@keyframes wmglow { 50% { text-shadow: 0 0 40px rgba(77, 227, 255, .95), 0 0 110px rgba(79, 123, 255, 1), 0 4px 0 #2F5BEA; } }
.tagline { margin: 18px 0 36px; font-size: clamp(1rem, 2.2vw, 1.5rem); color: #D3DEFF; letter-spacing: .06em; text-shadow: 0 2px 12px #000; }
.menu { display: grid; gap: 12px; width: min(300px, 100%); }
.menu button { padding: 14px; font: 700 1.1rem var(--disp); letter-spacing: .08em; text-transform: uppercase; background: rgba(14, 24, 56, .88); color: #fff; border-color: #2A3F78; }
.menu button.primary { background: linear-gradient(180deg, #4A78FF, #2549CC); border-color: #8FA8FF; box-shadow: 0 0 34px rgba(47, 91, 234, .8); }
.title.wizard .wordmark { font-size: clamp(1.6rem, 4vw, 2.6rem); animation: none; }
.title.wizard .tagline { display: none; }
#wiz { width: min(1000px, 100%); margin-top: 56px; }
#wiz h2 { font-size: 1.7rem; margin-bottom: 16px; text-shadow: 0 0 20px rgba(108, 140, 255, .7); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.pick { text-align: left; padding: 14px; background: linear-gradient(180deg, rgba(24, 40, 86, .94), rgba(11, 19, 46, .94)); border: 1px solid var(--line); color: var(--ink); display: block; }
.pick b { font: 700 1.1rem var(--disp); display: block; }
.pick em { display: block; font-style: normal; color: #D3DEFF; font-size: .85rem; margin: 2px 0 6px; }
.pick p { font-size: .82rem; color: var(--dim); margin: 0 0 8px; }
.pick small { display: block; margin-top: 8px; }
.pick .trait { font-size: .72rem; margin-top: 4px; }
.pick[aria-pressed="true"] { border-color: #8FA8FF; box-shadow: 0 0 0 2px #2F5BEA, 0 0 30px rgba(79, 123, 255, .65); transform: translateY(-2px); }
#wiz-name { max-width: 560px; margin: 0 auto 20px; text-align: left; }
#wiz-name label { margin: 14px 0 6px; }
#wiz-name button { background: rgba(14, 24, 56, .88); color: #fff; border-color: #2A3F78; }
#wiz-next { padding: 12px 28px; font-size: 1.05rem; }
#wizbar { position: fixed; top: 0; left: 0; right: 0; z-index: 13; display: flex; align-items: center; gap: 16px; padding: 10px 16px; }
#wizbar button { background: rgba(14, 24, 56, .92); color: #fff; border-color: #2A3F78; }
#steps { display: flex; gap: 8px; margin: 0 auto; padding: 0; list-style: none; counter-reset: s; flex-wrap: wrap; justify-content: center; }
#steps li { counter-increment: s; font-size: .8rem; color: #A5B4DE; padding: 5px 12px; border-radius: 999px; border: 1px solid #2A3F78; background: rgba(6, 11, 31, .75); }
#steps li::before { content: counter(s) ". "; }
#steps li.done { color: #fff; }
#steps li.now { color: #fff; background: #2F5BEA; border-color: #8FA8FF; box-shadow: 0 0 16px rgba(79, 123, 255, .7); }
#wizbar:not([hidden]) ~ main { padding-top: 64px; }

.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- ending: hero left, share right, one screen ---- */
#ending { max-width: 1240px; margin: 0 auto; }
@media (min-width: 861px) {
  #ending:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: center; height: 100%; }
  .endcol { max-height: 100%; overflow-y: auto; scrollbar-width: thin; padding: 4px; }
}
.endcol { display: grid; gap: 12px; }
.hero { position: relative; isolation: isolate; text-align: center; padding: 8px; --hc: var(--accent); }
.hero::before { content: ""; position: absolute; inset: -10% -8%; z-index: -1; background: radial-gradient(closest-side, color-mix(in srgb, var(--hc) 38%, transparent), transparent); animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .55; transform: scale(1.06); } }
.kicker { margin: 0; font: 700 .95rem var(--disp); letter-spacing: .26em; text-transform: uppercase; color: var(--dim); }
.days { font: 700 clamp(4.5rem, min(18vh, 10vw), 11rem)/1 var(--disp); letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--hc); margin: 4px 0; text-shadow: 0 0 40px color-mix(in srgb, var(--hc) 70%, transparent), 0 0 100px color-mix(in srgb, var(--hc) 45%, transparent); }
.hero.runway .days { background: linear-gradient(180deg, #FF8A5C, #E03131); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 28px rgba(224, 49, 49, .6)); text-shadow: none; }
#e-title { font-size: clamp(1.5rem, 3.4vh, 2.2rem); color: var(--ink); margin: 0 0 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 14px 0 0; }
.stats div { padding: 8px 4px; background: var(--glass); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--edge); }
.stats dt { font: 700 1.45rem var(--disp); font-variant-numeric: tabular-nums; }
.stats dd { margin: 0; font-size: .7rem; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.cta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cta > * { font-size: 1rem; text-align: center; padding: 11px 12px; }
.cta .primary { grid-column: 1 / -1; font-size: 1.1rem; padding: 13px; }
.btn { display: inline-block; border-radius: 9px; border: 1px solid var(--brand); text-decoration: none; transition: filter .15s, box-shadow .15s, transform .12s; }
.btn:hover { transform: translateY(-1px); }
.best { margin: 0; text-align: center; color: #D3DEFF; font-weight: 700; }
.post summary { cursor: pointer; font-weight: 600; }
.post .who { display: flex; gap: 10px; align-items: center; margin: 12px 0; }
.post small { display: block; }
.post #e-post { white-space: pre-wrap; margin: 0; }
.cause { margin: 0 0 6px; font-weight: 700; color: var(--hc); }
.rank { display: inline-block; margin: 4px 0 8px; padding: 6px 18px; border-radius: 999px; font: 700 1rem var(--disp); color: #fff; background: var(--hc); box-shadow: 0 0 22px color-mix(in srgb, var(--hc) 70%, transparent); }
.stamp { display: inline-block; font: 700 1em var(--disp); letter-spacing: .08em; text-transform: uppercase; color: var(--oc, var(--hc)); border: .12em solid currentColor; border-radius: 8px; padding: .1em .45em; transform: rotate(-6deg); text-shadow: 0 0 16px currentColor; box-shadow: 0 0 20px color-mix(in srgb, currentColor 50%, transparent), inset 0 0 14px color-mix(in srgb, currentColor 30%, transparent); }
.hero .stamp { font-size: 1.5rem; margin: 14px 0 12px; }
.share h3 { font-size: 1.35rem; margin-bottom: 4px; }
.share .dim { margin-bottom: 0; font-size: .92rem; }
.preview { margin: 10px 0 12px; padding: 10px 12px; max-height: 7.6em; overflow: auto; white-space: pre-wrap; font: inherit; font-size: .85rem; color: var(--ink); background: rgba(5, 10, 31, .85); border: 1px solid var(--line); border-radius: 9px; scrollbar-width: thin; }
#endfx { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; align-content: center; cursor: pointer; color: #fff; background: rgba(3, 6, 16, 0); transition: background 1s; }
#endfx[data-s="1"] { background: rgba(3, 6, 16, .9); }
#endfx[data-s="2"], #endfx[data-s="3"] { background: rgba(3, 6, 16, .62); }
#endfx small { position: absolute; bottom: 18px; opacity: .7; color: #fff; }
#fx-day { position: absolute; top: 12%; font: 700 clamp(3rem, 12vw, 8rem) var(--disp); font-variant-numeric: tabular-nums; text-shadow: 0 0 30px rgba(79, 123, 255, .9); }
#fx-stamp { font-size: clamp(2rem, 9vw, 6rem); padding: .15em .5em; background: rgba(8, 12, 30, .95); animation: slam .35s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes slam { from { transform: rotate(-6deg) scale(3); opacity: 0; } to { transform: rotate(-6deg) scale(1); opacity: 1; } }
body.fx-freeze #stage { filter: saturate(.1) brightness(.8); transition: filter 1s; }
body.shake { animation: shake .4s; }
@keyframes shake { 20% { transform: translate(-10px, 6px); } 40% { transform: translate(8px, -8px); } 60% { transform: translate(-6px, 4px); } 80% { transform: translate(4px, -3px); } }
#ending.reveal > * { animation: rise .6s both; }
#ending.reveal > :nth-child(2) { animation-delay: .5s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---- small screens: stack, page may scroll vertically ---- */
@media (max-width: 860px) {
  main { padding: 12px 16px; }
  .layout, .layout:has(#side[hidden]) { grid-template-columns: minmax(0, 1fr); }
  #region.sheet { top: auto; left: 0; right: 0; bottom: 0; max-height: 70vh; overflow-y: auto; border-radius: 14px 14px 0 0; position: fixed; z-index: 7; }
  .bubble { padding: 6px 10px; font-size: .85rem; }
  #topbar { padding: 8px 16px; gap: 4px 14px; }
  #topbar strong { flex-basis: 100%; font-size: 1.1rem; }
  .stat { min-width: 0; }
  .stat b { font-size: 1rem; }
  .daychip { font-size: .9rem; }
  #notice { top: auto; bottom: 14px; transform: translate(-50%, 30px) scale(.96); }
  #notice.show { transform: translate(-50%, 0); }
  .live { padding: 0 18px 0 10px; font-size: .75rem; letter-spacing: .1em; }
  #feedtxt { font-size: .95rem; }
  .title { justify-content: flex-start; padding-top: 60px; }
  #wiz { margin-top: 24px; }
  #steps { display: none; }
  #wizbar { background: rgba(6, 11, 31, .92); }
  kbd { display: none; }
  .days { font-size: clamp(4.5rem, 22vw, 8rem); }
  #ending:not([hidden]) { display: grid; gap: 14px; }
  #deploybar { font-size: .85rem; white-space: nowrap; padding-left: 12px; gap: 8px; }
  #legend { display: none; }
  #notice[data-kind="cycle"] { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px; }
}
@media (min-width: 861px) {
  body:has(#side:not([hidden])) #notice { left: calc(50% - 177px); max-width: min(760px, calc(100vw - 400px)); }
}
@media (min-width: 861px) and (max-height: 640px) {
  body:has(#side:not([hidden])), body:has(#ending:not([hidden])) { height: auto; min-height: 100dvh; overflow: auto; }
}
@media (prefers-reduced-motion: reduce) {
  #fx-stamp, body.shake, #ending.reveal > *, .hero::before, .wordmark, .bubble, .live i, .warn, #deploybar { animation: none; }
  #open-roadmap.has, #open-roadmap.has #rm-badge, .tile.afford, .tile.ship, .poach, .chip.idle, body.assigning .country.deploy, #feedtxt.in { animation: none; }
  .tile.afford { box-shadow: 0 0 12px rgba(108, 140, 255, .6); }
  .chip.idle { box-shadow: 0 0 12px rgba(255, 197, 61, .5); }
  #notice, #rtoast, button { transition: none; }
}
@media (min-width: 861px) and (max-height: 760px) { #reps-help { display: none; } .fl { -webkit-line-clamp: 1; } #meters { gap: 7px; } }

.repfx { margin: 0 0 4px; font-size: .78rem; color: var(--gold); line-height: 1.3; }
.repfx b { color: #FFA45C; }
.poach { position: absolute; z-index: 2; transform: translate(-50%, -40px); pointer-events: none; font: 700 .72rem var(--disp); color: var(--gold); text-shadow: 0 0 8px rgba(255, 197, 61, .8); opacity: 0; animation: poach 1.6s ease-out; }
@keyframes poach { 15% { opacity: .9; } to { transform: translate(-50%, -78px); opacity: 0; } }
.madeby { position: absolute; bottom: 12px; left: 0; right: 0; font-size: .78rem; letter-spacing: .12em; color: #8EA0D4; text-shadow: 0 1px 8px #000; }
.madeby a, .thoughts { color: inherit; text-decoration: none; }
.madeby a { color: #C9D6FF; border-bottom: 1px solid rgba(201, 214, 255, .35); }
.madeby a:hover { color: #fff; }
.thoughts { display: block; margin-top: 10px; text-align: center; font-size: .88rem; color: var(--dim); }
.thoughts:hover { color: #fff; text-decoration: underline; }

/* ---- phones (<= 860px): compact HUD, bigger map, fitted skill tree ---- */
@media (max-width: 860px) {
  main { padding: 8px 12px 16px; }
  .mapwrap { margin: 0 -12px; border-radius: 0; border-width: 1px 0; }
  /* topbar: row 1 stats, row 2 cycle pill + mute + speeds */
  #topbar { gap: 6px 8px; padding: 6px 12px 8px; }
  #topbar strong { display: none; }
  #topbar::before { content: ""; order: 5; flex-basis: 100%; height: 0; }
  #day { order: 1; font-size: .8rem; padding: 3px 9px; }
  .stat { order: 2; flex: 1 1 auto; min-width: 0; }
  .stat small { font-size: .56rem; letter-spacing: .1em; }
  .stat b { font-size: .92rem; white-space: nowrap; }
  #cycle { order: 6; flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; padding: 3px 9px; }
  #mute { order: 7; padding: 3px 8px; margin-left: auto; }
  .speeds { order: 8; gap: 3px; }
  .speeds button { padding: 3px 8px; font-size: .85rem; }
  .ticker { min-height: 32px; }
  #feedtxt { font-size: .85rem; }
  /* map: full bleed, 140% wide and pannable sideways; Antarctica cropped */
  body:not(.attract) #mapscroll { display: block; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  body:not(.attract) #mapbox { width: 140%; aspect-ratio: 960 / 440; overflow: hidden; }
  body:not(.attract) #mapbox svg, body:not(.attract) #mapbox canvas, body:not(.attract) #bubbles { height: calc(100% * 500 / 440); bottom: auto; }
  /* deploy bar sits under the map instead of covering it */
  #deploybar { position: static; transform: none; animation: none; margin: 0; max-width: none; justify-content: space-between; border-radius: 0; border-width: 2px 0 0; padding: 4px 8px 4px 12px; font-size: .8rem; box-shadow: none; }
  #deploy-msg { white-space: normal; line-height: 1.2; }
  #rtoast { bottom: 6px; font-size: .8rem; padding: 5px 12px; }
  #open-roadmap { padding: 9px; }
  #reps-help { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  /* notices: compact strip at the bottom */
  #notice { bottom: 8px; gap: 8px; padding: 7px 12px 7px 8px; max-width: calc(100vw - 16px); }
  #notice .nt-tag { font-size: .62rem; padding: 4px 6px; }
  #notice .nt-title { font-size: .9rem; }
  #notice .nt-text { font-size: .78rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  #notice[data-kind="cycle"] { flex-direction: row; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; max-width: calc(100vw - 16px); }
  #notice[data-kind="cycle"] .nt-title { font-size: 1.05rem; }
  #notice[data-kind="cycle"] .nt-text { font-size: .78rem; }
  /* Strategic Investments */
  #roadmap { padding: 8px 10px; gap: 8px; }
  .rm-head { gap: 4px 12px; }
  .rm-head h2 { font-size: 1.1rem; flex: 1 1 auto; }
  .rm-head .x { order: 2; margin-left: 0; }
  .rm-hype b { font-size: 1.6rem; }
  .rm-hype span { font-size: .8rem; }
  .rm-sub { order: 3; flex-basis: 100%; gap: 10px; font-size: .8rem; }
  .rm-hint { display: none; }
  .tabs { gap: 4px; }
  .tabs button { font-size: .62rem; padding: 6px 2px; line-height: 1.15; letter-spacing: 0; }
  #trees { padding: 2px; }
  #trees.compact .tile { padding: 5px 6px; gap: 2px; border-radius: 8px; }
  #trees.compact .tile.afford { padding: 4px 5px; }
  #trees.compact .tile .nm { font-size: .75rem; line-height: 1.15; }
  #trees.compact .tile .cost { font-size: .62rem; padding: 0 5px; }
  #trees.compact .tile .cost::after { content: ""; }
  #trees.compact .tile em { font-size: .8rem; }
  #trees.compact .tile .rq { display: none; }
  #rm-detail { padding: 8px 12px 12px; margin: 0 -10px -8px; gap: 2px; font-size: .88rem; }
  #rm-detail h3 { font-size: 1rem; }
  #rm-detail .ship-btn { padding: 10px; font-size: 1rem; margin-top: 4px; }
  /* ending: keep the LinkedIn button near the top */
  #ending:not([hidden]) { gap: 8px; }
  .days { font-size: clamp(3rem, 15vw, 4.5rem); margin: 0; }
  .hero { padding: 0; }
  .hero .stamp { font-size: 1.15rem; margin: 8px 0 6px; }
  #e-title { font-size: 1.3rem; }
  .rank { margin: 2px 0 4px; padding: 3px 14px; font-size: .9rem; }
  .tag { font-size: .9rem; margin-bottom: 0; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
  .stats dt { font-size: 1.05rem; }
  .stats dd { font-size: .6rem; }
  .preview { max-height: 5em; }
}
@media (max-width: 860px) {
  /* phones: region card sits in the flow right under the map; notices drop over the ticker, clear of the controls */
  #region.sheet { position: static; order: -1; max-height: none; border-radius: 14px; z-index: auto; }
  #notice { top: 92px; bottom: auto; transform: translate(-50%, -20px) scale(.96); }
  #notice.show { transform: translate(-50%, 0); }
}
