:root {
  --bg: #0B1140; --panel: #121A55; --panel2: #18226A; --line: #2A3580;
  --ink: #F4F7FB; --muted: #9FB0C8; --teal: #3FAEA7; --teal2: #7FD6CF;
  --amber: #F2B23A; --red: #E5634D; --navy: #161E6F;
  --t: 300ms;
}
@media (prefers-reduced-motion: reduce) { :root { --t: 0ms; } }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #05082A; overflow: hidden; }
body { font-family: 'Fira Sans', Arial, sans-serif; color: var(--ink); }
.num { font-family: 'Fira Code', monospace; font-variant-numeric: tabular-nums; }
button, select { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--teal2); outline-offset: 2px; }
kbd { font-family: 'Fira Code', monospace; font-size: 12px; border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; margin-left: 6px; opacity: .7; }

/* Fixed 16:9 stage, scaled to the viewport by app.js (letterboxed). */
.stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0;
  background: var(--bg); padding: 28px 40px 26px; display: flex; flex-direction: column; gap: 18px; }

.hdr { display: grid; grid-template-columns: 1fr auto auto; gap: 28px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.title { font-size: 32px; font-weight: 600; letter-spacing: .2px; }
.sub { font-size: 16px; color: var(--muted); margin-top: 4px; }
.tabs { display: flex; gap: 4px; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font-size: 17px; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--teal); }
.hdr-right { display: flex; align-items: center; gap: 22px; }
.live-dot { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px var(--teal); transition: background var(--t); }
.live-dot.off .dot { background: #4A5590; box-shadow: none; }
.seg { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.seg button { background: none; border: 0; padding: 9px 20px; font-size: 17px; color: var(--muted); border-radius: 7px; transition: background var(--t), color var(--t); }
.seg button[aria-checked="true"] { background: var(--teal); color: #06212A; font-weight: 600; }

.tab { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 18px; }
.tab[hidden] { display: none; }

/* Live */
.main { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 150px 1fr; }
.card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 24px; display: flex; flex-direction: column; min-height: 0; }
.card.ship { background: linear-gradient(180deg, #1B2A78 0%, #16226A 58%, #0E3F5C 58%, #0B2E45 100%); }
.card.twin { background: linear-gradient(rgba(127,214,207,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(127,214,207,.07) 1px, transparent 1px), var(--panel2); background-size: 24px 24px; }
.k { font-size: 14px; letter-spacing: 2.6px; font-weight: 600; color: var(--teal2); text-transform: uppercase; display: flex; justify-content: space-between; align-items: baseline; }
.k em { font-style: normal; color: var(--muted); letter-spacing: .4px; text-transform: none; font-weight: 400; font-size: 14px; }
.k.muted { color: var(--muted); }
.svgwrap { flex: 1; min-height: 0; display: flex; align-items: center; }
.svgwrap svg { width: 100%; height: 100%; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.m { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; }
.m .l { font-size: 15px; color: var(--muted); }
.m .v { font-size: 44px; font-weight: 600; line-height: 1.12; }
.m .u { font-size: 16px; color: var(--muted); margin-left: 6px; }
.mcr-note { position: absolute; top: 52px; left: 24px; right: 24px; background: rgba(229,99,77,.18); border: 1px solid var(--red); color: var(--ink); border-radius: 8px; padding: 6px 12px; font-size: 15px; }
.link { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 26px; }
.arrow { width: 120px; text-align: center; font-size: 15px; color: #4A5590; transition: color var(--t); }
.arrow svg { display: block; margin: 0 auto 4px; }
.arrow path { stroke: #3A4790; transition: stroke var(--t); }
.arrow.on { color: var(--teal2); }
.arrow.on path { stroke: var(--teal2); }
.arrow.off path { stroke-dasharray: 6 6; }
.link-note { width: 136px; font-size: 14px; color: var(--muted); text-align: center; line-height: 1.35; }
.rec[hidden], .mcr-note[hidden] { display: none; }
.rec { position: absolute; left: 24px; right: 24px; bottom: 116px; background: rgba(11,17,64,.92); border: 1.5px solid var(--teal); border-radius: 10px; padding: 10px 14px; display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; align-items: center; }
.rec-k { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--teal2); font-weight: 600; grid-column: 1; }
.rec-t { font-size: 20px; grid-column: 1; }
.rec .btn { grid-column: 2; grid-row: 1 / span 2; }

.bottom { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; height: 168px; }
.gap { background: var(--panel); border: 1px solid var(--line); border-left: 6px solid #3A4790; border-radius: 12px; padding: 14px 20px; display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: center; transition: border-color var(--t); }
.gap.alert { border-left-color: var(--amber); }
.gap-k { font-size: 14px; letter-spacing: 2.4px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.gap.alert .gap-k, .gap.alert .gap-big { color: var(--amber); }
.gap-big { font-size: 54px; font-weight: 600; color: var(--ink); transition: color var(--t); }
.gap-s { font-size: 15px; color: var(--muted); }
.gap-chart svg { width: 100%; height: 86px; display: block; }
.gap-q { font-size: 17px; line-height: 1.35; margin-top: 4px; }
.gap-q b { color: var(--amber); }
.cii { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 20px; }
.band { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 12px; }
.band div { height: 44px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 20px; color: #06212A; opacity: .38; transition: opacity var(--t), outline-color var(--t); outline: 3px solid transparent; outline-offset: 2px; }
.band [data-r="A"] { background: #3FAEA7; } .band [data-r="B"] { background: #8FD0C5; } .band [data-r="C"] { background: #E8EDF5; }
.band [data-r="D"] { background: var(--amber); } .band [data-r="E"] { background: var(--red); }
.band .cur { opacity: 1; outline-color: #fff; }
.cii-s { font-size: 15px; color: var(--muted); margin-top: 12px; }
.cii-s b { color: var(--ink); font-family: 'Fira Code', monospace; }

.controls { display: grid; grid-template-columns: 1fr 1.25fr 1fr 1fr 430px; gap: 26px; align-items: start; border-top: 1px solid var(--line); padding-top: 14px; height: 138px; }
.ctl { display: flex; flex-direction: column; gap: 10px; }
.ctl .l { display: flex; justify-content: space-between; font-size: 16px; color: var(--muted); }
.ctl .l b { color: var(--ink); font-size: 18px; }
.ctl .scope { font-size: 13px; color: var(--muted); line-height: 1.3; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--teal) var(--p, 50%), var(--line) var(--p, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -8px; border-radius: 50%; background: #fff; border: 3px solid var(--teal); }
input[type=range]::-moz-range-track { height: 8px; border-radius: 4px; background: var(--line); }
input[type=range]::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--teal); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--teal); }
.mini-seg { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.mini-seg button { flex: 1; background: none; border: 0; padding: 5px 6px; font-size: 14px; color: var(--muted); border-radius: 6px; }
.mini-seg button[aria-checked="true"] { background: var(--panel2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--teal); }
.ctl-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ctl-btns .wide { grid-column: 1 / span 2; }
.ctl-btns select { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 14px; color: var(--muted); }
.btn { background: none; border: 1.5px solid var(--line); color: var(--ink); border-radius: 10px; padding: 8px 12px; font-size: 15px; font-weight: 600; }
.btn.primary { border-color: var(--teal); color: var(--teal2); }
.btn.ghost { color: var(--muted); }
.btn.small { padding: 7px 12px; border-color: var(--teal); color: var(--teal2); }
.btn[disabled] { opacity: .35; cursor: default; }

/* Savings / Year / How */
.pane-title { font-size: 26px; font-weight: 600; }
.pane-sub { font-size: 17px; color: var(--muted); margin-top: 6px; }
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.sv { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px 26px; }
.sv .r { font-size: 14px; letter-spacing: 2.4px; color: var(--teal2); font-weight: 600; text-transform: uppercase; }
.sv .t { font-size: 26px; font-weight: 600; margin: 6px 0 16px; }
.sv .big { font-size: 88px; font-weight: 600; line-height: 1; }
.sv .lab { font-size: 16px; color: var(--muted); margin-top: 6px; }
.sv .small { font-size: 40px; font-weight: 600; color: var(--teal2); margin-top: 22px; }
.yp { display: grid; grid-template-columns: 1fr 380px; gap: 22px; flex: 1; min-height: 0; }
.yp-chart { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; min-height: 0; }
.yp-chart svg { width: 100%; height: 100%; }
.yp-side { display: flex; flex-direction: column; gap: 12px; }
.plan { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; display: grid; grid-template-columns: 1fr 64px; gap: 4px 12px; }
.plan .n { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.plan .sw { width: 26px; height: 4px; border-radius: 2px; display: inline-block; }
.plan .d { font-size: 14px; color: var(--muted); }
.plan .d b { color: var(--ink); font-family: 'Fira Code', monospace; font-weight: 500; }
.plan .rt { grid-column: 2; grid-row: 1 / span 2; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 700; color: #06212A; }
.econ { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; font-size: 14px; color: var(--muted); display: grid; grid-template-columns: 1fr 110px; gap: 6px 10px; align-items: center; }
.econ input { background: var(--bg); border: 1px solid var(--line); color: var(--ink); border-radius: 6px; padding: 4px 6px; font: 14px 'Fira Code', monospace; width: 100%; }
.how { overflow: auto; columns: 2; column-gap: 40px; font-size: 16px; line-height: 1.5; color: #DCE3EE; padding-right: 8px; }
.how h3 { font-size: 18px; color: var(--teal2); margin: 14px 0 4px; break-after: avoid; }
.how .f { font-family: 'Fira Code', monospace; font-size: 15px; color: var(--ink); background: rgba(255,255,255,.04); border-left: 3px solid var(--teal); padding: 6px 10px; margin: 6px 0; break-inside: avoid; }
.how .src { color: var(--muted); font-size: 14px; }
.how table { border-collapse: collapse; font-size: 15px; break-inside: avoid; }
.how td { padding: 3px 14px 3px 0; border-bottom: 1px solid var(--line); }
