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

body {
  background-color: #030712;
  color: #f1f5f9;
  font-family: 'Outfit', -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* 顶部导航 */
header {
  padding: 10px 20px;
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

header h1 {
  font-size: 1.15rem;
  font-weight: 800;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

header p {
  font-size: 0.76rem;
  color: #94a3b8;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shell-toggle-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #38bdf8;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.shell-toggle-btn:hover {
  background: #334155;
  color: #ffffff;
}
.shell-toggle-btn.active {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.sound-toggle-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #38bdf8;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.sound-toggle-btn:hover {
  background: #334155;
  color: #38bdf8;
}
.sound-toggle-btn.muted {
  color: #64748b;
}

/* 模式切换 */
.mode-switcher {
  display: flex;
  background: #1e293b;
  padding: 3px;
  border-radius: 30px;
  border: 1px solid #334155;
}

.mode-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mode-btn.active.ice {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.4);
}

.mode-btn.active.ev {
  background: linear-gradient(135deg, #06b6d4, #0284c7);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

/* 容器 */
.main-container {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* 3D 渲染区 */
#canvas3d {
  flex: 1;
  width: 100%;
  height: 100%;
  display: block;
}

/* 3D 零件巡检 Component Inspector Modal */
.inspector-card {
  position: absolute;
  top: 60px;
  left: 14px;
  width: 320px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid #38bdf8;
  border-radius: 12px;
  padding: 14px;
  z-index: 15;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.insp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.insp-badge {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid #38bdf8;
  color: #38bdf8;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.insp-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
}
.insp-close-btn:hover { color: #ffffff; }

.insp-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 6px;
}

.insp-desc {
  font-size: 0.8rem;
  color: #cbd5e1;
  line-height: 1.45;
  margin-bottom: 10px;
}

.insp-hint {
  font-size: 0.68rem;
  color: #64748b;
  border-top: 1px dashed rgba(148, 163, 184, 0.2);
  padding-top: 6px;
}

/* 视角与镜头拉近 Preset Bar */
.focus-bar {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 6px 12px;
  border-radius: 24px;
  z-index: 5;
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
  max-width: calc(100% - 380px);
}

.focus-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #38bdf8;
  margin-right: 4px;
}

.focus-btn {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.focus-btn:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: #38bdf8;
  color: #ffffff;
}

.focus-btn.active {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* 实时机械状态 HUD Card */
.hud-card {
  position: absolute;
  bottom: 16px;
  left: 14px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 12px;
  padding: 10px 14px;
  z-index: 5;
  backdrop-filter: blur(8px);
  min-width: 260px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.hud-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
  padding-bottom: 4px;
}

.hud-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}

.hud-item {
  display: flex;
  flex-direction: column;
}

.hud-lbl {
  font-size: 0.68rem;
  color: #94a3b8;
}

.hud-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: #f8fafc;
}

.stroke-badge {
  color: #f97316;
}

/* 控制面板 */
.control-panel {
  width: 350px;
  background: rgba(15, 23, 42, 0.95);
  border-left: 1px solid rgba(56, 189, 248, 0.15);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  backdrop-filter: blur(12px);
  z-index: 6;
}

.panel-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 12px;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

/* 启动 & 刹车按钮行 */
.start-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 10px;
}

.start-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid #334155;
  background: radial-gradient(circle, #1e293b 0%, #0f172a 100%);
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.start-btn.running.ice {
  border-color: #f97316;
  color: #ffedd5;
  box-shadow: 0 0 20px rgba(249, 115, 22, 0.6);
  background: radial-gradient(circle, #ea580c 0%, #7c2d12 100%);
}

.start-btn.running.ev {
  border-color: #06b6d4;
  color: #cffaff;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.6);
  background: radial-gradient(circle, #0284c7 0%, #0c4a6e 100%);
}

.brake-btn {
  flex: 1;
  height: 70px;
  background: linear-gradient(135deg, #374151, #1f2937);
  border: 2px solid #4b5563;
  border-radius: 12px;
  color: #ef4444;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: all 0.2s ease;
}

.brake-btn:hover {
  border-color: #ef4444;
  background: linear-gradient(135deg, #7f1d1d, #450a0a);
  color: #ffffff;
}

.brake-btn.active {
  border-color: #f87171;
  background: radial-gradient(circle, #dc2626 0%, #991b1b 100%);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
}

.brake-btn small {
  font-size: 0.68rem;
  font-weight: 400;
  color: #9ca3af;
}

/* 挡位选择器 Gear Stick */
.gear-stick-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}

.gear-btn {
  background: #0f172a;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 8px 0;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gear-btn:hover {
  border-color: #38bdf8;
  color: #ffffff;
}

.gear-btn.active {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  border-color: #7dd3fc;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.gear-desc {
  font-size: 0.74rem;
  color: #38bdf8;
  background: rgba(15, 23, 42, 0.6);
  padding: 6px 8px;
  border-radius: 6px;
}

/* 方向盘与差速器 Slider */
.slider-group { display: flex; flex-direction: column; gap: 4px; }
.slider-label { display: flex; justify-content: space-between; font-size: 0.76rem; color: #cbd5e1; }
.mono-val { font-family: 'JetBrains Mono', monospace; color: #38bdf8; font-weight: 700; }
input[type="range"] { width: 100%; accent-color: #38bdf8; cursor: pointer; }

.diff-hint {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 6px;
  line-height: 1.35;
}

/* 4-Stroke Step Mode */
.stroke-mode-toggle {
  display: flex;
  gap: 6px;
}

.stroke-mode-btn {
  flex: 1;
  background: #0f172a;
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 6px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stroke-mode-btn.active {
  background: #334155;
  border-color: #f97316;
  color: #f97316;
  font-weight: 700;
}

.next-stroke-btn {
  width: 100%;
  background: linear-gradient(135deg, #f97316, #ea580c);
  border: none;
  color: #ffffff;
  padding: 8px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(249, 115, 22, 0.4);
  margin-bottom: 8px;
}

.next-stroke-btn:hover {
  background: linear-gradient(135deg, #fb923c, #f97316);
}

.stroke-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.stroke-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px;
  transition: all 0.2s ease;
}

.stroke-card.active {
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.15);
  box-shadow: 0 0 8px rgba(249, 115, 22, 0.3);
}

#scIntake.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}
#scIntake.active .sc-name { color: #38bdf8; }

#scCompress.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}
#scCompress.active .sc-name { color: #f59e0b; }

#scPower.active {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.18);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}
#scPower.active .sc-name { color: #f87171; }

#scExhaust.active {
  border-color: #94a3b8;
  background: rgba(148, 163, 184, 0.15);
  box-shadow: 0 0 10px rgba(148, 163, 184, 0.4);
}
#scExhaust.active .sc-name { color: #cbd5e1; }

.sc-name {
  font-size: 0.74rem;
  font-weight: 700;
  color: #f97316;
}

.sc-desc {
  font-size: 0.68rem;
  color: #94a3b8;
  line-height: 1.3;
  margin-top: 2px;
}

/* 科普知识 */
.kid-explainer {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.78rem;
  color: #e2e8f0;
  line-height: 1.45;
}
.kid-explainer-title { color: #fbbf24; font-weight: 700; margin-bottom: 4px; }

/* 比较框 Comparison Box */
.compare-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.72rem;
}

.cmp-col {
  background: #0f172a;
  border-radius: 8px;
  padding: 8px;
  border: 1px solid #334155;
}

.cmp-h {
  font-weight: 700;
  margin-bottom: 4px;
}
.cmp-h.ice { color: #f97316; }
.cmp-h.ev { color: #06b6d4; }

.cmp-col ul {
  padding-left: 14px;
  color: #94a3b8;
  line-height: 1.35;
}

/* Back to Home Button */
#homeBtn {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 17px;
  color: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: all 0.2s ease;
}

#homeBtn:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(148, 163, 184, 0.45);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Floating Language Switcher */
.lang-switch {
  position: fixed;
  top: 10px;
  left: 108px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  height: 34px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.22);
  padding: 2px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.lang-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}

.lang-btn:hover {
  color: #f1f5f9;
}

.lang-btn.active {
  background: rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* 点火故事字幕 Narrated Story Caption (js/ignition-story.js) */
.story-caption {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(720px, calc(100% - 48px));
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 14px;
  padding: 10px 18px;
  color: #fde68a;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
  z-index: 6;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* 重新播放点火 Replay start 按钮 (SCENARIO-009/010) */
.replay-btn {
  height: 70px;
  min-width: 140px;
  background: linear-gradient(135deg, #78350f, #451a03);
  border: 2px solid #f59e0b;
  border-radius: 12px;
  color: #fde68a;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: all 0.2s ease;
}

.replay-btn:hover {
  border-color: #fbbf24;
  background: linear-gradient(135deg, #92400e, #57230a);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.5);
}

.replay-btn small {
  font-size: 0.68rem;
  font-weight: 400;
  color: #d97706;
}

header { padding-left: 120px; }
@media (max-width: 768px) {
  header { padding-left: 14px; flex-direction: column; gap: 8px; }
  .main-container { flex-direction: column; }
  .control-panel { width: 100%; height: 40vh; }
  .focus-bar { max-width: 100%; top: 4px; }
  .inspector-card { width: calc(100% - 28px); top: auto; bottom: 80px; }
}
