:root {
  --brand: #ff3300;
  --brand-strong: #e02a00;
  --bg: #f5f4f2;
  --surface: #ffffff;
  --surface-2: #f7f6f4;
  --ink: #161616;
  --muted: #6b6b6b;
  --line: #e4e2de;
  --focus: #ff330066;
  --good: #18a058;
  --warn: #e3a008;
  --bad: #e5341d;
  --meter-off: #e7e5e1;
  --shadow: 0 1px 2px rgb(0 0 0 / 4%), 0 8px 24px rgb(0 0 0 / 6%);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --surface: #1b1b1b;
    --surface-2: #232323;
    --ink: #f2f2f2;
    --muted: #a3a3a3;
    --line: #2f2f2f;
    --meter-off: #2c2c2c;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 26px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 20px; line-height: 1.3; margin: 0 0 6px; }
p { margin: 0 0 12px; }

/* Layout */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: #121212;
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { display: block; height: 23px; width: auto; }
.product { font-weight: 700; font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase; color: #fff; opacity: 0.9; }
.account { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 14px; }
.account-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.85; }

.shell { width: 100%; max-width: 600px; margin: 32px auto; padding: 0 16px; flex: 1; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 16px;
}
.center { text-align: center; }
.center-text { text-align: center; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px; }

/* Text */
.lead { font-size: 17px; color: var(--muted); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; min-height: 21px; margin: 8px 0 0; }
.hint[data-tone="bad"] { color: var(--bad); font-weight: 600; }
.hint[data-tone="warn"] { color: var(--warn); font-weight: 600; }
.fine { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.small-text { font-size: 13px; margin: 0; }
.eyebrow { text-transform: uppercase; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 4px; font-weight: 600; }

/* Sign-in */
.hero h1 { font-size: 30px; }
.how { padding: 0; margin: 20px 0 24px; list-style: none; counter-reset: how; display: grid; gap: 10px; }
.how li { counter-increment: how; display: flex; gap: 12px; align-items: baseline; }
.how li::before {
  content: counter(how);
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  transform: translateY(-1px);
}
.google-button { min-height: 44px; }

/* Forms */
.field-label { display: block; font-weight: 600; font-size: 14px; margin: 20px 0 6px; }
.optional { font-weight: 400; color: var(--muted); }
.input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.input:focus { outline: 3px solid var(--focus); border-color: var(--brand); }
select.input { margin-bottom: 12px; }

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.button:active:not(:disabled) { transform: scale(0.98); }
.button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.button.primary { background: var(--brand); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--brand-strong); }
.button.secondary { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.button.ghost { background: transparent; border-color: var(--line); color: inherit; }
.button.small { padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.topbar .button.ghost { border-color: #444; }
.button.large { padding: 15px 26px; font-size: 17px; }
.button.block { width: 100%; margin-top: 24px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.center-actions { justify-content: center; }

.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: currentColor; display: inline-block; }
.button.primary .rec-dot { background: #fff; }
.rec-dot.live { background: var(--bad); animation: pulse 1.2s ease-in-out infinite; }
.stop-square { width: 12px; height: 12px; border-radius: 2px; background: #fff; display: inline-block; }
@keyframes pulse { 50% { opacity: 0.25; } }

/* Microphone */
.mic-panel {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.mic-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mic-header .field-label { margin: 0; }
.mic-panel .button { margin-top: 12px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--meter-off);
  color: var(--muted);
  white-space: nowrap;
}
.pill[data-tone="good"] { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.pill[data-tone="warn"] { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill[data-tone="bad"] { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.pill[data-tone="busy"] { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }

.level {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
  height: 22px;
}
.level span { border-radius: 3px; background: var(--meter-off); transition: background 0.06s; }
.level span.on { background: var(--good); }
.level span.on.warn { background: var(--warn); }
.level span.on.bad { background: var(--bad); }
.level-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Recording */
.rec-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--bad); margin: 0; }
.rec-label.paused { color: var(--muted); }
.rec-label.paused .rec-dot { animation: none; background: var(--muted); }
.timer { font-size: 56px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; margin: 4px 0 0; line-height: 1.1; }
#step-recording .meter-slot { margin: 24px 0 0; text-align: left; }

/* Review & upload */
.playback { width: 100%; margin-top: 8px; }
.progress { height: 10px; border-radius: 999px; background: var(--meter-off); overflow: hidden; margin: 16px 0 10px; }
.progress-fill { height: 100%; width: 0; background: var(--brand); transition: width 0.2s; }

/* Status */
.status-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.status-head h2 { overflow-wrap: anywhere; }
.timeline { list-style: none; padding: 0; margin: 20px 0 16px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.timeline li {
  position: relative;
  padding-top: 22px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.timeline li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: var(--meter-off);
  border: 2px solid var(--surface);
  box-sizing: content-box;
  z-index: 1;
}
.timeline li::after {
  content: "";
  position: absolute;
  top: 8px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--meter-off);
}
.timeline li:first-child::after { display: none; }
.timeline li.done { color: var(--ink); }
.timeline li.done::before, .timeline li.done::after { background: var(--good); }
.timeline li.active { color: var(--ink); font-weight: 700; }
.timeline li.active::before { background: var(--brand); animation: pulse 1.2s ease-in-out infinite; }
.timeline li.active::after { background: var(--good); }
.timeline li.error { color: var(--bad); font-weight: 700; }
.timeline li.error::before { background: var(--bad); }
.status-text { margin: 0; }

/* Alerts & loading */
.alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
  background: color-mix(in srgb, var(--bad) 8%, var(--surface));
}
.alert-close { border: 0; background: none; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }
.spinner {
  width: 28px;
  height: 28px;
  margin: 8px auto 12px;
  border-radius: 50%;
  border: 3px solid var(--meter-off);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
  .shell { margin: 16px auto; }
  .card { padding: 20px; }
  .hero h1 { font-size: 24px; }
  .timer { font-size: 44px; }
  .timeline li { font-size: 11px; }
  .account-email { max-width: 120px; }
  .product { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
