:root {
  --bg: #f7f6fb;
  --bg-wash: #eeeaff;
  --surface: #ffffff;
  --surface-2: #fbfaff;
  --text: #1a1730;
  --text-2: #635f7a;
  --text-muted: #8b87a3;
  --border: #e3e0ee;
  --border-strong: #cfc9e4;
  --accent: #5b3df5;
  --accent-ink: #4a30d6;
  --accent-wash: rgba(91, 61, 245, 0.08);
  --accent-ring: rgba(91, 61, 245, 0.18);
  --good: #0ca30c;
  --good-wash: rgba(12, 163, 12, 0.1);
  --critical: #d03b3b;
  --critical-wash: rgba(208, 59, 59, 0.1);
  --warning: #b45309;
  --warning-wash: rgba(217, 119, 6, 0.12);
  --shadow: 0 1px 2px rgba(26, 23, 48, 0.04), 0 12px 32px -12px rgba(26, 23, 48, 0.16);
  --mono: "MS Mincho", "ＭＳ 明朝", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: "MS Mincho", "ＭＳ 明朝", "Hiragino Mincho ProN", "Yu Mincho", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --bg: #121022;
    --bg-wash: #1a1533;
    --surface: #1c1933;
    --surface-2: #201d3a;
    --text: #edebf7;
    --text-2: #a79fc4;
    --text-muted: #857fa3;
    --border: #2e2a47;
    --border-strong: #3c3760;
    --accent: #8b7bff;
    --accent-ink: #a597ff;
    --accent-wash: rgba(139, 123, 255, 0.14);
    --accent-ring: rgba(139, 123, 255, 0.28);
    --good: #2fbf4f;
    --good-wash: rgba(47, 191, 79, 0.14);
    --critical: #f0685f;
    --critical-wash: rgba(240, 104, 95, 0.14);
    --warning: #f5a623;
    --warning-wash: rgba(245, 166, 35, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 20px 40px -16px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121022;
  --bg-wash: #1a1533;
  --surface: #1c1933;
  --surface-2: #201d3a;
  --text: #edebf7;
  --text-2: #a79fc4;
  --text-muted: #857fa3;
  --border: #2e2a47;
  --border-strong: #3c3760;
  --accent: #8b7bff;
  --accent-ink: #a597ff;
  --accent-wash: rgba(139, 123, 255, 0.14);
  --accent-ring: rgba(139, 123, 255, 0.28);
  --good: #2fbf4f;
  --good-wash: rgba(47, 191, 79, 0.14);
  --critical: #f0685f;
  --critical-wash: rgba(240, 104, 95, 0.14);
  --warning: #f5a623;
  --warning-wash: rgba(245, 166, 35, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 20px 40px -16px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f7f6fb;
  --bg-wash: #eeeaff;
  --surface: #ffffff;
  --surface-2: #fbfaff;
  --text: #1a1730;
  --text-2: #635f7a;
  --text-muted: #8b87a3;
  --border: #e3e0ee;
  --border-strong: #cfc9e4;
  --accent: #5b3df5;
  --accent-ink: #4a30d6;
  --accent-wash: rgba(91, 61, 245, 0.08);
  --accent-ring: rgba(91, 61, 245, 0.18);
  --good: #0ca30c;
  --good-wash: rgba(12, 163, 12, 0.1);
  --critical: #d03b3b;
  --critical-wash: rgba(208, 59, 59, 0.1);
  --warning: #b45309;
  --warning-wash: rgba(217, 119, 6, 0.12);
  --shadow: 0 1px 2px rgba(26, 23, 48, 0.04), 0 12px 32px -12px rgba(26, 23, 48, 0.16);
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  /* every font-size in this file is in rem, so this doubles all text at once */
  font-size: 200%;
}

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 50% -10%, var(--bg-wash), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration: none; }

/* ---------- nav ---------- */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 780px;
  margin: 0 auto;
  padding: 20px 24px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--accent-ink); }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent-wash);
  color: var(--accent-ink);
}

.nav-links {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px;
  box-shadow: var(--shadow);
}

.nav-links a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  padding: 7px 14px;
  border-radius: 100px;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-links a:hover { color: var(--text); background: var(--surface-2); }

.nav-links a.active {
  color: #fff;
  background: var(--accent);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .nav-links a.active { color: #16132b; }
}
:root[data-theme="dark"] .nav-links a.active { color: #16132b; }

/* ---------- shell ---------- */

.shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 44px 24px 80px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-ink);
  font-weight: 600;
  margin: 0 0 8px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
  text-wrap: balance;
}

.lede {
  color: var(--text-2);
  margin: 0 0 24px;
  font-size: 0.96rem;
}

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-2);
  text-transform: uppercase;
  margin-bottom: 6px;
  margin-top: 20px;
}
label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="password"],
input[type="tel"] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  font-family: var(--sans);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.phrase {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  background: var(--accent-wash);
  border: 1px solid var(--accent-ring);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 20px 0 4px;
  color: var(--text);
}
.phrase .phrase-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-ink);
  font-weight: 700;
  flex-shrink: 0;
}

/* ---------- buttons ---------- */

button {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease;
}
button:active { transform: scale(0.98); }
button:disabled { cursor: not-allowed; opacity: 0.5; transform: none; }

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn-primary {
  flex: 1;
  padding: 13px 20px;
  background: var(--accent);
  color: #fff;
  min-width: 140px;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }

.btn-ghost {
  padding: 13px 16px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); background: var(--surface); }

/* mic record control */

.record-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 28px 0 8px;
}

.record-btn {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px -8px var(--accent-ring);
  flex-direction: column;
  gap: 0;
}
.record-btn svg { width: 26px; height: 26px; }

.record-btn::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.record-btn.recording {
  background: var(--critical);
  box-shadow: 0 8px 24px -8px var(--critical-wash);
}
.record-btn.recording::before {
  border-color: var(--critical);
  opacity: 1;
  animation: ring-pulse 1.6s ease-out infinite;
}

@keyframes ring-pulse {
  0%   { transform: scale(0.9); opacity: 0.7; }
  100% { transform: scale(1.35); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .record-btn.recording::before { animation: none; opacity: 0.5; }
}

.record-caption {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  height: 16px;
}
.record-caption.listening { color: var(--critical); font-weight: 600; }

/* ---------- visualizer ---------- */

.visualizer-wrap {
  margin-top: 4px;
  border-radius: 12px;
  background: #14121f;
  padding: 10px;
  height: 0;
  overflow: hidden;
  opacity: 0;
  transition: height 0.2s ease, opacity 0.2s ease, margin 0.2s ease;
}
.visualizer-wrap.active {
  height: 76px;
  opacity: 1;
  margin-top: 16px;
}
#visualizer {
  width: 100%;
  /* fixed, independent of .visualizer-wrap's collapsing height —
     the canvas is measured via getBoundingClientRect() the instant
     recording starts, before the reveal transition has expanded the
     parent, so its own box must already be full-size. */
  height: 76px;
  display: block;
}

/* ---------- sample progress ---------- */

.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}
.dots { display: flex; gap: 6px; }
.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--border-strong);
  transition: background 0.2s ease, transform 0.2s ease;
}
.dot.filled { background: var(--good); transform: scale(1.1); }
.progress-text {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-2);
  margin-left: 4px;
}

/* ---------- log / result panel ---------- */

#log {
  margin-top: 20px;
  padding: 13px 16px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-2);
}
#log:empty { display: none; }

.result-panel {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.result-headline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px;
}
.result-headline .icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.result-headline .icon svg { width: 18px; height: 18px; }
.result-headline.ok { background: var(--good-wash); }
.result-headline.ok .icon { background: var(--good); color: #fff; }
.result-headline.fail { background: var(--critical-wash); }
.result-headline.fail .icon { background: var(--critical); color: #fff; }
.result-headline .headline-text { font-size: 1.1rem; font-weight: 700; }
.result-headline .subtext { font-size: 0.85rem; color: var(--text-2); font-weight: 500; }

.warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 18px 16px;
  padding: 11px 13px;
  background: var(--warning-wash);
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--warning);
  font-weight: 500;
  line-height: 1.4;
}
.warning-banner svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.result-rows {
  padding: 6px 18px 16px;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}
.result-row .k { color: var(--text-muted); }
.result-row .v { font-family: var(--mono); color: var(--text); font-weight: 500; }
.result-row .v.ok { color: var(--good); }
.result-row .v.fail { color: var(--critical); }

/* ---------- landing page ---------- */

.hero { text-align: left; }
.link-cards { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.link-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color 0.15s ease, transform 0.1s ease, background 0.15s ease;
}
.link-card:hover { border-color: var(--accent); background: var(--surface); transform: translateY(-1px); }
.link-card .icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.link-card .icon svg { width: 18px; height: 18px; }
.link-card .title { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.link-card .desc { font-size: 0.83rem; color: var(--text-2); }
.link-card .arrow { margin-left: auto; color: var(--text-muted); flex-shrink: 0; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 5px 12px 5px 9px;
  border-radius: 100px;
  margin-top: 18px;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.status-dot.up { background: var(--good); box-shadow: 0 0 0 0 rgba(12, 163, 12, 0.5); animation: dot-pulse 1.8s ease-out infinite; }
@keyframes dot-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0.45); }
  70%  { box-shadow: 0 0 0 6px rgba(12, 163, 12, 0); }
  100% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0); }
}
