:root {
  color-scheme: light;
  --ink: #171817;
  --muted: #66706b;
  --line: #d9dfdc;
  --surface: #f6f7f4;
  --panel: #ffffff;
  --green: #07845f;
  --red: #b93d3d;
  --blue: #275f9d;
  --gold: #c5952d;
  --soft-green: #edf7f2;
  --soft-blue: #edf3fb;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 14px 14px 122px;
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 7vw, 44px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  letter-spacing: 0;
}

.icon-button,
.quiet-button,
.main-action,
.mode-button,
.login-form button {
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), inset 0 0 0 1px var(--line);
}

.status-band,
.provider-surface,
.bottom-controls,
.transcript-surface,
.audio-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #e2e6e3;
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(31, 41, 36, 0.07);
}

.provider-surface {
  padding: 10px;
}

.status-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  margin-top: 8px;
  padding: 0 4px;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--muted);
  font-size: 12px;
}

.status-band > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
}

.status-dot.live {
  background: var(--green);
}

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

.provider-row,
.transcript-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.provider-row {
  min-height: 44px;
}

.provider-option {
  flex: 1;
  text-align: center;
  font-size: 16px;
}

.provider-divider {
  width: 1px;
  height: 28px;
  background: var(--line);
}

.provider-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  flex: 1;
  justify-content: center;
}

.provider-toggle input {
  position: absolute;
  opacity: 0;
}

.toggle-track {
  width: 56px;
  height: 32px;
  padding: 4px;
  border-radius: 999px;
  background: #dce7e2;
  transition: background 160ms ease;
}

.toggle-track span {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 8px rgba(24, 32, 28, 0.2);
  transition: transform 160ms ease;
}

.provider-toggle input:checked + .toggle-track {
  background: #dde7f4;
}

.provider-toggle input:checked + .toggle-track span {
  transform: translateX(24px);
}

.quiet-button {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 8px;
  background: #eef3f0;
  color: var(--ink);
  font-weight: 700;
}

.provider-row .quiet-button,
.provider-row .icon-button {
  min-width: 44px;
  padding: 0 10px;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

.mode-button {
  min-height: 58px;
  border-radius: 8px;
  background: #f2f5f3;
  color: var(--ink);
  text-align: center;
  padding: 10px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02);
}

.mode-button.active {
  background: #e7f3ef;
  box-shadow: inset 0 0 0 2px var(--green);
}

.mode-button span {
  display: block;
  font-size: 15px;
  font-weight: 850;
}

.mode-button small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.main-action {
  width: 74px;
  height: 74px;
  min-height: 74px;
  flex: 0 0 74px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: 13px;
  font-weight: 850;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  box-shadow: 0 14px 28px rgba(7, 132, 95, 0.26);
}

.main-action.stop {
  background: var(--red);
  box-shadow: 0 14px 28px rgba(185, 61, 61, 0.22);
}

.mic-mark {
  font-size: 22px;
  line-height: 1;
}

.transcript-surface,
.audio-panel {
  padding: 14px;
}

.transcript-surface {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.bottom-controls {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 20;
  width: min(732px, calc(100% - 20px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  backdrop-filter: blur(16px);
}

.bottom-controls .mode-grid {
  flex: 1;
}

.transcript-header h2 {
  color: #8a928e;
  font-size: 16px;
  font-weight: 500;
}

.transcript {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1;
  overflow: auto;
  margin-top: 12px;
  padding: 2px;
}

.line {
  width: fit-content;
  max-width: min(92%, 520px);
  padding: 10px 12px 11px;
  border-radius: 8px;
  background: var(--soft-green);
  line-height: 1.4;
}

.line.reply {
  align-self: flex-end;
  background: var(--soft-blue);
}

.line.pending {
  opacity: 0.72;
}

.line .meta {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.source-text {
  display: block;
  color: #737c77;
  font-size: 13px;
  line-height: 1.35;
  margin-top: 6px;
}

.source-text::before {
  content: "Вы сказали: ";
  font-weight: 700;
}

.translated-text {
  display: block;
  font-size: 18px;
}

.audio-chip {
  min-height: 34px;
  margin-top: 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(7, 132, 95, 0.12);
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  padding: 0 12px;
  cursor: pointer;
}

.audio-panel select {
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 10px;
}

#device-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 18% 12%, rgba(15, 123, 92, 0.18), transparent 28%),
    linear-gradient(135deg, rgba(39, 95, 157, 0.12), rgba(197, 149, 45, 0.1) 54%, rgba(15, 123, 92, 0.12)),
    #f5f7f2;
}

.login-shell {
  width: min(440px, 100%);
}

.login-panel {
  position: relative;
  overflow: hidden;
  padding: 26px;
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 246, 0.9)),
    var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 30px 90px rgba(31, 41, 36, 0.16);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 16px 34px rgba(15, 123, 92, 0.25);
}

.login-chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.login-chips span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef3f0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.login-panel h1 {
  max-width: 9ch;
  font-size: clamp(36px, 11vw, 54px);
  line-height: 0.98;
}

.login-panel p {
  max-width: 28ch;
  margin-top: 14px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.login-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 11px;
  margin-top: 28px;
}

.login-form input {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 14px;
  font-size: 18px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.login-form button {
  min-height: 54px;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-size: 18px;
  font-weight: 850;
  box-shadow: 0 16px 34px rgba(15, 123, 92, 0.22);
}

.login-form button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.login-error {
  min-height: 20px;
  margin-top: 12px;
  color: var(--red);
  font-size: 14px;
}

@media (max-width: 520px) {
  .app-shell {
    padding: 10px 10px 116px;
    gap: 10px;
  }

  .mode-button {
    min-height: 56px;
    padding: 9px;
  }

  .main-action {
    width: 70px;
    height: 70px;
    min-height: 70px;
    flex-basis: 70px;
  }

  .provider-row {
    gap: 8px;
  }

  .provider-option,
  .provider-toggle strong {
    font-size: 15px;
  }

  .provider-row .quiet-button {
    display: none;
  }
}
