:root {
  --bg: #0A1424;
  --bg-2: #0C1729;
  --card: #0F1C2E;
  --card-2: #132438;
  --line: #22344A;
  --line-2: #1B2A3E;
  --text: #EAF0F7;
  --text-2: #C9D3DF;
  --muted: #A3B1C2;
  --accent: #4CC9F0;
  --accent-ink: #06121F;
  --green: #4ADE80;
  --green-bg: #0E2A1E;
  --amber: #F5A524;
  --amber-bg: #2A1E0A;
  --red: #F05454;
  --blue: #5AB4FF;
  --radius: 16px;
  --sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
a { color: var(--accent); }
button { font-family: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
h1, h2, h3 { margin: 0; letter-spacing: -0.2px; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { flex: 0 0 220px; border-right: 1px solid var(--line-2); padding: 22px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.main-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.view { flex: 1 1 auto; padding: 22px 24px 28px; max-width: 1180px; width: 100%; margin: 0 auto; outline: none; }
.topbar { display: none; }
.tabbar { display: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; border-bottom: 1px solid var(--line-2); margin-bottom: 10px; text-decoration: none; color: var(--text); }
.brand-name { font-size: 20px; font-weight: 800; }
.brand-name b { color: var(--accent); font-weight: 800; }
.brand-sub { font-family: var(--mono); font-size: 10.5px; color: var(--muted); letter-spacing: .6px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-size: 14.5px; font-weight: 500; }
.nav-link:hover { background: #0F2133; }
.nav-link.active { background: #12283B; color: var(--text); font-weight: 600; }
.nav-link.active svg { stroke: var(--accent); }
.nav-sep { height: 1px; background: var(--line-2); margin: 10px 0; }
.nav-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 6px; }
.label-cap { font-size: 11px; font-weight: 600; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.seg { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.seg button { flex: 1 1 0; min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; padding: 0 10px; }
.seg button[aria-pressed="true"] { background: var(--line); color: var(--text); font-weight: 700; }

@media (max-width: 899px) {
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 8px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; border-top: 1px solid var(--line-2); background: rgba(12, 23, 41, .96); backdrop-filter: blur(10px); padding: 6px 4px calc(8px + var(--safe-b)); }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 52px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; }
  .tab.active { color: var(--accent); font-weight: 700; }
  .tab.active svg { stroke: var(--accent); }
  .view { padding: 4px 16px calc(96px + var(--safe-b)); }
  .brand { border: 0; padding: 0; margin: 0; }
  .brand-name { font-size: 18px; }
}

/* ---------- cards & common ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 0 22px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); color: var(--text); font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: #33506F; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
.chip { display: inline-flex; align-items: center; font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 7px; border: 1.5px solid var(--green); color: var(--green); }
.chip-muted { border-color: var(--line); color: var(--muted); }
.grid { display: grid; gap: 12px; }
.row { display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; margin: 0 0 12px; }
.section-title .muted { font-weight: 500; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; min-height: 40px; }
.progress { height: 6px; border-radius: 3px; background: #232C37; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: #1D3046; color: var(--text); padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* ---------- home ---------- */
.hero { position: relative; height: 286px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: #12305A; }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 70% 50%; }
.hero::after { content: ''; position: absolute; inset: 0 38% 0 0; background: linear-gradient(90deg, rgba(8,22,46,.72), rgba(8,22,46,.35) 60%, rgba(8,22,46,0)); }
.hero-text { position: relative; z-index: 1; padding: 36px 30px; display: flex; flex-direction: column; gap: 10px; }
.hero-title { display: flex; align-items: center; gap: 14px; }
.hero-title::before { content: ''; width: 5px; height: 38px; border-radius: 3px; background: var(--accent); }
.hero h1 { font-size: 42px; font-weight: 800; color: #fff; }
.hero p { margin: 0 0 0 19px; font-size: 18px; font-weight: 500; color: #E3EAF3; }
.home-row { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; }
.journey { display: flex; flex-direction: column; gap: 16px; }
.journey-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.journey-head h2 { font-size: 19px; }
.journey-head p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.journey-body { display: flex; gap: 18px; }
.timeline { flex: 1 1 0; margin: 0; padding: 0; list-style: none; }
.timeline li { display: flex; gap: 14px; }
.timeline .rail { flex: 0 0 18px; display: flex; flex-direction: column; align-items: center; }
.timeline .dot { width: 16px; height: 16px; border-radius: 9px; border: 2px solid #8C9BAE; margin-top: 3px; flex: 0 0 auto; }
.timeline .dot.done { background: var(--green); border-color: var(--green); }
.timeline .bar { flex: 1 1 auto; width: 2px; background: #33465E; min-height: 14px; }
.timeline a { font-size: 15px; color: #DDE5EE; text-decoration: none; padding-bottom: 14px; min-height: 30px; }
.timeline a:hover { color: var(--accent); }
.mini-diagram { flex: 0 0 210px; border-left: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.journey-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: auto; flex-wrap: wrap; }
.modes-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode-card { text-align: left; background: var(--card-2); border: 1px solid #2A3E57; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; color: var(--text); text-decoration: none; min-height: 120px; }
.mode-card:hover { border-color: var(--accent); }
.mode-card strong { font-size: 16px; }
.mode-card span { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.systems-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.sys { min-height: 56px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.sys .code { font-size: 12.5px; font-weight: 700; }
.sys .name { font-size: 13px; color: #B7C3D1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys svg { flex: 0 0 24px; stroke: var(--text-2); }
.sys.on { border: 1.5px solid var(--green); background: var(--green-bg); }
.sys.on .code { color: var(--green); }
.sys.on .name { color: var(--text); font-weight: 600; }
.sys.on svg { stroke: var(--green); }
.sys.off { opacity: .85; cursor: default; }
.footer-note { border-top: 1px solid var(--line-2); padding-top: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: var(--muted); text-align: center; }
@media (max-width: 1100px) { .systems-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 899px) {
  .home-row { grid-template-columns: 1fr; }
  .hero { height: 210px; }
  .hero img { object-position: 85% 100%; }
  .hero::after { inset: 0 0 35% 0; background: linear-gradient(180deg, rgba(8,22,46,.88) 0%, rgba(8,22,46,.6) 55%, rgba(8,22,46,0) 100%); }
  .hero-text { padding: 18px; }
  .hero h1 { font-size: 28px; }
  .hero-title::before { height: 28px; width: 4px; }
  .hero p { font-size: 14px; margin-left: 14px; }
  .mini-diagram { display: none; }
  .systems-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .journey-foot .btn { width: 100%; }
}

/* ---------- topic ---------- */
.topic-head { display: flex; flex-direction: column; gap: 8px; }
.topic-head h1 { font-size: 30px; font-weight: 800; }
.refs { display: flex; flex-wrap: wrap; gap: 6px; }
.layer { display: flex; flex-direction: column; gap: 10px; }
.layer h3 { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.hook-q { font-size: 22px; font-weight: 700; line-height: 1.3; }
.hook-a { font-size: 16.5px; line-height: 1.55; color: var(--text-2); }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 460px; }
.tbl th { text-align: left; font-size: 12.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); background: var(--card-2); padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; line-height: 1.45; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:first-child { font-weight: 600; }
.analogy { font-size: 16px; line-height: 1.6; color: var(--text-2); }
.limits { font-size: 14.5px; line-height: 1.5; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; }
.remember { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.remember li { display: flex; gap: 12px; font-size: 15.5px; line-height: 1.5; }
.remember li::before { content: ''; flex: 0 0 8px; height: 8px; border-radius: 4px; background: var(--accent); margin-top: 8px; }
.notes { font-size: 14px; line-height: 1.5; color: #F2D29B; background: var(--amber-bg); border: 1px solid #5A4216; border-radius: 12px; padding: 12px 14px; }
.original { font-family: var(--mono); font-size: 13px; line-height: 1.6; white-space: pre-wrap; color: var(--text-2); background: #0B1626; border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; }
.original-title { font-size: 12px; color: var(--muted); font-family: var(--mono); margin: 12px 0 6px; }
.topic-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.scenario-list { display: flex; flex-direction: column; gap: 8px; }
.scenario-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); text-decoration: none; color: var(--text); font-size: 15px; }
.scenario-item:hover { border-color: var(--accent); }
.topic-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------- flashcards ---------- */
.fc-wrap { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.fc-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.fc-card { min-height: 280px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); padding: 28px; display: flex; flex-direction: column; justify-content: center; gap: 16px; cursor: pointer; text-align: left; width: 100%; }
.fc-q { font-size: 22px; font-weight: 700; line-height: 1.35; }
.fc-a { font-size: 18px; line-height: 1.5; color: var(--text-2); border-top: 1px solid var(--line); padding-top: 16px; }
.fc-hint { color: var(--muted); font-size: 13px; }
.grades { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.grade { min-height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 15px; font-weight: 700; }
.grade small { font-size: 11px; color: var(--muted); font-weight: 500; }
.grade.g1 { border-color: #6B2B2B; } .grade.g4 { border-color: #1F5A3A; }
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; color: var(--muted); }

/* ---------- quiz ---------- */
.quiz-wrap { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.quiz-q { font-size: 21px; font-weight: 700; line-height: 1.4; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { text-align: left; min-height: 54px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 16px; line-height: 1.4; cursor: pointer; display: flex; gap: 12px; align-items: center; }
.opt:hover:not([disabled]) { border-color: var(--accent); }
.opt .k { font-family: var(--mono); font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }
.opt.correct { border-color: var(--green); background: var(--green-bg); }
.opt.wrong { border-color: var(--red); background: #2A1212; }
.explain { border-radius: 12px; padding: 14px 16px; font-size: 15.5px; line-height: 1.55; background: var(--card-2); border: 1px solid var(--line); }
.explain strong { display: block; margin-bottom: 4px; }
.score { font-size: 48px; font-weight: 800; }

/* ---------- what if ---------- */
.wi { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.wi-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.wi-status { display: flex; flex-direction: column; gap: 10px; }
.wi-left, .wi-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel { background: #7F98AE; border-radius: 14px; padding: 14px; color: #0D1B2A; box-shadow: inset 0 0 0 2px #6C849A; }
.panel-title { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; letter-spacing: 1px; color: #0D1B2A; margin-bottom: 8px; }
.panel-grid { display: grid; gap: 10px 8px; }
.pb-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pb-label { font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-align: center; min-height: 14px; color: #0D1B2A; }
.pb { width: 58px; height: 58px; border-radius: 6px; border: 2px solid #3E4E5E; background: #26313C; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; padding: 4px; cursor: pointer; box-shadow: 0 2px 0 #1A232C; }
.pb:active { transform: translateY(1px); box-shadow: none; }
.pb .leg { font-family: var(--mono); font-size: 10.5px; font-weight: 700; line-height: 1; min-height: 12px; padding: 1px 3px; border-radius: 2px; color: #4D5A66; }
.pb .leg.box { border: 1px solid #5B6874; }
.pb .leg.amber { color: var(--amber); }
.pb .leg.white { color: #F4F7FA; border-color: #F4F7FA; }
.pb .leg.green { color: var(--green); }
.pb .leg.blue { color: var(--blue); border-color: var(--blue); }
.pb .leg.red { color: var(--red); }
.pb.guard { box-shadow: 0 0 0 3px #C4473F; }
.light { width: 58px; height: 34px; border-radius: 5px; background: #26313C; border: 2px solid #3E4E5E; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: #4D5A66; }
.light.red { color: var(--red); }
.conds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); font-size: 14px; cursor: pointer; text-align: left; }
.toggle .sw { flex: 0 0 38px; height: 22px; border-radius: 11px; background: #2A3A4E; position: relative; }
.toggle .sw::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 8px; background: #8C9BAE; transition: .15s; }
.toggle[aria-pressed="true"] .sw { background: #1F5A3A; }
.toggle[aria-pressed="true"] .sw::after { left: 19px; background: var(--green); }
.toggle.fail[aria-pressed="true"] .sw { background: #5A2020; }
.toggle.fail[aria-pressed="true"] .sw::after { background: var(--red); }
.ecam { background: #050A10; border: 1px solid #1B2A3E; border-radius: 12px; padding: 14px; font-family: var(--mono); font-size: 14px; display: flex; flex-direction: column; gap: 6px; min-height: 64px; }
.ecam .warning { color: var(--red); font-weight: 700; }
.ecam .caution { color: var(--amber); font-weight: 700; }
.ecam .ok { color: var(--green); }
.wi-notes { display: flex; flex-direction: column; gap: 8px; }
.wi-notes div { font-size: 13.5px; line-height: 1.5; color: #F2D29B; background: var(--amber-bg); border: 1px solid #5A4216; border-radius: 10px; padding: 10px 12px; }
.schematic { background: #050A10; border: 1px solid #1B2A3E; border-radius: 14px; padding: 10px; }
.schematic svg { width: 100%; height: auto; display: block; }
.node { cursor: pointer; }
.bus-info { font-size: 14px; line-height: 1.5; padding: 12px 14px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); min-height: 48px; }
.preset-select { min-height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); color: var(--text); padding: 0 12px; font-family: inherit; font-size: 14px; width: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .l-on::before { background: var(--green); } .legend .l-off::before { background: var(--amber); }
.legend .l-unk::before { background: transparent; border: 1.5px dashed #7D8896; } .legend .l-ina::before { background: #0D141D; border: 1.5px solid #3A4656; }
.legend .l-kc::before { background: var(--green); border-radius: 50%; } .legend .l-ko::before { background: #050A10; border: 1.5px solid #8C9BAE; border-radius: 50%; }
.legend .l-arr::before { width: 16px; height: 3px; border-radius: 0; background: var(--green); vertical-align: 3px; }
.main-sum { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13.5px; }
.main-sum .ok { color: var(--green); font-family: var(--mono); } .main-sum .caution { color: var(--amber); font-family: var(--mono); } .main-sum .unk { color: #9AA6B4; font-family: var(--mono); }
.k-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.k-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 46px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); color: var(--text); font-size: 13.5px; text-align: left; cursor: pointer; }
.k-item:hover { border-color: var(--accent); }
.kstate { flex: 0 0 auto; font-family: var(--mono); font-size: 11.5px; font-weight: 700; padding: 0; border-radius: 0; pointer-events: none; }
.kstate::before { content: '● '; }
.kstate.kc { color: var(--green); } .kstate.ko { color: #A3B1C2; } .kstate.ko::before { content: '○ '; } .kstate.ku { color: #7D8896; } .kstate.ku::before { content: '◌ '; }
.k-detail { font-size: 14px; line-height: 1.5; }
@media (max-width: 700px) { .k-list { grid-template-columns: 1fr; } }
@media (max-width: 1050px) { .wi, .wi-top { grid-template-columns: 1fr; } }
@media (max-width: 520px) {
  .pb { width: 50px; height: 50px; } .light { width: 50px; }
  .conds { grid-template-columns: 1fr; }
  .grades .grade { font-size: 14px; }
  .fc-card { padding: 20px; min-height: 240px; } .fc-q { font-size: 19px; }
  .topic-head h1 { font-size: 24px; } .hook-q { font-size: 19px; }
}

/* ---------- settings ---------- */
.form-row { display: flex; flex-direction: column; gap: 8px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 14.5px; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .schematic { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 6px; }
  .schematic.zoom svg { min-width: 860px; }
  .sch-zoom { display: inline-flex !important; }
}
.sch-zoom { display: none; gap: 6px; margin: 0 0 8px; }
.sch-zoom button { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid #2A3A50; background: #0D141D; color: #CFD8E3; }
.sch-zoom button[aria-pressed="true"] { background: #1B2A3E; color: #fff; border-color: #4ADE80; }
@media (max-width: 640px) {
  table.tbl { min-width: 0; }
  table.tbl thead { display: none; }
  table.tbl, table.tbl tbody, table.tbl tr, table.tbl td { display: block; width: 100%; }
  table.tbl tr { border: 1px solid #1B2A3E; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: #0B1220; }
  table.tbl td { border: 0 !important; padding: 3px 0 !important; }
  table.tbl td::before { content: attr(data-label); display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #7D8896; margin-bottom: 1px; }
  table.tbl td:first-child { font-weight: 700; font-size: 16px; }
  table.tbl td:first-child::before { display: none; }
  .tbl-wrap { overflow: visible; border: 0; background: none; }
}

/* What-if: diagram always fits the screen height; on screens with the sidebar (>= 900px) the controls open
   as a drawer from the left, over the sidebar, and the content shifts right so the schematic stays visible. */
.wi-ctrl-head, .sb-ctrl { display: none; }
@media (min-width: 701px) {
  .schematic svg { max-height: calc(100dvh - 150px); width: auto; max-width: 100%; margin: 0 auto; }
}
@media (min-width: 900px) {
  .sb-ctrl { display: flex; align-items: center; gap: 10px; width: 100%; margin-bottom: 14px; padding: 12px 14px; border-radius: 12px; border: 0; cursor: pointer;
    background: #4ADE80; color: #04140A; font: inherit; font-size: 15px; font-weight: 700; text-align: left; }
  .sb-ctrl svg { width: 20px; height: 20px; flex: 0 0 auto; }
  .wi-ctrl { position: fixed; top: 0; left: 0; bottom: 0; width: 420px; z-index: 55; overflow-y: auto; -webkit-overflow-scrolling: touch;
    background: rgba(8, 13, 21, .98); border-right: 1px solid #1B2A3E; padding: 16px 16px 40px; transform: translateX(-105%); transition: transform .22s ease;
    display: flex; flex-direction: column; gap: 14px; box-shadow: 12px 0 30px rgba(0,0,0,.4); }
  .wi-ctrl.open { transform: none; }
  .wi-ctrl-head { display: flex; justify-content: space-between; align-items: center; }
  .wi-ctrl .wi, .wi-ctrl .wi-top { grid-template-columns: 1fr; }
  .wi-ctrl .conds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-col { transition: margin-left .22s ease; }
  body.ctrl-open .main-col { margin-left: 200px; }   /* 420 drawer - 220 sidebar */
}
