﻿@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg-dark: #05070d;
  --bg-deep: #090d18;
  --bg-card: rgba(15, 20, 38, 0.52);
  --bg-card-hover: rgba(20, 28, 52, 0.72);
  --bg-card-strong: rgba(10, 13, 24, 0.86);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(0, 242, 254, 0.2);
  --border-soft: rgba(255, 255, 255, 0.05);

  /* Palette */
  --text-main: #f6f8ff;
  --text-muted: #a1abc4;
  --text-soft: #7682a3;
  --neon-cyan: #54e7ff;
  --neon-emerald: #6ef2c4;
  --neon-purple: #b38cff;
  --neon-pink: #ff6fae;
  --neon-orange: #ffb15c;
  --neon-blue: #7db3ff;
  --danger: #ff6276;
  --panel-glow: rgba(84, 231, 255, 0.12);

  --glass-blur: blur(26px) saturate(145%);
  --shadow-neon: 0 20px 60px rgba(0, 0, 0, 0.45);
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

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

body {
  background:
    radial-gradient(circle at 20% 10%, rgba(84, 231, 255, 0.08), transparent 24%),
    radial-gradient(circle at 80% 0%, rgba(179, 140, 255, 0.12), transparent 28%),
    radial-gradient(circle at 70% 70%, rgba(110, 242, 196, 0.05), transparent 22%),
    linear-gradient(180deg, #05070d 0%, #070a12 100%);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.12));
  opacity: 0.55;
  mix-blend-mode: screen;
}

body::after {
  background-image: radial-gradient(circle, rgba(255,255,255,0.032) 0.7px, transparent 0.8px);
  background-size: 3px 3px;
  opacity: 0.18;
  mix-blend-mode: soft-light;
}

header, main, .tutorial-overlay, .modal-overlay {
  position: relative;
  z-index: 1;
}

/* Header */
header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(7, 8, 13, 0.8);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.5rem 1rem;
  border-radius: 100px;
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 500;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-orange);
  box-shadow: 0 0 8px var(--neon-orange);
}

.status-indicator.ready {
  background: var(--neon-emerald);
  box-shadow: 0 0 8px var(--neon-emerald);
}

.status-indicator.active {
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
  animation: pulse 1.5s infinite;
}

/* Main Layout */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  margin: 0;
}

.hero-layout {
  display: grid;
  grid-template-columns: 4fr 1fr;
  width: 100%;
  min-height: calc(100vh - 81px);
  gap: 1rem;
}

.feed-container {
  width: 100%;
  min-height: calc(100vh - 81px);
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(84, 231, 255, 0.06), transparent 34%),
    linear-gradient(180deg, #04050a 0%, #080c14 100%);
  border-radius: 0 24px 24px 0;
  isolation: isolate;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -30px 60px rgba(0, 0, 0, 0.45),
    0 22px 60px rgba(0, 0, 0, 0.35);
}

.feed-container::before,
.feed-container::after {
  content: '';
  position: absolute;
  inset: 16px;
  pointer-events: none;
  border-radius: 22px;
  z-index: 4;
}

.feed-container::before {
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    inset 0 0 0 1px rgba(84,231,255,0.04),
    0 0 0 1px rgba(0,0,0,0.2);
}

.feed-container::after {
  background: linear-gradient(180deg, transparent 0%, rgba(84,231,255,0.08) 50%, transparent 100%);
  width: calc(100% - 32px);
  height: 2px;
  left: 16px;
  top: 12px;
  opacity: 0.65;
  animation: hudScan 8s linear infinite;
}

.score-rail {
  width: 100%;
  min-height: calc(100vh - 81px);
  padding: 1.25rem 1.25rem 1.25rem 0;
  background: linear-gradient(180deg, rgba(7, 8, 13, 0.98), rgba(10, 12, 20, 0.92));
  position: sticky;
  top: 81px;
  align-self: start;
  overflow-y: auto;
  overflow-x: hidden;
}

.score-card {
  height: 100%;
}

.correction-log-card {
  margin-top: 1rem;
  min-height: 240px;
}

.correction-log-card .feedback-container {
  min-height: 180px;
  max-height: calc(100vh - 420px);
  overflow-y: auto;
}

.processing-card {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 1.25rem;
  overflow: hidden;
  position: relative;
}

.processing-hourglass {
  width: 132px;
  height: 172px;
  position: relative;
  margin: 0 auto 0.1rem;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 0 18px rgba(0, 242, 254, 0.25));
  transition: transform 200ms ease, filter 200ms ease;
  flex: 0 0 auto;
}

.processing-hourglass svg {
  width: 100%;
  height: 100%;
  display: block;
}

.processing-hourglass.is-animating {
  animation: hourglassBob 3s ease-in-out infinite;
}

.processing-hourglass:hover {
  transform: translateY(-2px) scale(1.01);
}

.processing-hourglass.is-paused {
  filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.18));
}

.processing-hourglass.is-paused.is-animating {
  animation-play-state: paused;
}

.hourglass-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  max-width: 240px;
  min-width: 200px;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 242, 254, 0.25);
  background: rgba(8, 10, 18, 0.94);
  color: var(--text-main);
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-line;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
}

.hourglass-tooltip.hidden {
  display: none;
}

.hourglass-glass {
  transition: transform 180ms ease, opacity 180ms ease;
}

.processing-copy {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  flex: 1;
  width: 100%;
}

.processing-status-shell {
  min-height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0;
}

.processing-status-text {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  color: var(--neon-cyan);
  text-transform: uppercase;
  transition: opacity 240ms ease, transform 240ms ease, color 240ms ease;
  text-align: center;
}

.processing-status-text.is-fading {
  opacity: 0.25;
  transform: translateY(2px);
}

.processing-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  margin-top: 0.2rem;
  width: 100%;
}

.processing-metric {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 0.8rem 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.25rem;
  min-width: 0;
}

.processing-metric-label {
  color: var(--text-muted);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex: 0 0 auto;
}

.processing-metric-value {
  font-family: var(--font-title);
  font-weight: 700;
  color: var(--text-main);
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-align: left;
  flex: none;
  min-width: 0;
  word-break: normal;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  width: 100%;
}

.processing-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  position: relative;
}

.processing-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple), var(--neon-emerald));
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.35);
  transition: width 0.12s linear;
}

@media (max-width: 960px) {
  .processing-metric-value {
    font-size: 0.94rem;
  }
}

@media (max-width: 640px) {
  .processing-metric {
    padding: 0.72rem 0.75rem;
  }

  .processing-metric-label {
    font-size: 0.64rem;
  }

  .processing-metric-value {
    font-size: 0.88rem;
  }
}

@media (max-width: 960px) {
  .processing-card {
    min-height: 320px;
  }
}

@media (max-width: 640px) {
  .processing-card {
    min-height: 300px;
    padding: 1rem;
  }

  .processing-hourglass {
    width: 108px;
    height: 136px;
  }

  .processing-metrics {
    grid-template-columns: 1fr;
  }

  .processing-metric {
    align-items: center;
  }
}

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

@keyframes sandDrop {
  0%, 100% { opacity: 0.45; transform: translateX(-50%) scaleY(1); }
  50% { opacity: 1; transform: translateX(-50%) scaleY(0.98); }
}

@keyframes sandFill {
  0%, 100% { opacity: 1; transform: translateX(-50%) scaleY(1); }
  50% { opacity: 0.55; transform: translateX(-50%) scaleY(1.02); }
}

@keyframes pulseSand {
  0%, 100% { transform: translate(-50%, -50%) scale(0.95); }
  50% { transform: translate(-50%, -50%) scale(1.08); }
}

/* Ensure both live stream and uploaded video share these exact rules */
#webcam {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  /* Force full viewport height */
  object-fit: fill;
  /* Prevents stretching; ensures whole video is seen */
  transform: scaleX(-1);
  background-color: #000;
  /* Fills empty space if aspect ratio differs */
}

#webcam.uploaded-video {
  transform: scaleX(-1) !important;
}

#webcam.mirrored-video {
  transform: scaleX(-1) !important;
}

#webcam.custom-replay {
  transform: scaleX(-1) !important;
}

#custom-review-video {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: fill;
  transform: scaleX(-1);
  background-color: #000;
}

#custom-review-video.mirrored-video {
  transform: scaleX(-1) !important;
}

#custom-review-video.hidden {
  display: none !important;
}

#canvas-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  transform: scaleX(-1);
}

#canvas-overlay.uploaded-video {
  transform: scaleX(-1) !important;
}

#canvas-overlay.mirrored-video {
  transform: scaleX(-1) !important;
}

#canvas-overlay.custom-replay {
  transform: scaleX(-1) !important;
}

/* Controls overlaid on camera */
.camera-controls-overlay {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  gap: 0.75rem;
  z-index: 5;
}

.voice-toggle-pill {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 7;
}

.voice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  background: rgba(10, 12, 20, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  font-size: 0.8rem;
}

.voice-toggle input {
  accent-color: var(--neon-cyan);
}

.recording-active {
  background: linear-gradient(135deg, #ff4d4d, #ff0000) !important;
  color: #fff !important;
  box-shadow: 0 0 18px rgba(255, 0, 0, 0.45) !important;
}

.record-toggle {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 7;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(10, 12, 20, 0.45);
  backdrop-filter: blur(14px);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.record-toggle.hidden {
  display: none;
}

.record-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ff1e1e;
  box-shadow: 0 0 16px rgba(255, 0, 0, 0.7);
}

.record-toggle.recording-active .record-dot {
  background: #ff0000;
  transform: scale(1.08);
}

.overlay-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)), var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 18px 30px rgba(0,0,0,0.24);
}

/* Calibration/Overlay Warning */
.warning-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(84,231,255,0.12), transparent 24%),
    rgba(5, 7, 12, 0.78);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  z-index: 6;
  text-align: center;
  padding: 2rem;
  transition: opacity 0.4s ease;
}

.warning-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, rgba(84,231,255,0.95), rgba(179,140,255,0.95));
  color: #fff;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 12px;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  box-shadow:
    0 12px 26px rgba(84, 231, 255, 0.22),
    inset 0 1px 0 rgba(255,255,255,0.16);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow:
    0 16px 34px rgba(84, 231, 255, 0.28),
    0 0 0 1px rgba(255,255,255,0.08) inset;
}

/* Controls Panel below the fold */
.control-sidebar {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
  background: var(--bg-dark);
  /* Solid background for the scrollable section */
}

.control-sidebar .panel-card:first-child {
  grid-column: 1 / -1;
}

.panel-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), transparent 18%),
    var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 22px;
  padding: 1.5rem;
  user-select: none;
  -webkit-user-select: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.09),
    inset 0 0 0 1px rgba(255,255,255,0.02),
    0 18px 50px rgba(0, 0, 0, 0.28);
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
}

.panel-card:hover {
  transform: translateY(-2px);
  border-color: rgba(84, 231, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 20px 56px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(84,231,255,0.06);
}

.panel-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 0.75rem;
}

/* Tabs for mode switching */
.mode-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 0.25rem;
  border: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
  font-family: var(--font-title);
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn[data-mode="yoga"].active {
  border-left: 3px solid var(--neon-purple);
  color: var(--neon-purple);
  text-shadow: 0 0 8px rgba(155, 81, 224, 0.4);
}

.tab-btn[data-mode="pt"].active {
  border-left: 3px solid var(--neon-cyan);
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
}

/* Selector Grid */
.item-selector-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.selector-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.75rem;
  text-align: center;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.selector-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.selector-item.active {
  background: rgba(0, 242, 254, 0.05);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.15);
}

.selector-item[data-pose].active {
  background: rgba(155, 81, 224, 0.05);
  border-color: var(--neon-purple);
  box-shadow: 0 0 12px rgba(155, 81, 224, 0.15);
}

.selector-item-secondary {
  border-style: dashed;
  color: var(--neon-cyan);
}

.selector-item.custom-pose-item {
  position: relative;
  padding-right: 2.2rem;
}

.custom-pose-remove {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  border: none;
  background: rgba(255, 77, 77, 0.95);
  color: white;
  font-size: 0.9rem;
  line-height: 1;
  display: none;
  cursor: pointer;
}

.selector-item.custom-pose-item:hover .custom-pose-remove {
  display: grid;
  place-items: center;
}

.custom-editor-card {
  width: min(760px, 95vw);
}

.custom-builder-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 2;
}

.pose-name-input {
  width: 100%;
  margin: 0.75rem 0 1rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
}

.custom-angles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.angle-field {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.angle-field input {
  padding: 0.8rem 0.85rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
}

/* Gauges */
.gauges-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.metric-gauge-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.1rem 1rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: visible;
}

.metric-gauge-wrapper > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.circular-gauge {
  position: relative;
  flex: 0 0 88px;
  width: 88px;
  height: 88px;
  margin-top: 0.15rem;
  overflow: visible;
}

.circular-gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
  display: block;
}

.circular-gauge circle {
  fill: none;
  stroke-width: 9;
}

.circular-gauge .bg-circle {
  stroke: rgba(255, 255, 255, 0.06);
}

.circular-gauge .progress-circle {
  stroke: var(--neon-cyan);
  stroke-dasharray: 226;
  stroke-dashoffset: 226;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.35s, stroke 180ms ease, filter 180ms ease;
  filter: drop-shadow(0 0 10px rgba(84, 231, 255, 0.28));
}

.circular-gauge.is-hot {
  animation: gaugePulse 1.5s ease-in-out infinite;
}

.gauge-val {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
  pointer-events: none;
}

/* Feedback log */
.feedback-container {
  flex: 1;
  min-height: 150px;
  max-height: 250px;
  overflow-y: auto;
  padding: 0.5rem;
  border-radius: 12px;
  background: rgba(6, 9, 18, 0.38);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feedback-item {
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  font-size: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.06);
  border-left: 3px solid var(--text-muted);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.feedback-item.correct {
  border-left-color: var(--neon-emerald);
  background: rgba(5, 240, 160, 0.03);
}

.feedback-item.incorrect {
  border-left-color: var(--neon-pink);
  background: rgba(255, 0, 127, 0.03);
}

/* ROM History */
.rom-graph-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#rom-graph {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.18));
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  width: 100%;
  height: 120px;
}

.calibration-helper {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 0.5rem;
}

/* Utilities */
.text-cyan {
  color: var(--neon-cyan);
}

.text-purple {
  color: var(--neon-purple);
}

.text-emerald {
  color: var(--neon-emerald);
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.1);
    opacity: 0.7;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes dash {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes hudScan {
  0% { transform: translateY(0); opacity: 0.15; }
  50% { opacity: 0.75; }
  100% { transform: translateY(calc(100vh - 40px)); opacity: 0.15; }
}

@keyframes gaugePulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(84, 231, 255, 0.26)); }
  50% { transform: scale(1.02); filter: drop-shadow(0 0 18px rgba(179, 140, 255, 0.38)); }
}

@keyframes modalRise {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(84,231,255,0.12), transparent 24%),
    rgba(5, 7, 12, 0.78);
  backdrop-filter: var(--glass-blur);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.modal-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), transparent 18%),
    var(--bg-card-strong);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow:
    0 26px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 2rem;
  width: 90%;
  max-width: 450px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  text-align: center;
  backdrop-filter: var(--glass-blur);
  animation: modalRise 260ms ease-out;
}

.modal-card h3 {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-main);
}

.modal-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.modal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 1rem;
  border-radius: 12px;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.modal-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
  transform: translateY(-2px);
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: var(--font-title);
  transition: color 0.3s;
}

.close-modal-btn:hover {
  color: var(--danger);
}

/* Tutorial */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tutorial-overlay iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.tutorial-close-btn {
  position: absolute;
  bottom: 2rem;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  color: #fff;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 12px;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
  transition: all 0.3s ease;
  z-index: 101;
}

.tutorial-close-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.5);
}

/* Upload Video */
.upload-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), transparent 18%),
    var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 18px 50px rgba(0,0,0,0.28);
}

.file-drop-area {
  border: 1px dashed rgba(84,231,255,0.22);
  border-radius: 18px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.03);
}

.file-drop-area:hover {
  border-color: rgba(84,231,255,0.4);
  background: rgba(84,231,255,0.05);
  transform: translateY(-1px);
}

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

.upload-status {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
  border-radius: 100px;
  transition: width 0.1s ease;
}

.upload-results {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* State Toggles */
.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.modal-overlay.hidden {
  display: none !important;
}

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(92vw, 380px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: rgba(10, 14, 24, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid var(--neon-cyan);
  color: var(--text-main);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
}

.toast.error {
  border-left-color: var(--neon-pink);
}

.toast.warning {
  border-left-color: #ffb347;
}

.toast.success {
  border-left-color: var(--neon-emerald);
}

.toast-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.toast-message {
  font-size: 0.9rem;
  line-height: 1.45;
  color: #d1d5db;
}

.toast-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.toast-btn {
  border: none;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.toast-btn.primary {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
}

@media (max-width: 960px) {
  .hero-layout {
    grid-template-columns: 1fr;
  }

  .feed-container {
    min-height: 58vh;
    border-radius: 0;
  }

  .score-rail {
    min-height: auto;
    padding: 0 1rem 1rem;
    position: static;
    top: auto;
  }

  .score-rail,
  .control-sidebar {
    width: 100%;
  }

  .control-sidebar {
    padding: 1rem;
    gap: 1rem;
  }

  .panel-card {
    padding: 1rem;
  }

  .modal-card {
    max-width: 92vw;
  }
}

@media (max-width: 640px) {
  header {
    padding: 1rem;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
  }

  .dashboard-grid {
    overflow-x: hidden;
  }

  .hero-layout {
    min-height: auto;
    gap: 0.75rem;
  }

  .feed-container {
    min-height: 50vh;
    border-radius: 0;
  }

  #webcam,
  #canvas-overlay {
    object-fit: cover;
  }

  .score-rail {
    padding: 0 0.75rem 0.75rem;
  }

  .control-sidebar {
    padding: 1rem 0.75rem;
    gap: 1rem;
    grid-template-columns: 1fr;
  }

  .item-selector-grid {
    grid-template-columns: 1fr;
  }

  .panel-card {
    border-radius: 16px;
    padding: 1rem;
  }

  .panel-title {
    font-size: 1rem;
  }

  .modal-overlay {
    padding: 0.75rem;
  }

  .modal-card {
    width: 100%;
    max-width: none;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.25rem;
    border-radius: 16px;
  }

  .modal-btn {
    font-size: 1rem;
    padding: 0.9rem;
  }

  .camera-controls-overlay,
  .voice-toggle-pill {
    top: 0.6rem;
  }

  .voice-toggle-pill {
    right: 0.6rem;
  }

  .record-toggle {
    left: 0.6rem;
    width: 50px;
    height: 50px;
  }

  .status-badge {
    width: 100%;
    justify-content: center;
  }

  .camera-controls-overlay {
    left: 0.6rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .voice-toggle {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
  }

  .custom-builder-close {
    top: 0.6rem;
    right: 0.6rem;
  }

  .tutorial-close-btn {
    bottom: 1rem;
    font-size: 0.9rem;
    padding: 0.65rem 1.2rem;
  }
}

@media (max-width: 420px) {
  header {
    padding: 0.85rem 0.75rem;
  }

  .logo {
    font-size: 1.2rem;
  }

  .status-badge {
    font-size: 0.75rem;
    padding: 0.45rem 0.75rem;
  }

  .feed-container {
    min-height: 44vh;
  }

  .overlay-card,
  .voice-toggle {
    font-size: 0.72rem;
  }

  .panel-card {
    padding: 0.85rem;
  }

  .modal-card {
    padding: 1rem;
  }
}
