:root {
  --bg: #14161a;
  --surface: #1e2126;
  --surface-2: #262a31;
  --text: #f2f0ea;
  --text-dim: #8a8f98;
  --accent: #ff5a1f;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --border: #33373f;

  --font-display: "Bebas Neue", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* {
  box-sizing: border-box;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- Header ---------- */

.site-header {
  width: 100%;
  text-align: center;
  padding: 3rem 1.5rem 1rem;
}

.wordmark {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4rem);
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--text);
}

.wordmark span {
  color: var(--accent);
}

.tagline {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

/* ---------- Main / Stages ---------- */

main {
  width: 100%;
  max-width: 640px;
  padding: 1rem 1.5rem 3rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hidden {
  display: none !important;
}

/* ---------- Upload dropzone ---------- */

.dropzone {
  width: 100%;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 4rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--surface-2);
  outline: none;
}

.dropzone-icon {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  color: var(--accent);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropzone-text {
  font-weight: 600;
  font-size: 1.05rem;
}

.dropzone-sub {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.privacy-note {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 1rem;
  text-align: center;
}

/* ---------- Demo CTA ---------- */

.demo-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.25rem;
  text-align: center;
}

.demo-text {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.6rem 1.3rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* ---------- Loading ---------- */

#loadingStage {
  padding: 4rem 0;
  gap: 1.25rem;
}

.loader-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

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

.loading-text {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

/* ---------- Analysis / video ---------- */

.video-wrap {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}

#sourceVideo {
  display: none;
}

#overlayCanvas {
  width: 100%;
  display: block;
}

.live-readout {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: rgba(20, 22, 26, 0.75);
  backdrop-filter: blur(4px);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
}

.live-line {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
}

.live-line.status-good { color: var(--good); }
.live-line.status-warn { color: var(--warn); }
.live-line.status-bad { color: var(--bad); }

/* ---------- Results scoreboard ---------- */

.scoreboard {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem 1.5rem;
  text-align: center;
}

.scoreboard-header {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.overall-score {
  margin-bottom: 1.75rem;
}

.overall-number {
  font-family: var(--font-mono);
  font-size: 4.5rem;
  font-weight: 600;
  line-height: 1;
}

.overall-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-top: 0.4rem;
}

.sub-scores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.sub-score {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 1rem 0.5rem;
  border: 1px solid var(--border);
}

.sub-score-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.sub-score-number {
  font-family: var(--font-mono);
  font-size: 1.9rem;
  font-weight: 600;
  margin: 0.25rem 0;
}

.sub-score-weight {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.score-good { color: var(--good); }
.score-warn { color: var(--warn); }
.score-bad { color: var(--bad); }

.deepest-note {
  margin-top: 1.25rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* ---------- Recommendations ---------- */

.recommendations {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem 1.5rem;
  margin-top: 1rem;
  text-align: left;
}

.recommendations-heading {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 1rem;
}

.recommendations-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.recommendations-list li {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
}

/* ---------- Buttons ---------- */

.btn-primary {
  margin-top: 1.5rem;
  background: var(--accent);
  color: #14161a;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 2rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* ---------- Error ---------- */

.error-text {
  color: var(--bad);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem 0 0;
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 1.5rem;
}

.site-footer a {
  color: var(--text-dim);
  font-size: 0.8rem;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
  .sub-scores {
    grid-template-columns: 1fr;
  }
  .dropzone {
    padding: 3rem 1rem;
  }
}