:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #192124;
  --muted: #647174;
  --line: #d8e0e3;
  --accent: #256a5f;
  --accent-text: #ffffff;
  --danger: #9c2f2f;
  --topbar-control-height: 46px;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app-shell {
  height: 100vh;
  padding: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: filter 160ms ease, opacity 160ms ease;
}

.app-shell.is-locked {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.listen-stack {
  display: grid;
  min-width: 0;
}

.listen-control {
  position: relative;
  height: var(--topbar-control-height);
  display: grid;
  grid-template-columns: 188px 0 0;
  align-items: center;
  border-radius: 8px;
  background: var(--accent);
  overflow: visible;
}

.listen-control.is-listening {
  grid-template-columns: 148px 28px 34px;
  background: var(--danger);
}

.listen-main-button {
  width: 100%;
  min-width: 0;
  border-radius: 8px;
}

.listen-control.is-listening .listen-main-button {
  border-radius: 8px 0 0 8px;
  background: transparent;
}

.inline-mic-meter {
  width: 0;
  height: 100%;
  display: grid;
  justify-items: center;
  align-items: center;
  overflow: hidden;
  opacity: 0;
}

.listen-control.is-listening .inline-mic-meter {
  width: 28px;
  opacity: 1;
}

#meterFill {
  --meter-level: 0;
  --meter-opacity: 0.35;
  width: 7px;
  height: 24px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.24);
  overflow: hidden;
}

#meterFill .voice-bar {
  width: 100%;
  height: 100%;
  display: block;
  min-height: 0;
  border-radius: inherit;
  background: #fff;
  opacity: var(--meter-opacity);
  transform: scaleY(var(--meter-level));
  transform-origin: center bottom;
  transition: transform 70ms linear, opacity 70ms linear;
}

.mic-menu-button {
  width: 0;
  height: var(--topbar-control-height);
  min-height: var(--topbar-control-height);
  border: 0;
  border-radius: 0 8px 8px 0;
  padding: 0;
  background: transparent;
  color: var(--accent-text);
  cursor: pointer;
  font-size: 18px;
  font-weight: 850;
  line-height: 1;
  overflow: hidden;
}

.listen-control.is-listening .mic-menu-button {
  width: 34px;
}

.mic-menu-button[hidden] {
  display: block;
  visibility: hidden;
}

.mic-menu {
  position: absolute;
  z-index: 12;
  top: calc(100% + 8px);
  right: 0;
  width: min(300px, calc(100vw - 32px));
  max-height: min(320px, 60vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: var(--panel);
  box-shadow: 0 18px 45px rgb(20 35 40 / 0.16);
}

.mic-menu[hidden] {
  display: none;
}

.mic-menu-option {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 9px 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.mic-menu-option:hover,
.mic-menu-option[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent), transparent 88%);
}

.language-menu-button {
  height: var(--topbar-control-height);
  width: var(--topbar-control-height);
  border: 1px solid color-mix(in srgb, var(--line), var(--text) 10%);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 1px;
  padding: 0 6px;
  background: color-mix(in srgb, var(--panel), var(--bg) 32%);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 850;
  line-height: 1;
}

.language-menu-caret {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: 0;
  font-weight: 850;
}

h1 span {
  font-weight: 400;
}

.topbar p,
.panel-title span,
.placeholder {
  color: var(--muted);
}

.status-pill {
  display: none;
}

.status-pill.live {
  color: var(--accent);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgb(20 35 40 / 0.07);
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 650;
}

input[type="password"],
input[type="email"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px 13px;
  background: #fbfcfc;
}

.language-grid {
  position: relative;
  width: var(--topbar-control-height);
}

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

.language-popover {
  position: absolute;
  z-index: 10;
  top: calc(100% + 8px);
  left: 0;
  width: min(360px, calc(100vw - 40px));
  max-height: min(470px, 70vh);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 45px rgb(20 35 40 / 0.18);
  padding: 10px;
  transform: translateX(var(--language-popover-shift, 0));
}

.language-search {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  margin-bottom: 8px;
  outline: none;
}

.language-search:focus {
  border-color: color-mix(in srgb, var(--accent), white 30%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 85%);
}

.language-option-list {
  max-height: 360px;
  overflow-y: auto;
  display: grid;
  gap: 4px;
}

.language-option {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-weight: 750;
}

.language-option:hover,
.language-option:focus-visible {
  background: #eef5f3;
  outline: none;
}

.language-option.is-selected {
  background: color-mix(in srgb, var(--accent), white 88%);
  color: var(--accent);
}

.language-option.is-selected small {
  color: var(--accent);
}

.language-option:disabled {
  opacity: 0.45;
  cursor: default;
}

.language-option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.language-empty-state {
  color: var(--muted);
  padding: 14px 10px;
  font-weight: 650;
}

.primary-button {
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  height: var(--topbar-control-height);
  min-height: var(--topbar-control-height);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 800;
  min-width: 0;
}

.danger-button {
  background: var(--danger);
}

.session-qr-button {
  width: var(--topbar-control-height);
  height: var(--topbar-control-height);
  min-height: var(--topbar-control-height);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 5px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.session-refresh-button {
  border: 0;
  padding: 0 2px;
  background: transparent;
  color: #4c565a;
  cursor: pointer;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  min-width: 20px;
  min-height: var(--topbar-control-height);
}

.session-refresh-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.session-qr-button[hidden],
.session-refresh-button[hidden] {
  display: none;
}

.session-qr-button img {
  width: 34px;
  height: 34px;
  display: block;
}

.live-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  flex: 1;
  min-height: 0;
}

.app-footer {
  display: flex;
  justify-content: flex-end;
  flex: 0 0 auto;
  padding-top: 10px;
}

.app-footer img {
  width: min(104px, 24vw);
  height: auto;
  display: block;
  opacity: 0.74;
}

.panel {
  min-height: 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.translation-title-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.display-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toggle-control {
  display: inline-flex !important;
  grid-auto-flow: column;
  align-items: center;
  gap: 7px !important;
  min-height: 34px;
}

.toggle-control input {
  accent-color: var(--accent);
}

.segmented-control {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfcfc;
}

.segmented-control button {
  width: 38px;
  height: 36px;
  border: 0;
  border-right: 1px solid var(--line);
  appearance: none;
  display: grid;
  place-items: center;
  padding: 0 2px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.segmented-control button:last-child {
  border-right: 0;
}

.segmented-control button.is-active {
  background: var(--accent);
  color: var(--accent-text);
}

.segmented-control button:disabled {
  opacity: 0.4;
  cursor: default;
}

.font-style-control button,
.text-size-control button {
  font-weight: 800;
}

.font-style-control button {
  width: 46px;
  color: var(--text);
  padding: 0;
}

.font-style-control button.is-active {
  color: var(--accent-text);
}

.font-preview-icon {
  width: 23px;
  height: 23px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: square;
  stroke-linejoin: round;
}

.font-style-rounded .font-preview-icon {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.font-style-light .font-preview-icon {
  stroke-width: 2;
}

.text-size-control button {
  font-size: 20px;
}

.translation-card .caption-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  scroll-behavior: auto;
  min-height: 0;
  padding-right: 4px;
}

.translation-card .caption-stack > :first-child {
  margin-top: auto;
}

.translation-card p {
  font-size: clamp(21px, calc(var(--card-font-scale, 1) * 3vw), 44px);
  line-height: 1.12;
  font-weight: 720;
  hyphens: none;
  overflow-wrap: normal;
  text-wrap: pretty;
  word-break: normal;
}

.translation-grid[data-font-style="rounded"] .translation-card p {
  font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Trebuchet MS", ui-sans-serif, system-ui, sans-serif;
  font-weight: 760;
}

.translation-grid[data-font-style="light"] .translation-card p {
  font-weight: 520;
}

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

.translation-target-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  min-height: 0;
}

.translation-target-grid.target-count-2,
.translation-target-grid.target-count-3,
.translation-target-grid.target-count-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.translation-target-grid.target-count-3,
.translation-target-grid.target-count-4 {
  grid-auto-rows: minmax(0, 1fr);
}

.translation-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  min-height: 0;
  flex-direction: column;
  background: var(--panel);
}

.source-card {
  background: #f9fbfb;
}

.source-card p {
  font-size: clamp(17px, calc(var(--card-font-scale, 1) * 2vw), 32px);
  color: var(--muted);
}

.translation-grid[data-contrast="warm"] .translation-card {
  background: #fff8ef;
}

.translation-grid[data-contrast="light"] .translation-card {
  background: #fbfcfc;
}

.translation-grid[data-contrast="warm"] .source-card,
.translation-grid[data-contrast="light"] .source-card {
  background: color-mix(in srgb, var(--panel), var(--bg) 55%);
}

.translation-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.translation-card header h3 {
  margin: 0;
}

.pane-subtitle {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.translation-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.translation-card-pop,
.translation-card-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0;
  background: color-mix(in srgb, var(--bg), var(--panel) 42%);
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.translation-card-pop:hover,
.translation-card-pop:focus-visible {
  color: var(--accent);
  outline: none;
}

.translation-card-close:hover,
.translation-card-close:focus-visible {
  color: var(--danger);
  outline: none;
}

.translation-card-close:disabled {
  opacity: 0.35;
  cursor: default;
}

.pop-button {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  width: 38px;
  height: 38px;
  padding: 0;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.pop-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.caption-line {
  animation: caption-rise 160ms linear;
}

@keyframes caption-rise {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.display-body {
  --display-bg: #090909;
  --display-text: #fff6df;
  --display-muted: #b5aaa0;
  background: var(--display-bg);
  color: var(--display-text);
  overflow: hidden;
}

.display-body[data-contrast="warm"] {
  --display-bg: #1c1310;
  --display-text: #fff1d6;
  --display-muted: #cbbba4;
}

.display-body[data-contrast="light"] {
  --display-bg: #f8f7f2;
  --display-text: #101414;
  --display-muted: #546061;
}

.display-fullscreen-button {
  position: fixed;
  z-index: 20;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border: 1px solid color-mix(in srgb, var(--display-muted), transparent 45%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--display-bg), transparent 18%);
  color: var(--display-text);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  opacity: 0.42;
  transition: opacity 140ms ease, background 140ms ease;
}

.display-fullscreen-button:hover,
.display-fullscreen-button:focus-visible,
.display-fullscreen-button.is-fullscreen {
  opacity: 1;
  outline: none;
}

.projector-root {
  height: 100vh;
  padding: min(5vw, 72px);
}

.projector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: min(3vw, 44px);
}

.projector-with-source {
  grid-template-columns: minmax(240px, 0.42fr) minmax(0, 1fr);
}

.projector-target-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: min(3vw, 44px);
  min-height: 0;
}

.projector-with-source.target-count-2 .projector-target-grid,
.projector-with-source.target-count-3 .projector-target-grid,
.projector-with-source.target-count-4 .projector-target-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.projector-with-source.target-count-3 .projector-target-grid,
.projector-with-source.target-count-4 .projector-target-grid {
  grid-auto-rows: minmax(0, 1fr);
}

.projector-root:not(.projector-grid) .projector-column,
.projector-root > .placeholder {
  height: 100%;
}

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

.projector-column h2 {
  margin: 0 0 min(2vw, 24px);
  color: var(--display-muted);
  font-size: clamp(22px, 2.2vw, 42px);
}

.projector-feed {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: min(2.2vw, 22px);
  overflow-y: auto;
  overflow-anchor: none;
  scroll-behavior: auto;
}

.projector-feed > :first-child {
  margin-top: auto;
}

.projector-feed p {
  margin: 0;
  color: var(--display-text);
  font-size: clamp(34px, calc(var(--font-scale, 1) * 7vw), 118px);
  line-height: 1.06;
  font-weight: 800;
  letter-spacing: 0;
}

body[data-font-style="rounded"] .projector-feed p {
  font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Trebuchet MS", ui-sans-serif, system-ui, sans-serif;
  font-weight: 820;
}

body[data-font-style="light"] .projector-feed p {
  font-weight: 560;
}

.source-column .projector-feed p {
  color: var(--display-muted);
  font-size: clamp(24px, calc(var(--font-scale, 1) * 4.3vw), 72px);
  font-weight: 700;
}

body[data-font-style="rounded"] .source-column .projector-feed p {
  font-weight: 760;
}

body[data-font-style="light"] .source-column .projector-feed p {
  font-weight: 500;
}

.projector-feed .placeholder {
  color: var(--display-muted);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(245 247 248 / 0.52);
}

.auth-overlay[hidden] {
  display: none;
}

.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgb(20 35 40 / 0.18);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-brand h2 {
  font-size: 34px;
  line-height: 1;
}

.account-summary {
  position: relative;
  display: flex;
  align-items: center;
}

.account-summary[hidden] {
  display: none;
}

.account-menu-button {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--line), var(--text) 8%);
  border-radius: 999px;
  background: var(--panel);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
}

.account-menu-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-menu-button span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--accent);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 15;
  width: min(280px, calc(100vw - 36px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 42px rgb(20 35 40 / 0.16);
}

.account-menu[hidden] {
  display: none;
}

.account-menu-header {
  display: grid;
  gap: 2px;
  padding: 4px 4px 12px;
  border-bottom: 1px solid var(--line);
}

.account-menu-header strong,
.account-menu-header span,
.account-menu-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-header strong {
  font-size: 14px;
}

.account-menu-header span,
.account-menu-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.account-menu-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.account-menu-signout {
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.provider-buttons {
  display: grid;
  gap: 8px;
}

.auth-tabs button,
.provider-buttons button,
.link-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.provider-buttons button {
  min-height: var(--topbar-control-height);
  display: grid;
  grid-template-columns: 24px 1fr 24px;
  align-items: center;
  justify-items: center;
  width: 100%;
  padding: 0 14px;
}

.provider-logo {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
}

.google-logo {
  color: #4285f4;
  font-family: Arial, sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.apple-logo svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: #111;
}

.auth-tabs button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.link-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
}

.forgot-password-button {
  justify-self: start;
  color: color-mix(in srgb, var(--muted), transparent 12%);
  font-size: 12px;
  font-weight: 650;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.company-logo {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 850;
  letter-spacing: 0;
}

.remember-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 650;
}

.remember-option input {
  accent-color: var(--accent);
}

.auth-status {
  min-height: 20px;
  color: var(--danger);
  font-size: 14px;
}

.qr-popup-body,
.mobile-body {
  background: var(--bg);
}

.qr-popup {
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 28px;
}

.qr-popup h1,
.mobile-header h1 {
  font-size: 34px;
}

.qr-popup img {
  width: min(78vw, 360px);
  aspect-ratio: 1;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-popup p {
  max-width: min(420px, 90vw);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  overflow-wrap: anywhere;
}

.mobile-shell {
  height: var(--mobile-viewport-height, 100svh);
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px max(14px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.mobile-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-header h1 {
  line-height: 1;
  white-space: nowrap;
}

.mobile-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.mobile-original-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}

.mobile-original-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.mobile-header select {
  width: min(48vw, 180px);
  padding: 10px 12px;
  font-weight: 750;
}

.mobile-caption-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-caption-pane {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.mobile-source-pane {
  flex: 0 0 32%;
  background: #f9fbfb;
}

.mobile-translation-pane {
  flex: 1 1 auto;
}

.mobile-caption-panel:not(.show-original) .mobile-translation-pane {
  flex-basis: 100%;
}

.mobile-caption-stack {
  height: 100%;
  display: block;
  overflow-y: auto;
  overflow-anchor: none;
  padding-bottom: 8px;
}

.mobile-caption-stack p {
  margin: 0 0 16px;
  font-size: clamp(28px, 8.5vw, 52px);
  line-height: 1.1;
  font-weight: 800;
}

.mobile-source-stack p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: clamp(18px, 5.4vw, 32px);
  font-weight: 750;
  line-height: 1.14;
}

@media (max-width: 390px) {
  .mobile-header {
    gap: 8px;
  }

  .mobile-header h1 {
    font-size: 28px;
  }

  .mobile-controls {
    gap: 8px;
  }

  .mobile-header select {
    width: min(34vw, 140px);
    padding-inline: 8px;
  }

  .mobile-original-toggle {
    font-size: 13px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px;
  }

  .topbar,
  .live-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .listen-stack {
    min-width: 0;
  }

  .listen-control {
    max-width: 100%;
  }

  .live-grid {
    display: grid;
  }

  .translation-grid,
  .translation-target-grid.target-count-2,
  .translation-target-grid.target-count-3,
  .translation-target-grid.target-count-4 {
    grid-template-columns: 1fr;
  }

  .projector-with-source,
  .projector-with-source.target-count-2 .projector-target-grid,
  .projector-with-source.target-count-3 .projector-target-grid,
  .projector-with-source.target-count-4 .projector-target-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: 330px;
  }

  .primary-button {
    width: 100%;
  }

  .session-qr-button {
    width: var(--topbar-control-height);
    flex: 0 0 var(--topbar-control-height);
  }

  .language-popover {
    left: 0;
    width: min(320px, calc(100vw - 32px));
  }
}
