/* ==========================================================================
   Relativistic Optical Delay-Line Data Storage Medium
   Web Application Stylesheet: Deep Space Aerospace Scientific UI Theme
   ========================================================================== */

:root {
  /* Color Palette: Deep Space Aerospace Blue-Tinted Theme */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2234;
  --bg-card: #151d2e;
  --bg-card-hover: #1c263c;
  --border-color: #26334d;
  --border-highlight: #3b82f6;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0a0e17;

  /* Accent Colors */
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-blue: #3b82f6;
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.2);
  --accent-emerald: #10b981;
  --accent-purple: #a855f7;
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.25);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font-serif: "Times New Roman", Times, Georgia, serif;

  /* Geometry & Spacing */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
  color-scheme: dark;
  background-color: var(--bg-primary);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Application Container */
#app-container, .container {
  max-width: 1720px;
  margin: 0 auto;
  padding: 1.2rem 1.5rem 3rem;
}

/* Header */
#app-header, .header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#app-header h1 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#app-header h1::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  background: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent-cyan);
}

.header-byline {
  font-size: 0.92rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.analysis-tab-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.4rem;
  margin-bottom: 1.5rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#active-preset-label {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.4);
  font-family: var(--font-mono);
}

/* 3-Tab Navigation Bar */
.tab-nav-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  padding: 0.45rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.tab-nav-btn {
  flex: 1 1 220px;
  padding: 0.75rem 1.25rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
}

.tab-nav-btn:hover {
  background: var(--bg-tertiary);
  color: #fff;
}

.tab-nav-btn.active {
  background: rgba(59, 130, 246, 0.18);
  color: #fff;
  border-color: var(--accent-blue);
  box-shadow: inset 0 0 12px rgba(59, 130, 246, 0.2);
}

.tab-panel[hidden] {
  display: none !important;
}

/* Easy-Reading Layout for Tab 1 (Introduction) & Tab 2 (Story) */
.reading-pane {
  max-width: 820px;
  margin: 0 auto 2rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.75rem 3.25rem;
  box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
  .reading-pane {
    padding: 1.5rem 1.4rem;
  }
}

.prose-content {
  font-size: 1.08rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.prose-content p {
  margin-bottom: 1.35rem;
  color: #e2e8f0;
}

.prose-content h2, .prose-content h3 {
  color: #fff;
  margin-top: 1.8rem;
  margin-bottom: 0.85rem;
  line-height: 1.35;
}

.story-header {
  text-align: center;
  margin-bottom: 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.story-title {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0.45rem 0;
  letter-spacing: -0.01em;
}

.story-byline {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.story-prose {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1.14rem;
  line-height: 1.88;
  letter-spacing: 0.01em;
}

.story-prose p {
  margin-bottom: 1.45rem;
  color: #f1f5f9;
  text-indent: 1.5em;
}

.author-signoff {
  margin-top: 2rem;
  font-weight: 600;
  color: var(--accent-cyan) !important;
  text-align: right;
}

.author-signoff a {
  color: var(--accent-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.author-signoff a:hover {
  color: #fff;
}

/* Top Full-Width Section 1 */
.top-full-section {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

/* Overall Scheme Visual Overview Banner (After Section 1) */
.scheme-overview-section {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.75rem 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.scheme-overview-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.scheme-overview-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.scheme-overview-subtitle {
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.scheme-svg-frame {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #060c1d;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
}

.scheme-svg-frame svg {
  width: 100%;
  height: auto;
  display: block;
}

@keyframes pulseFlowOut {
  from { stroke-dashoffset: 22; }
  to   { stroke-dashoffset: 0; }
}

@keyframes pulseFlowReturn {
  from { stroke-dashoffset: 56; }
  to   { stroke-dashoffset: 0; }
}

.anim-beam-out {
  animation: pulseFlowOut 1.3s linear infinite;
}

.anim-beam-return {
  animation: pulseFlowReturn 2.4s linear infinite;
}

.scheme-stage-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem;
  margin-top: 1rem;
}

@media (max-width: 960px) {
  .scheme-stage-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .scheme-stage-strip {
    grid-template-columns: 1fr;
  }
}

.scheme-stage-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  border-top: 3px solid var(--accent-blue);
}

.scheme-stage-card.stage-space {
  border-top-color: var(--accent-cyan);
}

.scheme-stage-card.stage-reflect {
  border-top-color: var(--accent-amber);
}

.scheme-stage-card.stage-readout {
  border-top-color: var(--accent-rose);
}

.scheme-stage-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.scheme-stage-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

/* Interactive Simulation Workspace: Controls & Telemetry (Left) + Diagrams (Right) */
.simulation-workspace {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 2rem;
}

@media (max-width: 1200px) {
  .simulation-workspace {
    grid-template-columns: 1fr;
  }
}

/* Full-Width Technical Report Panel (Sections 2-6, No Inner Scrollbar) */
#report-panel, .report-pane {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow-sm);
  max-height: none;
  overflow: visible;
  margin-bottom: 2rem;
}

.report-section {
  margin-bottom: 2.2rem;
  padding-bottom: 1.8rem;
  border-bottom: 1px solid var(--border-color);
}

.report-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.report-section h2, .section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.85rem;
  letter-spacing: -0.01em;
}

.report-section h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 1.2rem;
  margin-bottom: 0.6rem;
}

.report-section h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-amber);
  margin-bottom: 0.4rem;
}

.report-section p {
  color: var(--text-secondary);
  margin-bottom: 0.9rem;
  font-size: 0.95rem;
}

.report-section p strong {
  color: #fff;
}

/* Callouts */
.callout {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin: 1.2rem 0;
  border-left: 4px solid var(--border-highlight);
  background: var(--bg-tertiary);
}

.callout-info {
  border-left-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
}

.callout-warning {
  border-left-color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.08);
}

.callout h4 {
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

/* Equations Styling */
.equation {
  margin: 1.2rem 0;
  padding: 1rem 1.2rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: #e2e8f0;
  text-align: center;
  overflow-x: auto;
}

math {
  font-size: 1.05em;
  color: #f1f5f9;
}

.equation math {
  font-size: 1.18rem;
}

/* Bottom Glossary Section */
.glossary-bottom-section {
  margin-top: 2rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow-sm);
}

.control-group-highlight {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.25rem;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 1.2rem 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.ste-table, .glossary-table, .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.ste-table th, .glossary-table th, .data-table th {
  background-color: var(--bg-tertiary);
  color: var(--accent-cyan);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.ste-table td, .glossary-table td, .data-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  vertical-align: top;
}

.ste-table tr:last-child td, .glossary-table tr:last-child td, .data-table tr:last-child td {
  border-bottom: none;
}

.ste-table tr:hover, .glossary-table tr:hover, .data-table tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.ste-table td strong {
  color: #fff;
}

/* Left Simulation Pane: Cockpit Sidebar */
#cockpit-sidebar, .cockpit-pane {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Mission Preset Buttons */
.preset-selector-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
}

.preset-selector-bar h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
  margin-bottom: 0.65rem;
}

.preset-btn-grid {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.btn-preset {
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.85rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-preset:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  color: #fff;
}

.btn-preset.active {
  background: rgba(59, 130, 246, 0.18);
  border-color: var(--accent-blue);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 10px rgba(59, 130, 246, 0.2);
}

.btn-preset.active::after {
  content: "ACTIVE";
  font-family: var(--font-mono);
  font-size: 0.66rem;
  background: var(--accent-blue);
  color: #fff;
  padding: 0.12rem 0.38rem;
  border-radius: 3px;
}

/* Sliders Control Deck */
.slider-control-deck {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.slider-control-deck h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
  margin-bottom: 0.2rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.control-group label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.control-group label span {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  font-weight: 600;
  font-size: 0.8rem;
}

/* Custom Range Input */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent-blue);
  border: 2px solid #fff;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.6);
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: var(--accent-cyan);
}

input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent-blue);
  border: 2px solid #fff;
  cursor: pointer;
}

/* Live Telemetry Card */
#telemetry-card, .telemetry-card {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.9) 0%, rgba(21, 29, 46, 0.95) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

#telemetry-card h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-emerald);
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#telemetry-card h3::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse-telemetry 2s infinite ease-in-out;
}

@keyframes pulse-telemetry {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
}

.telemetry-item {
  background: var(--bg-tertiary);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
}

.telemetry-item .t-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 0.15rem;
}

.telemetry-item .t-val {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 600;
  color: #fff;
}

/* Specific Telemetry Summary Lines */
#telemetry-delay, #telemetry-doppler, #telemetry-capacity {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 0.28rem 0;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  line-height: 1.35;
}

/* Right Simulation Pane: Multi-Deck Interactive Visualizations */
#chart-deck, .chart-deck {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-top: 0;
}

@media (max-width: 1100px) {
  #chart-deck, .chart-deck {
    grid-template-columns: 1fr;
  }
}

.chart-container {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 0.2s;
}

.chart-container:hover {
  border-color: rgba(59, 130, 246, 0.5);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border-color);
}

.chart-container h3 {
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
}

.chart-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #060910;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.canvas-wrapper canvas {
  width: 100%;
  height: 100%;
  display: block;
}
