:root {
  --bg: #07090c;
  --bg-2: #0c1016;
  --panel: #10151c;
  --panel-2: #141b24;
  --line: #1e2833;
  --line-2: #293645;
  --text: #dbe5ee;
  --text-2: #9aa9b8;
  --text-3: #62717f;
  --accent: #3fd0ff;
  --accent-2: #1aa6d6;
  --warn: #ffb547;
  --bad: #ff5a5a;
  --good: #7ee081;
  --night: #b58cff;
  --radius: 8px;
  --dock-w: 318px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.4 'Inter', system-ui, sans-serif; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--text-3); font-size: 12px; margin: 6px 0; }
.warn { color: var(--warn); }
.bad { color: var(--bad) !important; }
.good { color: var(--good) !important; }
.mono { font-family: var(--mono); }
.ic { width: 16px; height: 16px; flex: none; }

body { display: grid; grid-template-rows: 52px 1fr 92px; }

/* ---------------- top bar ---------------- */
#topbar { display: flex; align-items: center; gap: 18px; padding: 0 14px; background: linear-gradient(180deg, #0d131a, #0a0e13); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: radial-gradient(circle at 30% 30%, #2de0ff, #0b4e66); color: #001018; }
.brand .logo .ic { width: 18px; height: 18px; }
.brand b { display: block; font-size: 15px; letter-spacing: 0.02em; }
.brand span { font-size: 11px; color: var(--text-2); }
.bench-switch { display: flex; align-items: center; gap: 8px; }
.bench-switch .lbl { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.status { display: flex; gap: 6px; flex: 1; justify-content: center; }
.chip { padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.chip.day { color: #ffe08a; border-color: #5a4a1c; }
.chip.night { color: var(--night); border-color: #3e2b66; background: #150f22; }
.chip.dim { color: var(--text-3); }
.actions { display: flex; gap: 8px; }

/* ---------------- buttons & inputs ---------------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; transition: background 0.12s, border-color 0.12s; white-space: nowrap; }
.btn:hover { background: #1b2430; border-color: #36475a; }
.btn:disabled { opacity: 0.45; cursor: progress; }
.btn.primary { background: linear-gradient(180deg, #1ec3f5, #0f93c2); border-color: #33d4ff; color: #00131b; font-weight: 600; }
.btn.primary:hover { background: linear-gradient(180deg, #45d3fb, #16a4d4); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.tiny { padding: 2px 7px; font-size: 11px; }
.btn.wide { width: 100%; justify-content: center; padding: 9px; margin: 8px 0 4px; }
.btn.icon-only { padding: 6px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.segmented { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 2px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--text-2); font-size: 12px; font-weight: 600; }
.segmented button.on { background: var(--accent); color: #00131b; }
select, input[type='text'], input[type='number'] { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 4px 6px; outline: none; }
select:focus, input:focus { border-color: var(--accent-2); }

/* ---------------- layout ---------------- */
#workspace { display: grid; grid-template-columns: var(--dock-w) 1fr var(--dock-w); min-height: 0; }
.dock { overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 8px 8px 40px; scrollbar-width: thin; scrollbar-color: #2a3644 transparent; }
#dock-right { border-right: 0; border-left: 1px solid var(--line); }
#viewport { position: relative; overflow: hidden; background: #000; }
#gl { display: block; width: 100%; height: 100%; }

/* ---------------- panels ---------------- */
.panel { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; background: transparent; border: 0; cursor: pointer; font-weight: 600; font-size: 12.5px; letter-spacing: 0.01em; text-align: left; }
.panel-head .ic { color: var(--accent); }
.panel-head span { flex: 1; }
.panel-head .chev { color: var(--text-3); transition: transform 0.15s; }
.panel.collapsed .panel-body { display: none; }
.panel.collapsed .chev { transform: rotate(-90deg); }
.panel-body { padding: 4px 10px 10px; border-top: 1px solid var(--line); }
.ctl-group { margin: 10px 0 2px; }
.ctl-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.ctl { display: grid; align-items: center; gap: 6px; margin: 5px 0; }
.ctl.slider { grid-template-columns: 1fr; }
.ctl.slider .ctl-label { font-size: 12px; color: var(--text-2); display: flex; justify-content: space-between; }
.ctl.slider { grid-template-areas: 'label num' 'range range'; grid-template-columns: 1fr auto; row-gap: 1px; }
.ctl.slider .ctl-label { grid-area: label; }
.ctl.slider .num-wrap { grid-area: num; display: flex; align-items: center; gap: 4px; }
.ctl.slider input[type='range'] { grid-area: range; width: 100%; }
.ctl .num { width: 78px; text-align: right; font-family: var(--mono); font-size: 11.5px; padding: 2px 5px; }
.ctl .unit { color: var(--text-3); font-size: 11px; min-width: 18px; }
.ctl.select { grid-template-columns: 1fr 1.5fr; }
.ctl.select .ctl-label, .ctl.toggle .ctl-label { font-size: 12px; color: var(--text-2); }
.ctl.select select { width: 100%; min-width: 0; }
.ctl.toggle { grid-template-columns: 1fr auto; }
.switch { position: relative; width: 34px; height: 18px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .knob { position: absolute; inset: 0; border-radius: 999px; background: #243140; transition: background 0.15s; cursor: pointer; }
.switch .knob::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #9fb3c6; transition: transform 0.15s, background 0.15s; }
.switch input:checked + .knob { background: var(--accent-2); }
.switch input:checked + .knob::after { transform: translateX(16px); background: #fff; }
input[type='range'] { -webkit-appearance: none; appearance: none; height: 16px; background: transparent; margin: 0; }
input[type='range']::-webkit-slider-runnable-track { height: 3px; background: #243140; border-radius: 2px; }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); margin-top: -4.5px; box-shadow: 0 0 0 3px rgba(63, 208, 255, 0.15); }
input[type='range']::-moz-range-track { height: 3px; background: #243140; }
input[type='range']::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--accent); }
.info-line { font-family: var(--mono); font-size: 11px; color: var(--text-2); margin: 6px 0; }
.lux-presets { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.target-preview { display: grid; grid-template-columns: 110px 1fr; gap: 8px; margin: 6px 0 10px; font-size: 11px; color: var(--text-2); }
.target-preview img { width: 110px; border-radius: 4px; border: 1px solid var(--line-2); image-rendering: auto; background: #000; }
.target-preview b { color: var(--accent); font-weight: 600; font-size: 11px; }
.target-preview p { margin: 3px 0 0; }

/* readouts */
.readouts { display: grid; grid-template-columns: 1fr; gap: 0; margin: 4px 0 8px; }
.ro { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px dashed #1b2530; font-size: 11.5px; }
.ro-label { color: var(--text-3); white-space: nowrap; }
.ro-val { font-family: var(--mono); text-align: right; color: var(--text); font-size: 11px; }
.analysis-tabs { margin: 6px 0; }
.analysis-tabs .segmented button { padding: 3px 7px; font-size: 11px; }
.mini-chart { height: 170px; position: relative; }
.metro-launch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.launch { display: flex; align-items: center; gap: 6px; padding: 7px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; font-size: 11.5px; text-align: left; }
.launch:hover { border-color: var(--accent-2); }
.launch .ic { color: var(--accent); }
.progress { position: relative; height: 22px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; }
.progress .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #0f93c2, #3fd0ff); transition: width 0.15s; }
.progress span { position: relative; font-size: 11px; padding: 0 8px; line-height: 20px; color: #fff; text-shadow: 0 1px 2px #000; }

/* ---------------- viewport overlays ---------------- */
#viewport-tools { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; pointer-events: none; }
#viewport-tools > * { pointer-events: auto; }
#viewport-tools .segmented { background: rgba(8, 11, 15, 0.85); backdrop-filter: blur(6px); }
.mini-check { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-2); background: rgba(8, 11, 15, 0.85); padding: 4px 8px; border-radius: 7px; border: 1px solid var(--line-2); }
.sel-label { font-size: 11.5px; color: var(--text-2); background: rgba(8, 11, 15, 0.7); padding: 4px 8px; border-radius: 7px; }
#pip-frame { position: absolute; right: 14px; bottom: 14px; border: 1px solid #3a4b5d; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(63, 208, 255, 0.08); }
#pip-hud { position: absolute; left: 0; right: 0; top: -22px; height: 22px; line-height: 22px; font: 500 10.5px var(--mono); color: var(--accent); background: rgba(8, 11, 15, 0.92); border: 1px solid #3a4b5d; border-bottom: 0; border-radius: 6px 6px 0 0; padding: 0 8px; cursor: move; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; }
.pip-actions { position: absolute; right: 4px; bottom: 4px; display: flex; gap: 4px; opacity: 0.4; transition: opacity 0.15s; }
#pip-frame:hover .pip-actions { opacity: 1; }
.pip-actions .btn { background: rgba(8, 11, 15, 0.8); }
body.acquiring #pip-hud::after { content: ' · ACQUIRING…'; color: var(--warn); }
#fatal { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; background: #07090c; color: var(--text-2); }

/* ---------------- gallery ---------------- */
#gallery { display: flex; gap: 8px; align-items: center; padding: 8px 12px; overflow-x: auto; background: var(--panel); border-top: 1px solid var(--line); }
.gal-title { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; min-width: 64px; }
.gal-title .ic { color: var(--accent); }
.gal-empty { color: var(--text-3); font-size: 12px; }
.gal-item { flex: none; display: flex; flex-direction: column; gap: 3px; padding: 4px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; }
.gal-item:hover { border-color: var(--accent-2); }
.gal-item img { height: 54px; border-radius: 3px; }
.gal-item span { font: 10px var(--mono); color: var(--text-2); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- toasts ---------------- */
#toasts { position: fixed; right: 16px; top: 64px; display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px; background: #121a23; border: 1px solid var(--line-2); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); max-width: 380px; font-size: 12.5px; animation: tin 0.2s ease-out; }
.toast.warn { border-color: #6a4c14; } .toast.warn .ic { color: var(--warn); }
.toast.error { border-color: #6a1c1c; } .toast.error .ic { color: var(--bad); }
.toast.info .ic { color: var(--accent); }
.toast.out { opacity: 0; transform: translateX(20px); transition: all 0.35s; }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }

/* ---------------- modal / workbench ---------------- */
.modal { position: fixed; inset: 0; background: rgba(2, 4, 6, 0.72); backdrop-filter: blur(3px); z-index: 50; display: grid; place-items: center; }
.metro-shell { position: relative; width: min(1720px, 97vw); height: 94vh; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; display: grid; grid-template-rows: 48px 1fr; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.metro-head { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid var(--line); background: #0d131a; }
.metro-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.metro-title .ic { color: var(--accent); }
.metro-sub { color: var(--text-2); font-weight: 400; font-size: 12px; }
.metro-tools { display: flex; align-items: center; gap: 6px; }
.metro-tools .inline { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12px; }
.sample-sel { max-width: 340px; }
.metro-body { display: grid; grid-template-columns: 206px 1fr 420px; min-height: 0; }
.metro-nav { overflow-y: auto; border-right: 1px solid var(--line); padding: 8px; background: #0d1218; }
.nav-group { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); margin: 10px 4px 4px; }
.nav-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 1px solid transparent; background: transparent; border-radius: 6px; cursor: pointer; text-align: left; font-size: 12.5px; color: var(--text-2); }
.nav-item:hover { background: #121a23; }
.nav-item.on { background: #0f2633; border-color: #1c5873; color: var(--text); }
.nav-item .ic { color: var(--accent); }
.metro-view { position: relative; min-width: 0; min-height: 0; display: grid; grid-template-rows: 1fr 26px; }
.viewer-host { position: relative; overflow: hidden; min-height: 0; }
.viewer-canvas { display: block; touch-action: none; }
.metro-hint { font-size: 11.5px; color: var(--text-3); padding: 5px 10px; border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-grid { display: grid; gap: 10px; padding: 10px; min-height: 0; overflow: auto; }
.chart-grid.n2 { grid-template-rows: 1fr 1fr; }
.chart-grid.n3 { grid-template-rows: 1fr 1fr 1fr; }
.chart-grid.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.chart-grid.shading { grid-template-rows: auto 1fr; }
.chart-cell { position: relative; min-height: 180px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.chart-grid.shading .chart-cell:first-child { min-height: 0; }
.metro-side { overflow-y: auto; border-left: 1px solid var(--line); padding: 10px 12px 40px; background: var(--panel); }
.side-sec { margin-bottom: 14px; }
.side-sec h4 { margin: 0 0 6px; font-size: 11.5px; letter-spacing: 0.02em; color: var(--accent); font-weight: 600; }
.side-field { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; margin: 5px 0; font-size: 12px; color: var(--text-2); }
.side-field select { max-width: 210px; }
.side-check { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-2); margin: 5px 0; }
.side-chart { position: relative; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
table.metrics { width: 100%; border-collapse: collapse; font-size: 12px; }
table.metrics th { text-align: left; font-weight: 500; color: var(--text-3); padding: 4px 6px 4px 0; border-bottom: 1px solid #18212b; }
table.metrics td { font-family: var(--mono); font-size: 11.5px; text-align: right; padding: 4px 0; border-bottom: 1px solid #18212b; }
table.metrics.dense th, table.metrics.dense td { padding: 3px 4px; font-size: 11px; }
table.metrics thead th { color: var(--text-2); text-align: right; }
table.metrics.patches td:nth-child(2) { text-align: left; font-family: inherit; }
.sw { display: inline-block; width: 16px; height: 14px; border-radius: 2px; margin-left: 2px; vertical-align: middle; border: 1px solid rgba(255, 255, 255, 0.15); }
.empty { display: grid; place-items: center; gap: 8px; text-align: center; color: var(--text-3); padding: 40px 10px; }
.empty .ic { width: 32px; height: 32px; }
.metro-busy { position: absolute; inset: 48px 0 0 0; background: rgba(5, 8, 11, 0.55); display: grid; place-content: center; justify-items: center; gap: 10px; z-index: 5; color: var(--text); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #1c2a38; border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.help-card { width: min(620px, 92vw); background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 18px 22px; }
.help-card h3 { margin-top: 0; }
.help-card li { margin: 6px 0; color: var(--text-2); }
.help-card b { color: var(--text); }

@media (max-width: 1300px) {
  :root { --dock-w: 280px; }
  .metro-body { grid-template-columns: 170px 1fr 360px; }
  .status .chip.mono { display: none; }
}

/* ================= help system ================= */
.help-i { display: inline-grid; place-items: center; width: 13px; height: 13px; margin-left: 5px; border-radius: 50%; border: 1px solid var(--line-2); color: var(--text-3); font: italic 600 9px/1 Georgia, serif; cursor: help; vertical-align: 1px; flex: none; user-select: none; opacity: 0.55; transition: opacity 0.12s, color 0.12s, border-color 0.12s; }
.ctl:hover .help-i, .ro:hover .help-i, .side-field:hover .help-i, .side-check:hover .help-i, .panel-head:hover .help-i, .help-i:focus { opacity: 1; color: var(--accent); border-color: var(--accent-2); outline: none; }
.help-i.static { opacity: 1; cursor: default; }
.panel-head > .panel-tools { flex: none; display: inline-flex; align-items: center; gap: 4px; }
.panel-head > .panel-tools > span { flex: none; }
.panel-tool { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; color: var(--text-3); opacity: 0; transition: opacity 0.12s; }
.panel-tool .ic { width: 14px; height: 14px; color: var(--text-3) !important; }
.panel-head:hover .panel-tool { opacity: 1; }
.panel-tool:hover .ic { color: var(--accent) !important; }
.side-lesson { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin: -4px 0 6px; }
.help-tip, .help-pin { position: fixed; z-index: 90; max-width: 380px; }
.help-tip { pointer-events: none; }
.help-card-pop { background: #0f151c; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; box-shadow: 0 12px 40px rgba(0,0,0,0.55); font-size: 12.5px; color: var(--text-2); }
.help-card-pop.pinned { border-color: var(--accent-2); }
.hc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.hc-head b { color: var(--text); font-size: 13px; flex: 1; }
.hc-x { background: transparent; border: 0; cursor: pointer; color: var(--text-3); padding: 2px; display: grid; place-items: center; }
.hc-x:hover { color: var(--text); }
.hc-what { margin: 4px 0 8px; color: var(--text); }
.hc-row { display: grid; grid-template-columns: 92px 1fr; gap: 8px; margin: 5px 0; }
.hc-k { display: flex; align-items: flex-start; gap: 5px; color: var(--text-3); font-size: 11.5px; }
.hc-k .ic { width: 13px; height: 13px; margin-top: 2px; }
.hc-v { color: var(--text-2); }
.hc-formula { overflow-x: auto; color: var(--text); }
.hc-formula .katex-display { margin: 2px 0; text-align: left; }
.hc-tip { display: flex; gap: 6px; margin-top: 8px; padding: 7px 9px; border-radius: 7px; background: rgba(255,181,71,0.07); border: 1px solid rgba(255,181,71,0.22); color: #f3d7a8; }
.hc-tip .ic { color: var(--warn); width: 14px; height: 14px; margin-top: 1px; }
.hc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hc-foot { margin-top: 8px; font-size: 10.5px; color: var(--text-3); }
body.help-mode, body.help-mode * { cursor: help !important; }
body.help-mode .help-hover { outline: 2px dashed var(--accent); outline-offset: 2px; border-radius: 6px; }
body.help-mode [data-help="topbar.helpmode"] { cursor: pointer !important; }
.btn.on { border-color: var(--accent); color: var(--accent); background: rgba(63,208,255,0.1); }
.katex { font-size: 1.02em; }

/* ================= guided tour ================= */
.tour-spot { position: fixed; z-index: 80; border-radius: 9px; pointer-events: none; box-shadow: 0 0 0 2px var(--accent), 0 0 18px 4px rgba(63,208,255,0.55); animation: tourPulse 1.6s ease-in-out infinite; transition: left 0.18s, top 0.18s, width 0.18s, height 0.18s; }
.tour-card { position: fixed; z-index: 85; width: 380px; max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); overflow: auto; background: #0e141b; border: 1px solid var(--accent-2); border-radius: 12px; padding: 12px 14px; box-shadow: 0 18px 60px rgba(0,0,0,0.6); font-size: 13px; }
.tour-card.centred { width: 460px; }
.tour-head { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-3); }
.tour-lesson { display: flex; align-items: center; gap: 6px; flex: 1; color: var(--accent); font-weight: 600; }
.tour-count { font-family: var(--mono); }
.tour-bar { height: 3px; background: var(--line); border-radius: 2px; margin: 8px 0 10px; overflow: hidden; }
.tour-bar > div { height: 100%; background: var(--accent); transition: width 0.2s; }
.tour-card h4 { margin: 0 0 6px; font-size: 15px; color: var(--text); }
.tour-body { color: var(--text-2); line-height: 1.5; }
.tour-body b { color: var(--text); }
.tour-task { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 4px; padding: 8px 10px; border-radius: 8px; background: rgba(63,208,255,0.07); border: 1px solid rgba(63,208,255,0.25); color: var(--text); }
.tour-task .ic { color: var(--accent); margin-top: 1px; }
.tour-task.ok { background: rgba(126,224,129,0.08); border-color: rgba(126,224,129,0.4); }
.tour-task.ok .ic { color: var(--good); }
.tour-why { margin-top: 8px; color: var(--text-2); }
.tour-why summary { cursor: pointer; display: flex; align-items: center; gap: 6px; color: var(--warn); font-size: 12px; list-style: none; }
.tour-why summary .ic { width: 14px; height: 14px; }
.tour-why > div { margin-top: 6px; padding: 8px 10px; border-left: 2px solid var(--warn); background: rgba(255,181,71,0.05); line-height: 1.5; }
.tour-btns { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.tour-btns.wrap { flex-wrap: wrap; }
.tour-btns .grow { flex: 1; }
.quiz-opts { display: grid; gap: 6px; margin: 8px 0; }
.quiz-opt { text-align: left; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; }
.quiz-opt:hover { border-color: var(--accent-2); }
.quiz-opt.right { border-color: var(--good); background: rgba(126,224,129,0.1); }
.quiz-opt.wrong { border-color: var(--bad); background: rgba(255,90,90,0.1); }
.quiz-fb p { margin: 4px 0; color: var(--text-2); }

/* ================= advisor ================= */
.advisor-chip { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.advisor-chip .ic { width: 13px; height: 13px; }
.advisor-chip.lvl-tip { color: #f3d7a8; border-color: #5a4a1c; }
.advisor-chip.lvl-warn { color: var(--warn); border-color: #7a5316; background: #1b1408; }
.advisor-chip.lvl-bad { color: var(--bad); border-color: #6d2020; background: #1d0b0b; }
.advisor-list { display: grid; gap: 8px; }
.adv-item { border: 1px solid var(--line-2); border-left-width: 3px; border-radius: 8px; padding: 7px 9px; background: var(--panel-2); font-size: 12px; }
.adv-item.lvl-tip { border-left-color: #c9a45b; }
.adv-item.lvl-warn { border-left-color: var(--warn); }
.adv-item.lvl-bad { border-left-color: var(--bad); }
.adv-head { display: flex; align-items: center; gap: 6px; }
.adv-head b { flex: 1; font-size: 12.5px; }
.adv-item.lvl-tip .adv-head .ic:first-child { color: #c9a45b; }
.adv-item.lvl-warn .adv-head .ic:first-child { color: var(--warn); }
.adv-item.lvl-bad .adv-head .ic:first-child { color: var(--bad); }
.adv-item p { margin: 4px 0 6px; color: var(--text-2); }
.adv-item details { margin: 2px 0 6px; color: var(--text-3); }
.adv-item summary { cursor: pointer; color: var(--text-3); font-size: 11.5px; }
.panel.flash { box-shadow: 0 0 0 2px var(--accent); transition: box-shadow 0.3s; }

/* ================= academy ================= */
.acad-shell { width: min(1180px, 96vw); height: min(860px, 92vh); display: grid; grid-template-rows: auto 1fr; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.acad-head { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #0c1117; }
.acad-head .metro-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.acad-head .metro-title .ic { color: var(--accent); }
.acad-tabs { display: flex; gap: 4px; flex: 1; justify-content: center; flex-wrap: wrap; }
.acad-tab { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 7px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text-2); }
.acad-tab:hover { background: var(--panel-2); }
.acad-tab.on { border-color: var(--accent-2); color: var(--accent); background: rgba(63,208,255,0.07); }
.acad-body { overflow: auto; padding: 16px 20px; }
.acad-intro { display: flex; gap: 20px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.acad-intro h3 { margin: 0 0 6px; }
.acad-intro p { color: var(--text-2); max-width: 760px; margin: 0; }
.acad-progress { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 200px; }
.ring { --p: 0; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0); }
.ring span { width: 60px; height: 60px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-family: var(--mono); font-size: 13px; }
.track { margin: 18px 0; }
.track-head { display: flex; align-items: center; gap: 8px; }
.track-head .ic { color: var(--accent); }
.track-head h4 { margin: 0; font-size: 14px; }
.track > .muted { margin: 2px 0 8px; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.lesson-card { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel-2); }
.lesson-card.done { border-color: rgba(126,224,129,0.35); }
.lc-top { display: flex; gap: 6px; align-items: flex-start; }
.lc-top .ic { color: var(--text-3); margin-top: 1px; }
.lesson-card.done .lc-top .ic { color: var(--good); }
.lesson-card p { margin: 0; color: var(--text-2); font-size: 12px; flex: 1; }
.lc-meta { display: flex; gap: 10px; align-items: center; color: var(--text-3); font-size: 11px; }
.lc-meta span { display: inline-flex; align-items: center; gap: 3px; }
.lc-meta .ic { width: 12px; height: 12px; }
.lesson-card .btn { align-self: flex-start; }
.acad-split { display: grid; grid-template-columns: 260px 1fr; gap: 18px; height: 100%; min-height: 0; }
.acad-list { display: flex; flex-direction: column; gap: 2px; overflow: auto; border-right: 1px solid var(--line); padding-right: 10px; }
.acad-list.wide { width: auto; }
.acad-li { display: flex; align-items: center; gap: 8px; text-align: left; padding: 6px 8px; border-radius: 6px; border: 0; background: transparent; cursor: pointer; color: var(--text-2); }
.acad-li:hover { background: var(--panel-2); color: var(--text); }
.acad-li.on { background: rgba(63,208,255,0.08); color: var(--accent); }
.acad-li span { flex: 1; }
.acad-li code { font-size: 10px; color: var(--text-3); }
.acad-search { width: 100%; padding: 7px 9px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--bg-2); margin-bottom: 6px; }
.acad-article { max-width: 820px; line-height: 1.6; color: var(--text-2); overflow: auto; }
.acad-article.single { margin: 0 auto; }
.acad-article h2 { color: var(--text); margin: 0 0 4px; }
.acad-article h4 { color: var(--text); margin: 18px 0 4px; }
.acad-article .lead { color: var(--text); font-size: 14px; }
.acad-article b { color: var(--text); }
.acad-article code { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.acad-article .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.acad-related { margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--line); }
.diagram { margin: 12px 0; padding: 8px; background: #0a0f14; border: 1px solid var(--line); border-radius: 9px; }
.acad-detail { overflow: auto; }
.acad-detail .help-card-pop { max-width: 640px; box-shadow: none; }
.acad-samples > p { color: var(--text-2); max-width: 860px; }
.sample-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.sample-card { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel-2); }
.sample-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #000; }
.sample-ph { aspect-ratio: 16 / 9; display: grid; place-items: center; align-content: center; gap: 6px; border-radius: 6px; background: #0a0f14; color: var(--text-3); }
.sample-card p { margin: 0; font-size: 12px; }
.sample-card details summary { cursor: pointer; color: var(--warn); font-size: 12px; }
.sample-ref { border: 1px solid rgba(255,181,71,0.3); border-radius: 8px; padding: 8px; background: rgba(255,181,71,0.04); }
.sample-ref details summary { cursor: pointer; color: var(--warn); font-size: 12px; margin-top: 4px; }
.metrics.dense th, .metrics.dense td { padding: 2px 4px; font-size: 11.5px; }
#welcome .welcome-card { width: min(560px, 92vw); background: var(--panel); border: 1px solid var(--accent-2); border-radius: 14px; padding: 22px 24px; text-align: center; }
#welcome .welcome-card p { color: var(--text-2); line-height: 1.55; text-align: left; }
#welcome .btn-row { justify-content: center; margin-top: 14px; }
.logo.big { width: 48px; height: 48px; margin: 0 auto; border-radius: 12px; display: grid; place-items: center; background: radial-gradient(circle at 30% 30%, #2de0ff, #0b4e66); color: #001018; }
.logo.big .ic { width: 26px; height: 26px; }

@keyframes tourPulse { 50% { box-shadow: 0 0 0 2px var(--accent), 0 0 28px 8px rgba(63,208,255,0.35); } }
