/* Orate — sleek dark theme (Linear-style). Dark-only by design.
   Meters/ring keep severity encoding (accent / warning / danger) with
   same-ramp dark tracks; values always labeled in ink. */

:root {
  --page: #0a0a0c;
  --surface: rgba(255, 255, 255, 0.025);
  --surface-solid: #101113;
  --ink: #f7f8f8;
  --ink-2: #9ea3ae;
  --ink-muted: #62666d;
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.14);
  --grid: rgba(255, 255, 255, 0.06);

  --accent: #7c8aff;
  --accent-deep: #5e6ad2;
  --accent-track: #23264a;
  --warning: #f0b429;
  --warning-track: #3a2f10;
  --danger: #ef6a6a;
  --danger-track: #421c1c;
  --good-text: #3dd68c;

  --radius: 12px;
  --radius-sm: 8px;
  --glow: 0 0 40px rgba(124, 138, 255, 0.35);
  --card-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background:
    radial-gradient(ellipse 70% 45% at 50% -12%, rgba(94, 106, 210, 0.22), transparent 70%),
    radial-gradient(ellipse 40% 30% at 85% 0%, rgba(124, 138, 255, 0.07), transparent 70%),
    var(--page);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(124, 138, 255, 0.35); }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* display rules on sections must never defeat the hidden attribute */
[hidden] { display: none !important; }

/* ---------- chrome ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 720px; margin: 0 auto; padding: 22px 24px 8px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  filter: drop-shadow(0 0 10px rgba(124, 138, 255, 0.5));
}
.brand-name { font-weight: 600; font-size: 16px; letter-spacing: -0.02em; }
.topbar-tag {
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-muted);
  border: 1px solid var(--hairline); border-radius: 99px; padding: 4px 12px;
}

.shell { max-width: 720px; margin: 0 auto; padding: 16px 24px 72px; }
.view { display: flex; flex-direction: column; gap: 20px; }

/* ---------- shared bits ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--card-inset);
  backdrop-filter: blur(8px);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-muted);
}

.section-head { display: flex; align-items: baseline; justify-content: space-between; }
.section-head h2 { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink-2); }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, #6c78e6, var(--accent-deep));
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; letter-spacing: -0.01em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 20px rgba(94, 106, 210, 0.25);
  transition: filter 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}
.btn-primary:hover { filter: brightness(1.12); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 28px rgba(94, 106, 210, 0.4); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.04); color: var(--ink-2);
  border: 1px solid var(--hairline);
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-weight: 500; font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.07); color: var(--ink); border-color: var(--hairline-strong); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-muted); font-size: 13px; font-weight: 500;
  padding: 5px 10px; border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.btn-ghost svg { width: 14px; height: 14px; }

/* ---------- home ---------- */

.hero { padding-top: 40px; text-align: center; }
.hero h1 {
  font-size: 42px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.1;
  background: linear-gradient(180deg, #ffffff 30%, rgba(255, 255, 255, 0.55));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero h1 em {
  font-family: var(--font-display);
  font-style: italic; font-weight: 500;
  font-size: 1.08em; letter-spacing: -0.01em;
  padding-right: 0.06em; /* italic overhang clips against gradient text otherwise */
  background: linear-gradient(120deg, #a5affb 20%, var(--accent) 55%, #c0a9f5);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero-sub { color: var(--ink-2); max-width: 460px; margin: 14px auto 0; font-size: 15px; }

.mode-switch {
  display: flex; align-self: center; gap: 2px;
  margin-top: 10px; padding: 3px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--hairline); border-radius: 10px;
}
.mode-btn {
  padding: 7px 16px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--ink-muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.mode-btn:hover { color: var(--ink-2); }
.mode-btn.active {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  box-shadow: var(--card-inset), 0 1px 3px rgba(0, 0, 0, 0.3);
}

.topic-card { padding: 18px 20px; margin-top: 8px; }

.scenario-card { padding: 18px 20px; margin-top: 8px; display: flex; flex-direction: column; gap: 10px; }
.scenario-input {
  font: inherit; color: var(--ink);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 10px 12px; resize: vertical; min-height: 44px;
  transition: border-color 0.15s ease;
}
.scenario-input::placeholder { color: var(--ink-muted); }
.scenario-input:focus { outline: none; border-color: var(--accent-deep); }
.scenario-actions { display: flex; justify-content: flex-end; }
.suggestions { display: flex; flex-direction: column; gap: 8px; }
.suggestion {
  width: 100%; text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.suggestion:hover { background: rgba(124, 138, 255, 0.07); border-color: var(--accent-deep); }
.suggestion-q { font-size: 14px; font-weight: 500; line-height: 1.45; }
.suggestion-why { font-size: 12.5px; color: var(--ink-muted); margin-top: 3px; }
.suggestion-tips { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; padding: 2px 2px 0; }
.suggestion-tips strong {
  font-family: var(--font-mono); font-weight: 500; font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted);
  display: block; margin-bottom: 2px;
}
.topic-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.topic-text { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.35; }

.record-cta { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 0 6px; }
.btn-record {
  width: 88px; height: 88px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #7f8cff, var(--accent-deep) 70%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: grid; place-items: center;
  box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-record:hover {
  transform: scale(1.05);
  box-shadow: 0 0 56px rgba(124, 138, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-record:active { transform: scale(0.97); }
.btn-record svg { width: 36px; height: 36px; }
.record-hint { font-size: 13px; color: var(--ink-muted); }

.camera-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  border: 1px solid var(--hairline); border-radius: 99px;
  padding: 6px 14px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.camera-toggle:hover { border-color: var(--hairline-strong); color: var(--ink); }
.camera-toggle .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good-text); }
.camera-toggle.off { color: var(--ink-muted); }
.camera-toggle.off .dot { background: var(--ink-muted); }

.rec-preview {
  width: 100%; max-height: 320px; border-radius: var(--radius-sm);
  background: #000; object-fit: cover;
  transform: scaleX(-1); /* mirror, like looking in a mirror */
}

/* signature: a quietly breathing waveform beneath the record button */
.idle-wave { display: flex; align-items: center; gap: 4px; height: 26px; }
.idle-wave span {
  width: 3px; border-radius: 2px;
  background: var(--accent);
  opacity: 0.55;
  height: calc(6px + var(--h, 0) * 18px);
  animation: breathe 3.2s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
@keyframes breathe {
  0%, 100% { transform: scaleY(0.55); opacity: 0.35; }
  50% { transform: scaleY(1); opacity: 0.75; }
}

.history { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.history-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.history-item {
  width: 100%; text-align: left;
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); padding: 12px 14px;
  box-shadow: var(--card-inset);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.history-item:hover { background: rgba(255, 255, 255, 0.05); border-color: var(--hairline-strong); }
.history-score {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  border: 2px solid var(--accent);
  box-shadow: 0 0 12px rgba(124, 138, 255, 0.25);
}
.history-score.mid { border-color: var(--warning); box-shadow: 0 0 12px rgba(240, 180, 41, 0.2); }
.history-score.low { border-color: var(--danger); box-shadow: 0 0 12px rgba(239, 106, 106, 0.2); }
.history-meta { min-width: 0; }
.history-topic { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-sub { font-size: 12.5px; color: var(--ink-muted); }

/* ---------- recording ---------- */

.rec-topic { text-align: center; padding-top: 24px; }
.rec-topic p { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; margin-top: 6px; }

.rec-card { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.rec-status { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.rec-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 10px rgba(239, 106, 106, 0.8);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.rec-timer { margin-left: auto; font-family: var(--font-mono); font-size: 13.5px; color: var(--ink-2); }
.rec-timer.ending { color: var(--danger); font-weight: 700; }

.waveform { width: 100%; height: 96px; display: block; }

.rec-actions { display: flex; justify-content: space-between; gap: 12px; }
.stop-square { width: 10px; height: 10px; border-radius: 2px; background: #fff; display: inline-block; }
.rec-note { text-align: center; font-size: 12.5px; color: var(--ink-muted); }

/* ---------- analyzing ---------- */

.analyze-card {
  padding: 44px 28px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  margin-top: 48px;
}
.analyze-card h2 { font-size: 19px; font-weight: 650; letter-spacing: -0.02em; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--accent-track);
  border-top-color: var(--accent);
  filter: drop-shadow(0 0 8px rgba(124, 138, 255, 0.4));
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.analyze-steps { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.analyze-steps li {
  color: var(--ink-muted); font-size: 14px;
  display: flex; align-items: center; gap: 8px; justify-content: center;
  transition: color 0.3s ease;
}
.analyze-steps li::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--grid); flex: none;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.analyze-steps li.active { color: var(--ink); }
.analyze-steps li.active::before { background: var(--accent); box-shadow: 0 0 8px rgba(124, 138, 255, 0.7); }
.analyze-steps li.done { color: var(--ink-2); }
.analyze-steps li.done::before { background: var(--good-text); }

/* ---------- results ---------- */

.result-hero { text-align: center; padding-top: 28px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.score-ring { width: 152px; height: 152px; position: relative; margin-bottom: 8px; }
.score-ring svg {
  width: 100%; height: 100%; transform: rotate(-90deg);
  filter: drop-shadow(0 0 18px rgba(124, 138, 255, 0.35));
}
.score-ring .num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 50px; font-weight: 700; letter-spacing: -0.04em;
}
.result-grade {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500; color: var(--ink-muted);
  text-transform: uppercase; letter-spacing: 0.18em;
}
.result-title {
  font-family: var(--font-display);
  font-style: italic; font-weight: 500;
  font-size: 34px; letter-spacing: -0.01em;
  padding: 0 0.08em;
  background: linear-gradient(120deg, #ffffff 30%, rgba(255, 255, 255, 0.65));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.result-summary { color: var(--ink-2); max-width: 520px; margin-top: 6px; }
.result-topic { font-size: 13px; color: var(--ink-muted); margin-top: 2px; }

.meters { padding: 8px 20px; }
.meter-row { display: grid; grid-template-columns: 118px 1fr 34px; gap: 14px; align-items: center; padding: 14px 0; }
.meter-row + .meter-row { border-top: 1px solid var(--grid); }
.meter-label { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; }
.meter-track { height: 6px; border-radius: 3px; background: var(--accent-track); overflow: hidden; }
.meter-track.mid { background: var(--warning-track); }
.meter-track.low { background: var(--danger-track); }
.meter-fill {
  height: 100%; border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  box-shadow: 0 0 10px rgba(124, 138, 255, 0.4);
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.meter-track.mid .meter-fill { background: var(--warning); box-shadow: 0 0 10px rgba(240, 180, 41, 0.3); }
.meter-track.low .meter-fill { background: var(--danger); box-shadow: 0 0 10px rgba(239, 106, 106, 0.3); }
.meter-value { font-size: 13.5px; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.meter-feedback { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); margin-top: -7px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat-tile { padding: 14px 16px; }
.stat-label {
  font-family: var(--font-mono);
  font-size: 10px; color: var(--ink-muted); font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.stat-value { font-family: var(--font-mono); font-size: 20px; font-weight: 500; margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--ink-2); }

.result-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.result-card h3 {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-2);
}
.transcript { color: var(--ink-2); font-size: 14.5px; line-height: 1.75; }
.transcript mark {
  background: rgba(240, 180, 41, 0.16);
  color: var(--warning);
  border-radius: 4px; padding: 0 3px;
}

.takeaways { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .takeaways { grid-template-columns: 1fr; } }
.takeaways ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.takeaways li { font-size: 13.5px; color: var(--ink-2); display: flex; gap: 8px; }
.takeaways li::before { flex: none; font-weight: 700; }
.takeaways .ups li::before { content: "↑"; color: var(--good-text); }
.takeaways .downs li::before { content: "→"; color: var(--accent); }

.result-actions { display: flex; justify-content: center; gap: 12px; padding-top: 6px; }

.playback { width: 100%; border-radius: var(--radius-sm); background: #000; }
.video-note { font-size: 12px; color: var(--ink-muted); }
.body-summary { font-size: 14.5px; color: var(--ink-2); }
.body-tips { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.body-tips li { font-size: 13.5px; color: var(--ink-2); display: flex; gap: 8px; }
.body-tips li::before { content: "→"; flex: none; font-weight: 700; color: var(--accent); }
.body-pending { font-size: 13.5px; color: var(--ink-muted); animation: pulse 1.6s ease-in-out infinite; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #16171a; color: var(--ink);
  border: 1px solid var(--hairline-strong);
  padding: 10px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  max-width: 90vw;
  animation: toast-in 0.25s ease;
  z-index: 10;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (max-width: 480px) {
  .hero h1 { font-size: 32px; }
  .meter-row { grid-template-columns: 96px 1fr 32px; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .idle-wave span { animation: none; transform: scaleY(0.7); }
}
