*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --panel-bg: #1a1a1e;
  --instr-bg: #1a1a26;
  --instr-border: #333;
  --text-light: #c0c0c0;
  --text-dim: #666;
  --amber: #e8a000;
  --red: #e03030;
  --green: #20c040;
  --blue: #3080e0;
  --accent: #e8a000;
  --glow: rgba(232, 160, 0, 0.15);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #08080a;
  color: var(--text-light);
  overflow-x: hidden;
  min-height: 100vh;
}

/* Top bar */
.topbar {
  background: linear-gradient(180deg, #0d0d10, #1a1a1e);
  border-bottom: 1px solid #2a2a30;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 44px;
}
.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.topbar-title small { color: var(--text-dim); font-weight: 400; font-size: 11px; }
.topbar-controls { display: flex; align-items: center; gap: 8px; }

.btn {
  background: #2a2a30;
  border: 1px solid #3a3a44;
  color: var(--text-light);
  padding: 5px 14px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn:hover { background: #3a3a44; border-color: #555; }
.btn.active { background: var(--amber); color: #000; border-color: var(--amber); }
.btn.quiz-btn {
  background: linear-gradient(135deg, #1a2a1a, #0a1a0a);
  border-color: #2a4a2a;
  color: var(--green);
}
.btn.quiz-btn.active {
  background: linear-gradient(135deg, #1a4a1a, #0a2a0a);
  border-color: var(--green);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.mode-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--text-dim);
}
.mode-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}
.mode-indicator .dot.explore { background: var(--blue); }
.mode-indicator .dot.quiz {
  background: var(--green);
  animation: pulse-dot 1s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Scroll hint */
.scroll-hint {
  text-align: center;
  padding: 6px;
  font-size: 10px;
  color: var(--text-dim);
  background: #0a0a0d;
  border-bottom: 1px solid #1a1a20;
}
.scroll-hint span {
  display: inline-block;
  animation: hint-bounce 2s ease-in-out infinite;
}
@keyframes hint-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Panel */
.panel-wrapper {
  width: 100%;
  overflow-x: auto;
  padding: 12px 10px 30px;
  background: radial-gradient(ellipse at 50% 0%, #121216, #08080a);
}
.panel {
  min-width: 1100px;
  max-width: 1300px;
  margin: 0 auto;
  background: var(--panel-bg);
  border-radius: 8px;
  border: 1px solid #2a2a30;
  padding: 20px 18px 18px;
  box-shadow: 0 0 60px rgba(0,0,0,0.5);
}

/* Annunciator */
.annunciator {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-bottom: 12px;
  padding: 6px 10px;
  background: #0d0d10;
  border: 1px solid #1a1a20;
  border-radius: 4px;
}
.annunc-lamp {
  width: 80px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 2px;
  border: 1px solid #222;
  text-transform: uppercase;
  transition: all 0.3s;
}
.annunc-lamp.danger { background: #1a0505; color: #802020; border-color: #331010; }
.annunc-lamp.caution { background: #1a1205; color: #806020; border-color: #332010; }
.annunc-lamp.advisory { background: #050a12; color: #204060; border-color: #101a33; }
.annunc-lamp[data-active="true"].danger {
  background: #c02020; color: #fff;
  box-shadow: 0 0 8px rgba(192,32,32,0.4);
}
.annunc-lamp[data-active="true"].caution {
  background: #c08020; color: #000;
  box-shadow: 0 0 8px rgba(192,128,32,0.4);
}
.annunc-lamp[data-active="true"].advisory {
  background: #204080; color: #fff;
  box-shadow: 0 0 8px rgba(32,64,128,0.4);
}

/* Gauges rows */
.gauges-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 10px;
}

/* Gauge component */
.gauge {
  position: relative;
  background: #1a1a2a;
  border: 2px solid var(--instr-border);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  overflow: hidden;
}
.gauge:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--glow), inset 0 0 12px rgba(232,160,0,0.05);
  transform: scale(1.03);
  z-index: 10;
}
.gauge.medium { width: 130px; height: 130px; }
.gauge.small { width: 100px; height: 100px; }

.gauge svg {
  width: 100%;
  height: 100%;
  display: block;
}

.gauge-label {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-dim);
  white-space: nowrap;
  text-transform: uppercase;
  pointer-events: none;
}
.gauge:hover .gauge-label { color: var(--accent); }

/* Quiz highlights */
.gauge.quiz-highlight {
  border-color: var(--green) !important;
  box-shadow: 0 0 24px rgba(32,192,64,0.4) !important;
  animation: pulse-glow 1s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 16px rgba(32,192,64,0.3); }
  50% { box-shadow: 0 0 32px rgba(32,192,64,0.6); }
}
.gauge.quiz-target {
  border-color: var(--red) !important;
  box-shadow: 0 0 24px rgba(224,48,48,0.5) !important;
}
.gauge.quiz-found {
  border-color: var(--green) !important;
  box-shadow: 0 0 20px rgba(32,192,64,0.4) !important;
}

/* Rectangular panel items */
.rect-panel {
  background: #1a1a2a;
  border: 2px solid var(--instr-border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.rect-panel:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--glow);
}
.rect-panel.quiz-highlight {
  outline: 2px solid var(--green) !important;
  outline-offset: 3px;
  animation: pulse-glow 1s ease-in-out infinite;
}

/* Engine gauges */
.engine-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
  padding: 12px 6px;
  border-top: 1px solid #222;
  border-bottom: 1px solid #222;
}
.eng-gauge {
  width: 64px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.eng-gauge:hover { transform: translateY(-2px); }
.eng-gauge .gauge-circle {
  width: 100%;
  height: 64px;
  border-radius: 50%;
  background: #1a1a2a;
  border: 1.5px solid var(--instr-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--amber);
  font-family: 'Courier New', monospace;
  transition: all 0.2s;
}
.eng-gauge:hover .gauge-circle {
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--glow);
}
.eng-gauge .eng-label {
  font-size: 7px;
  color: var(--text-dim);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.eng-gauge:hover .eng-label { color: var(--accent); }
.eng-gauge.quiz-highlight .gauge-circle {
  border-color: var(--green) !important;
  box-shadow: 0 0 16px rgba(32,192,64,0.4) !important;
}
.eng-gauge.quiz-target .gauge-circle {
  border-color: var(--red) !important;
  box-shadow: 0 0 16px rgba(224,48,48,0.4) !important;
}
.eng-gauge.quiz-found .gauge-circle {
  border-color: var(--green) !important;
  box-shadow: 0 0 12px rgba(32,192,64,0.4) !important;
}

/* Controls */
.controls-row {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.control-block {
  background: #0d0d10;
  border: 1px solid #1a1a20;
  border-radius: 4px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 120px;
}
.control-block:hover {
  border-color: var(--accent);
  background: #101015;
  box-shadow: 0 0 10px var(--glow);
}
.control-block .block-title {
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.control-block .block-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.control-item {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-light);
  padding: 2px 0;
  transition: all 0.2s;
}
.control-item .ctrl-label { color: var(--text-dim); }
.control-item .ctrl-value {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  font-size: 10px;
}
.control-item.quiz-highlight {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  animation: pulse-glow 1s ease-in-out infinite;
}
.control-item.quiz-target {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

/* Tooltip */
.tooltip {
  position: fixed;
  max-width: 260px;
  background: #0d0d12;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 10px 13px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 500;
  box-shadow: 0 4px 24px rgba(0,0,0,0.6);
}
.tooltip.visible { opacity: 1; }
.tooltip .tt-name { font-size: 12px; font-weight: 700; color: var(--accent); }
.tooltip .tt-name small { color: var(--text-dim); font-weight: 400; font-size: 10px; margin-left: 4px; }
.tooltip .tt-desc { font-size: 11px; color: #aaa; margin-top: 4px; line-height: 1.4; }
.tooltip .tt-detail { font-size: 10px; color: var(--text-dim); margin-top: 4px; font-style: italic; }

/* Quiz overlay */
.quiz-overlay {
  position: fixed;
  top: 44px;
  left: 0;
  right: 0;
  height: 48px;
  background: linear-gradient(135deg, #0a1a0a, #0d0d10);
  border-bottom: 1px solid #2a5a2a;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 90;
  padding: 0 16px;
}
.quiz-overlay.active { display: flex; }
.quiz-question { font-size: 15px; font-weight: 700; color: var(--green); }
.quiz-score { font-size: 11px; color: var(--text-dim); }
.quiz-score strong { color: var(--accent); }

/* Quiz complete */
.quiz-complete {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #0d0d12;
  border: 1px solid var(--green);
  border-radius: 12px;
  padding: 30px 40px;
  text-align: center;
  z-index: 200;
  display: none;
  box-shadow: 0 0 60px rgba(0,0,0,0.8);
}
.quiz-complete.active { display: block; }
.quiz-complete h2 { font-size: 22px; color: var(--green); margin-bottom: 8px; }
.quiz-complete p { color: #aaa; font-size: 14px; }
.quiz-complete .final-score { font-size: 48px; color: var(--accent); font-weight: 700; margin: 10px 0; }

/* Modal */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-bg.active { display: flex; }
.modal {
  background: #121216;
  border: 1px solid #2a2a30;
  border-radius: 10px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.modal h2 { font-size: 18px; color: var(--accent); margin-bottom: 4px; }
.modal .modal-sub { font-size: 11px; color: var(--text-dim); margin-bottom: 12px; }
.modal .modal-section { margin-bottom: 12px; }
.modal .modal-section h3 {
  font-size: 11px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.modal .modal-section p,
.modal .modal-section ul { font-size: 13px; color: #aaa; line-height: 1.5; }
.modal .modal-section ul { list-style: none; padding: 0; }
.modal .modal-section ul li {
  padding: 2px 0;
  padding-left: 12px;
  position: relative;
}
.modal .modal-section ul li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
}
.modal-close {
  margin-top: 16px;
  width: 100%;
  padding: 8px;
  background: #2a2a30;
  border: 1px solid #3a3a44;
  border-radius: 4px;
  color: var(--text-light);
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
}
.modal-close:hover { background: #3a3a44; }

/* Responsive */
@media (max-width: 1200px) {
  .panel { min-width: auto; }
  .panel-wrapper { padding: 8px 4px; }
}
