:root {
  --bg-deep: #0b111e;
  --bg-canvas-top: #111a2e;
  --bg-canvas-bottom: #090e1a;
  --panel-bg: rgba(15, 23, 42, 0.88);
  --panel-card: rgba(30, 41, 59, 0.68);
  --panel-card-hover: rgba(51, 65, 85, 0.72);
  --border-subtle: rgba(148, 163, 184, 0.16);
  --border-focus: rgba(56, 189, 248, 0.48);

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --partner-a: #38bdf8;
  --partner-a-soft: rgba(56, 189, 248, 0.16);
  --partner-b: #f59e0b;
  --partner-b-soft: rgba(245, 158, 11, 0.16);

  --role-mover: #ef4444;
  --role-mover-soft: rgba(239, 68, 68, 0.18);
  --role-synergist: #f59e0b;
  --role-synergist-soft: rgba(245, 158, 11, 0.18);
  --role-stabilizer: #0ea5e9;
  --role-stabilizer-soft: rgba(14, 165, 233, 0.18);
  --role-unassessed: #64748b;
  --role-unassessed-soft: rgba(100, 116, 139, 0.22);

  --ev-direct: #10b981;
  --ev-inference: #818cf8;
  --ev-caution: #fbbf24;

  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#app-shell {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.94), rgba(9, 14, 26, 0.99));
  backdrop-filter: blur(10px);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.loading-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  width: min(500px, 92vw);
  padding: 28px 32px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.loading-spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--partner-a);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.loading-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.loading-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(148, 163, 184, 0.16);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
  transition: width 0.25s ease;
}

.loading-note {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ==========================================================================
   Top Navigation Header
   ========================================================================== */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 16px;
  background: rgba(11, 17, 30, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 40;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-badge {
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.brand-titles h1 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Posture Category Selector Tabs */
.posture-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.posture-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
}

.posture-tab:hover {
  background: rgba(51, 65, 85, 0.65);
  color: var(--text-primary);
}

.posture-tab.is-active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.24), rgba(30, 58, 138, 0.42));
  border-color: rgba(56, 189, 248, 0.65);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(14, 165, 233, 0.18);
}

.tab-index {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--partner-a);
  opacity: 0.85;
}

.tab-text {
  display: flex;
  flex-direction: column;
}

.tab-text strong {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
}

.tab-text small {
  font-size: 10.5px;
  color: var(--text-muted);
}

.posture-tab.is-active .tab-text small {
  color: #bae6fd;
}

.btn-ghost-pill {
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-ghost-pill:hover {
  background: rgba(51, 65, 85, 0.85);
  border-color: var(--partner-a);
  color: #ffffff;
}

/* ==========================================================================
   Biomechanical Assumptions Banner
   ========================================================================== */
.assumptions-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1.1fr);
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  background: rgba(15, 23, 42, 0.94);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
  z-index: 35;
}

.assumption-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.partner-pill {
  padding: 3px 7px;
  border-radius: 5px;
  font-weight: 600;
  font-size: 10.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.pill-a {
  background: var(--partner-a-soft);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.pill-b {
  background: var(--partner-b-soft);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.assumption-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}

.assumption-text strong {
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assumption-text span {
  color: var(--text-secondary);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assumption-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
  flex-shrink: 0;
}

.assumption-note {
  min-width: 0;
  overflow: hidden;
}

.note-badge {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(129, 140, 248, 0.16);
  border: 1px solid rgba(129, 140, 248, 0.35);
  color: #c7d2fe;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.assumption-note p {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Main Workspace Grid (Left Panel + Center 3D Viewport + Right Panel)
   ========================================================================== */
.workspace-grid {
  display: grid;
  grid-template-columns: 330px 1fr 370px;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.side-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 25;
}

.panel-left {
  border-right: 1px solid var(--border-subtle);
}

.panel-right {
  border-left: 1px solid var(--border-subtle);
}

/* Modern Web Guidance: interactions-in-complex-layouts containment */
.panel-section {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 11px 12px;
  content-visibility: auto;
  contain-intrinsic-size: auto 300px auto 260px;
}

@supports not (content-visibility: auto) {
  .panel-section {
    contain: layout style paint;
  }
}

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

.section-header h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.section-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.section-question {
  font-size: 11.5px;
  color: #93c5fd;
  background: rgba(30, 58, 138, 0.25);
  border-left: 2px solid var(--partner-a);
  padding: 5px 8px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 9px;
}

.badge-accent {
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  font-size: 11px;
  font-weight: 600;
}

.badge-schematic {
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fde68a;
  font-size: 10.5px;
  font-weight: 600;
}

.badge-verified {
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  font-size: 10.5px;
  font-weight: 600;
}

/* ==========================================================================
   Left Panel: Phase Breakdown Cards & Schematic Joint Angles
   ========================================================================== */
.phase-cards-container {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.phase-card {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.16s ease;
}

.phase-card:hover {
  background: var(--panel-card-hover);
}

.phase-card.is-active {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: inset 3px 0 0 var(--partner-a);
}

.phase-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.phase-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.phase-card-range {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--partner-a);
}

.phase-card-details {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.phase-detail-row strong {
  color: #93c5fd;
  font-weight: 600;
}

/* Joint Angle Readouts */
.angle-partner-group {
  margin-top: 8px;
}

.angle-partner-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  margin-bottom: 5px;
  color: var(--text-secondary);
}

.partner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-a {
  background: var(--partner-a);
  box-shadow: 0 0 6px var(--partner-a);
}

.dot-b {
  background: var(--partner-b);
  box-shadow: 0 0 6px var(--partner-b);
}

.angles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.angle-cell {
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  flex-direction: column;
}

.angle-name {
  font-size: 10.5px;
  color: var(--text-muted);
}

.angle-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Legend Section */
.legend-block + .legend-block {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.legend-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.legend-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

.swatch-mover {
  background: var(--role-mover);
}

.swatch-synergist {
  background: var(--role-synergist);
}

.swatch-stabilizer {
  background: var(--role-stabilizer);
}

.swatch-unassessed {
  background: repeating-linear-gradient(
    45deg,
    #475569,
    #475569 3px,
    #94a3b8 3px,
    #94a3b8 6px
  );
}

.legend-row strong {
  font-size: 11.5px;
  display: block;
  line-height: 1.2;
}

.legend-row small {
  font-size: 10.5px;
  color: var(--text-muted);
}

.vector-legend-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}

.vector-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.arrow-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.arrow-motion {
  background: rgba(34, 211, 238, 0.16);
  color: #22d3ee;
  border: 1px solid rgba(34, 211, 238, 0.4);
}

.arrow-gravity {
  background: rgba(244, 63, 94, 0.16);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.arrow-support {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

/* ==========================================================================
   Center 3D Viewport & Floating HUD
   ========================================================================== */
.viewport-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 42%, var(--bg-canvas-top), var(--bg-canvas-bottom));
  overflow: hidden;
}

#webgl-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#webgl-canvas:active {
  cursor: grabbing;
}

.viewport-hud-top {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 96%;
  pointer-events: none;
}

.hud-pill-group {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.hud-group-label {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 7px;
  font-weight: 600;
  white-space: nowrap;
}

.hud-btn {
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.hud-btn:hover {
  background: rgba(51, 65, 85, 0.65);
  color: #ffffff;
}

.hud-btn.is-active {
  background: rgba(14, 165, 233, 0.25);
  border-color: rgba(56, 189, 248, 0.6);
  color: #ffffff;
  font-weight: 600;
}

.hud-btn small {
  font-size: 10px;
  opacity: 0.8;
}

/* Honest Layer Disclosure Banner at bottom of 3D viewport */
.layer-disclosure-banner {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 18;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
  font-size: 11.5px;
  color: var(--text-secondary);
  max-width: 92%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.disclosure-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38bdf8;
  flex-shrink: 0;
}

/* 3D Callout Leader Lines & Pins */
.callout-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 12;
}

.callout-pins-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 14;
}

.callout-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.32);
  color: var(--text-primary);
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.42);
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.callout-pin:hover,
.callout-pin.is-selected {
  border-color: #38bdf8;
  background: rgba(15, 23, 42, 0.96);
  transform: translate(-50%, -50%) scale(1.05);
  z-index: 16;
}

.pin-partner-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
}

.pin-partner-A {
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
}

.pin-partner-B {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.pin-role-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

/* Hover Tooltip */
.hover-tooltip {
  position: absolute;
  z-index: 30;
  pointer-events: none;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.5);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  font-size: 11.5px;
  color: var(--text-primary);
  max-width: 260px;
}

.hover-tooltip.is-hidden {
  display: none;
}

/* ==========================================================================
   Right Panel: Muscle Group Inspector & Literature Verification
   ========================================================================== */
.partner-switch-pills {
  display: flex;
  gap: 4px;
}

.partner-switch-btn {
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.65);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.partner-switch-btn.is-active[data-inspect-partner="A"] {
  background: var(--partner-a-soft);
  border-color: var(--partner-a);
  color: #7dd3fc;
}

.partner-switch-btn.is-active[data-inspect-partner="B"] {
  background: var(--partner-b-soft);
  border-color: var(--partner-b);
  color: #fcd34d;
}

.muscle-inspector-card {
  background: rgba(30, 41, 59, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 9px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inspector-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.inspect-meta-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.16);
  color: #bae6fd;
}

.inspect-rep-pill {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-secondary);
}

.role-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
}

.role-mover {
  background: var(--role-mover-soft);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.role-synergist {
  background: var(--role-synergist-soft);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.5);
}

.role-stabilizer {
  background: var(--role-stabilizer-soft);
  color: #7dd3fc;
  border: 1px solid rgba(14, 165, 233, 0.5);
}

.role-unassessed {
  background: var(--role-unassessed-soft);
  color: #cbd5e1;
  border: 1px dashed rgba(148, 163, 184, 0.55);
}

.inspect-muscle-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.inspect-muscle-title small {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 6px;
}

.inspector-kv-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.kv-box {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 6px;
  padding: 6px 8px;
}

.kv-label {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.kv-box strong {
  font-size: 11.5px;
  color: var(--text-primary);
  font-weight: 600;
}

.inspector-explanation-box {
  background: rgba(15, 23, 42, 0.55);
  border-left: 3px solid var(--partner-a);
  border-radius: 0 6px 6px 0;
  padding: 7px 9px;
}

.box-title {
  font-size: 10.5px;
  font-weight: 600;
  color: #7dd3fc;
  margin-bottom: 3px;
}

.inspector-explanation-box p {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.inspector-evidence-box {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 11px;
}

.evidence-header {
  margin-bottom: 4px;
}

.evidence-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
}

.ev-direct {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.ev-inference {
  background: rgba(129, 140, 248, 0.18);
  color: #c7d2fe;
  border: 1px solid rgba(129, 140, 248, 0.45);
}

.ev-caution {
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.45);
}

.evidence-note {
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.anatomical-basis-text {
  color: var(--text-muted);
  font-size: 10.5px;
}

.side-selector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
}

.side-btn-group {
  display: flex;
  gap: 4px;
}

.side-btn {
  padding: 3px 9px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
}

.side-btn.is-active {
  background: rgba(56, 189, 248, 0.22);
  border-color: var(--partner-a);
  color: #ffffff;
  font-weight: 600;
}

/* Muscle Role Groups Matrix */
.section-subcount {
  font-size: 10.5px;
  color: var(--text-muted);
}

.muscle-role-groups {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.role-group-block {
  border-radius: 7px;
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.12);
  padding: 7px 8px;
}

.role-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  margin-bottom: 6px;
}

.role-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.muscle-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.muscle-chip:hover {
  background: rgba(51, 65, 85, 0.8);
  color: #ffffff;
}

.muscle-chip.is-selected {
  border-color: #38bdf8;
  background: rgba(14, 165, 233, 0.24);
  color: #ffffff;
  font-weight: 600;
}

/* Waterloo Evidence Panel */
.waterloo-evidence-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 11px;
  color: var(--text-secondary);
}

.waterloo-finding-box {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 6px;
  padding: 7px 9px;
}

.waterloo-finding-box strong {
  color: #6ee7b7;
  display: block;
  margin-bottom: 3px;
}

.semg-warning-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 6px;
  padding: 7px 9px;
  color: #fde68a;
}

/* ==========================================================================
   Bottom Timeline & Camera Dock
   ========================================================================== */
.bottom-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
  background: rgba(11, 17, 30, 0.96);
  border-top: 1px solid var(--border-subtle);
  z-index: 40;
}

.dock-transport {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary-transport {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.6);
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-primary-transport:hover {
  filter: brightness(1.12);
}

.step-btn-group {
  display: flex;
  gap: 4px;
}

.btn-dock {
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.72);
  color: var(--text-secondary);
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.btn-dock:hover {
  background: rgba(51, 65, 85, 0.85);
  color: #ffffff;
}

.btn-dock.is-active {
  background: rgba(14, 165, 233, 0.25);
  border-color: var(--partner-a);
  color: #7dd3fc;
  font-weight: 600;
}

/* Center Timeline Scrubber */
.dock-timeline {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 240px;
}

.timeline-top-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11.5px;
}

.timeline-phase-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#timeline-phase-name {
  font-weight: 600;
  color: #7dd3fc;
  white-space: nowrap;
}

.timeline-phase-desc {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-readout {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.timeline-readout strong {
  color: #ffffff;
}

.timeline-slider-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.timeline-slider {
  width: 100%;
  height: 6px;
  appearance: none;
  background: rgba(51, 65, 85, 0.85);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #38bdf8;
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
  cursor: grab;
}

.timeline-phase-ticks {
  display: grid;
  grid-template-columns: 22fr 30fr 22fr 26fr;
  gap: 2px;
  font-size: 10px;
  color: var(--text-muted);
}

.phase-tick-seg {
  text-align: center;
  padding-top: 1px;
  border-top: 2px solid rgba(148, 163, 184, 0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phase-tick-seg.is-active {
  border-top-color: var(--partner-a);
  color: #7dd3fc;
  font-weight: 600;
}

/* Right Controls Cluster */
.dock-controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.control-cluster {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cluster-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 2px;
}

/* ==========================================================================
   Methodology Modal
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(9, 14, 26, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.is-hidden {
  display: none;
}

.modal-card {
  width: min(760px, 95vw);
  max-height: 86vh;
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  padding: 20px 24px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.modal-header h2 {
  font-size: 16px;
  color: #ffffff;
}

.btn-close-modal {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-secondary);
  cursor: pointer;
}

.modal-block + .modal-block {
  margin-top: 16px;
}

.modal-block h3 {
  font-size: 13.5px;
  color: #7dd3fc;
  margin-bottom: 8px;
}

.modal-block ul {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12.5px;
}

/* ==========================================================================
   Responsive Breakpoints for Tablet & Mobile Touch
   ========================================================================== */
@media (max-width: 1240px) {
  .workspace-grid {
    grid-template-columns: 290px 1fr 320px;
  }
  .brand-subtitle {
    display: none;
  }
}

@media (max-width: 980px) {
  #app-shell {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
  }
  .top-header {
    flex-wrap: wrap;
  }
  .workspace-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 58vh auto auto;
  }
  .viewport-container {
    order: 1;
    height: 58vh;
  }
  .panel-left {
    order: 2;
    border-right: none;
    border-top: 1px solid var(--border-subtle);
  }
  .panel-right {
    order: 3;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }
  .bottom-dock {
    flex-wrap: wrap;
  }
}
