:root {
  color-scheme: light;
  --ink: #13233f;
  --muted: #64748b;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eaf1ff;
  --green: #059669;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --line: #dce4ef;
  --surface: rgba(255, 255, 255, 0.9);
  --shadow: 0 20px 50px rgba(37, 99, 235, 0.1);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% 5%, #dbeafe 0, transparent 30rem),
    radial-gradient(circle at 95% 90%, #e0e7ff 0, transparent 28rem),
    #f7f9fc;
}

button,
select {
  font: inherit;
}

button:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 3px;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.subtitle {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.status-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  min-width: 126px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
}

.status-chip[data-state="listening"] {
  color: var(--green);
}

.status-chip[data-state="listening"] .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(5, 150, 105, 0.12);
}

.status-chip[data-state="error"] {
  color: var(--red);
}

.status-chip[data-state="error"] .status-dot {
  background: var(--red);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(420px, 1.45fr);
  gap: 24px;
}

.control-panel,
.transcript-panel,
.help-panel {
  border: 1px solid rgba(220, 228, 239, 0.9);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.control-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 32px 30px;
  text-align: center;
}

.control-panel > p {
  color: var(--muted);
  line-height: 1.65;
}

.microphone-visual {
  position: relative;
  display: grid;
  width: 132px;
  height: 132px;
  margin-bottom: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
}

.pulse-ring {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-radius: inherit;
  opacity: 0;
}

.microphone-visual.is-listening .pulse-ring {
  animation: pulse 1.8s ease-out infinite;
}

.microphone-icon {
  position: relative;
  width: 56px;
  height: 70px;
}

.microphone-capsule {
  position: absolute;
  top: 0;
  left: 16px;
  width: 24px;
  height: 43px;
  border-radius: 14px;
  background: var(--blue);
}

.microphone-capsule::after {
  position: absolute;
  right: -8px;
  bottom: -9px;
  width: 36px;
  height: 31px;
  border: 4px solid var(--blue);
  border-top: 0;
  border-radius: 0 0 22px 22px;
  content: "";
}

.microphone-stem {
  position: absolute;
  bottom: 0;
  left: 26px;
  width: 4px;
  height: 17px;
  border-radius: 4px;
  background: var(--blue);
}

.microphone-stem::after {
  position: absolute;
  right: -9px;
  bottom: 0;
  width: 22px;
  height: 4px;
  border-radius: 4px;
  background: var(--blue);
  content: "";
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(100%, 260px);
  min-height: 52px;
  margin: 8px 0 22px;
  border: 0;
  border-radius: 14px;
  background: var(--blue);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.primary-button:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.primary-button.is-listening {
  background: var(--red);
  box-shadow: 0 12px 24px rgba(220, 38, 38, 0.2);
}

.primary-button:disabled {
  background: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.button-icon {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: currentColor;
}

.primary-button.is-listening .button-icon {
  border-radius: 2px;
}

.language-field {
  display: grid;
  width: min(100%, 260px);
  gap: 8px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
  text-align: left;
}

.language-field select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.browser-note {
  margin: 20px 0 0;
  font-size: 0.78rem;
}

.transcript-panel {
  min-height: 540px;
  padding: 30px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.text-button {
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: var(--blue-soft);
  color: var(--blue);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
}

.current-transcript {
  min-height: 130px;
  margin-top: 24px;
  padding: 22px;
  border: 1px dashed #bfdbfe;
  border-radius: 16px;
  background: #f8fbff;
}

.transcript-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.interim-text {
  margin-bottom: 0;
  color: #7c8ca3;
  font-size: 1.15rem;
  line-height: 1.65;
}

.interim-text.has-content {
  color: var(--ink);
}

.history-section {
  margin-top: 26px;
}

.transcript-list {
  display: grid;
  max-height: 235px;
  margin: 0;
  padding: 0;
  gap: 10px;
  overflow-y: auto;
  list-style: none;
}

.transcript-list li:not(.empty-state) {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f1f5f9;
  line-height: 1.55;
}

.transcript-index {
  color: var(--blue);
  font-weight: 800;
}

.empty-state {
  padding: 22px;
  border-radius: 12px;
  background: #f8fafc;
  color: #94a3b8;
  text-align: center;
}

.help-panel {
  display: grid;
  grid-template-columns: 0.6fr 1.4fr;
  gap: 36px;
  margin-top: 24px;
  padding: 28px 32px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding-left: 24px;
  gap: 12px 30px;
  color: var(--muted);
  line-height: 1.55;
}

.steps li::marker {
  color: var(--blue);
  font-weight: 800;
}

.error-banner {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: grid;
  max-width: 430px;
  padding: 16px 20px;
  border: 1px solid #fecaca;
  border-radius: 14px;
  background: var(--red-soft);
  box-shadow: 0 16px 36px rgba(127, 29, 29, 0.16);
  color: #991b1b;
  gap: 5px;
}

.error-banner[hidden] {
  display: none;
}

@keyframes pulse {
  0% {
    opacity: 0.7;
    transform: scale(0.85);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 680px);
    padding: 28px 0;
  }

  .hero,
  .panel-heading {
    align-items: flex-start;
  }

  .workspace,
  .help-panel {
    grid-template-columns: 1fr;
  }

  .transcript-panel {
    min-height: 460px;
  }
}

@media (max-width: 520px) {
  .hero {
    flex-direction: column;
  }

  .control-panel,
  .transcript-panel,
  .help-panel {
    padding: 24px 20px;
    border-radius: 18px;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
