/* ==========================================================================
   短程團體機位「五天配套」教學互動系統 - 航空專屬樣式表 (styles.css)
   Aviation Theme / Glassmorphism / Pedagogical Visualization
   ========================================================================== */

:root {
  /* 主色調：航太深藍與機翼金屬銀 */
  --bg-primary: #080f24;
  --bg-secondary: #0e1b3d;
  --bg-card: rgba(16, 31, 68, 0.78);
  --bg-card-hover: rgba(23, 44, 94, 0.88);
  --border-subtle: rgba(56, 189, 248, 0.14);
  --border-focus: #38bdf8;
  
  /* 業務狀態標示色 (對應 Excel 與航空業界標準) */
  --outbound-blue: #00b0f0;         /* 去程 (Excel 表頭與去程標記) */
  --outbound-glow: rgba(0, 176, 240, 0.4);
  --inbound-green: #10b981;         /* 回程 (返台航班) */
  --inbound-glow: rgba(16, 185, 129, 0.35);
  --in-destination: #6366f1;       /* 日本在地旅遊中 (D2~D4) */
  --golden-cyan: #06b6d4;          /* 1/5~1/10 黃金咬合核心期 */
  --golden-bg: rgba(6, 182, 212, 0.12);
  --orphan-red: #f43f5e;           /* 首尾斷頭位 / 孤鳥位 */
  --orphan-bg: rgba(244, 63, 94, 0.15);
  --clash-orange: #f97316;         /* 機位超賣 / 擠壓衝突 */
  
  /* 文字與中性色 */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-highlight: #38bdf8;
  
  /* 字體族群 */
  --font-sans: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', var(--font-sans);
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* 視覺光影與圓角 */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-subtle);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.25);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 全域重置 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: radial-gradient(circle at 50% 0%, #132757 0%, var(--bg-primary) 70%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 實用類別 */
.font-mono { font-family: var(--font-mono); }
.text-cyan { color: var(--text-highlight); }
.text-emerald { color: #34d399; }
.text-rose { color: var(--orphan-red); }
.hidden { display: none !important; }

/* 玻璃擬態卡片 */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

/* 頂部導航列 */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 68px;
  background: rgba(8, 15, 36, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0284c7, #0369a1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 18px rgba(2, 132, 199, 0.4);
}

.brand-icon svg {
  width: 26px;
  height: 26px;
  transform: rotate(45deg);
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.nav-btn.highlight {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(2, 132, 199, 0.35));
  border-color: #38bdf8;
  color: #e0f2fe;
}

.nav-btn.highlight:hover {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.4), rgba(2, 132, 199, 0.55));
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: var(--border-focus);
}

/* 課堂逐步教學導覽條 */
.teaching-wizard {
  background: linear-gradient(90deg, #102454, #19367d);
  border-bottom: 2px solid #38bdf8;
  padding: 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: slideDown 0.3s ease;
}

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

.wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wizard-badge {
  background: #0284c7;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
}

.wizard-step-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #e0f2fe;
  flex: 1;
  margin-left: 1rem;
}

.wizard-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-step {
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.825rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-step:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.btn-step.primary {
  background: #38bdf8;
  color: #080f24;
  font-weight: 700;
  border-color: #38bdf8;
}

.btn-step.primary:hover {
  background: #7dd3fc;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.btn-step:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-close-wizard {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}

.btn-close-wizard:hover {
  color: #fff;
}

.wizard-body p {
  color: #cbd5e1;
  font-size: 0.925rem;
  max-width: 1200px;
}

/* 主容器 */
.main-container {
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* 模組 1：航線基本盤面板 */
.flight-specs-panel {
  padding: 1.5rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.75rem;
}

.badge-tag {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-highlight);
  letter-spacing: 0.02em;
}

.flight-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #34d399;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.flight-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 1.25rem;
}

.flight-card {
  background: rgba(13, 27, 60, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: relative;
  overflow: hidden;
}

.flight-card.outbound {
  border-left: 4px solid var(--outbound-blue);
}

.flight-card.inbound {
  border-left: 4px solid var(--inbound-green);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flight-type-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
}

.outbound .flight-type-badge {
  background: rgba(0, 176, 240, 0.15);
  color: var(--outbound-blue);
  border: 1px solid rgba(0, 176, 240, 0.3);
}

.inbound .flight-type-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--inbound-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.airline-logo {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.flight-number {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.05em;
}

.route-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
}

.airport {
  display: flex;
  flex-direction: column;
}

.airport .code {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
}

.airport .city {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.route-arrow svg {
  color: var(--text-highlight);
  animation: floatPlane 3s ease-in-out infinite;
}

@keyframes floatPlane {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.flight-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.75rem;
}

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

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.stat-val {
  font-size: 0.875rem;
  font-weight: 700;
  color: #e2e8f0;
}

/* 中央對流儀表板 */
.balance-center-card {
  background: linear-gradient(180deg, rgba(14, 30, 68, 0.8), rgba(9, 20, 48, 0.9));
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.balance-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  color: #93c5fd;
}

.balance-date-display {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.convection-visual {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.85rem 0;
  gap: 0.5rem;
}

.side {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
}

.side-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.seat-badge {
  font-size: 1rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  min-width: 100px;
}

.outbound-badge {
  background: rgba(0, 176, 240, 0.2);
  color: #38bdf8;
  border: 1px solid #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.inbound-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid #34d399;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.25);
}

.group-names-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.convection-core {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0 0.5rem;
}

.circular-meter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.meter-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: #38bdf8;
}

.sub-meter-desc {
  font-size: 0.7rem;
  color: #94a3b8;
}

.in-destination-meter {
  background: rgba(99, 102, 241, 0.15);
  border: 1px dashed rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.id-count {
  color: #a5b4fc;
  font-weight: 700;
}

/* 模組 2：時間軸控制列 */
.timeline-control-bar {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.timeline-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: none;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.35);
  transition: var(--transition);
}

.btn-play:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #0369a1, #0284c7);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
}

.btn-tool {
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-tool:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.timeline-scrubber-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.scrubber-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.725rem;
  color: var(--text-muted);
}

.phase-mark.golden {
  color: #38bdf8;
  font-weight: 700;
}

.timeline-slider {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
  cursor: grab;
  transition: transform 0.15s ease;
}

.timeline-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.2);
}

.timeline-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.timeline-tick-item {
  cursor: pointer;
  padding: 0.15rem 0.25rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.timeline-tick-item:hover, .timeline-tick-item.active {
  color: #38bdf8;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.15);
}

.timeline-tick-item.golden-day {
  color: #7dd3fc;
}

.filter-toggles {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.toggle-pill input {
  accent-color: #38bdf8;
}

.toggle-pill.active {
  border-color: #38bdf8;
  color: #e0f2fe;
  background: rgba(56, 189, 248, 0.12);
}

/* 模組 3：排程矩陣甘特圖 */
.matrix-section {
  padding: 1.5rem;
}

.matrix-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.matrix-title-group h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.matrix-subtitle {
  font-size: 0.825rem;
  color: var(--text-secondary);
}

.legend-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.dot-outbound { background: var(--outbound-blue); }
.dot-touring { background: var(--in-destination); }
.dot-inbound { background: var(--inbound-green); }
.dot-golden { background: #0284c7; box-shadow: 0 0 6px #38bdf8; }
.dot-orphan { background: var(--orphan-red); }

/* 甘特圖表格樣式 */
.matrix-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(8, 17, 40, 0.95);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
  font-size: 0.85rem;
}

.matrix-table th, .matrix-table td {
  padding: 0.65rem 0.5rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.matrix-table thead th {
  background: #0f1f45;
  color: #e2e8f0;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

.sticky-col {
  position: sticky;
  left: 0;
  background: #0d1a3a !important;
  z-index: 20;
  min-width: 150px;
  text-align: left !important;
  padding-left: 1rem !important;
  font-weight: 700;
  border-right: 2px solid rgba(56, 189, 248, 0.25) !important;
}

/* Excel 藍色標頭高亮 (1/5 ~ 1/10) */
.th-golden {
  background: #0077b6 !important;
  color: #ffffff !important;
  box-shadow: inset 0 0 10px rgba(0, 180, 216, 0.4);
}

.th-date-title {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
}

.th-date-weekday {
  font-size: 0.7rem;
  opacity: 0.8;
  display: block;
}

/* 當前選定日期的縱向光柱掃描 */
.col-highlight {
  background: rgba(56, 189, 248, 0.12) !important;
  position: relative;
}

.col-highlight::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-left: 1px solid rgba(56, 189, 248, 0.5);
  border-right: 1px solid rgba(56, 189, 248, 0.5);
  pointer-events: none;
}

/* 甘特圖儲存格內部元件 */
.cell-outbound {
  background: rgba(0, 176, 240, 0.22);
  color: #38bdf8;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.25rem;
  border: 1px solid rgba(0, 176, 240, 0.4);
  cursor: pointer;
  transition: var(--transition);
}

.cell-outbound:hover {
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(0, 176, 240, 0.5);
}

.cell-inbound {
  background: rgba(16, 185, 129, 0.22);
  color: #34d399;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.25rem;
  border: 1px solid rgba(16, 185, 129, 0.4);
  cursor: pointer;
  transition: var(--transition);
}

.cell-inbound:hover {
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.cell-touring {
  background: rgba(99, 102, 241, 0.12);
  color: #c7d2fe;
  font-size: 0.75rem;
  border-radius: 4px;
}

.cell-orphan-warning {
  background: var(--orphan-bg) !important;
  color: #fda4af;
  border: 1px dashed var(--orphan-red) !important;
  font-size: 0.7rem;
  animation: flashAlert 2s infinite;
}

@keyframes flashAlert {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.cell-clash-warning {
  background: rgba(249, 115, 22, 0.25) !important;
  color: #fdba74;
  border: 1px solid var(--clash-orange) !important;
  font-size: 0.75rem;
  font-weight: 700;
}

/* 甘特圖底部匯總列 */
.summary-row th {
  background: #0a1532 !important;
  color: #cbd5e1;
  font-size: 0.8rem;
}

.summary-row td {
  background: #09122b;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.825rem;
}

.outbound-sum-row td { color: #38bdf8; }
.inbound-sum-row td { color: #34d399; }
.balance-indicator-row td { font-size: 0.75rem; }

/* 模組 4：破壞五天實驗室 */
.lab-section {
  padding: 1.75rem;
  border: 1px solid rgba(244, 63, 94, 0.3);
  position: relative;
  overflow: hidden;
}

.lab-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #38bdf8, #f43f5e, #f97316);
}

.lab-header {
  margin-bottom: 1.5rem;
}

.lab-badge {
  display: inline-block;
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.5rem;
}

.lab-header h2 {
  font-size: 1.35rem;
  color: #fff;
  margin-bottom: 0.4rem;
}

.lab-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.lab-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.scenario-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.btn-scenario {
  background: rgba(13, 26, 56, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--text-primary);
  transition: var(--transition);
}

.btn-scenario strong {
  font-size: 0.9rem;
  color: #fff;
}

.btn-scenario span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.btn-scenario:hover {
  background: rgba(23, 44, 94, 0.9);
  border-color: var(--border-focus);
}

.btn-scenario.active {
  border-color: #38bdf8;
  background: rgba(14, 165, 233, 0.18);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.25);
}

.btn-scenario.danger.active {
  border-color: var(--orphan-red);
  background: rgba(244, 63, 94, 0.18);
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.25);
}

.btn-scenario.warning.active {
  border-color: var(--clash-orange);
  background: rgba(249, 115, 22, 0.18);
  box-shadow: 0 0 15px rgba(249, 115, 22, 0.25);
}

/* 實驗室結果分析卡 */
.lab-result-card {
  background: rgba(9, 18, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.result-status-icon {
  font-size: 2rem;
}

.result-title-group h3 {
  font-size: 1.15rem;
  color: #fff;
}

.result-title-group p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.impact-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.metric-card {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.m-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.m-val {
  font-size: 1rem;
  font-weight: 700;
}

.pedagogical-explain {
  background: rgba(15, 28, 62, 0.6);
  border-left: 3px solid #38bdf8;
  padding: 0.85rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.875rem;
  color: #cbd5e1;
  line-height: 1.7;
}

/* 模組 5：專題講堂 Tabs */
.lecture-tabs-section {
  padding: 1.75rem;
}

.tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab-btn {
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-full);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

.lecture-card {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
  align-items: center;
}

.lecture-text h3 {
  font-size: 1.25rem;
  color: #fff;
  margin-bottom: 0.85rem;
}

.lecture-text p {
  color: #cbd5e1;
  font-size: 0.925rem;
  margin-bottom: 1rem;
  line-height: 1.7;
}

.lecture-text ul {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  color: #cbd5e1;
  font-size: 0.9rem;
}

.lecture-visual {
  background: rgba(10, 20, 48, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

/* 視覺流程示意 */
.pipeline-flow {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.pipe-node {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #e0f2fe;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  width: 100%;
}

.pipe-node.highlight-node {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(2, 132, 199, 0.4));
  border-color: #38bdf8;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.pipe-arrow {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.orphan-box {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.orphan-item {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.orphan-item.head {
  background: rgba(244, 63, 94, 0.15);
  border-left: 4px solid var(--orphan-red);
}

.orphan-item.middle {
  background: rgba(16, 185, 129, 0.15);
  border-left: 4px solid var(--inbound-green);
}

.orphan-item.tail {
  background: rgba(249, 115, 22, 0.15);
  border-left: 4px solid var(--clash-orange);
}

.o-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

.orphan-item strong {
  font-size: 0.95rem;
  color: #fff;
}

.orphan-item p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

.chains-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chain-badge {
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chain-badge.c1 { border-left: 4px solid #facc15; }
.chain-badge.c2 { border-left: 4px solid #4ade80; }
.chain-badge.c3 { border-left: 4px solid #38bdf8; }
.chain-badge.c4 { border-left: 4px solid #ec4899; }
.chain-badge.c5 { border-left: 4px solid #a855f7; }

.ticket-rule-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.rule-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* 模組 6：隨堂測驗區 */
.quiz-section {
  padding: 1.75rem;
}

.quiz-header {
  margin-bottom: 1.5rem;
}

.quiz-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.4rem;
}

.quiz-header h2 {
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 0.3rem;
}

.quiz-header p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.quiz-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.quiz-card {
  background: rgba(10, 21, 50, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quiz-q-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.5;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-opt {
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 0.825rem;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.quiz-opt:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.quiz-opt.correct {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: #10b981 !important;
  color: #6ee7b7 !important;
  font-weight: 700;
}

.quiz-opt.wrong {
  background: rgba(244, 63, 94, 0.25) !important;
  border-color: #f43f5e !important;
  color: #fda4af !important;
}

.quiz-feedback {
  font-size: 0.8rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  color: #cbd5e1;
  line-height: 1.5;
  display: none;
}

/* Excel 原始對照 Modal 彈窗 */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-dialog {
  background: #0f1e42;
  border: 1px solid #38bdf8;
  border-radius: var(--radius-lg);
  max-width: 1200px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: #38bdf8;
  font-size: 1.1rem;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
}

.btn-close-modal:hover { color: #fff; }

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.excel-preview-scroll {
  overflow-x: auto;
}

.excel-styled-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.825rem;
  background: #ffffff;
  color: #1e293b;
}

.excel-styled-table th, .excel-styled-table td {
  border: 1px solid #cbd5e1;
  padding: 0.5rem 0.4rem;
  text-align: center;
}

.excel-styled-table thead tr:nth-child(1),
.excel-styled-table thead tr:nth-child(2) {
  background: #f1f5f9;
  font-weight: 700;
  text-align: left;
}

.date-header-excel th {
  background: #e2e8f0;
  font-weight: 700;
}

.excel-hl-cell {
  background: #00b0f0 !important;
  color: #fff !important;
  font-weight: 800;
}

.excel-styled-table .row-label {
  background: #f8fafc;
  font-weight: 700;
  text-align: left;
}

.c-yellow { background: #ffff00; font-weight: 700; }
.c-green { background: #92d050; font-weight: 700; }
.c-cyan { background: #7dd3fc; font-weight: 700; }
.c-pink { background: #f472b6; font-weight: 700; }
.c-purple { background: #c084fc; font-weight: 700; }
.c-in-dest { background: #e2e8f0; }

.excel-modal-tips {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  background: rgba(56, 189, 248, 0.12);
  border-radius: var(--radius-sm);
  color: #bae6fd;
  font-size: 0.85rem;
}

/* 頁尾 */
.app-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.25rem 2rem;
  background: rgba(8, 15, 36, 0.95);
}

.footer-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.825rem;
  color: var(--text-muted);
}

.footer-col-left {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-meta {
  color: var(--text-secondary);
}

.footer-copyright {
  color: #38bdf8;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
}

.footer-col-right {
  color: #94a3b8;
  font-size: 0.8rem;
}

/* 簡報全螢幕投影模式 (Presentation Mode) */
body.fullscreen-mode .top-nav {
  padding: 0.5rem 1.5rem;
  height: 54px;
}

body.fullscreen-mode .main-container {
  max-width: 100%;
  padding: 1rem;
}

body.fullscreen-mode .matrix-table {
  font-size: 0.95rem;
}

/* 響應式調整 */
@media (max-width: 1200px) {
  .flight-cards-grid {
    grid-template-columns: 1fr;
  }
  .scenario-buttons {
    grid-template-columns: repeat(2, 1fr);
  }
  .impact-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .lecture-card {
    grid-template-columns: 1fr;
  }
  .quiz-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .top-nav {
    padding: 0.5rem 1rem;
    height: auto;
    flex-direction: column;
    gap: 0.5rem;
  }
  .timeline-control-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .scenario-buttons {
    grid-template-columns: 1fr;
  }
  .impact-metrics-grid {
    grid-template-columns: 1fr;
  }
}
