:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #d0d5dd;
  --blue: #1d4ed8;
  --green: #047857;
  --purple: #7c3aed;
  --red: #b42318;
  --shadow: 0 18px 50px rgba(16, 24, 40, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 4px;
}

.label,
.status-label,
.caption-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(2rem, 8vw, 3.15rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.icon-button {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--blue);
  font-size: 1.4rem;
  font-weight: 800;
}

.status-panel,
.caption-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

.pulse {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--muted);
  flex: 0 0 auto;
}

.pulse.live {
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(4, 120, 87, 0.35);
  animation: pulse 1.35s infinite;
}

.pulse.error {
  background: var(--red);
}

.status-text {
  margin: 2px 0 0;
  font-size: 1.08rem;
  font-weight: 800;
}

.actions {
  display: grid;
  gap: 12px;
}

.action,
.mode-button,
.stop-button {
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.action,
.stop-button {
  min-height: 88px;
  color: #ffffff;
  text-align: left;
  padding: 18px;
}

.mode-button {
  min-height: 70px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
}

.mode-button.headphones {
  border-color: rgba(124, 58, 237, 0.4);
}

.mode-button.phrase {
  border-color: rgba(4, 120, 87, 0.4);
}

.action:active,
.mode-button:active,
.stop-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.action-title,
.action-subtitle,
.mode-title,
.mode-subtitle {
  display: block;
}

.action-title {
  font-size: 1.18rem;
  font-weight: 850;
}

.action-subtitle {
  margin-top: 4px;
  font-size: 0.96rem;
  opacity: 0.88;
}

.mode-title {
  font-size: 1rem;
  font-weight: 850;
}

.mode-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.action-primary {
  background: var(--blue);
}

.action-primary.phrase {
  background: var(--green);
}

.action-secondary {
  background: var(--purple);
}

.action-secondary.phrase {
  background: var(--green);
}

.stop-button {
  min-height: 56px;
  background: var(--ink);
  text-align: center;
  font-weight: 850;
}

.stop-button:disabled,
.action:disabled,
.mode-button:disabled {
  opacity: 0.5;
}

.captions {
  display: grid;
  gap: 12px;
  flex: 1;
}

.caption-box {
  min-height: 118px;
  padding: 16px;
}

.caption-box.strong {
  border-color: rgba(29, 78, 216, 0.35);
}

.caption-text {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.45;
}

footer {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: center;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(4, 120, 87, 0.35);
  }

  70% {
    box-shadow: 0 0 0 12px rgba(4, 120, 87, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(4, 120, 87, 0);
  }
}
