:root {
  --ink: #fff7ec;
  --muted: #c1ad99;
  --panel: rgba(23, 14, 13, 0.94);
  --line: rgba(255, 218, 173, 0.17);
  --gold: #ffd166;
  --orange: #ff8d4d;
  --red: #ff5f5f;
  --blue: #64c9ff;
  --violet: #a892ff;
  --success: #78e7a4;
  --warning: #ffd07c;
  --danger: #ff9393;
  --shadow: 0 24px 64px rgba(0,0,0,.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: #080405; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 13%, rgba(255, 105, 64, .12), transparent 29rem),
    radial-gradient(circle at 88% 18%, rgba(100, 201, 255, .11), transparent 32rem),
    linear-gradient(180deg, #080405, #120908 50%, #060304 100%);
  overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .48;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.7) 0 1px, transparent 1.2px),
    radial-gradient(circle, rgba(255,184,105,.55) 0 1px, transparent 1.2px);
  background-size: 103px 103px, 151px 151px; background-position: 0 0, 43px 31px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}
button, select, input, textarea { font: inherit; }
button, select, input[type="range"], input[type="checkbox"] { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(255,209,102,.85); outline-offset: 3px; }
button:disabled { opacity: .46; cursor: not-allowed; }
.site-header {
  position: sticky; top: 0; z-index: 30; min-height: 78px; display: grid;
  grid-template-columns: minmax(220px,1fr) auto minmax(220px,1fr); align-items: center; gap: 18px;
  padding: 12px 22px; background: rgba(10,5,6,.88); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px);
}
.brand { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 12px; width: max-content; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; position: relative; overflow: hidden;
  background: linear-gradient(145deg, var(--gold), var(--orange) 56%, #9d3d4a); box-shadow: 0 10px 28px rgba(255,133,70,.24);
  font-weight: 900; letter-spacing: -5px; padding-right: 5px;
}
.brand-mark::after { content: ""; position: absolute; inset: 3px; border: 1px solid rgba(255,255,255,.35); border-radius: 10px; }
.brand-mark span:last-child { opacity: .62; }
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-size: 1.02rem; }
.brand-copy small { margin-top: 5px; color: var(--muted); font-size: .72rem; }
.header-title { text-align: center; }
.header-title h1 { margin: 2px 0 0; font-size: clamp(1.1rem, 2vw, 1.55rem); letter-spacing: -.02em; }
.eyebrow, .panel-kicker { color: var(--gold); font-size: .72rem; font-weight: 850; text-transform: uppercase; letter-spacing: .14em; }
.header-actions { display: flex; justify-content: flex-end; gap: 9px; }

.ghost-button, .secondary-button, .primary-button, .icon-button, .text-button, .preset-button {
  border-radius: 11px; min-height: 42px; font-weight: 800; transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.ghost-button, .secondary-button { color: var(--ink); background: rgba(255,218,173,.06); border: 1px solid rgba(255,218,173,.2); padding: 10px 14px; }
.ghost-button:hover, .secondary-button:hover { background: rgba(255,209,102,.11); border-color: rgba(255,209,102,.4); transform: translateY(-1px); }
.primary-button { border: 0; color: #241007; background: linear-gradient(135deg, #ffdc7d, #ff9d55); padding: 11px 16px; box-shadow: 0 10px 24px rgba(255,135,70,.18); }
.primary-button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.icon-button { width: 42px; padding: 0; color: var(--ink); background: rgba(255,255,255,.05); border: 1px solid var(--line); font-size: 1.2rem; }
.text-button { color: var(--gold); background: transparent; border: 0; padding: 8px 10px; }
.full-width { width: 100%; }
.button-stack { display: grid; gap: 9px; }
.button-row { display: flex; align-items: center; gap: 8px; }
.small-buttons button { min-height: 38px; }

.app-shell {
  position: relative; z-index: 1; display: grid; grid-template-columns: 288px minmax(650px,1fr) 290px; align-items: start; gap: 16px;
  max-width: 1920px; margin: 0 auto; padding: 16px;
}
.panel, .display-card { border: 1px solid var(--line); background: linear-gradient(180deg, rgba(28,17,16,.93), rgba(13,8,10,.95)); box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.panel { border-radius: 18px; overflow: hidden; }
.controls-panel, .notebook-panel { position: sticky; top: 94px; max-height: calc(100vh - 110px); overflow: auto; }
.panel-heading, .card-heading, .section-title-row, .workspace-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-heading { padding: 18px; border-bottom: 1px solid var(--line); }
.panel-heading h2, .workspace-toolbar h2, .card-heading h3 { margin: 3px 0 0; }
.panel-heading h2 { font-size: 1.12rem; }
h2,h3,h4,p { margin-top: 0; }
.control-section { padding: 17px 18px; border-bottom: 1px solid var(--line); }
.control-section h3 { margin-bottom: 11px; font-size: .94rem; }
.compact-section p { margin-bottom: 12px; }
.standards-card { background: linear-gradient(135deg, rgba(255,209,102,.08), rgba(255,95,95,.06)); }
.standards-card p, .support-copy { color: var(--muted); line-height: 1.52; font-size: .82rem; margin-bottom: 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink); }
.switch-row span { display: grid; }
.switch-row small { color: var(--muted); margin-top: 4px; line-height: 1.35; }
.switch-row input { appearance: none; width: 48px; height: 26px; border-radius: 999px; background: #3a2b29; border: 1px solid var(--line); position: relative; flex: 0 0 auto; }
.switch-row input::after { content:""; position:absolute; width:18px; height:18px; border-radius:50%; top:3px; left:4px; background:#f5e3ce; transition:left .16s ease; }
.switch-row input:checked { background: rgba(255,209,102,.28); border-color: var(--gold); }
.switch-row input:checked::after { left:24px; background:var(--gold); }
.info-dot { width:32px; height:32px; border-radius:50%; border:1px solid rgba(255,209,102,.35); color:var(--gold); background:rgba(255,209,102,.07); font-weight:900; }
.range-label { display:flex; justify-content:space-between; align-items:center; gap:12px; color:var(--muted); font-size:.8rem; font-weight:800; }
.range-label output { color:var(--gold); font-variant-numeric:tabular-nums; }
input[type="range"] { width:100%; margin:12px 0 15px; accent-color:var(--orange); }
.stage-range { margin-top:16px; }
.preset-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:7px; }
.preset-button { min-height:68px; padding:8px; color:var(--ink); background:rgba(255,255,255,.025); border:1px solid var(--line); display:grid; gap:3px; }
.preset-button small { color:var(--muted); }
.preset-button.active { background:rgba(255,209,102,.1); border-color:rgba(255,209,102,.45); }
.progress-track { height:9px; border-radius:999px; background:rgba(255,255,255,.07); overflow:hidden; }
.progress-track span { display:block; height:100%; width:0; background:linear-gradient(90deg,var(--gold),var(--orange),var(--red)); border-radius:inherit; transition:width .3s ease; }
.progress-copy { color:var(--muted); font-size:.8rem; line-height:1.45; margin:10px 0 0; }

.workspace { min-width:0; }
.workspace-toolbar { min-height:74px; padding:15px 18px; margin-bottom:14px; border:1px solid var(--line); border-radius:17px; background:rgba(18,10,10,.84); box-shadow:var(--shadow); }
.status-pill { display:inline-flex; align-items:center; gap:8px; border-radius:999px; padding:8px 12px; color:var(--muted); background:rgba(255,255,255,.04); border:1px solid var(--line); font-size:.78rem; }
.status-dot { width:8px; height:8px; border-radius:50%; background:var(--success); box-shadow:0 0 12px var(--success); }
.display-card { border-radius:18px; overflow:hidden; }
.card-heading { min-height:76px; padding:16px 18px; border-bottom:1px solid var(--line); }
.card-heading h3 { font-size:1rem; }
.hero-grid { display:grid; grid-template-columns:minmax(0,1.22fr) minmax(340px,.78fr); gap:14px; }
canvas { display:block; width:100%; height:auto; background:#080506; }
.star-display-card canvas { border-bottom:1px solid var(--line); }
.stage-badge { padding:8px 11px; border-radius:999px; color:var(--gold); background:rgba(255,209,102,.08); border:1px solid rgba(255,209,102,.2); font-size:.73rem; font-weight:850; text-transform:uppercase; letter-spacing:.08em; }
.stage-explanation { padding:16px 18px 18px; }
.stage-explanation p { color:var(--muted); line-height:1.52; margin-bottom:11px; }
.cause-effect { padding:12px 13px; border-radius:12px; background:linear-gradient(90deg,rgba(255,209,102,.08),rgba(255,95,95,.06)); border:1px solid rgba(255,209,102,.17); line-height:1.45; font-size:.84rem; }
.telemetry-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:1px; background:var(--line); }
.telemetry-grid div { min-height:83px; display:grid; align-content:center; gap:6px; padding:13px 15px; background:rgba(13,8,10,.95); }
.telemetry-grid span { color:var(--muted); font-size:.7rem; line-height:1.25; }
.telemetry-grid strong { color:var(--gold); font-size:.86rem; line-height:1.3; }
.fusion-card { margin:14px; padding:15px; border-radius:14px; background:radial-gradient(circle at 85% 15%,rgba(255,95,95,.12),transparent 12rem),rgba(255,255,255,.025); border:1px solid var(--line); }
.fusion-card h4 { margin:5px 0 10px; }
.reaction { padding:12px; border-radius:10px; text-align:center; color:#211006; background:linear-gradient(90deg,#ffd780,#ff9e58); font-weight:900; letter-spacing:.01em; }
.fusion-card p { margin:11px 0 0; color:var(--muted); font-size:.82rem; line-height:1.5; }
.energy-pathway { display:grid; grid-template-columns:1fr auto 1fr auto 1fr auto 1fr; align-items:stretch; gap:5px; margin:14px; }
.energy-step { min-height:94px; display:grid; align-content:center; gap:4px; padding:9px; border-radius:11px; background:rgba(255,255,255,.025); border:1px solid var(--line); text-align:center; }
.energy-step span { width:25px; height:25px; display:grid; place-items:center; margin:0 auto 2px; border-radius:50%; background:rgba(255,209,102,.1); color:var(--gold); font-weight:900; }
.energy-step strong { font-size:.75rem; }
.energy-step small { color:var(--muted); line-height:1.25; font-size:.65rem; }
.energy-step.active { background:rgba(255,209,102,.12); border-color:var(--gold); box-shadow:0 0 22px rgba(255,209,102,.14); }
.energy-pathway.inactive .energy-step, .energy-pathway.inactive .energy-arrow { opacity:.38; }
.energy-pathway.inactive .energy-step.active { background:rgba(255,255,255,.025); border-color:var(--line); box-shadow:none; }
.energy-arrow { display:grid; place-items:center; color:var(--muted); }
.analysis-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:14px; }
.metric-chip { display:grid; gap:2px; min-width:95px; padding:8px 10px; text-align:right; border-radius:10px; background:rgba(255,209,102,.07); border:1px solid rgba(255,209,102,.16); }
.metric-chip span { color:var(--muted); font-size:.65rem; text-transform:uppercase; letter-spacing:.08em; }
.metric-chip strong { color:var(--gold); font-size:.85rem; }
.chart-note { margin:0; padding:11px 14px; color:var(--muted); font-size:.76rem; line-height:1.45; border-top:1px solid var(--line); }
.comparison-card, .explanation-card, .limitation-card { margin-top:14px; }
.table-wrap { overflow:auto; max-height:370px; }
table { width:100%; border-collapse:collapse; font-size:.81rem; }
th,td { padding:12px 13px; text-align:left; border-bottom:1px solid var(--line); font-variant-numeric:tabular-nums; }
th { position:sticky; top:0; z-index:1; color:var(--muted); background:#1a0f0f; font-size:.67rem; text-transform:uppercase; letter-spacing:.06em; }
.empty-cell { text-align:center; color:var(--muted); padding:28px; }
.comparison-feedback { margin:0; padding:12px 16px; color:var(--muted); font-size:.8rem; line-height:1.4; }
.comparison-feedback.success { color:var(--success); }
.comparison-feedback.warning { color:var(--warning); }
.explanation-layout { display:grid; grid-template-columns:.8fr 1.2fr; }
.prompt-box, .claim-box { padding:18px; }
.prompt-box { border-right:1px solid var(--line); }
.prompt-box > p { color:var(--muted); line-height:1.52; }
.evidence-choice { display:flex; gap:9px; align-items:center; margin:9px 0; padding:10px; border-radius:10px; border:1px solid var(--line); background:rgba(255,255,255,.02); font-size:.82rem; }
.evidence-choice input { width:18px; height:18px; accent-color:var(--orange); }
.claim-box label { display:block; margin-bottom:9px; font-weight:850; }
textarea { width:100%; resize:vertical; color:var(--ink); background:#160d0d; border:1px solid rgba(255,218,173,.22); border-radius:11px; padding:12px; line-height:1.5; }
.claim-box button { margin-top:11px; }
.feedback-message { min-height:38px; margin:11px 0 0; color:var(--muted); font-size:.82rem; line-height:1.45; }
.feedback-message.success { color:var(--success); }
.feedback-message.warning { color:var(--warning); }
.feedback-message.error { color:var(--danger); }
.limitation-card { padding:18px; }
.limitation-card h3 { margin:4px 0 14px; }
.limitation-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }
.limitation-grid p { margin:0; padding:12px; color:var(--muted); background:rgba(255,255,255,.024); border:1px solid var(--line); border-radius:12px; line-height:1.5; font-size:.82rem; }

.notebook-section { padding:16px 18px; border-bottom:1px solid var(--line); }
.notebook-section h3 { font-size:.91rem; margin-bottom:11px; }
.notebook-section p { color:var(--muted); font-size:.8rem; line-height:1.48; margin:0; }
.notebook-metric { display:flex; justify-content:space-between; gap:12px; padding:7px 0; border-bottom:1px dashed rgba(255,218,173,.13); font-size:.78rem; }
.notebook-metric span { color:var(--muted); }
.notebook-metric strong { color:var(--gold); text-align:right; }
.timeline { margin:0; padding:0 0 0 20px; }
.timeline li { margin:8px 0; color:var(--muted); font-size:.77rem; line-height:1.35; }
.timeline li.current { color:var(--gold); font-weight:850; }
.timeline li.complete { color:var(--success); }
.vocabulary-card dl { margin:0; }
.vocabulary-card dt { font-weight:850; margin-top:9px; }
.vocabulary-card dd { margin:2px 0 0; color:var(--muted); font-size:.78rem; line-height:1.4; }

.help-dialog { width:min(720px,calc(100vw - 28px)); color:var(--ink); background:#180d0d; border:1px solid rgba(255,209,102,.32); border-radius:18px; box-shadow:0 30px 90px rgba(0,0,0,.68); }
.help-dialog::backdrop { background:rgba(5,2,3,.8); backdrop-filter:blur(5px); }
.help-dialog form { margin:0; }
.dialog-heading { display:flex; justify-content:space-between; align-items:center; gap:16px; }
.dialog-heading h2 { margin:4px 0 0; }
.guide-steps { padding-left:22px; color:var(--muted); line-height:1.58; }
.guide-steps li { margin:10px 0; padding-left:5px; }
.guide-steps strong { color:var(--ink); }
.guide-note { margin:18px 0; padding:14px; border-radius:12px; background:rgba(255,209,102,.08); border:1px solid rgba(255,209,102,.16); line-height:1.5; }
.tooltip { position:fixed; z-index:100; max-width:300px; padding:10px 12px; color:var(--ink); background:#180d0d; border:1px solid rgba(255,209,102,.32); border-radius:10px; box-shadow:var(--shadow); font-size:.78rem; line-height:1.45; pointer-events:none; }

@media (max-width:1400px) {
  .app-shell { grid-template-columns:260px minmax(600px,1fr); }
  .notebook-panel { position:static; grid-column:1/-1; max-height:none; display:grid; grid-template-columns:repeat(4,1fr); }
  .notebook-panel .panel-heading { grid-column:1/-1; }
  .notebook-section { border-right:1px solid var(--line); }
}
@media (max-width:1100px) {
  .site-header { grid-template-columns:1fr auto; }
  .header-title { display:none; }
  .app-shell { grid-template-columns:1fr; }
  .controls-panel { position:static; max-height:none; }
  .hero-grid, .analysis-grid { grid-template-columns:1fr; }
}
@media (max-width:760px) {
  .site-header { padding:10px 12px; }
  .brand-copy small { display:none; }
  .header-actions .ghost-button:first-child { display:none; }
  .app-shell { padding:10px; gap:10px; }
  .status-pill { display:none; }
  .energy-pathway { grid-template-columns:1fr; }
  .energy-arrow { transform:rotate(90deg); min-height:18px; }
  .explanation-layout, .limitation-grid { grid-template-columns:1fr; }
  .prompt-box { border-right:0; border-bottom:1px solid var(--line); }
  .notebook-panel { display:block; }
  .card-heading { align-items:flex-start; flex-wrap:wrap; }
}
@media (max-width:500px) {
  .brand-mark { width:40px; height:40px; }
  .brand-copy strong { font-size:.9rem; }
  .header-actions .ghost-button { padding:9px 10px; font-size:.78rem; }
  .preset-grid, .telemetry-grid { grid-template-columns:1fr; }
  .button-row { flex-wrap:wrap; }
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior:auto!important; animation-duration:.001ms!important; animation-iteration-count:1!important; transition-duration:.001ms!important; }
}
