/* ====== Constant-Speed Prop Lab ====== */
:root {
  --bg: #14181d; --panel: #1a2027; --panel2: #10151b; --line: #2b333d;
  --text: #e2e9f1; --dim: #8b9aab; --accent: #4a89c7;
  --thr: #c9d2dc; --prop: #5ea3ff; --mix: #ef6a6a;
  --ok: #3fae5a; --warn: #e0a02e; --fail: #e5484d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
}

/* ---------- header ---------- */
header {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 6px 14px; background: var(--panel2); border-bottom: 1px solid var(--line);
}
.brand b { font-size: 15px; letter-spacing: 0.06em; color: #fff; }
.brand span { display: block; font-size: 10.5px; color: var(--dim); margin-top: -3px; }
.hgroup { display: flex; align-items: center; gap: 4px; }
.hlabel { font-size: 10px; color: var(--dim); letter-spacing: 0.1em; margin-right: 4px; }
header button, #phasechips button {
  background: #232b34; color: #cfd9e4; border: 1px solid #333d49;
  padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12.5px;
}
header button:hover, #phasechips button:hover { background: #2d3843; }
header button.active, #phasechips button.active {
  background: #2c4a68; border-color: var(--accent); color: #fff;
}

/* ---------- layout ---------- */
main { flex: 1; display: flex; min-height: 0; }
#panel-left {
  width: 348px; min-width: 348px; overflow-y: auto; padding: 8px;
  background: var(--panel); border-right: 1px solid var(--line);
}
body.big-cockpit #panel-left { width: 520px; min-width: 520px; }
body.big-cockpit #dials svg.dial { width: 46%; }
#center { flex: 1; position: relative; min-width: 300px; background: #171c22; }
#view3d { position: absolute; inset: 0; }
#view3d canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#labellayer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#panel-right {
  width: 400px; min-width: 400px; overflow-y: auto; padding: 10px 14px;
  background: var(--panel); border-left: 1px solid var(--line);
}

/* ---------- left panel ---------- */
.lever-row { display: flex; gap: 8px; align-items: flex-start; }
#quadrant { flex: 1; }
.quadrant { width: 100%; }
.quad-face { fill: #12161c; stroke: #2b333d; }
.quad-title { fill: #77879a; font-size: 12px; letter-spacing: 0.15em; }
.quad-slot { fill: #05070a; stroke: #333c46; }
.quad-minmax { fill: #66727f; font-size: 9.5px; letter-spacing: 0.05em; }
.quad-label { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; }
.quad-sub { fill: #66727f; font-size: 10px; }
.lever { cursor: ns-resize; }
.lever-ring { fill: none; stroke-width: 2; opacity: 0; }
.lever-ring.pulsing { opacity: 1; animation: pulse 0.9s infinite; }
@keyframes pulse { 50% { stroke-width: 5; opacity: 0.45; } }
.tape-col { display: flex; flex-direction: column; gap: 6px; align-items: center; }
#phase-lamp {
  font: 600 12px Consolas, monospace; letter-spacing: 0.1em; color: #9fd0ff;
  background: #0d1319; border: 1px solid #2b3947; padding: 3px 8px; border-radius: 5px; text-align: center; width: 86px;
}

#dials { display: flex; flex-wrap: wrap; margin-top: 6px; }
svg.dial { width: 48%; height: auto; }
.dial-face { fill: #0e1319; }
.dial-rim { fill: none; stroke: #333d49; stroke-width: 2.5; }
.dial-num { fill: #c3ced9; font-size: 11px; font-family: Consolas, monospace; }
.dial-title { fill: #8494a5; font-size: 10.5px; letter-spacing: 0.1em; }
.dial-unit { fill: #66727f; font-size: 9px; }
.dial-needle { stroke: #f2f6fa; stroke-width: 3; fill: none; }
.dial-hubdot { fill: #aab7c4; }
.dial-readout { fill: #ffd97a; font-size: 15px; font-family: Consolas, monospace; font-weight: 600; }
.dial-bug { fill: var(--prop); }

.bladebar { width: 100%; margin-top: 4px; }
.bb-title { fill: #77879a; font-size: 10px; letter-spacing: 0.04em; }
.bb-end { fill: #a7b4c2; font-size: 11px; font-weight: 700; }
.bb-num { fill: #66727f; font-size: 10px; }
.bb-ptr { fill: #ffd97a; }
.bb-read { fill: #ffd97a; font-size: 15px; font-family: Consolas, monospace; font-weight: 700; }

.govlamp {
  margin-top: 6px; padding: 7px 10px; border-radius: 7px; font-size: 12.5px;
  background: #10151b; border: 1px solid var(--line); color: #b9c6d4;
}
.govlamp span { color: var(--dim); font-size: 11.5px; }
.govlamp.ok b { color: var(--ok); }
.govlamp.warn b { color: var(--warn); }
.govlamp.limit b { color: #d9a0ff; }
.govlamp.fail b { color: var(--fail); }

.annunciator { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; min-height: 26px; }
.ann { font: 700 11px Consolas, monospace; letter-spacing: 0.06em; padding: 4px 8px; border-radius: 4px; }
.ann.info { background: #17303f; color: #7cc4ff; border: 1px solid #275a76; }
.ann.warn { background: #3c2f11; color: #ffce56; border: 1px solid #7a5c17; }
.ann.fail { background: #46161a; color: #ff8b90; border: 1px solid #8c2a30; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.55; } }

/* ---------- center overlays ---------- */
#phasechips {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 5px; align-items: center; background: rgba(13,18,24,0.82);
  padding: 5px 10px; border-radius: 9px; border: 1px solid #2b333d;
}
#tasrow {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  background: rgba(13,18,24,0.85); padding: 6px 14px; border-radius: 8px; border: 1px solid #2b333d;
  font-size: 12px; color: #a8b8c8;
}
#tasrow input { vertical-align: middle; width: 220px; }
#tasrow span { font: 700 13px Consolas, monospace; color: #cfe4ff; margin-left: 8px; }
#caption {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 18px;
  max-width: 76%; background: rgba(10, 14, 19, 0.9); border: 1px solid #33465a;
  border-left: 4px solid var(--accent);
  padding: 10px 18px; border-radius: 8px; font-size: 15.5px; color: #eaf2fa;
}
#sectionwrap { position: absolute; left: 12px; bottom: 14px; width: 385px; }
#sectionwrap canvas { width: 100%; height: auto; border-radius: 8px; border: 1px solid #2b333d; }

.lbl {
  position: absolute; transform: translate(-8px, -22px); pointer-events: none;
  font: 600 11.5px "Segoe UI", sans-serif; color: #d6e4f2;
  background: rgba(13, 18, 24, 0.85); border: 1px solid #3a4655;
  padding: 2px 7px; border-radius: 4px; white-space: nowrap;
}
.leaderlines { position: absolute; inset: 0; width: 100%; height: 100%; }
.leader { stroke: #55677a; stroke-width: 1.2; }

#errbox {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999; display: none;
  background: #7f1d1d; color: #fff; font: 12px Consolas, monospace; padding: 6px; white-space: pre-wrap;
}

/* ---------- right panel / lessons ---------- */
.lesson-nav { display: flex; gap: 6px; margin-bottom: 8px; }
.lesson-nav select {
  flex: 1; background: #10151b; color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px; font-size: 12.5px;
}
.lesson-nav button {
  background: #232b34; color: #cfd9e4; border: 1px solid #333d49; border-radius: 6px;
  padding: 4px 11px; cursor: pointer; font-size: 14px;
}
.lesson-nav button:hover { background: #2d3843; }
#lessonbody h2 { font-size: 17px; margin: 6px 0 10px; line-height: 1.3; }
#lessonbody h3 { font-size: 14.5px; margin: 14px 0 6px; color: #cfe0f0; }
#lessonbody h4 { margin: 0 0 4px; font-size: 13.5px; }
.lnum { color: var(--dim); font-size: 12px; font-weight: 400; margin-right: 4px; }
#lessonbody p, #lessonbody li { color: #c6d2de; font-size: 13.2px; }
#lessonbody ul, #lessonbody ol { padding-left: 20px; margin: 6px 0; }
#lessonbody li { margin-bottom: 5px; }
.k-thr { color: #e8eef5; font-weight: 700; background: #272c33; padding: 0 5px; border-radius: 3px; }
.k-prop { color: #9cc4ff; font-weight: 700; background: #1a2c47; padding: 0 5px; border-radius: 3px; }
.k-mix { color: #ff9d9d; font-weight: 700; background: #3c1d1f; padding: 0 5px; border-radius: 3px; }
.key-idea {
  background: #14232f; border: 1px solid #2a4a63; border-left: 4px solid var(--accent);
  border-radius: 6px; padding: 9px 12px; margin: 10px 0; font-size: 13.2px; color: #d8e7f5;
}
.tip { color: #9fb2c5; font-style: italic; font-size: 12.6px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.btnrow button, .mistake button {
  background: #24425f; color: #dceafa; border: 1px solid #38648c; border-radius: 6px;
  padding: 6px 11px; cursor: pointer; font-size: 12.5px;
}
.btnrow button:hover, .mistake button:hover { background: #2d5377; }
.lever-list li { margin-bottom: 8px; }

.chain { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 10px 0; }
.ch-row { display: flex; gap: 5px; width: 100%; }
.ch-box {
  background: #10151b; border: 1px solid #33404e; border-radius: 6px; padding: 6px 8px;
  font-size: 11.3px; color: #b7c5d3; flex: 1; text-align: center;
}
.ch-box b { display: block; color: #ffd97a; font-family: Consolas, monospace; font-size: 12.5px; }
.ch-box.wide { width: 100%; }
.ch-box.thr { border-color: #4d5a68; }
.ch-box.prop { border-color: #2f5d9e; }
.ch-box.mix { border-color: #7a3538; }
.ch-box.gov { border-color: #2f8f83; }
.ch-box.loop { border-color: #3f6b48; color: #b9e0c2; }
.ch-arrow { color: #5d7182; font-size: 12px; }

.stripchart { display: block; border-radius: 6px; }
.chart-legend { display: flex; gap: 12px; font-size: 11px; color: #a5b4c3; margin: 3px 0 8px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

.compare .cmp-controls { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; font-size: 12.5px; color: #a8b8c8; }
.compare input[type=range] { width: 180px; vertical-align: middle; }
.cmp-panels { display: flex; gap: 8px; }
.cmp-panel { flex: 1; background: #10151b; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.cmp-panel h4 { margin: 0 0 6px; text-align: center; font-size: 12.5px; letter-spacing: 0.08em; color: #9db0c2; }
.cmp-panel canvas { width: 100%; height: auto; }
.cmp-panel p { font-size: 11.6px; color: #93a5b6; margin: 6px 0 0; }

.quiz { background: #10151b; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.quiz-q { font-size: 13.2px; margin-bottom: 8px; color: #dbe6f1; }
.quiz-opts { display: flex; flex-direction: column; gap: 5px; }
.quiz-opts button {
  text-align: left; background: #1b232c; border: 1px solid #33404e; color: #c6d2de;
  padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 12.6px;
}
.quiz-opts button:hover:not(:disabled) { background: #232e3a; }
.quiz-opts button.correct { background: #173123; border-color: #2e7d4f; color: #b8e6c9; }
.quiz-opts button.wrong { background: #391b1e; border-color: #8c2a30; color: #f0b6ba; }
.quiz-explain { margin-top: 8px; font-size: 12.4px; color: #cbb8a0; }
.quiz-explain.good { color: #a9d8b8; }

.matrix-scroll { overflow-x: auto; margin-top: 8px; }
.phase-matrix { border-collapse: collapse; width: 100%; font-size: 10.6px; }
.phase-matrix th { background: #10151b; color: #8b9aab; padding: 5px 4px; border: 1px solid #29323d; font-size: 10px; }
.phase-matrix td { padding: 5px 4px; border: 1px solid #29323d; color: #c0cdda; }
.phase-matrix td.ph { font-weight: 700; color: #e8f0f8; }
.phase-matrix tbody tr { cursor: pointer; }
.phase-matrix tbody tr:hover { background: #1d2733; }
.phase-matrix tbody tr.active { background: #24425f; }
.matrix-note { font-size: 11.4px; color: #8b9aab; font-style: italic; }

.mistake { background: #10151b; border: 1px solid var(--line); border-left: 4px solid #7a5c17; border-radius: 6px; padding: 9px 12px; margin: 8px 0; }
.mistake p { margin: 0; }

.signoff li { margin-bottom: 7px; }
.section-diagram { background: transparent; }
.statelist li { margin-bottom: 7px; }
.pitch-table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 12px; }
.pitch-table th, .pitch-table td { border: 1px solid #29323d; padding: 5px 7px; text-align: left; color: #c0cdda; }
.pitch-table th { background: #10151b; color: #93a5b6; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: #2c3540; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* Back to the Parastrate dashboard (parastrate.com hosts this lab). */
header .home-link { font-size: 11px; color: var(--dim); text-decoration: none; padding: 4px 9px; border: 1px solid var(--line); border-radius: 4px; white-space: nowrap; }
header .home-link:hover { color: #fff; }
