:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --preview-bg: rgb(0, 76, 84);
  --panel: #ffffff;
  --text: #162033;
  --muted: #647084;
  --line: #d8dfeb;
  --accent: #176bff;
  --accent-dark: #0d4dc0;
  --danger: #c7362f;
  --good: #168255;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
  padding: 0.8rem 1rem;
}

button:hover:not(:disabled) {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.onboarding-overlay {
  align-items: center;
  background: rgba(12, 18, 32, 0.68);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 20;
}

.onboarding-overlay.is-hidden {
  display: none;
}

.onboarding-popover {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  max-width: 360px;
  padding: 22px;
  text-align: center;
  width: 100%;
}

.onboarding-popover h2 {
  margin-bottom: 10px;
}

.onboarding-popover p {
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 18px;
}

.onboarding-popover button {
  width: 100%;
}

.choice-buttons {
  display: grid;
  gap: 10px;
}

.consent-popover-field {
  align-items: flex-start;
  color: var(--muted);
  display: flex;
  font-size: 0.88rem;
  font-weight: 700;
  gap: 9px;
  line-height: 1.35;
  margin: 16px 0 18px;
  text-align: left;
}

.consent-popover-field input {
  flex: 0 0 auto;
  margin-top: 3px;
}

body.is-previewing .topbar,
body.is-previewing .stage {
  display: none;
}

body:not(.is-previewing) .review-panel {
  display: none;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 40px;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 0.98;
  margin-bottom: 0;
}

h2 {
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.status-pill {
  background: #e8eefb;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-dark);
  font-weight: 800;
  min-width: 112px;
  padding: 0.55rem 0.8rem;
  text-align: center;
}

.setup-panel,
.review-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px;
}

.setup-panel {
  align-items: end;
  grid-template-columns: 1fr;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.panel-title span {
  font-weight: 800;
}

input[type="text"] {
  background: #fbfcff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  min-height: 46px;
  padding: 0.7rem 0.8rem;
  width: 100%;
}

.stage {
  display: grid;
  gap: 0;
  grid-template-columns: minmax(240px, 420px);
  justify-content: center;
  margin-bottom: 18px;
  position: relative;
}

.video-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.panel-title {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.cue-preview-panel .panel-title {
  justify-content: center;
  min-height: 64px;
  position: relative;
}

.panel-statuses {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
  position: absolute;
  right: 14px;
  text-align: right;
  top: 50%;
  transform: translateY(-50%);
}

.cue-title {
  flex: 1;
  font-weight: 900;
  padding: 0 78px 0 2px;
  text-align: left;
}

.cue-title span {
  font-weight: 400;
}

.panel-statuses #recordToggleButton {
  min-height: 0;
  padding: 0.45rem 0.75rem;
  width: auto;
}

.record-status-dot {
  background: #9aa5b5;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
  height: 10px;
  width: 10px;
}

.record-status-dot.is-ready {
  background: var(--good);
}

.record-status-dot.is-recording {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(199, 54, 47, 0.16);
}

.audio-debug {
  color: var(--muted);
  display: none;
  font-size: 0.72rem;
  line-height: 1.35;
  margin: 12px auto 0;
  max-width: 420px;
  overflow-wrap: anywhere;
  text-align: center;
}

small,
.review-copy p,
output {
  color: var(--muted);
}

.video-frame {
  aspect-ratio: 16 / 9;
  background: var(--preview-bg);
  display: block;
  object-fit: contain;
  width: 100%;
}

#cueVideo {
  aspect-ratio: 9 / 16;
}

#previewVideo {
  aspect-ratio: 9 / 16;
  object-fit: cover;
}

.video-stack {
  aspect-ratio: 9 / 16;
  background: var(--preview-bg);
  position: relative;
  width: 100%;
}

.simple-two-video-stack {
  background-color: var(--preview-bg);
  background-image: url("/fly-eagles-fly-preview-poster.jpg?v=2026-09-06-green-bg");
  background-position: center;
  background-size: cover;
}

.preview-page .video-frame,
.preview-page .video-stack {
  background-color: var(--preview-bg);
}

.simple-two-video-stack.is-showing-poster #previewCueVideo {
  opacity: 0;
}

.cue-frame {
  height: 100%;
  object-fit: cover;
}

.preview-overlay {
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
  height: 49.5%;
  left: 50%;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 49.5%;
  z-index: 2;
}

.score-panel {
  background: transparent;
  border: 0;
  left: 50%;
  margin-top: 0;
  min-height: 0;
  overflow: visible;
  position: absolute;
  top: 152px;
  transform: translateX(-50%);
  width: min(420px, 100%);
  z-index: 4;
}

.score-panel > .panel-title {
  display: none;
}

.score-tools {
  align-items: center;
  background: #f8f9fc;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  border-top: 0;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 9px 14px;
}

.score-mode-switch {
  background: #f8f9fc;
  border: 1px solid var(--line);
  border-top: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 10px 14px;
}

.mode-button {
  background: #e8eefb;
  color: var(--accent-dark);
  padding: 0.55rem 0.7rem;
}

.mode-button.is-active {
  background: var(--accent);
  color: #ffffff;
}

.score-toggle {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  font-size: 0.88rem;
  font-weight: 700;
  gap: 7px;
}

.score-toggle input {
  accent-color: var(--accent);
}

#scoreProgress {
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 800;
}

.score-viewport {
  background: transparent;
  height: clamp(88px, 14vh, 112px);
  overflow: auto;
  padding: 0;
  scroll-behavior: smooth;
}

.score-loading,
.score-error {
  color: var(--muted);
  font-weight: 700;
}

.score-error {
  color: var(--danger);
}

.score-image {
  display: block;
  height: 420px;
  max-width: none;
  width: auto;
}

.is-lyrics-mode .score-image {
  display: none;
}

.is-score-mode .lyrics-view {
  display: none;
}

.is-score-mode {
  overflow: auto hidden;
  white-space: nowrap;
}

.lyrics-view {
  align-content: start;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  background: rgba(16, 24, 39, 0.62);
  display: grid;
  gap: 6px;
  min-height: calc(100% + 160px);
  padding: 10px 10px 150px;
}

.lyric-line {
  color: rgba(255, 255, 255, 0.42);
  font-size: clamp(1.25rem, 4.8vw, 1.75rem);
  font-weight: 900;
  line-height: 1.04;
  margin: 0 auto;
  max-width: 760px;
  position: relative;
  text-align: center;
  width: 100%;
}

.lyric-line.is-count-in,
.lyric-line.is-status-line {
  font-weight: 400;
}

.lyric-prefix {
  font-weight: 400;
}

.lyric-line.is-active {
  transform: scale(1.04);
}

.lyric-line.is-past {
  color: rgba(134, 183, 255, 0.68);
}

.lyric-word {
  display: inline-block;
  white-space: pre;
}

.lyric-character,
.lyric-space {
  color: currentColor;
  transition: color 90ms linear;
}

.lyric-line.is-active .lyric-character.is-lit,
.lyric-line.is-active .lyric-space.is-lit {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
}

.lyric-line.is-past .lyric-character,
.lyric-line.is-past .lyric-space {
  color: rgba(134, 183, 255, 0.68);
}

.mirror {
  transform: scaleX(-1);
}

.preview-overlay.mirror {
  transform: translate(-50%, -50%) scaleX(-1);
}

.preview-page {
  border: 0;
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0;
}

.preview-page.is-processing .preview-controls-panel,
.preview-page.is-processing .preview-video-panel,
.preview-page.is-processing .preview-playback-controls,
.preview-page.is-processing .finish-row,
.preview-page.is-processing .preview-sync-control,
.preview-page.has-finished-video .preview-controls-panel,
.preview-page.has-finished-video .preview-video-panel,
.preview-page.has-finished-video .preview-playback-controls,
.preview-page.has-finished-video .finish-row,
.preview-page.has-finished-video .preview-sync-control {
  display: none;
}

.preview-controls-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  padding: 6px 8px 5px;
  width: min(420px, 100%);
}

.preview-playback-controls {
  align-items: center;
  background: transparent;
  border: 0;
  display: flex;
  gap: 8px;
  padding: 0;
  width: 100%;
}

.preview-playback-controls button {
  min-width: 42px;
  padding: 0.35rem 0.5rem;
}

.preview-playback-controls input {
  accent-color: var(--accent);
  flex: 1;
}

.finish-row {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 0;
  display: flex;
  justify-content: center;
  padding: 0 10px 10px;
  width: min(420px, 100%);
}

.preview-sync-control {
  align-items: stretch;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  border-top: 0;
  color: var(--muted);
  display: grid;
  font-size: 0.78rem;
  font-weight: 800;
  gap: 4px;
  padding: 8px 10px 10px;
  width: min(420px, 100%);
}

.sync-help {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
}

.preview-sync-control input {
  accent-color: var(--accent);
  width: 100%;
}

.sync-endpoints {
  display: flex;
  font-size: 0.68rem;
  justify-content: space-between;
  line-height: 1;
}

.preview-video-panel {
  border-radius: 8px;
  width: min(252px, 60%, 100%);
}

.finish-button {
  flex: 0 0 auto;
  min-width: 88px;
  padding: 0.55rem 0.9rem;
}

.audio-mix-control {
  align-items: stretch;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-width: 0;
  width: 100%;
}

.audio-mix-control .mix-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: -1px;
  text-align: center;
}

.mix-endpoints {
  color: var(--muted);
  display: flex;
  font-size: 0.64rem;
  justify-content: space-between;
  line-height: 1;
  width: 100%;
}

.mix-endpoints span {
  font-weight: 800;
}

.audio-mix-control input {
  accent-color: var(--accent);
  width: 100%;
}

#recordedVideo {
  object-fit: cover;
}

.upload-row {
  background: var(--panel);
  margin-top: 8px;
  padding: 0 2px;
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  min-height: 24px;
  text-align: center;
  width: min(420px, 100%);
}

.preview-page.is-processing .upload-row {
  align-content: center;
  background: var(--bg);
  border: 0;
  border-radius: 0;
  display: grid;
  gap: 18px;
  min-height: calc(100vh - 28px);
  margin-top: 0;
  padding: 28px 18px;
  width: 100%;
}

.processing-logo {
  display: none;
}

.preview-page.is-processing .processing-logo {
  display: block;
  margin: 0 auto 2px;
  max-width: min(320px, 86%);
  width: 100%;
}

.preview-page.is-processing #uploadStatus {
  display: grid;
  gap: 6px;
}

.preview-page.is-processing #uploadStatus span {
  font-weight: 400;
}

.processing-progress {
  display: grid;
  gap: 8px;
  justify-self: center;
  max-width: 360px;
  width: min(82vw, 360px);
}

.processing-progress[hidden] {
  display: none;
}

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

.processing-progress-fill {
  background: linear-gradient(90deg, #0f8f3f, #22c55e, #b5f4c8);
  height: 100%;
  position: relative;
  transition: width 480ms ease;
  width: 0%;
}

.processing-progress-fill::after {
  animation: processingShimmer 1.4s linear infinite;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.44), transparent);
  content: "";
  inset: 0;
  position: absolute;
  transform: translateX(-100%);
}

.processing-progress-text {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

@keyframes processingShimmer {
  to {
    transform: translateX(100%);
  }
}

.preview-page.has-finished-video .upload-row {
  order: 2;
}

.finished-video-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  width: min(420px, 100%);
}

.preview-page.has-finished-video .finished-video-panel {
  order: 1;
}

.finished-video-panel[hidden] {
  display: none;
}

.finished-video {
  aspect-ratio: 9 / 16;
  background: var(--preview-bg);
  display: block;
  object-fit: contain;
  width: 100%;
}

.final-video-title {
  font-size: 1.2rem;
  margin: 0;
  text-align: center;
}

.final-options {
  display: grid;
  gap: 10px;
}

.instagram-note {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  text-align: center;
}

.permanent-link-field,
.final-email-field {
  color: var(--text);
  display: grid;
  font-size: 0.84rem;
  font-weight: 800;
  gap: 5px;
}

.permanent-link-field input,
.final-email-field input {
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  padding: 0.65rem 0.75rem;
  width: 100%;
}

.permanent-link-field input {
  background: #f7f9fd;
  color: var(--muted);
}

.permanent-link-row {
  display: flex;
  gap: 8px;
}

.permanent-link-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.copy-link-button {
  align-items: center;
  display: inline-flex;
  flex: 0 0 42px;
  justify-content: center;
  min-height: 0;
  padding: 0.65rem;
}

.copy-link-button span {
  border: 2px solid currentColor;
  border-radius: 2px;
  height: 15px;
  position: relative;
  width: 13px;
}

.copy-link-button span::before {
  border: 2px solid currentColor;
  border-radius: 2px;
  content: "";
  height: 15px;
  left: -6px;
  position: absolute;
  top: 3px;
  width: 13px;
}

.email-send-row {
  display: flex;
  gap: 8px;
}

.email-send-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.email-send-row button {
  flex: 0 0 auto;
  padding: 0.65rem 0.85rem;
}

.final-email-field small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.3;
}

.final-consent-field {
  align-items: flex-start;
  color: var(--muted);
  display: flex;
  font-size: 0.78rem;
  font-weight: 700;
  gap: 8px;
  line-height: 1.3;
}

.final-consent-field input {
  flex: 0 0 auto;
  margin-top: 2px;
}

.email-status {
  color: var(--muted);
  font-size: 0.78rem;
  min-height: 1rem;
  text-align: center;
}

.submission-debug {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  padding-top: 8px;
}

.submission-debug summary {
  cursor: pointer;
  font-weight: 800;
  text-align: left;
}

.submission-debug pre {
  background: #f7f9fd;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  margin: 8px 0 0;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
}

.download-button {
  background: var(--accent);
  border-radius: 8px;
  color: #ffffff;
  display: block;
  font-weight: 800;
  padding: 0.8rem 1rem;
  text-align: center;
  text-decoration: none;
}

.download-button:hover {
  background: var(--accent-dark);
}

.is-recording {
  background: #ffe9e7;
  border-color: #ffc7c2;
  color: var(--danger);
}

.is-ready {
  background: #e8f7ef;
  border-color: #b9e7ce;
  color: var(--good);
}

@media (max-width: 820px) and (min-width: 641px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .setup-panel,
  .review-panel {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 640px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .setup-panel,
  .stage,
  .review-panel {
    grid-template-columns: 1fr;
  }

  .audio-mix-control {
    align-items: stretch;
    width: 100%;
  }

  .finish-button {
    width: 100%;
  }

  .audio-mix-control input {
    width: 100%;
  }

}
