:root {
  color-scheme: light;
  --bg: #ecebe7;
  --panel: rgba(255, 255, 252, 0.92);
  --panel-strong: #ffffff;
  --text: #1b1b18;
  --muted: #66645e;
  --line: rgba(27, 27, 24, 0.11);
  --primary: #126d62;
  --primary-strong: #06433d;
  --accent: #e0612f;
  --source-bg: #f7faf5;
  --english-bg: #fffdf8;
  --warning: #8d4f00;
  --shadow: 0 18px 42px rgba(28, 28, 24, 0.1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07110f;
  --panel: rgba(14, 22, 20, 0.92);
  --panel-strong: #14211e;
  --text: #f3efe4;
  --muted: #b8b1a4;
  --line: rgba(245, 238, 225, 0.14);
  --primary: #66d7c5;
  --primary-strong: #a8f4e8;
  --accent: #ff9868;
  --source-bg: #141917;
  --english-bg: #101a17;
  --warning: #ffc46f;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Aptos", "Segoe UI Variable", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(224, 97, 47, 0.14), transparent 28%),
    radial-gradient(circle at 92% 0%, rgba(18, 109, 98, 0.12), transparent 30%),
    var(--bg);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 152, 104, 0.13), transparent 28%),
    radial-gradient(circle at 92% 0%, rgba(102, 215, 197, 0.12), transparent 32%),
    linear-gradient(180deg, #07110f 0%, #0b1413 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 9px 12px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 120ms ease,
    opacity 120ms ease,
    background 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #14887b);
}

.secondary {
  color: var(--text);
  background: rgba(27, 27, 24, 0.07);
}

html[data-theme="dark"] .secondary {
  background: rgba(245, 238, 225, 0.1);
}

.translator-shell {
  width: min(1440px, calc(100% - 20px));
  min-height: 100%;
  margin: 0 auto;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topbar,
.status-strip,
.translation-column {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .status-strip,
html[data-theme="dark"] .translation-column {
  border-color: rgba(245, 238, 225, 0.1);
}

.topbar {
  position: relative;
  z-index: 60;
  min-height: 58px;
  padding: 8px 10px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.brand-cluster {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  min-width: 0;
}

.brand {
  flex: 0 0 auto;
  color: var(--text);
  text-decoration: none;
}

.brand-name {
  display: block;
  font-size: 0.98rem;
  font-weight: 950;
  letter-spacing: -0.03em;
}

.language-split {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.language-menu {
  position: relative;
  flex: 0 0 auto;
}

.language-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  min-width: 36px;
  gap: 4px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--primary-strong);
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.76rem;
  font-weight: 950;
  cursor: pointer;
  user-select: none;
}

.language-menu summary::-webkit-details-marker {
  display: none;
}

html[data-theme="dark"] .language-menu summary {
  background: rgba(245, 238, 225, 0.08);
}

.language-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 80;
  width: min(248px, calc(100vw - 28px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.target-language-menu .language-menu-panel {
  right: auto;
  left: 0;
}

.toolbar {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.button-row,
.top-links {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

#start-button::after {
  content: "";
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-left: 7px;
  border-radius: 999px;
  background: #d51f1f;
  box-shadow: 0 0 0 3px rgba(213, 31, 31, 0.14);
  vertical-align: middle;
}

.language-pair {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(27, 27, 24, 0.06);
}

html[data-theme="dark"] .language-pair {
  background: rgba(245, 238, 225, 0.07);
  border-color: rgba(245, 238, 225, 0.1);
}

.language-control {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.language-arrow {
  color: var(--primary-strong);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.select-field,
.text-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.75);
  outline: none;
}

html[data-theme="dark"] .select-field,
html[data-theme="dark"] .text-field {
  background: rgba(4, 11, 10, 0.74);
}

.select-field {
  field-sizing: content;
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 8px 30px 8px 10px;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: normal;
  text-transform: none;
}

.text-field {
  padding: 10px 12px;
}

.select-field:focus,
.text-field:focus {
  border-color: rgba(18, 109, 98, 0.4);
  box-shadow: 0 0 0 3px rgba(18, 109, 98, 0.12);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--primary-strong);
  background: rgba(18, 109, 98, 0.12);
  font-size: 0.75rem;
  font-weight: 850;
}

.pill.subtle {
  color: var(--muted);
  background: rgba(27, 27, 24, 0.06);
}

html[data-theme="dark"] .pill {
  background: rgba(102, 215, 197, 0.14);
}

html[data-theme="dark"] .pill.subtle {
  background: rgba(245, 238, 225, 0.08);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 850;
  text-decoration: none;
}

.theme-toggle {
  min-width: 58px;
}

#demo-button {
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
}

html[data-theme="dark"] .nav-link {
  background: rgba(245, 238, 225, 0.09);
}

.backend-drawer {
  position: relative;
  flex: 0 0 auto;
  border-radius: 16px;
  overflow: visible;
}

.backend-drawer[open] summary {
  border-color: rgba(224, 97, 47, 0.62);
  box-shadow: 0 0 0 3px rgba(224, 97, 47, 0.12);
}

.backend-drawer summary {
  min-height: 30px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--primary-strong);
  background: rgba(18, 109, 98, 0.12);
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}

.backend-drawer summary::-webkit-details-marker {
  display: none;
}

html[data-theme="dark"] .backend-drawer summary {
  background: rgba(102, 215, 197, 0.14);
}

.backend-summary-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  vertical-align: middle;
}

.backend-detail-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.38);
}

html[data-theme="dark"] .backend-detail-strip {
  background: rgba(245, 238, 225, 0.06);
}

.backend-summary-status {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--muted);
  background: rgba(27, 27, 24, 0.06);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: normal;
}

.backend-summary-status.online {
  color: var(--primary-strong);
  background: rgba(18, 109, 98, 0.12);
}

html[data-theme="dark"] .backend-summary-status {
  background: rgba(245, 238, 225, 0.08);
}

html[data-theme="dark"] .backend-summary-status.online {
  background: rgba(102, 215, 197, 0.14);
}

.backend-content {
  flex: 1 0 100%;
  order: 4;
  width: 100%;
  max-height: min(68vh, 720px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  display: grid;
  gap: 10px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.backend-panel-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 4px;
}

.backend-panel-head strong {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
}

.field-label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.endpoint-preview {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
  font-size: 0.8rem;
  line-height: 1.4;
  word-break: break-word;
}

html[data-theme="dark"] .endpoint-preview {
  background: rgba(4, 11, 10, 0.52);
}

.backend-connect-card,
.auth-card,
.admin-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.48);
}

.backend-connect-card {
  grid-template-columns: minmax(220px, 0.75fr) minmax(240px, 1fr) auto;
  align-items: center;
  border-color: rgba(18, 109, 98, 0.24);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(220, 244, 236, 0.62));
}

html[data-theme="dark"] .backend-connect-card,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .admin-panel {
  background: rgba(9, 18, 16, 0.68);
}

html[data-theme="dark"] .backend-connect-card {
  border-color: rgba(102, 215, 197, 0.24);
  background: linear-gradient(135deg, rgba(14, 28, 25, 0.92), rgba(20, 50, 44, 0.62));
}

.setup-step {
  position: relative;
}

.step-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.step-heading strong {
  display: block;
  margin-top: 2px;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
}

.step-number {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--primary);
  color: #fffaf0;
  font-size: 0.95rem;
  font-weight: 950;
  box-shadow: 0 10px 20px rgba(18, 109, 98, 0.18);
}

.step-copy {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.connection-field {
  display: grid;
  gap: 8px;
}

.connection-actions {
  justify-content: flex-end;
}

.auth-card {
  grid-template-columns: minmax(220px, 0.75fr) minmax(220px, 1fr) auto minmax(180px, 0.7fr);
  align-items: center;
}

.admin-panel-head,
.admin-user-row,
.admin-user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-panel-head {
  justify-content: space-between;
}

.admin-users {
  display: grid;
  gap: 8px;
}

.admin-section {
  display: grid;
  gap: 7px;
}

.admin-section-title {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-session-summary {
  padding: 8px 10px;
  border: 1px solid rgba(18, 109, 98, 0.22);
  border-radius: 12px;
  background: rgba(235, 249, 243, 0.72);
  color: var(--primary-strong);
  font-size: 0.8rem;
  font-weight: 800;
}

html[data-theme="dark"] .admin-session-summary {
  background: rgba(102, 215, 197, 0.12);
}

.admin-user-row {
  justify-content: space-between;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.54);
}

html[data-theme="dark"] .admin-user-row {
  background: rgba(245, 238, 225, 0.06);
}

.admin-user-meta {
  display: grid;
  gap: 2px;
  min-width: min(100%, 250px);
}

.admin-user-email {
  font-weight: 900;
}

.admin-user-detail {
  color: var(--muted);
  font-size: 0.78rem;
}

.compact-button {
  padding: 7px 10px;
  font-size: 0.76rem;
}

.status-strip {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.status-strip span {
  min-width: 0;
}

#status-text {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#latency-text,
#audio-text {
  flex: 0 0 auto;
  white-space: nowrap;
}

.translation-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.translation-column {
  min-height: 0;
  padding: 10px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
}

.column-toolbar {
  min-height: 46px;
  padding: 2px 2px 9px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.column-toolbar h1 {
  margin: 2px 0 0;
  font-size: clamp(1rem, 1.5vw, 1.28rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.transcript-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.block-label {
  color: var(--primary);
  font-size: 0.66rem;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.compact-button {
  padding: 7px 10px;
  border-radius: 11px;
  font-size: 0.8rem;
}

.transcript-body {
  flex: 1;
  min-height: 360px;
  margin-top: 10px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--english-bg);
  user-select: text;
  scroll-behavior: smooth;
}

.source-box .transcript-body {
  background: var(--source-bg);
}

.conversation-box {
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.source-box,
.english-box {
  display: none;
}

.conversation-body {
  background: #fffdf6;
}

html[data-theme="dark"] .conversation-body {
  background: #0d1613;
}

.conversation-pair {
  display: grid;
  gap: 3px;
  margin-bottom: 5px;
  padding: 4px;
  border: 1px solid rgba(27, 27, 24, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
}

html[data-theme="dark"] .conversation-pair {
  border-color: rgba(245, 238, 225, 0.1);
  background: rgba(245, 238, 225, 0.05);
}

.conversation-pair.latest {
  border-left: 4px solid var(--accent);
  box-shadow: 0 8px 18px rgba(28, 28, 24, 0.07);
}

.conversation-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 6px;
  margin: 0;
  padding: 6px 8px;
  border-radius: 9px;
  line-height: 1.36;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.conversation-line.source {
  background: #efefec;
}

.conversation-line.target {
  background: #eef8e8;
}

html[data-theme="dark"] .conversation-line.source {
  background: #18201d;
}

html[data-theme="dark"] .conversation-line.target {
  background: #13241e;
}

.conversation-language {
  min-width: 26px;
  min-height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(27, 27, 24, 0.08);
  font-size: 0.6rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

html[data-theme="dark"] .conversation-language {
  background: rgba(245, 238, 225, 0.08);
  border-color: rgba(245, 238, 225, 0.11);
}

.conversation-text {
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 720;
}

.transcript-line,
.empty-copy {
  margin: 0 0 7px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.54;
}

.transcript-line {
  padding: 6px 8px;
  border-radius: 10px;
  color: var(--text);
  font-size: 0.94rem;
}

.source-box .transcript-line {
  font-weight: 720;
}

.transcript-line.latest {
  border-left: 4px solid var(--accent);
  background: rgba(224, 97, 47, 0.13);
  box-shadow: 0 8px 18px rgba(28, 28, 24, 0.07);
}

html[data-theme="dark"] .transcript-line.latest {
  background: rgba(255, 152, 104, 0.14);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

.empty-copy {
  color: var(--muted);
  font-style: italic;
}

.content-shell {
  width: min(980px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.content-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.about-hero,
.info-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .about-hero,
html[data-theme="dark"] .info-card {
  border-color: rgba(245, 238, 225, 0.1);
}

.about-hero {
  padding: 24px;
}

.about-hero h1 {
  margin: 8px 0;
  font-size: clamp(2rem, 5vw, 3.6rem);
  letter-spacing: -0.05em;
}

.about-hero p,
.info-card p,
.info-card li {
  color: var(--muted);
  line-height: 1.62;
}

.info-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.info-card {
  padding: 20px;
}

.info-card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.info-card ul,
.info-card ol {
  margin: 10px 0 0;
  padding-left: 20px;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-cluster {
    width: 100%;
  }

  .toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .translation-workspace,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .backend-content {
    grid-template-columns: 1fr;
  }

  .auth-card {
    grid-template-columns: 1fr;
  }

  .backend-connect-card {
    grid-template-columns: 1fr;
  }

  .connection-actions {
    justify-content: flex-start;
  }

  .transcript-body {
    min-height: 300px;
  }
}

@media (max-width: 620px) {
  .translator-shell {
    width: min(100% - 12px, 1440px);
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
    padding: 6px 0;
    gap: 6px;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    min-height: 0;
    padding: 7px;
    gap: 8px;
    border-radius: 15px;
  }

  .brand-cluster {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .brand-name {
    font-size: 0.94rem;
  }

  .toolbar,
  .button-row {
    width: 100%;
  }

  .toolbar {
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 6px;
  }

  .top-links {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    justify-self: end;
    align-self: start;
    gap: 4px;
  }

  .button-row,
  .top-links {
    gap: 5px;
  }

  .language-menu {
    min-width: 0;
  }

  .language-menu summary {
    min-height: 28px;
    padding: 4px 7px;
    font-size: 0.7rem;
  }

  .language-menu-panel {
    top: calc(100% + 6px);
    width: min(220px, calc(100vw - 24px));
    padding: 8px;
  }

  .language-pair {
    gap: 6px;
    padding: 6px;
    border-radius: 12px;
  }

  .language-control {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 6px;
    font-size: 0.64rem;
  }

  .language-arrow {
    font-size: 0.76rem;
  }

  .select-field {
    min-width: 0;
    max-width: none;
    padding: 7px 26px 7px 9px;
    border-radius: 10px;
    font-size: 0.82rem;
  }

  .text-field {
    padding: 8px 10px;
    border-radius: 10px;
  }

  button {
    padding: 7px 9px;
    border-radius: 10px;
    font-size: 0.8rem;
  }

  .button-row button,
  .nav-link,
  .pill {
    flex: 0 0 auto;
    justify-content: center;
    white-space: nowrap;
  }

  .compact-button {
    padding: 6px 8px;
    border-radius: 9px;
    font-size: 0.72rem;
  }

  .pill {
    min-height: 26px;
    padding: 5px 8px;
    font-size: 0.68rem;
  }

  .nav-link {
    min-height: 27px;
    padding: 5px 9px;
    font-size: 0.72rem;
  }

  #demo-button {
    min-height: 27px;
    padding: 5px 9px;
    font-size: 0.72rem;
  }

  .backend-drawer {
    border-radius: 13px;
  }

  .backend-drawer[open] {
    position: relative;
    inset: auto;
    z-index: auto;
    max-height: none;
    display: block;
    overflow: visible;
  }

  .button-row .backend-drawer {
    flex: 0 0 auto;
  }

  .backend-drawer summary {
    padding: 6px 9px;
    font-size: 0.76rem;
  }

  .backend-drawer[open] summary {
    background: rgba(18, 109, 98, 0.12);
  }

  .backend-summary-line {
    gap: 6px;
    width: calc(100% - 14px);
  }

  .backend-summary-status {
    max-width: 60%;
    padding: 4px 7px;
    font-size: 0.66rem;
  }

  .backend-content {
    position: fixed;
    inset: max(6px, env(safe-area-inset-top)) 6px max(6px, env(safe-area-inset-bottom));
    z-index: 120;
    width: auto;
    height: calc(100vh - 12px);
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 8px 8px max(14px, env(safe-area-inset-bottom));
    gap: 6px;
    align-content: start;
    border-radius: 15px;
  }

  .backend-connect-card,
  .auth-card,
  .admin-panel {
    gap: 5px;
    padding: 6px;
    border-radius: 10px;
  }

  .backend-connect-card {
    scroll-margin-bottom: 18px;
  }

  .connection-actions {
    position: sticky;
    bottom: 0;
    z-index: 1;
    padding-top: 3px;
    background: linear-gradient(180deg, transparent, var(--panel) 34%);
  }

  .step-heading {
    gap: 6px;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .step-heading strong {
    font-size: 0.84rem;
  }

  .step-number {
    width: 23px;
    height: 23px;
    font-size: 0.72rem;
    box-shadow: none;
  }

  .step-copy {
    display: none;
  }

  .field-label {
    gap: 3px;
    font-size: 0.6rem;
    letter-spacing: 0.08em;
  }

  .connection-field {
    gap: 5px;
  }

  .backend-content .button-row.compact {
    gap: 5px;
  }

  .backend-panel-head {
    padding: 0 1px 3px;
  }

  .backend-panel-head strong {
    font-size: 0.86rem;
  }

  .step-copy,
  .endpoint-preview,
  .admin-session-summary,
  .admin-user-detail {
    font-size: 0.67rem;
  }

  .endpoint-preview,
  .admin-session-summary {
    padding: 5px 6px;
    border-radius: 9px;
    line-height: 1.25;
  }

  .admin-panel-head,
  .admin-user-row,
  .admin-user-actions {
    gap: 5px;
  }

  .admin-panel-head strong {
    font-size: 0.84rem;
  }

  .admin-section {
    gap: 4px;
  }

  .admin-section-title {
    font-size: 0.6rem;
    letter-spacing: 0.08em;
  }

  .admin-users {
    gap: 5px;
  }

  .admin-user-row {
    padding: 5px;
    border-radius: 9px;
  }

  .admin-user-email {
    font-size: 0.78rem;
  }

  .admin-user-actions .compact-button {
    padding: 5px 6px;
    font-size: 0.66rem;
  }

  .status-strip {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    min-height: 0;
    padding: 6px 9px;
    border-radius: 12px;
    font-size: 0.76rem;
  }

  .translation-workspace {
    flex: 1 1 auto;
    gap: 8px;
    min-height: 0;
    overflow: hidden;
  }

  .conversation-box {
    display: flex;
    min-height: 0;
    overflow: hidden;
  }

  .source-box,
  .english-box {
    display: none;
  }

  .translation-column {
    min-height: 0;
    padding: 8px;
    border-radius: 16px;
  }

  .translation-workspace .source-box,
  .translation-workspace .english-box {
    display: none;
  }

  .column-toolbar {
    min-height: 36px;
    padding: 0 0 6px;
    align-items: center;
    gap: 8px;
  }

  .column-toolbar h1 {
    font-size: 0.96rem;
  }

  .block-label {
    font-size: 0.58rem;
    letter-spacing: 0.1em;
  }

  .transcript-body {
    min-height: 0;
    margin-top: 8px;
    padding: 8px;
    border-radius: 12px;
  }

  .conversation-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .transcript-line,
  .empty-copy {
    margin-bottom: 5px;
    line-height: 1.45;
  }

  .transcript-line {
    padding: 5px 7px;
    font-size: 0.88rem;
  }

  .conversation-pair {
    gap: 2px;
    margin-bottom: 4px;
    padding: 3px;
    border-radius: 10px;
  }

  .conversation-line {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 5px;
    padding: 5px 6px;
    border-radius: 8px;
    line-height: 1.34;
  }

  .conversation-language {
    min-width: 22px;
    min-height: 18px;
    margin-top: 1px;
    font-size: 0.56rem;
  }

  .conversation-text {
    font-size: 0.9rem;
  }
}

@media (max-width: 380px) {
  .language-control {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .language-pair {
    gap: 3px;
  }

  button {
    padding: 6px 7px;
    font-size: 0.74rem;
  }
}
