@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap");

:root {
  --primary-teal: #0f7e9b;
  --primary-teal-dark: #095f76;
  --primary-teal-light: #e6f4f8;
  --primary-teal-border: #a9c4cf;
  
  --accent-amber: #d67b19;
  --accent-amber-dark: #b86510;
  --accent-amber-light: #fff8ed;
  --accent-amber-border: #f2cca1;

  --bg-grid: #e9f4fb;
  --surface: #ffffff;
  --surface-alt: #f7fbfd;
  
  --ink: #123140;
  --muted: #4b6570;
  --subtle: #7a94a0;
  --border: #c8dbe3;
  --border-light: #e2eef3;

  --success: #1a7f4e;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;

  --error: #dc2626;
  --error-bg: #fef2f2;
  --error-border: #fecaca;

  --shadow-sm: 0 2px 6px rgba(12, 54, 68, 0.05);
  --shadow-md: 0 6px 16px rgba(12, 54, 68, 0.08);
  --shadow-lg: 0 12px 24px rgba(12, 54, 68, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

html, body {
  min-height: 100%;
}

body {
  font-family: "Inter", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: 
    radial-gradient(1200px 700px at 8% 2%, rgba(15, 126, 155, 0.14), transparent 62%),
    radial-gradient(900px 600px at 92% 98%, rgba(214, 123, 25, 0.12), transparent 66%),
    linear-gradient(165deg, #e9f4fb, #fdfbf7);
  color: var(--ink);
  line-height: 1.45;
  padding-bottom: 3.5rem;
  overflow-x: hidden;
}

/* Background blueprint grid */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(15, 126, 155, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214, 123, 25, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at center, black 45%, transparent 95%);
}

.math-expr {
  font-family: "Cambria Math", "Times New Roman", serif;
  letter-spacing: 0.02em;
}

.math-expr i {
  font-style: italic;
}

.math-expr sub, .math-expr sup {
  font-size: 0.75em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

.math-expr sup {
  top: -0.5em;
}

.math-expr sub {
  bottom: -0.25em;
}

.shell {
  width: min(1440px, calc(100% - 2rem));
  margin-inline: auto;
  padding-top: 1rem;
}

/* Header Banner */
.hero {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  background: linear-gradient(160deg, #ffffff, #f7fbfd);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 10px;
  background: var(--primary-teal);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-teal);
  background: var(--primary-teal-light);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
  border: 1px solid var(--primary-teal-border);
  text-decoration: none;
  transition: all 0.15s ease;
}

.brand-badge:hover {
  background: #d4ecf4;
  color: var(--primary-teal-dark);
}

.lab-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-amber-dark);
  background: var(--accent-amber-light);
  border: 1px solid var(--accent-amber-border);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  margin-left: 0.5rem;
}

.hero h1 {
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  font-weight: 700;
  color: var(--primary-teal-dark);
  line-height: 1.2;
  margin-bottom: 0.35rem;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 900px;
  line-height: 1.45;
}

.hero-meta-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Lab Navigation Tabs (Equal 4-column distribution) */
.lab-nav-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 992px) {
  .lab-nav-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .lab-nav-tabs {
    grid-template-columns: 1fr;
  }
}

.lab-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.75rem 0.65rem;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
}

.lab-tab:hover {
  border-color: var(--primary-teal);
  color: var(--primary-teal-dark);
  background: var(--primary-teal-light);
}

.lab-tab.active {
  background: var(--primary-teal);
  color: #ffffff;
  border-color: var(--primary-teal-dark);
  box-shadow: 0 4px 12px rgba(15, 126, 155, 0.25);
}

.lab-tab.active .tab-icon {
  transform: scale(1.1);
}

/* Card / Panel */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.panel:hover {
  border-color: var(--primary-teal-border);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-light);
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-teal-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Canvas apparatus container */
.canvas-card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.25rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Metronome Panel Widget */
.metronome-banner {
  background: linear-gradient(135deg, var(--accent-amber-light), #ffffff);
  border: 1px solid var(--accent-amber-border);
  border-left: 6px solid var(--accent-amber);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.2rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.metronome-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.metronome-pendulum-box {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent-amber);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 2px 6px rgba(214, 123, 25, 0.2);
}

.metronome-led {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d4d4d4;
  transition: background 0.08s ease, transform 0.08s ease, box-shadow 0.08s ease;
}

.metronome-led.flash {
  background: var(--accent-amber);
  transform: scale(1.3);
  box-shadow: 0 0 12px rgba(214, 123, 25, 0.9);
}

.metronome-info h3 {
  font-size: 1rem;
  color: var(--accent-amber-dark);
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.metronome-info p {
  font-size: 0.85rem;
  color: var(--muted);
}

.metronome-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn-mark-beat {
  background: linear-gradient(135deg, var(--accent-amber), var(--accent-amber-dark));
  color: #ffffff;
  border: 2px solid var(--accent-amber-dark);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(214, 123, 25, 0.35);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-mark-beat:hover {
  background: var(--accent-amber-dark);
  box-shadow: 0 6px 16px rgba(214, 123, 25, 0.45);
}

.btn-mark-beat:active {
  transform: translateY(2px);
  box-shadow: 0 2px 6px rgba(214, 123, 25, 0.2);
}

.beat-pill {
  background: #ffffff;
  border: 1px solid var(--accent-amber-border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-amber-dark);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-teal);
  color: #ffffff;
  border-color: var(--primary-teal-dark);
}

.btn-primary:hover {
  background: var(--primary-teal-dark);
}

.btn-accent {
  background: var(--accent-amber);
  color: #ffffff;
  border-color: var(--accent-amber-dark);
}

.btn-accent:hover {
  background: var(--accent-amber-dark);
}

.btn-ghost {
  background: var(--surface-alt);
  color: var(--ink);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--primary-teal-light);
  border-color: var(--primary-teal-border);
  color: var(--primary-teal-dark);
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.65rem 1.4rem;
  font-size: 1rem;
}

/* Metrics Badges Bar */
.metrics-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.metric-pill {
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.metric-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-teal-dark);
  font-variant-numeric: tabular-nums;
  margin-top: 0.1rem;
}

.metric-pill.amber .metric-val {
  color: var(--accent-amber-dark);
}

.metrics-bar.galileo-metrics {
  background: #fdfaf4;
  border-color: #dfd5c4;
}

.metrics-bar.galileo-metrics .metric-pill {
  border-color: #e5dcce;
}

/* Canvas Viewport */
.canvas-viewport {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--border);
}

#simCanvas {
  display: block;
  width: 100%;
  height: 310px;
  background: #ffffff;
  cursor: crosshair;
}

/* Incline Controls bar */
.apparatus-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.control-item label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
}

.control-item label span.val {
  color: var(--primary-teal);
  font-weight: 700;
}

input[type="range"] {
  accent-color: var(--primary-teal);
  cursor: pointer;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

/* Workflow Grid: Two columns for Data and Graphs */
.lab-grid {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 1.25rem;
}

@media (max-width: 1024px) {
  .lab-grid {
    grid-template-columns: 1fr;
  }
}

/* Data Table Container */
.table-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 0.85rem;
  max-height: 280px;
  overflow-y: auto;
  background: #ffffff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.data-table th {
  background: var(--surface-alt);
  color: var(--ink);
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  font-variant-numeric: tabular-nums;
}

.data-table tr:hover {
  background: #fbfdfd;
}

.data-table tr.active-row {
  background: var(--primary-teal-light);
  font-weight: 600;
}

/* Graphs Layout */
.graphs-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .graphs-container {
    grid-template-columns: 1fr;
  }
}

.graph-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.graph-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.graph-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-teal-dark);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.graph-canvas {
  width: 100%;
  height: 260px;
  display: block;
  background: #ffffff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.fit-formula-badge {
  background: var(--primary-teal-light);
  border: 1px solid var(--primary-teal-border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
  color: var(--primary-teal-dark);
  font-weight: 600;
  margin-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fit-formula-badge.amber {
  background: var(--accent-amber-light);
  border-color: var(--accent-amber-border);
  color: var(--accent-amber-dark);
}

/* Tangent Scrub Controls */
.tangent-controls {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.tangent-slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.tangent-slider-row input[type="range"] {
  flex: 1;
}

/* Hub Bridge Callout Box */
.hub-bridge-banner {
  background: linear-gradient(135deg, var(--surface-alt), #ffffff);
  border: 1px solid var(--border);
  border-left: 6px solid var(--accent-amber);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.hub-bridge-text h4 {
  font-size: 0.95rem;
  color: var(--accent-amber-dark);
  margin-bottom: 0.2rem;
}

.hub-bridge-text p {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Analysis & Mathematical Modeling Cards */
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.model-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
}

.model-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-teal-dark);
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border-light);
}

.equation-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin: 0.65rem 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.comparison-table th, .comparison-table td {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-light);
}

.comparison-table th {
  background: var(--primary-teal-light);
  color: var(--primary-teal-dark);
  font-weight: 700;
  text-align: left;
}

.comparison-table td.match {
  background: #f0fdf4;
  color: var(--success);
  font-weight: 700;
}

/* Questions Accordion / Guided Review */
.question-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  overflow: hidden;
  background: #ffffff;
}

.question-header {
  padding: 0.75rem 1rem;
  background: var(--surface-alt);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  user-select: none;
}

.question-header:hover {
  background: var(--primary-teal-light);
  color: var(--primary-teal-dark);
}

.question-body {
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.5;
  border-top: 1px solid var(--border-light);
  background: #ffffff;
}

/* Galileo Renaissance Musical Bell & Frets Tuning Studio */
.galileo-banner {
  background: #fbf9f4;
  border: 1px solid #dcd1c2;
  border-left: 6px solid #d67b19;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 14px rgba(214, 123, 25, 0.08);
}

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

.galileo-banner-info {
  flex: 1;
  min-width: 280px;
}

.galileo-banner-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #4a3424;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.galileo-banner-info p {
  font-size: 0.85rem;
  color: #5c4331;
  line-height: 1.5;
  margin: 0;
}

.galileo-banner-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-outline-galileo {
  background: #ffffff;
  border: 1.5px solid #d67b19;
  color: #b86510;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.38rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-outline-galileo:hover {
  background: #d67b19;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(214, 123, 25, 0.25);
}

.galileo-frets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.fret-card {
  background: #ffffff;
  border: 1px solid #e5dcce;
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.fret-card:hover {
  border-color: #d67b19;
  box-shadow: 0 2px 8px rgba(214, 123, 25, 0.15);
}

.fret-card.active-rung {
  border-color: #d67b19;
  background: #fffbf5;
  transform: scale(1.02);
  box-shadow: 0 0 0 2px rgba(214, 123, 25, 0.3);
}

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

.fret-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: #5c3a1e;
  background: #f4eee2;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.btn-ring-preview {
  background: transparent;
  border: 1px solid #dfd3c0;
  border-radius: 4px;
  color: #8c5d2e;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-ring-preview:hover {
  background: #d67b19;
  border-color: #d67b19;
  color: #ffffff;
}

.fret-slider-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.slider-fret {
  flex: 1;
  accent-color: #d67b19;
  cursor: pointer;
}

.fret-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f7e9b;
  min-width: 48px;
  text-align: right;
  font-family: monospace;
}

.fret-dist {
  font-size: 0.75rem;
  color: #8c6d53;
  font-style: italic;
}

.galileo-cadence-box {
  background: #ffffff;
  border: 1px solid #e5dcce;
  border-radius: var(--radius-md);
  padding: 1rem;
}

.cadence-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.cadence-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #f6f2ea;
  color: #5c3a1e;
  border: 1px solid #dfd5c4;
  transition: all 0.2s ease;
}

.cadence-badge.steady {
  background: rgba(15, 126, 155, 0.12);
  color: #0f7e9b;
  border-color: #0f7e9b;
}

.cadence-badge.accelerating {
  background: rgba(214, 123, 25, 0.12);
  color: #b86510;
  border-color: #d67b19;
}

/* Galileo Renaissance Manuscript & Historical Dossier */
.galileo-dossier {
  background: #fdfbf7;
  border: 1px solid #dcd1c2;
  border-left: 6px solid #b86510;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 14px rgba(184, 101, 16, 0.08);
  position: relative;
}

.galileo-dossier::before {
  content: "ANNO DOMINI 1638";
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #8c6d53;
}

.folio-header {
  margin-bottom: 1.25rem;
  border-bottom: 1px dashed #dcd1c2;
  padding-bottom: 0.85rem;
}

.folio-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #4a3424;
  font-family: "IBM Plex Sans", "Times New Roman", serif;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.folio-header p {
  font-size: 0.9rem;
  color: #6d5442;
  margin-top: 0.25rem;
}

.quote-block {
  background: #f8f2e6;
  border-left: 4px solid #b86510;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-family: "Georgia", "Cambria", serif;
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #38281b;
}

.quote-author {
  display: block;
  text-align: right;
  font-family: "Inter", sans-serif;
  font-style: normal;
  font-size: 0.8rem;
  font-weight: 700;
  color: #8c6d53;
  margin-top: 0.5rem;
}

.artifact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.artifact-card {
  background: #ffffff;
  border: 1px solid #e2d7c7;
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.artifact-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #b86510;
}

.artifact-card h3 {
  font-size: 0.98rem;
  font-weight: 700;
  color: #4a3424;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.artifact-card p {
  font-size: 0.84rem;
  color: #5a4637;
  line-height: 1.45;
  margin-bottom: 0.85rem;
  flex: 1;
}

.artifact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #b86510;
  text-decoration: none;
  border: 1px solid #e2cca8;
  background: #fdfaf4;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  align-self: flex-start;
}

.artifact-link:hover {
  background: #b86510;
  color: #ffffff;
}

/* Footer */
footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--subtle);
  padding: 1rem 0;
}

/* ==========================================================================
   Renaissance Theme: Galileo Galilei (Anno Domini 1638)
   Transforms the entire interface into a 17th-century Florentine manuscript
   ========================================================================== */
body.theme-galileo {
  background-color: #f6f1e5;
  background-image:
    radial-gradient(#d6c6a5 0.75px, transparent 0.75px),
    radial-gradient(ellipse at 50% 0%, #fffcf5 0%, #f5efe3 50%, #eae0ce 100%);
  background-size: 26px 26px, 100% 100%;
  color: #3b2818;
  font-family: "EB Garamond", "Baskerville", "Palatino", "Georgia", serif;
  font-size: 1.05rem;
  line-height: 1.6;
}

body.theme-galileo .bg-grid {
  background-image: 
    linear-gradient(to right, rgba(184, 101, 16, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(184, 101, 16, 0.04) 1px, transparent 1px);
}

body.theme-galileo .hero {
  background: #fbf7ee;
  border: 1.5px solid #d4c2a5;
  border-left: 6px solid #b86510;
  box-shadow: 0 6px 24px rgba(80, 50, 20, 0.08);
}

body.theme-galileo .hero h1 {
  font-family: "Cinzel", "EB Garamond", serif;
  font-size: 1.75rem;
  color: #17424d;
  letter-spacing: 0.02em;
}

body.theme-galileo .hero-subtitle {
  color: #553c26;
  font-style: italic;
  font-size: 0.98rem;
}

body.theme-galileo .brand-badge {
  background: #f3ebda;
  border-color: #d8c7ad;
  color: #5c3a1e;
  font-family: "Cinzel", "EB Garamond", serif;
}

body.theme-galileo .lab-badge {
  background: rgba(184, 101, 16, 0.12);
  border-color: #d4a770;
  color: #8f4602;
  font-family: "Cinzel", "EB Garamond", serif;
}

body.theme-galileo .lab-tab {
  font-family: "Cinzel", "EB Garamond", serif;
  font-size: 0.88rem;
  background: #fdfaf4;
  border: 1.5px solid #d8caa8;
  color: #5c3a1e;
}

body.theme-galileo .lab-tab.active {
  background: #b86510;
  border-color: #964803;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(184, 101, 16, 0.3);
}

body.theme-galileo .card,
body.theme-galileo .panel,
body.theme-galileo .canvas-card {
  background: #fcf9f2;
  border: 1.5px solid #d8caa8;
  box-shadow: 0 6px 24px rgba(70, 45, 20, 0.07);
}

body.theme-galileo .canvas-viewport {
  background: #fcf8f0;
  border-color: #cbbaa1;
}

body.theme-galileo .panel-title,
body.theme-galileo .section-title {
  font-family: "Cinzel", "EB Garamond", serif;
  color: #17424d;
  letter-spacing: 0.02em;
}

body.theme-galileo .metrics-bar.galileo-metrics {
  background: #f5eedf;
  border: 1.5px solid #d8caa8;
}

body.theme-galileo .metric-pill {
  background: #faf5eb;
  border-color: #dccbb0;
}

body.theme-galileo .metric-label {
  font-family: "Cinzel", "EB Garamond", serif;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: #724c28;
}

body.theme-galileo .metric-value {
  font-family: "EB Garamond", "Georgia", serif;
  font-size: 1.28rem;
  font-weight: 700;
  color: #17424d;
}

body.theme-galileo .btn-primary {
  background: #b86510;
  border-color: #964803;
  color: #ffffff;
  font-family: "Cinzel", "EB Garamond", serif;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(184, 101, 16, 0.25);
}

body.theme-galileo .btn-primary:hover {
  background: #964803;
}

body.theme-galileo .btn-ghost {
  background: #f7efe2;
  border-color: #d4c2a5;
  color: #5c3a1e;
  font-family: "Cinzel", "EB Garamond", serif;
}

body.theme-galileo .btn-ghost:hover {
  background: #ede1ce;
}

body.theme-galileo .btn-accent {
  background: #0f7e9b;
  border-color: #0c677f;
  color: #ffffff;
  font-family: "Cinzel", "EB Garamond", serif;
}

body.theme-galileo .fret-card {
  background: #fbf7ef;
  border: 1.5px solid #d4c2a5;
  box-shadow: 0 2px 8px rgba(92, 58, 30, 0.06);
}

body.theme-galileo .fret-card.active-rung {
  border-color: #d67b19;
  background: #fdf5ea;
  box-shadow: 0 0 16px rgba(214, 123, 25, 0.3);
}

body.theme-galileo .fret-badge {
  font-family: "Cinzel", serif;
  background: #eddcc5;
  color: #5c3a1e;
  border: 1px solid #d8caa8;
}

body.theme-galileo .galileo-cadence-box {
  background: #fbf7ef;
  border: 1.5px solid #d4c2a5;
}

body.theme-galileo .data-table {
  border-color: #d8caa8;
}

body.theme-galileo .data-table th {
  background: #ede0cd;
  border-color: #d8caa8;
  color: #442a15;
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

body.theme-galileo .data-table td {
  border-color: #e5d8c3;
  color: #3b2818;
  font-size: 0.94rem;
}

body.theme-galileo .data-table tr:hover {
  background: #f5eedf;
}

body.theme-galileo .galileo-dossier {
  background: #faf6ec;
  border: 2px solid #d4c2a5;
  border-left: 6px solid #b86510;
  box-shadow: 0 8px 30px rgba(92, 58, 30, 0.1);
}

body.theme-galileo .artifact-card {
  background: #fdfaf4;
  border: 1.5px solid #d8caa8;
}

body.theme-galileo .artifact-card h3 {
  font-family: "Cinzel", "EB Garamond", serif;
  color: #17424d;
}

body.theme-galileo .artifact-link {
  font-family: "Cinzel", "EB Garamond", serif;
  border-color: #d4a770;
  background: #f9f1e3;
  color: #8f4602;
}

body.theme-galileo .artifact-link:hover {
  background: #b86510;
  color: #ffffff;
}

body.theme-galileo .sidebar-card {
  background: #fcf9f2;
  border: 1.5px solid #d8caa8;
}

body.theme-galileo .slider-group label {
  font-family: "Cinzel", "EB Garamond", serif;
  color: #4a2e16;
}

body.theme-galileo .toggle-item {
  color: #4a2e16;
}

