:root {
  color-scheme: dark;
  --bg: #08111f;
  --panel: rgba(16, 30, 51, .84);
  --line: rgba(151, 177, 211, .18);
  --muted: #8ea2bd;
  --text: #f3f7fc;
  --cyan: #63e6d6;
  --blue: #6ea8ff;
  --red: #ff6b83;
  --amber: #f7c66a;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 0%, rgba(85, 146, 255, .18), transparent 34rem),
    radial-gradient(circle at 90% 18%, rgba(99, 230, 214, .12), transparent 28rem),
    linear-gradient(135deg, #08111f 0%, #0b1525 52%, #08111f 100%);
}

button, a { font: inherit; }

.shell { width: min(940px, calc(100% - 32px)); margin: 0 auto; padding: 58px 0 32px; }

.hero { margin-bottom: 26px; }
.eyebrow, .section-kicker, .stat-card > span, footer {
  color: var(--cyan); font-size: 11px; font-weight: 800; letter-spacing: .18em;
}
.eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 22px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 5px rgba(99, 230, 214, .12), 0 0 18px var(--cyan); }
h1 { margin: 0; font-size: clamp(42px, 7vw, 78px); line-height: .98; letter-spacing: -.06em; font-weight: 760; }
h1 em { color: var(--cyan); font-style: normal; }
.lead { max-width: 650px; margin: 22px 0 0; color: var(--muted); font-size: 15px; line-height: 1.75; }

.panel, .stat-card, .diagnostics {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(21, 39, 66, .88), rgba(11, 23, 41, .8));
  box-shadow: 0 22px 70px rgba(0, 0, 0, .18);
  backdrop-filter: blur(14px);
}
.panel { border-radius: 18px; }
.status-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; margin-bottom: 18px; }
.status-copy { display: grid; gap: 5px; }
.status-label { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.status-copy strong { font-size: 17px; }
.status-copy span:last-child { color: var(--muted); font-size: 13px; }
.pill { flex: 0 0 auto; border: 1px solid currentColor; border-radius: 999px; padding: 7px 11px; font-size: 10px; font-weight: 850; letter-spacing: .12em; }
.pill.waiting { color: var(--amber); }
.pill.success { color: var(--cyan); }
.pill.error { color: var(--red); }

.preview-panel { padding: 18px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding: 4px 3px 14px; }
h2 { margin: 5px 0 0; font-size: 22px; letter-spacing: -.03em; }
.recording-badge { display: flex; align-items: center; gap: 7px; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.recording-badge span { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 14px var(--red); animation: pulse 1.3s ease-in-out infinite; }
.recording-badge b { color: var(--muted); font-weight: 700; letter-spacing: .03em; }
.is-hidden { display: none !important; }
.preview-frame { position: relative; min-height: 300px; overflow: hidden; border-radius: 12px; background: #050a12; aspect-ratio: 16 / 9; }
video { display: block; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); background: #050a12; }
.preview-placeholder { position: absolute; inset: 0; display: grid; place-content: center; gap: 9px; text-align: center; color: var(--muted); background: radial-gradient(circle, rgba(35, 67, 106, .5), rgba(5, 10, 18, .98) 65%); }
.preview-placeholder strong { color: var(--text); font-size: 16px; }
.preview-placeholder span { max-width: 280px; font-size: 12px; line-height: 1.5; }
.placeholder-icon { margin: 0 auto 3px; color: var(--cyan); font-size: 35px; text-shadow: 0 0 28px rgba(99, 230, 214, .7); }
.preview-grid { position: absolute; inset: 0; pointer-events: none; opacity: .18; background-image: linear-gradient(rgba(255,255,255,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.18) 1px, transparent 1px); background-size: 20% 25%; }
.meter-wrap { position: absolute; right: 16px; bottom: 16px; width: min(180px, 35%); display: grid; gap: 6px; padding: 9px 10px; border: 1px solid rgba(255,255,255,.14); border-radius: 9px; background: rgba(3, 8, 15, .62); backdrop-filter: blur(8px); }
.meter-caption { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.meter { height: 5px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.13); }
.meter i { display: block; width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--blue)); transition: width .08s linear; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.stat-card { min-height: 112px; display: grid; align-content: center; gap: 7px; padding: 17px; border-radius: 14px; }
.stat-card > span { color: var(--muted); font-size: 10px; }
.stat-card strong { font-size: 18px; }
.stat-card small { min-height: 16px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.controls-panel { padding: 18px 20px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 17px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 750; transition: transform .18s ease, border-color .18s ease, background .18s ease, opacity .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .43; }
.button.primary { color: #06121d; background: var(--cyan); }
.button.secondary, .button.download { color: var(--text); border-color: var(--line); background: rgba(255,255,255,.05); }
.button.download { color: var(--cyan); border-color: rgba(99, 230, 214, .45); }
.fine-print { margin: 13px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.diagnostics { margin-top: 18px; border-radius: 13px; }
.diagnostics summary { padding: 14px 17px; color: var(--muted); cursor: pointer; font-size: 12px; }
.diagnostics pre { margin: 0; padding: 0 17px 17px; color: #b8c8dd; font: 11px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
footer { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 22px; color: #5d7393; font-size: 9px; }

@keyframes pulse { 50% { opacity: .35; transform: scale(.72); } }
@media (max-width: 640px) {
  .shell { width: min(100% - 22px, 940px); padding-top: 34px; }
  .status-panel { align-items: flex-start; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 86px; }
  .preview-frame { min-height: 220px; }
  .meter-wrap { width: 45%; }
}
