:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #1b1f23;
  --panel-2: #242a2f;
  --text: #f2f4f5;
  --muted: #aeb8be;
  --line: #394249;
  --accent: #f25545;
  --accent-2: #2cc7a4;
  --warn: #f0b84b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

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

code {
  color: #ffcbc5;
}

.app {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0 18px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

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

p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.status,
.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.badge.pass {
  border-color: rgba(44, 199, 164, 0.45);
  color: var(--accent-2);
}

.badge.warn {
  border-color: rgba(240, 184, 75, 0.55);
  color: var(--warn);
}

.meter-panel,
.log-panel,
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.meter-panel {
  overflow: hidden;
  margin-bottom: 16px;
}

#scope {
  display: block;
  width: 100%;
  height: 180px;
  background: #0a0c0e;
}

.meter-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card {
  padding: 16px;
}

.card-head,
.log-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.video,
.youtube {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #08090a;
}

.youtube iframe {
  display: block;
  width: 100%;
  height: 100%;
}

.log-panel {
  margin-top: 16px;
  padding: 16px;
}

.log-head {
  align-items: center;
}

.log-head h2 {
  margin: 0;
}

/* ── YouTube Download + Sync Card ── */
.card--full {
  grid-column: 1 / -1;
}

.sync-input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.url-input {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #0a0c0e;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
}

.url-input::placeholder {
  color: var(--muted);
}

.sync-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.88rem;
}

.sync-progress.hidden {
  display: none;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--line);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

#log {
  min-height: 220px;
  max-height: 360px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  color: #d8dee2;
  font-size: 0.9rem;
  line-height: 1.55;
}

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

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

  .status {
    white-space: normal;
  }
}
