:root {
  color-scheme: light;
  --bg: #f8f3e9;
  --ink: #1d2333;
  --muted: #5f6679;
  --line: rgba(29, 35, 51, 0.1);
  --card: rgba(255, 255, 255, 0.82);
  --shadow: 0 28px 70px rgba(29, 35, 51, 0.12);
  --accent: #ff6f3c;
  --accent-ink: #7b2f12;
  --accent-soft: #ffe1d3;
  --mint: #73c8a9;
  --navy: #243b7b;
  --sky: #dcefff;
  --lime: #d9f0ac;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 177, 124, 0.42), transparent 26rem),
    radial-gradient(circle at top right, rgba(115, 200, 169, 0.28), transparent 20rem),
    linear-gradient(180deg, #fff8ef, var(--bg));
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(29, 35, 51, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 35, 51, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 80%);
}

.shell {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero,
.stage-panel,
.panel,
.tool-links {
  position: relative;
  z-index: 1;
}

.hero {
  display: grid;
  gap: 22px;
  align-items: end;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  margin-bottom: 24px;
}

.kicker,
.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(42px, 8vw, 88px);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

.lede {
  max-width: 760px;
  margin: 14px 0 0;
  font-size: 18px;
  line-height: 1.65;
  color: #4c5468;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-content: start;
}

.hero-badges span,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(29, 35, 51, 0.08);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 28px rgba(29, 35, 51, 0.08);
  font-size: 13px;
  font-weight: 700;
}

.stage-panel,
.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.stage-panel { margin-bottom: 24px; }

.stage-toolbar,
.panel-heading,
.field-row,
.button-stack,
.report-footer {
  display: flex;
  gap: 16px;
}

.stage-toolbar,
.panel-heading {
  align-items: start;
  justify-content: space-between;
}

.stage-toolbar h2,
.panel-heading h3,
.mini-panel h4 {
  margin: 0;
  letter-spacing: -0.04em;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.camera-wrap { margin-top: 18px; }

.camera-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  min-height: 280px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top left, rgba(255, 111, 60, 0.32), transparent 16rem),
    linear-gradient(160deg, #13223e, #1b2d52 54%, #24456c);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.camera-stage video,
.camera-stage canvas,
.camera-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.camera-stage video,
.camera-stage canvas {
  object-fit: cover;
}

.camera-stage.is-front video,
.camera-stage.is-front canvas {
  transform: scaleX(-1);
}

.camera-scrim {
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8, 13, 23, 0.1), transparent 28%, transparent 74%, rgba(8, 13, 23, 0.36)),
    radial-gradient(circle at center, transparent 45%, rgba(8, 13, 23, 0.12) 100%);
}

.stage-readout {
  position: absolute;
  top: 18px;
  left: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  z-index: 2;
}

.countdown-block {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  min-width: 110px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 40px rgba(8, 13, 23, 0.22);
  text-align: right;
}

.countdown-label,
.foot-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.countdown-block strong {
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.06em;
}

.analysis-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.1fr 1fr 1fr;
}

.control-panel,
.summary-panel,
.report-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.field-row { align-items: stretch; }
.field-row .field { flex: 1; }

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(29, 35, 51, 0.12);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

textarea { resize: vertical; min-height: 98px; }

.button-stack {
  flex-wrap: wrap;
  align-items: stretch;
}

.button {
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.button:hover { transform: translateY(-1px); }

.primary {
  background: linear-gradient(135deg, #2847b8, #3e77ff);
  color: white;
  box-shadow: 0 14px 28px rgba(36, 59, 123, 0.3);
}

.accent {
  background: linear-gradient(135deg, #ff804d, #ffb16a);
  color: #412113;
  box-shadow: 0 14px 28px rgba(255, 111, 60, 0.26);
}

.ghost {
  background: #eef3ff;
  color: #29408b;
}

.subtle {
  background: #f4efe4;
  color: #5f5d58;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.fineprint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.scoreband,
.stats-grid {
  display: grid;
  gap: 12px;
}

.scoreband { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.scorecard,
.mini-panel {
  border-radius: var(--radius-md);
  border: 1px solid rgba(29, 35, 51, 0.08);
  background: rgba(255, 255, 255, 0.92);
}

.scorecard {
  padding: 16px;
  background: linear-gradient(160deg, rgba(220, 239, 255, 0.86), rgba(255, 255, 255, 0.96));
}

.score-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.scorecard strong {
  display: block;
  margin-top: 10px;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.06em;
}

.mini-panel { padding: 18px; }

.stat-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 12px;
  margin: 14px 0 0;
}

.stat-list dt {
  color: var(--muted);
  font-size: 13px;
}

.stat-list dd {
  margin: 0;
  text-align: right;
  font-weight: 800;
}

.insight-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: #374158;
  line-height: 1.55;
}

.insight-list li + li { margin-top: 10px; }

.report-summary {
  margin: 0;
  color: #445067;
  line-height: 1.65;
  font-size: 16px;
}

.report-footer {
  flex-wrap: wrap;
  border-top: 1px dashed rgba(29, 35, 51, 0.12);
  padding-top: 16px;
}

.report-footer > div {
  flex: 1 1 220px;
}

.report-footer p {
  margin: 0;
  line-height: 1.6;
  color: #374158;
}

.pill.neutral { color: #32405f; }
.pill.live { color: #6a2f0f; background: rgba(255, 231, 213, 0.96); }
.pill.ready { color: #1f5f4a; background: rgba(223, 248, 231, 0.96); }
.pill.warn { color: #7c5b00; background: rgba(255, 246, 200, 0.96); }

.tool-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
  padding: 18px 22px;
}

.tool-links a {
  color: #29408b;
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 1080px) {
  .analysis-grid,
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-badges {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100%, calc(100% - 18px));
    padding-top: 18px;
    padding-bottom: 34px;
  }

  .stage-panel,
  .panel {
    padding: 18px;
    border-radius: 24px;
  }

  .scoreband,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .countdown-block {
    min-width: 96px;
    padding: 13px 14px;
  }

  .countdown-block strong { font-size: 28px; }

  .field-row,
  .button-stack,
  .stage-toolbar,
  .panel-heading {
    flex-direction: column;
  }

  .toolbar-actions {
    justify-content: stretch;
  }

  .toolbar-actions .button,
  .button-stack .button {
    width: 100%;
  }
}
