:root {
  --bg: #1c2336;
  --bg-en: #1e2a3e;
  --bg-pl: #271f2e;
  --accent-en: #7fb8f8;
  --accent-en-dim: rgba(127, 184, 248, 0.16);
  --accent-en-glow: rgba(127, 184, 248, 0.32);
  --accent-pl: #f0879f;
  --accent-pl-dim: rgba(240, 135, 159, 0.16);
  --accent-pl-glow: rgba(240, 135, 159, 0.32);
  --text: #eef1f8;
  --text-secondary: #a8b4cd;
  --text-dim: #6b7a96;
  --surface: #222b3f;
  --surface-hover: #2c3850;
  --surface-raised: #283245;
  --border: rgba(200, 214, 240, 0.18);
  --border-subtle: rgba(200, 214, 240, 0.1);
  --green: #5dd99a;
  --glow-text: 0 0 16px rgba(255, 255, 255, 0.06);
  --glow-border: 0 8px 24px rgba(0, 0, 0, 0.16);
  --glow-border-color: rgba(200, 214, 240, 0.18);
  --mic-size: clamp(78px, 19vw, 92px);
  --mic-lane: calc(var(--mic-size) + 28px);
  --radius: 22px;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body.mode-transitioning .language-section,
body.mode-transitioning .divider,
body.mode-transitioning .quick-text-paste,
body.mode-transitioning .quick-text-bottom-actions {
  opacity: 0;
  transform: translateY(8px) scale(0.992);
}

body .language-section,
body .divider,
body .quick-text-paste,
body .quick-text-bottom-actions {
  transition:
    opacity 0.22s ease,
    transform 0.24s cubic-bezier(0.2, 0.9, 0.2, 1),
    border-color 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease;
}

@media (prefers-reduced-motion: reduce) {
  body.mode-transitioning .language-section,
  body.mode-transitioning .divider,
  body.mode-transitioning .quick-text-paste,
  body.mode-transitioning .quick-text-bottom-actions {
    transform: none;
  }
}

html {
  height: 100%;
  background: #191f30;
  color-scheme: dark;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 100dvh;
  background-color: #191f30;
  background:
    radial-gradient(ellipse at top center, rgba(127, 184, 248, 0.09), transparent 42%),
    radial-gradient(ellipse at bottom right, rgba(240, 135, 159, 0.08), transparent 38%),
    linear-gradient(180deg, #1c2438 0%, #191f2e 100%);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ====== TOP BAR ====== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  position: relative;
  z-index: 90;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(22, 28, 44, 0.96), rgba(22, 28, 44, 0.76));
  border-bottom: 1px solid rgba(200, 214, 240, 0.1);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

/* ====== SESSION NAME BAR ====== */
.conversation-name-bar {
  text-align: center;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  padding: 5px 16px 6px;
  background: rgba(22, 28, 44, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1;
  max-height: 22px;
  transition: opacity 0.4s ease, max-height 0.3s ease, padding 0.3s ease;
  flex-shrink: 0;
}
.conversation-name-bar.hidden {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

.app-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.app-title {
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: lowercase;
  color: #eef1ff;
  text-shadow: var(--glow-text);
}
.app-logo-wrap {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: none;
  border: none;
  box-shadow: none;
}
.app-logo-mini {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter:
    drop-shadow(0 0 5px rgba(180, 220, 255, 0.55))
    drop-shadow(0 0 14px rgba(140, 190, 255, 0.25));
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.top-actions .hidden {
  display: none !important;
}

.account-badge {
  font-size: 11px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  letter-spacing: 0.3px;
}

/* ====== ICON BUTTONS ====== */
.icon-btn {
  width: 42px;
  height: 42px;
  background: rgba(28, 36, 54, 0.86);
  border: 1px solid rgba(200, 214, 240, 0.14);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  border-radius: 16px;
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.2s;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}
.icon-btn:active {
  background: var(--surface-hover);
  color: var(--text);
  border-color: rgba(200, 214, 240, 0.22);
  transform: scale(0.97);
}

#history-toggle {
  color: #d0e6ff;
  border-color: rgba(127, 184, 248, 0.24);
  background:
    radial-gradient(circle at 30% 28%, rgba(127, 184, 248, 0.14), rgba(26, 32, 50, 0.96) 72%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 4px 16px rgba(0, 0, 0, 0.18);
}

#history-toggle svg {
  filter: drop-shadow(0 0 6px rgba(127, 184, 248, 0.22));
}

#history-toggle:active {
  background:
    radial-gradient(circle at 30% 28%, rgba(127, 184, 248, 0.2), rgba(32, 42, 64, 0.98) 72%);
  border-color: rgba(127, 184, 248, 0.36);
}

.live-caption-btn {
  position: relative;
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  flex: 0 0 42px;
  padding: 0;
  gap: 0;
  overflow: hidden;
  color: #d7fff0;
  border-color: rgba(93, 217, 154, 0.48);
  background: rgba(26, 32, 50, 0.82);
  box-shadow:
    inset 0 0 0 1px rgba(93, 217, 154, 0.05),
    0 0 0 rgba(93, 217, 154, 0);
  transition:
    color 0.24s ease,
    background 0.32s ease,
    border-color 0.24s ease,
    box-shadow 0.32s ease,
    width 0.28s cubic-bezier(0.2, 0.9, 0.2, 1),
    min-width 0.28s cubic-bezier(0.2, 0.9, 0.2, 1),
    max-width 0.28s cubic-bezier(0.2, 0.9, 0.2, 1),
    flex-basis 0.28s cubic-bezier(0.2, 0.9, 0.2, 1),
    padding 0.28s cubic-bezier(0.2, 0.9, 0.2, 1),
    gap 0.28s cubic-bezier(0.2, 0.9, 0.2, 1),
    transform 0.2s ease;
}

.live-caption-btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 15px;
  background:
    radial-gradient(circle at 28% 24%, rgba(93, 217, 154, 0.22), rgba(24, 42, 40, 0.14) 76%);
  opacity: 0;
  transition: opacity 0.48s ease;
  pointer-events: none;
}

.live-caption-btn::after {
  content: "";
  position: absolute;
  top: -42%;
  bottom: -42%;
  left: -72%;
  width: 46%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.5) 48%, transparent 100%);
  opacity: 0;
  transform: skewX(-16deg);
  pointer-events: none;
}

.live-caption-btn svg,
.live-listen-btn svg {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
}

.live-caption-label {
  display: inline-block;
  width: 0;
  min-width: 0;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1;
  position: relative;
  z-index: 1;
  transition:
    width 0.24s cubic-bezier(0.2, 0.9, 0.2, 1),
    min-width 0.24s cubic-bezier(0.2, 0.9, 0.2, 1),
    max-width 0.24s cubic-bezier(0.2, 0.9, 0.2, 1),
    opacity 0.18s ease;
}

.live-caption-btn.active,
.live-caption-btn.loading {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  flex-basis: 42px;
  padding: 0;
  gap: 0;
}

.live-caption-btn.active .live-caption-label,
.live-caption-btn.loading .live-caption-label {
  width: 0;
  min-width: 0;
  max-width: 0;
  opacity: 0;
}

.live-listen-btn.active {
  color: #ffffff;
  border-color: rgba(93, 217, 154, 0.7);
  background:
    radial-gradient(circle at 28% 24%, rgba(93, 217, 154, 0.32), rgba(24, 42, 40, 0.98) 74%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 22px rgba(93, 217, 154, 0.18);
}

.live-caption-btn.active {
  color: #ffffff;
  border-color: rgba(93, 217, 154, 0.72);
  background: rgba(24, 42, 40, 0.94);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 22px rgba(93, 217, 154, 0.18);
  animation: liveButtonPulse 1.8s ease-in-out infinite;
}

.live-caption-btn.active::before {
  opacity: 1;
}

.live-caption-btn.loading {
  color: #f2fff9;
  border-color: rgba(93, 217, 154, 0.66);
}

.live-caption-btn.loading::after {
  opacity: 0.72;
  animation: liveButtonSweep 1.05s cubic-bezier(0.36, 0, 0.24, 1) infinite;
}

@keyframes liveButtonSweep {
  from {
    left: -72%;
  }
  to {
    left: 126%;
  }
}

@keyframes liveButtonPulse {
  0%, 100% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.04),
      0 0 14px rgba(93, 217, 154, 0.12);
  }
  50% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.06),
      0 0 28px rgba(93, 217, 154, 0.32);
  }
}

.live-listen-btn {
  width: 0;
  min-width: 0;
  flex: 0 0 0;
  aspect-ratio: 1;
  padding: 0;
  gap: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateX(-10px) scale(0.92);
  margin-left: -8px;
  border-width: 0;
  color: #ffffff;
  border-color: rgba(93, 217, 154, 0.7);
  background:
    radial-gradient(circle at 28% 24%, rgba(93, 217, 154, 0.32), rgba(24, 42, 40, 0.98) 74%);
  transition:
    width 0.28s cubic-bezier(0.2, 0.9, 0.2, 1),
    min-width 0.28s cubic-bezier(0.2, 0.9, 0.2, 1),
    margin-left 0.28s cubic-bezier(0.2, 0.9, 0.2, 1),
    opacity 0.2s ease,
    transform 0.28s cubic-bezier(0.2, 0.9, 0.2, 1),
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.live-listen-btn.revealed {
  width: 42px;
  min-width: 42px;
  flex-basis: 42px;
  margin-left: 0;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1);
  border-width: 1px;
}

.live-listen-btn:not(.active) {
  color: #ffd6df;
  border-color: rgba(240, 135, 159, 0.66);
  background:
    radial-gradient(circle at 28% 24%, rgba(240, 135, 159, 0.28), rgba(47, 22, 37, 0.98) 74%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 22px rgba(240, 135, 159, 0.14);
}

.live-listen-btn .listen-icon-off {
  display: none;
}

.live-listen-btn:not(.active) .listen-icon-on {
  display: none;
}

.live-listen-btn:not(.active) .listen-icon-off {
  display: block;
}

/* Settings icon morph to X */
#settings-toggle {
  position: relative;
  transition: transform 0.3s ease;
}
#settings-toggle .settings-icon-open,
#settings-toggle .settings-icon-close {
  transition: opacity 0.25s ease, transform 0.3s ease;
}
#settings-toggle .settings-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg);
}
#settings-toggle.settings-open {
  transform: rotate(90deg);
}
#settings-toggle.settings-open .settings-icon-open {
  opacity: 0;
}
#settings-toggle.settings-open .settings-icon-close {
  opacity: 1;
  transform: rotate(0deg);
}

/* ====== SETTINGS PANEL ====== */
.panel {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 72px);
  left: 0;
  right: 0;
  background: rgba(24, 30, 48, 0.97);
  border-bottom: 1px solid rgba(200, 214, 240, 0.1);
  z-index: 120;
  transform: translateY(0);
  transition: transform 0.3s ease, opacity 0.3s ease;
  padding: 18px 16px 20px;
  max-height: calc(100dvh - (env(safe-area-inset-top, 0px) + 72px));
  overflow-y: auto;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.panel.hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
.panel-content { max-width: 420px; margin: 0 auto; }

.settings-group {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(200, 214, 240, 0.08);
}

.settings-group-title {
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.utility-btn {
  min-height: 66px;
  padding: 10px 12px;
}

.utility-btn-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1.05;
  min-height: 40px;
}

.utility-btn-label span:last-child {
  opacity: 0.82;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  gap: 12px;
}
.setting-row label {
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 72px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 600;
  flex-shrink: 0;
}
.setting-row input {
  flex: 1;
  min-width: 0;
  background: rgba(16, 22, 38, 0.82);
  border: 1px solid rgba(200, 214, 240, 0.14);
  border-radius: 14px;
  color: var(--text);
  padding: 11px 14px;
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  -webkit-user-select: text;
  user-select: text;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.setting-row input:focus {
  border-color: rgba(127, 184, 248, 0.52);
  box-shadow: 0 0 0 3px rgba(127, 184, 248, 0.1);
}
.setting-row input::placeholder {
  color: rgba(168, 180, 205, 0.42);
}

.toggle-btn {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 14px;
  border: 1px solid rgba(200, 214, 240, 0.16);
  background: rgba(16, 22, 38, 0.82);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.settings-select {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(200, 214, 240, 0.16);
  background: rgba(16, 22, 38, 0.82);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
    linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.settings-select:focus {
  border-color: rgba(127, 184, 248, 0.52);
  box-shadow: 0 0 0 3px rgba(127, 184, 248, 0.1);
}
.toggle-btn.active {
  background: rgba(127, 184, 248, 0.14);
  border-color: rgba(127, 184, 248, 0.42);
  color: var(--text);
}

.utility-btn.saved-state {
  background: rgba(93, 217, 154, 0.14);
  border-color: rgba(93, 217, 154, 0.5);
  color: #ecfff4;
  box-shadow:
    0 0 0 1px rgba(93, 217, 154, 0.08),
    0 0 18px rgba(93, 217, 154, 0.12);
}

.utility-btn.saving-state {
  border-color: rgba(127, 184, 248, 0.36);
  background: rgba(127, 184, 248, 0.1);
}

.utility-btn.action-pulse {
  animation: utility-action-pulse 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.utility-btn.saved-flash {
  animation: utility-saved-flash 820ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes utility-action-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(0.97); }
  70% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes utility-saved-flash {
  0% { box-shadow: 0 0 0 rgba(93, 217, 154, 0); }
  38% {
    box-shadow:
      0 0 0 1px rgba(93, 217, 154, 0.14),
      0 0 22px rgba(93, 217, 154, 0.18);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(93, 217, 154, 0.08),
      0 0 18px rgba(93, 217, 154, 0.12);
  }
}

#translation-mode-toggle {
  position: relative;
  overflow: hidden;
  min-width: 178px;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

#translation-mode-toggle.mode-fast {
  background: rgba(106, 171, 255, 0.12);
  border-color: rgba(106, 171, 255, 0.72);
  color: #fff;
  box-shadow:
    0 0 10px rgba(106, 171, 255, 0.3),
    inset 0 0 8px rgba(106, 171, 255, 0.1);
}

#translation-mode-toggle.mode-accurate {
  background: rgba(68, 201, 118, 0.13);
  border-color: rgba(68, 201, 118, 0.72);
  color: #fff;
  box-shadow:
    0 0 10px rgba(68, 201, 118, 0.3),
    inset 0 0 8px rgba(68, 201, 118, 0.12);
}

/* ====== LANGUAGE SECTIONS ====== */
.language-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  position: relative;
  min-height: 0;
  padding: 14px 14px 16px;
  overflow: hidden;
  transition:
    flex 420ms cubic-bezier(0.22, 0.78, 0.2, 1),
    transform 420ms cubic-bezier(0.22, 0.78, 0.2, 1),
    filter 420ms ease;
  will-change: flex, transform;
}

.section-top {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(127, 184, 248, 0.12), transparent 48%),
    linear-gradient(180deg, #1e2b42 0%, #192236 100%);
  border-bottom: 1px solid rgba(200, 214, 240, 0.07);
}
.section-bottom {
  background:
    radial-gradient(ellipse at 80% 100%, rgba(240, 135, 159, 0.11), transparent 48%),
    linear-gradient(180deg, #231828 0%, #1c1422 100%);
}

/* Section header with language + gender */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 30;
  margin-bottom: 12px;
  transition: transform 420ms cubic-bezier(0.22, 0.78, 0.2, 1), opacity 280ms ease;
}

.lang-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.lang-code {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.section-top .lang-code { color: var(--accent-en); }
.section-bottom .lang-code { color: var(--accent-pl); }

.lang-name {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ====== LANGUAGE SELECTOR ====== */
.lang-selector,
.lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 20px;
  position: relative;
  background: rgba(12, 18, 34, 0.32);
  border: 1px solid rgba(200, 214, 240, 0.13);
  min-height: 48px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  width: fit-content;
  max-width: min(48vw, 260px);
  flex: 0 1 auto;
}

.lang-selector {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.lang-selector:active {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(200, 214, 240, 0.2);
  transform: scale(0.99);
}

.lang-chevron {
  opacity: 0.6;
  flex-shrink: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.lang-selector.open .lang-chevron {
  transform: rotate(180deg);
  opacity: 0.9;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: min(320px, 84vw);
  max-height: 0;
  overflow: hidden;
  background: rgba(24, 32, 50, 0.99);
  border-radius: 22px;
  z-index: 500;
  transition: max-height 0.3s ease, opacity 0.2s ease, box-shadow 0.2s;
  opacity: 0;
  pointer-events: none;
  box-shadow: none;
}

.lang-dropdown.open {
  overflow-y: auto;
  opacity: 1;
  pointer-events: auto;
  border: 1px solid rgba(200, 214, 240, 0.14);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.38);
}

.lang-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  cursor: pointer;
  transition: background 0.1s;
  border: none;
  background: none;
  color: var(--text);
  width: 100%;
  font-family: var(--font);
  font-size: 14px;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.lang-dropdown-item:active { background: var(--surface-hover); }
.lang-dropdown-item.selected { background: var(--accent-en-dim); }
.section-bottom .lang-dropdown-item.selected { background: var(--accent-pl-dim); }

.lang-dropdown-item-code {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--text-secondary);
  min-width: 24px;
  text-transform: uppercase;
}

.lang-dropdown-item-name {
  font-weight: 300;
}

.lang-dropdown-item-native {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 300;
}

.lang-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 2px 10px;
}

/* ====== MUTE TOGGLE ====== */
.mute-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(200, 214, 240, 0.18);
  background: rgba(26, 32, 50, 0.94);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  right: auto;
  bottom: auto;
  transform: none;
  z-index: 4;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 8px rgba(127, 184, 248, 0.1);
}
.bottom-controls {
  display: none !important;
}
.mute-toggle-btn:active { background: var(--surface-hover); }
.mute-toggle-btn .text-only-icon-muted { display: none; }
.mute-toggle-btn .text-only-icon-sound { display: block; }

/* Active = text-only / muted */
.mute-toggle-btn.active {
  background: rgba(240, 112, 138, 0.16);
  border-color: var(--accent-pl);
  color: var(--accent-pl);
  box-shadow: 0 0 14px rgba(240, 112, 138, 0.12);
}
.mute-toggle-btn.active .text-only-icon-muted { display: block; }
.mute-toggle-btn.active .text-only-icon-sound { display: none; }

/* Hide mute button when dropdown is open */
.mute-toggle-btn.dropdown-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Text-only badge */
.text-only-badge {
  display: none;
  align-items: center;
  gap: 6px;
  color: var(--accent-pl);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.88;
  align-self: flex-start;
  margin-bottom: 4px;
}
.text-only-badge svg {
  opacity: 0.6;
}
.section-bottom.text-only .text-only-badge {
  display: flex;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

/* ====== GENDER TOGGLE (per side) ====== */
.gender-toggle {
  display: flex;
  gap: 4px;
  background: rgba(12, 18, 34, 0.4);
  border-radius: 18px;
  padding: 4px;
  border: 1px solid rgba(200, 214, 240, 0.13);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.gender-btn {
  flex: 1;
  min-width: 0;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  pointer-events: none;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.settings-gender-toggle {
  flex: 1;
  max-width: 220px;
}

.gender-btn-text {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Female active — warm rose-red */
.gender-btn[data-gender="female"].active {
  background: rgba(226, 80, 110, 0.22);
  color: #f0607e;
  box-shadow: inset 0 0 0 1px rgba(226, 80, 110, 0.14);
}
/* Male active — clear blue */
.gender-btn[data-gender="male"].active {
  background: rgba(80, 155, 245, 0.22);
  color: #5ba3f5;
  box-shadow: inset 0 0 0 1px rgba(80, 155, 245, 0.14);
}

.gender-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  flex: 0 0 auto;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}
/* Label removed — gender shown by button colour */
.gender-label {
  display: none;
}

/* ====== SECTION BODY (text area fills section) ====== */
.section-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  padding: 0;
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 1;
  transition: transform 420ms cubic-bezier(0.22, 0.78, 0.2, 1), opacity 280ms ease;
}

.section-body.has-suggestions {
  padding-bottom: 58px;
}

/* Mic pinned to bottom-right corner of each section */
.mic-corner {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition:
    opacity 260ms ease,
    transform 420ms cubic-bezier(0.22, 0.78, 0.2, 1);
}

.mic-with-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ====== TEXT DISPLAY ====== */
.text-display {
  width: 100%;
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-radius: 20px;
  background: transparent;
  transition:
    background 0.3s,
    border-color 0.3s,
    box-shadow 0.3s,
    min-height 420ms cubic-bezier(0.22, 0.78, 0.2, 1),
    max-height 420ms cubic-bezier(0.22, 0.78, 0.2, 1),
    opacity 280ms ease,
    transform 420ms cubic-bezier(0.22, 0.78, 0.2, 1);
}

/* Header is now in normal flow, so text areas can use the full width safely */
.section-top .text-display,
.section-bottom .text-display {
  width: calc(100% - var(--mic-lane));
  max-width: calc(100% - var(--mic-lane));
}

.section-top .text-display.has-content,
.section-bottom .text-display.has-content {
  width: min(100%, calc(100% - var(--mic-lane)));
  max-width: calc(100% - var(--mic-lane));
}

body.live-captions-active.live-direction-bottom-to-top .section-top,
body.live-captions-active.live-direction-top-to-bottom .section-bottom {
  flex: 1.45;
}

body.live-captions-active.live-direction-bottom-to-top .section-bottom,
body.live-captions-active.live-direction-top-to-bottom .section-top {
  flex: 0.55;
}

body.live-captions-active .mic-corner {
  opacity: 0.18;
  pointer-events: none;
}

body.live-captions-active.live-direction-top-to-bottom .section-top,
body.live-captions-active.live-direction-bottom-to-top .section-bottom {
  transform: translateY(0);
}

body.live-captions-active.live-direction-top-to-bottom .section-bottom {
  transform: translateY(4px);
}

body.live-captions-active.live-direction-bottom-to-top .section-top {
  transform: translateY(-4px);
}

body.live-captions-active .text-display.live-caption-source,
body.live-captions-active .text-display.live-caption-source.has-content {
  transform: translateY(-2px);
}

body.live-captions-active.live-direction-bottom-to-top .text-display.live-caption-source,
body.live-captions-active.live-direction-bottom-to-top .text-display.live-caption-source.has-content {
  transform: translateY(2px);
}

body.live-captions-active.live-direction-top-to-bottom .section-top .mic-corner,
body.live-captions-active.live-direction-bottom-to-top .section-bottom .mic-corner {
  opacity: 0.34;
  pointer-events: auto;
  z-index: 40;
  transform: scale(1.02);
}

body.live-captions-active .text-display.live-caption-target,
body.live-captions-active .text-display.live-caption-source {
  width: 100%;
  max-width: 100%;
}

/* Show box styling only when there's content */
.text-display.has-content {
  display: flex;
  align-items: stretch;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(200, 214, 240, 0.13);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
  margin-bottom: 2px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-height: clamp(124px, 20vh, 184px);
  max-height: clamp(124px, 20vh, 184px);
}

body.live-captions-active .text-display.live-caption-target.has-content {
  min-height: 236px;
  max-height: 42dvh;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025));
  border-color: rgba(238, 241, 248, 0.2);
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.04);
}

body.live-captions-active .text-display.live-caption-target.has-content::before,
body.live-captions-active .text-display.live-caption-target.has-content::after,
body.live-captions-active .text-display.live-caption-source.has-content::before,
body.live-captions-active .text-display.live-caption-source.has-content::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  z-index: 2;
  pointer-events: none;
  opacity: 0.86;
}

body.live-captions-active .text-display.live-caption-target.has-content::before,
body.live-captions-active .text-display.live-caption-source.has-content::before {
  top: 1px;
  height: 34px;
  border-radius: 19px 19px 0 0;
  background: linear-gradient(180deg, rgba(30, 38, 56, 0.9), rgba(30, 38, 56, 0));
}

body.live-captions-active .text-display.live-caption-target.has-content::after,
body.live-captions-active .text-display.live-caption-source.has-content::after {
  bottom: 1px;
  height: 42px;
  border-radius: 0 0 19px 19px;
  background: linear-gradient(0deg, rgba(30, 38, 56, 0.94), rgba(30, 38, 56, 0));
}

body.live-captions-active .text-display.live-caption-source.has-content {
  min-height: 88px;
  max-height: 126px;
  opacity: 0.78;
}

.text-content {
  --adaptive-font-size-base: clamp(18px, 2.3vw, 22px);
  --adaptive-font-size-medium: clamp(20px, 2.7vw, 25px);
  --adaptive-font-size-large: clamp(23px, 3.2vw, 29px);
  --adaptive-font-size-hero: clamp(27px, 4vw, 35px);
  --adaptive-line-height-base: 1.52;
  --adaptive-line-height-medium: 1.44;
  --adaptive-line-height-large: 1.34;
  --adaptive-line-height-hero: 1.22;
  font-size: var(--adaptive-font-size, var(--adaptive-font-size-base));
  line-height: var(--adaptive-line-height, var(--adaptive-line-height-base));
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--text);
  text-align: left;
  padding: 18px 52px 18px 18px;
  -webkit-user-select: text;
  user-select: text;
  max-inline-size: min(48ch, 100%);
  max-width: 100%;
  margin-right: auto;
  word-break: normal;
  overflow-wrap: anywhere;
  text-wrap: pretty;
  -webkit-hyphens: auto;
  hyphens: auto;
  flex: 1;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

body.live-captions-active .live-caption-target .text-content {
  --adaptive-font-size-base: 18px;
  --adaptive-font-size-medium: 20px;
  --adaptive-font-size-large: 23px;
  --adaptive-font-size-hero: 27px;
  --adaptive-line-height-base: 1.22;
  --adaptive-line-height-medium: 1.18;
  --adaptive-line-height-large: 1.12;
  --adaptive-line-height-hero: 1.06;
  font-weight: 500;
  max-inline-size: min(20ch, 100%);
  padding: 22px 72px 22px 24px;
}

body.live-captions-active .live-caption-source .text-content {
  --adaptive-font-size-base: 16px;
  --adaptive-font-size-medium: 17px;
  --adaptive-font-size-large: 18px;
  --adaptive-font-size-hero: 20px;
  color: var(--text-secondary);
  padding: 14px 64px 14px 16px;
}

.live-stream-text {
  display: flex;
  flex-direction: column;
  gap: 0.42em;
  scroll-behavior: smooth;
}

.live-stream-line {
  display: block;
  max-width: 100%;
}

.live-stream-line-new {
  animation: liveTextFadeIn 560ms cubic-bezier(0.2, 0.78, 0.2, 1) both;
}

.live-stream-line.is-streaming:not(.live-stream-line-new) {
  animation: liveTextSoftIn 260ms ease-out both;
}

.live-stream-line.is-streaming::after {
  content: "";
  display: inline-block;
  width: 0.34em;
  height: 0.34em;
  margin-left: 0.18em;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.38;
  transform: translateY(-0.08em);
}

.live-stream-text--source {
  gap: 0.28em;
}

.live-stream-text--reverse {
  justify-content: flex-start;
}

.live-scroll-paused {
  scroll-behavior: auto;
}

@keyframes liveTextFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes liveTextSoftIn {
  from { opacity: 0.72; }
  to { opacity: 1; }
}

@media (max-width: 520px) {
  .top-bar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .app-title {
    font-size: 13px;
    letter-spacing: 0.18em;
  }

  .app-logo-wrap {
    width: 30px;
    height: 30px;
  }

  .top-actions {
    gap: 6px;
  }

  .live-caption-btn {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    flex-basis: 42px;
    padding: 0;
  }

  .live-caption-label {
    min-width: 0;
    max-width: 0;
    font-size: 10px;
  }

  body.live-captions-active .live-caption-target .text-content {
    --adaptive-font-size-base: 28px;
    --adaptive-font-size-medium: 31px;
    --adaptive-font-size-large: 35px;
    --adaptive-font-size-hero: 40px;
  }
}

.adaptive-text--medium {
  --adaptive-font-size: var(--adaptive-font-size-medium);
  --adaptive-line-height: var(--adaptive-line-height-medium);
}

.adaptive-text--large {
  --adaptive-font-size: var(--adaptive-font-size-large);
  --adaptive-line-height: var(--adaptive-line-height-large);
}

.adaptive-text--hero {
  --adaptive-font-size: var(--adaptive-font-size-hero);
  --adaptive-line-height: var(--adaptive-line-height-hero);
  letter-spacing: -0.01em;
}
.text-content:empty { display: none; }

.text-content::-webkit-scrollbar {
  width: 4px;
}

.text-content::-webkit-scrollbar-track {
  background: transparent;
}

.text-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.text-display.has-save-action .text-content {
  padding-left: 18px;
}

.text-display.reader-enabled {
  cursor: pointer;
}

.text-display.reader-enabled.has-content {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.text-display.reader-enabled:active {
  transform: scale(0.995);
}

/* New message reveal: box fade + sentence swipe + light sweep accent */
.text-display.reveal-box {
  animation: text-box-fade 280ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  will-change: opacity, transform;
}

.text-display.reveal-sweep::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 42%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
}

.section-top .text-display.reveal-sweep::before,
.section-bottom .text-display.reveal-sweep::before {
  left: -46%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0),
    rgba(127, 184, 248, 0.12) 50%,
    rgba(255, 255, 255, 0)
  );
  animation: sweep-left-to-right 340ms cubic-bezier(0.22, 0.74, 0.24, 1) both;
}

.section-bottom .text-display.reveal-sweep::before {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0),
    rgba(240, 112, 138, 0.12) 50%,
    rgba(255, 255, 255, 0)
  );
}

.text-content.reveal-sentence {
  animation: sentence-fade-in 380ms cubic-bezier(0.2, 0.75, 0.2, 1) both;
  will-change: opacity, transform;
  overflow: hidden;
}

.section-top .text-content.reveal-sentence::after,
.section-bottom .text-content.reveal-sentence::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 100%;
  pointer-events: none;
  z-index: 2;
  animation: sentence-wipe-mask 420ms cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.section-top .text-content.reveal-sentence::after {
  background: linear-gradient(
    90deg,
    var(--bg-en) 82%,
    rgba(30, 42, 62, 0.25) 100%
  );
}

.section-bottom .text-content.reveal-sentence::after {
  background: linear-gradient(
    90deg,
    var(--bg-pl) 82%,
    rgba(39, 31, 44, 0.25) 100%
  );
}

@keyframes sentence-fade-in {
  0% { opacity: 0.25; transform: translateX(-4px); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes sentence-wipe-mask {
  0% { width: 100%; }
  100% { width: 0%; }
}

@keyframes text-box-fade {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes sweep-left-to-right {
  0% { transform: translateX(0); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateX(250%); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .text-display.reveal-box,
  .text-display.reveal-sweep::before,
  .text-content.reveal-sentence,
  .text-content.reveal-sentence::after {
    animation: none !important;
  }
  .text-content.reveal-sentence {
    opacity: 1;
    transform: none;
  }
}

/* Fade hint at bottom when scrollable */
.text-display.has-content::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1px;
  right: 1px;
  height: 20px;
  border-radius: 0 0 10px 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.text-display.scrollable::after {
  opacity: 1;
}
.section-top .text-display.scrollable::after {
  background: linear-gradient(to top, var(--bg-en), transparent);
}
.section-bottom .text-display.scrollable::after {
  background: linear-gradient(to top, var(--bg-pl), transparent);
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  background: rgba(18, 24, 40, 0.88);
  border: 1px solid rgba(200, 214, 240, 0.14);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  border-radius: 12px;
  transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}
.copy-btn:active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  transform: scale(0.96);
}
.section-top .copy-btn {
  border-color: rgba(127, 184, 248, 0.2);
  color: rgba(160, 206, 255, 0.9);
}
.section-bottom .copy-btn {
  border-color: rgba(240, 135, 159, 0.2);
  color: rgba(255, 172, 190, 0.9);
}
.copy-btn.hidden { display: none; }
.copy-btn.copied {
  color: var(--green);
  border-color: rgba(93, 217, 154, 0.44);
  box-shadow:
    0 0 0 1px rgba(93, 217, 154, 0.1),
    0 0 16px rgba(93, 217, 154, 0.14);
}

.learn-save-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: none;
  background: rgba(14, 20, 34, 0.3);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: color 0.15s, transform 0.15s, background 0.15s;
}

.learn-save-btn {
  display: none !important;
}

.learn-save-btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.05);
}

.learn-save-btn.hidden {
  display: none;
}

.learn-save-btn.saved {
  color: #f5c518;
}

.learn-save-btn.saved svg {
  fill: currentColor;
  stroke: currentColor;
}

/* ====== STATUS TEXT ====== */
.status-text {
  font-size: 12px;
  color: var(--text-secondary);
  min-height: 18px;
  transition: opacity 0.2s;
  letter-spacing: 0.02em;
  font-weight: 500;
  text-align: left;
  width: calc(100% - var(--mic-lane));
  max-width: calc(100% - var(--mic-lane));
}

.status-text.status-listening {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: calc(100% - var(--mic-lane));
  color: rgba(238, 241, 248, 0.88);
  animation: listening-text-pulse 1.35s ease-in-out infinite;
}

.status-text.status-listening::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 0 rgba(238, 241, 248, 0.34);
  animation: listening-dot-pulse 1.35s ease-out infinite;
}

.status-text.status-listening::after {
  content: '';
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.45;
  transform-origin: left center;
  animation: listening-bar-pulse 1.35s ease-in-out infinite;
}

body.live-captions-active .status-text {
  width: 100%;
  max-width: 100%;
}

body.live-captions-active .status-text.status-listening {
  width: fit-content;
  max-width: 100%;
}

@keyframes listening-text-pulse {
  0%, 100% { opacity: 0.56; }
  45% { opacity: 1; }
}

@keyframes listening-dot-pulse {
  0% {
    transform: scale(0.86);
    box-shadow: 0 0 0 0 rgba(238, 241, 248, 0.34);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 9px rgba(238, 241, 248, 0);
  }
  100% {
    transform: scale(0.86);
    box-shadow: 0 0 0 0 rgba(238, 241, 248, 0);
  }
}

@keyframes listening-bar-pulse {
  0%, 100% {
    opacity: 0.2;
    transform: scaleX(0.55);
  }
  45% {
    opacity: 0.62;
    transform: scaleX(1);
  }
}

/* ====== MIC BUTTONS ====== */
.mic-btn {
  width: var(--mic-size);
  height: var(--mic-size);
  border-radius: 50%;
  border: 1px solid rgba(200, 214, 240, 0.2);
  background: rgba(24, 32, 50, 0.92);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  transition: all 0.2s ease;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 12px 28px rgba(0, 0, 0, 0.22);
}
.mic-top { border-color: rgba(127, 184, 248, 0.48); color: rgba(160, 206, 255, 0.9); }
.mic-bottom { border-color: rgba(240, 135, 159, 0.48); color: rgba(255, 172, 192, 0.9); }

body.live-captions-active.live-direction-top-to-bottom .section-top .mic-btn,
body.live-captions-active.live-direction-bottom-to-top .section-bottom .mic-btn {
  pointer-events: auto;
  opacity: 1;
  cursor: pointer;
}

.mic-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid transparent;
  transition: all 0.3s ease;
  pointer-events: none;
}
.mic-ring-2 {
  inset: -10px;
}

.mic-btn:active:not(:disabled) {
  transform: scale(0.96);
}
.mic-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.mic-btn:disabled:active { transform: none; }

/* Connecting — spinning dashed ring while mic activates */
.mic-top.connecting {
  border-color: var(--accent-en);
  color: var(--accent-en);
  background:
    radial-gradient(circle at 50% 50%, rgba(127, 184, 248, 0.18), rgba(24, 32, 50, 0.94) 68%);
}
.mic-bottom.connecting {
  border-color: var(--accent-pl);
  color: var(--accent-pl);
  background:
    radial-gradient(circle at 50% 50%, rgba(240, 135, 159, 0.16), rgba(24, 32, 50, 0.94) 68%);
}
.mic-btn.connecting::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background:
    linear-gradient(110deg, transparent 0%, transparent 38%, currentColor 50%, transparent 62%, transparent 100%);
  background-size: 230% 100%;
  opacity: 0.2;
  animation: mic-ready-sweep 0.86s cubic-bezier(0.36, 0, 0.24, 1) infinite;
  pointer-events: none;
}
.mic-btn.connecting .mic-icon,
.mic-btn.connecting .stop-icon {
  position: relative;
  z-index: 1;
}
.mic-btn.connecting .mic-ring {
  border: 2px dashed currentColor;
  animation: spin-ring 1.2s linear infinite;
}
@keyframes mic-ready-sweep {
  from { background-position: 140% 0; opacity: 0.08; }
  42% { opacity: 0.24; }
  to { background-position: -140% 0; opacity: 0.08; }
}
@keyframes spin-ring {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Recording — audio-reactive glow, pulsing rings */
.mic-top.recording {
  --glow: 0;
  border-color: var(--accent-en);
  color: var(--accent-en);
  background: rgba(106, 171, 255, calc(0.2 + 0.35 * var(--glow)));
  box-shadow:
    0 0 calc(30px + 50px * var(--glow)) rgba(106, 171, 255, calc(0.6 + 0.4 * var(--glow))),
    0 0 calc(60px + 80px * var(--glow)) rgba(106, 171, 255, calc(0.4 + 0.4 * var(--glow))),
    0 0 calc(90px + 110px * var(--glow)) rgba(106, 171, 255, calc(0.2 + 0.3 * var(--glow))),
    0 0 calc(120px + 140px * var(--glow)) rgba(106, 171, 255, calc(0.08 + 0.2 * var(--glow)));
  transform: scale(calc(1 + 0.08 * var(--glow)));
}
.mic-top.recording .mic-ring {
  border: 2.5px solid rgba(106, 171, 255, 0.8);
  animation: ring-expand-en 1.8s ease-out infinite;
}
.mic-top.recording .mic-ring-2 {
  border: 2px solid rgba(106, 171, 255, 0.5);
  animation: ring-expand-en 1.8s ease-out 0.6s infinite;
}

.mic-bottom.recording {
  --glow: 0;
  border-color: var(--accent-pl);
  color: var(--accent-pl);
  background: rgba(240, 112, 138, calc(0.2 + 0.35 * var(--glow)));
  box-shadow:
    0 0 calc(30px + 50px * var(--glow)) rgba(240, 112, 138, calc(0.6 + 0.4 * var(--glow))),
    0 0 calc(60px + 80px * var(--glow)) rgba(240, 112, 138, calc(0.4 + 0.4 * var(--glow))),
    0 0 calc(90px + 110px * var(--glow)) rgba(240, 112, 138, calc(0.2 + 0.3 * var(--glow))),
    0 0 calc(120px + 140px * var(--glow)) rgba(240, 112, 138, calc(0.08 + 0.2 * var(--glow)));
  transform: scale(calc(1 + 0.08 * var(--glow)));
}
.mic-bottom.recording .mic-ring {
  border: 2.5px solid rgba(240, 112, 138, 0.8);
  animation: ring-expand-pl 1.8s ease-out infinite;
}
.mic-bottom.recording .mic-ring-2 {
  border: 2px solid rgba(240, 112, 138, 0.5);
  animation: ring-expand-pl 1.8s ease-out 0.6s infinite;
}

@keyframes ring-expand-en {
  0% { transform: scale(1); opacity: 1; border-color: rgba(106, 171, 255, 0.8); }
  40% { opacity: 0.6; }
  100% { transform: scale(3); opacity: 0; border-color: rgba(106, 171, 255, 0); }
}
@keyframes ring-expand-pl {
  0% { transform: scale(1); opacity: 1; border-color: rgba(240, 112, 138, 0.8); }
  40% { opacity: 0.6; }
  100% { transform: scale(3); opacity: 0; border-color: rgba(240, 112, 138, 0); }
}

/* Processing — subtle breathing */
.mic-btn.processing {
  border-color: var(--text-dim);
  color: var(--text-dim);
  animation: breathe 2s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.03); }
}

/* Playing — green pulse */
.mic-btn.playing {
  border-color: var(--green);
  color: var(--green);
  background: rgba(74, 222, 128, 0.1);
  box-shadow: 0 0 18px rgba(74, 222, 128, 0.13);
  animation: play-pulse 1s ease-in-out infinite;
}

@keyframes play-pulse {
  0%, 100% { box-shadow: 0 0 18px rgba(74, 222, 128, 0.13); }
  50% { box-shadow: 0 0 28px rgba(74, 222, 128, 0.22); }
}

/* Stop icon — hidden by default, shown during playback */
.stop-icon {
  display: none;
  width: 24px;
  height: 24px;
  position: relative;
  z-index: 2;
}
.mic-btn.playing .mic-icon { display: none !important; }
.mic-btn.playing .stop-icon {
  display: block !important;
  color: var(--green);
  transform: scale(1.08);
  filter: drop-shadow(0 0 5px rgba(74, 222, 128, 0.5));
}
.mic-btn.playing .stop-icon rect {
  fill: var(--green);
}

/* ====== SIGNAL PULSE (processing animation) ====== */
.signal-pulse {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.signal-pulse.active {
  opacity: 1;
}

/* SVG curved track */
.signal-pulse svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.signal-track-path {
  fill: none;
  stroke: rgba(127, 184, 248, 0.06);
  stroke-width: 1.5;
}
.signal-trail-path {
  fill: none;
  stroke: rgba(127, 184, 248, 0.32);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 5px rgba(127, 184, 248, 0.24));
  stroke-linecap: round;
}

/* Orbs positioned by JS along the curve */
.signal-orb {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7fb8f8;
  box-shadow:
    0 0 6px 2px rgba(127, 184, 248, 0.7),
    0 0 14px 4px rgba(127, 184, 248, 0.4),
    0 0 28px 8px rgba(127, 184, 248, 0.2),
    0 0 46px 16px rgba(127, 184, 248, 0.08);
  opacity: 0;
  transform: translate(-50%, -50%);
  will-change: left, top, opacity;
}

/* Arrival flash when orbs reach target mic */
.signal-arrival-flash {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #7fb8f8;
  transform: translate(-50%, -50%);
  animation: signal-flash 0.35s ease-out forwards;
  pointer-events: none;
}
@keyframes signal-flash {
  0% {
    box-shadow:
      0 0 8px 4px rgba(127, 184, 248, 0.9),
      0 0 20px 8px rgba(127, 184, 248, 0.6),
      0 0 40px 16px rgba(127, 184, 248, 0.3);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    box-shadow:
      0 0 16px 8px rgba(127, 184, 248, 0.7),
      0 0 40px 20px rgba(127, 184, 248, 0.4),
      0 0 70px 35px rgba(127, 184, 248, 0.12);
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(2.5);
  }
  100% {
    box-shadow: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(4);
  }
}

/* ====== SUGGESTIONS ====== */
.suggestions-shell {
  position: relative;
  margin-top: auto;
  min-height: 46px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Dictation-only sections (no suggestions) should not reserve a pill lane */
.section-body:not(.has-suggestions) .suggestions-shell {
  display: none;
}

.suggestions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-start;
  z-index: 1;
  padding: 0;
  padding-right: 10px;
  min-height: 46px;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
}
.suggestions::-webkit-scrollbar {
  display: none;
}

@media (max-width: 768px) {
  .section-bottom .suggestions-shell {
    padding-bottom: 0;
  }
}

.section-bottom .section-body {
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 64px);
}

.section-body.has-suggestions .suggestions-shell {
  position: absolute;
  left: 0;
  right: calc(var(--mic-size) + 36px);
  bottom: 0;
  margin-top: 0;
}

.section-bottom .suggestions-shell {
  position: absolute;
  left: 0;
  right: calc(var(--mic-size) + 36px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  margin-top: 0;
  min-height: 40px;
}

.suggestion-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  white-space: nowrap;
  max-width: min(78%, 420px);
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(28, 38, 58, 0.86);
  border: 1px solid rgba(200, 214, 240, 0.14);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  animation: chip-in 0.25s ease;
}
.section-top .suggestion-chip:active {
  background: var(--accent-en-dim);
  border-color: var(--accent-en);
  color: var(--accent-en);
}
.section-bottom .suggestion-chip:active {
  background: var(--accent-pl-dim);
  border-color: var(--accent-pl);
  color: var(--accent-pl);
}

@keyframes chip-in {
  from { opacity: 0; transform: translateY(6px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ====== DIVIDER ====== */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  flex-shrink: 0;
  background: rgba(14, 18, 32, 0.72);
  height: 52px;
  border-top: 1px solid rgba(200, 214, 240, 0.05);
  border-bottom: 1px solid rgba(200, 214, 240, 0.05);
}
.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(127, 184, 248, 0.28), rgba(200, 214, 240, 0.1), rgba(240, 135, 159, 0.28));
  transition: flex-basis 0.28s ease, flex-grow 0.28s ease, background 0.24s ease;
}
.divider-icon {
  color: var(--text-secondary);
  display: flex;
  opacity: 0.88;
}

.text-only-swap-btn {
  display: none;
  width: auto;
  height: auto;
  border-radius: 0;
  border: none;
  background: transparent;
  color: #9daabf;
  box-shadow: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: default;
  opacity: 0.76;
  transform: none;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  z-index: 4;
  -webkit-tap-highlight-color: transparent;
}

.text-only-swap-btn svg {
  filter: none;
}

body.text-only-mode .text-only-swap-btn {
  display: none;
}

body.text-only-mode .text-only-swap-btn svg {
  filter: drop-shadow(0 0 2px rgba(220, 232, 255, 0.22));
}

body.text-only-mode .text-only-swap-btn:active {
  border-color: rgba(255, 255, 255, 0.32);
  color: rgba(245, 250, 255, 0.9);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 12px rgba(127, 184, 248, 0.16);
}

/* ====== QUICK TEXT MODE ====== */
.quick-text-input,
.quick-text-bottom-actions,
.quick-text-paste,
.quick-text-new {
  display: none;
}

.quick-text-toggle {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(127, 184, 248, 0.28);
  background: radial-gradient(circle at 40% 35%, rgba(127, 184, 248, 0.12), rgba(18, 24, 42, 0.88) 70%);
  color: rgba(210, 230, 255, 0.88);
  box-shadow:
    0 0 12px rgba(127, 184, 248, 0.16),
    0 4px 14px rgba(0, 0, 0, 0.32),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.quick-text-toggle svg {
  filter: drop-shadow(0 0 4px rgba(160, 210, 255, 0.34));
}

.quick-text-toggle:active {
  transform: scale(0.93);
  box-shadow:
    0 0 18px rgba(127, 184, 248, 0.24),
    0 2px 8px rgba(0, 0, 0, 0.38),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  border-color: rgba(127, 184, 248, 0.48);
}

.quick-text-toggle.active {
  color: #dffff0;
  border-color: #4dff9a;
  background:
    radial-gradient(circle at 42% 34%, rgba(93, 217, 154, 0.18), rgba(18, 24, 42, 0.88) 70%);
  box-shadow:
    0 0 0 3px rgba(77, 255, 154, 0.92),
    0 0 18px rgba(77, 255, 154, 0.42),
    0 4px 14px rgba(0, 0, 0, 0.32),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.quick-text-toggle.active svg {
  filter: drop-shadow(0 0 5px rgba(77, 255, 154, 0.62));
}

body.mode-text {
  --quick-text-paste-height: 58px;
}

body.mode-text .language-section {
  min-height: 0;
  overflow: visible;
  z-index: 30;
}

body.mode-text .language-section:has(.lang-dropdown.open) {
  z-index: 420;
}

body.mode-text .section-top {
  flex: 0 1 35%;
}

body.mode-text .section-bottom {
  flex: 1 1 65%;
  padding-bottom: 0;
}

body.mode-text .mic-corner,
body.mode-text .suggestions-shell,
body.mode-text .bottom-controls,
body.mode-text .text-only-badge {
  display: none !important;
}

body.mode-text .section-header {
  position: absolute;
  inset: 0;
  z-index: 240;
  display: block;
  pointer-events: none;
}

body.mode-text .section-top .section-header {
  top: 0;
}

body.mode-text .lang-indicator {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  justify-content: center;
  border-radius: 15px;
  pointer-events: auto;
}

body.mode-text .lang-name,
body.mode-text .lang-chevron {
  display: none;
}

body.mode-text .lang-code {
  font-size: 13px;
  letter-spacing: 0.08em;
  font-weight: 650;
}

body.mode-text .lang-dropdown {
  position: absolute;
  right: 68px;
  left: auto;
  width: min(250px, calc(100vw - 34px));
  max-height: 260px;
  z-index: 999;
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(200, 214, 240, 0.14);
}

body.mode-text .section-top .lang-dropdown {
  top: 62px;
}

body.mode-text .section-bottom .lang-dropdown {
  top: auto;
  bottom: 50px;
}

body.mode-text .divider {
  position: relative;
  z-index: 40;
}

body.mode-text .header-right,
body.mode-text .gender-wrap {
  display: flex;
  align-items: center;
  pointer-events: auto;
}

body.mode-text .header-right {
  position: absolute;
  right: 14px;
  bottom: 18px;
}

body.mode-text .gender-toggle {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  flex: 0 0 42px;
  height: 42px;
  padding: 4px;
  gap: 0;
  border-radius: 15px;
  background: rgba(20, 28, 45, 0.78);
  border: 1px solid rgba(200, 214, 240, 0.12);
  transition: transform 0.2s ease, box-shadow 0.24s ease, border-color 0.24s ease, background 0.24s ease;
}

body.mode-text .gender-btn {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 11px;
  flex: 0 0 32px;
  transition: opacity 0.18s ease, transform 0.18s ease, color 0.18s ease, background 0.18s ease;
}

body.mode-text .gender-wrap,
body.mode-text .header-right {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  flex: 0 0 42px;
  height: 42px;
  overflow: visible;
}

body.mode-text .gender-btn.active {
  display: flex;
}

body.mode-text .section-top .gender-toggle {
  border-color: rgba(127, 184, 248, 0.24);
  box-shadow: 0 0 22px rgba(127, 184, 248, 0.10);
}

body.mode-text .section-top .gender-btn.active {
  color: #d8ebff;
  background: rgba(127, 184, 248, 0.20);
  border-color: rgba(127, 184, 248, 0.44);
}

body.mode-text .section-bottom .gender-toggle {
  border-color: rgba(240, 135, 159, 0.26);
  box-shadow: 0 0 22px rgba(240, 135, 159, 0.10);
}

body.mode-text .section-bottom .gender-btn.active {
  color: #ffdce5;
  background: rgba(240, 135, 159, 0.18);
  border-color: rgba(240, 135, 159, 0.42);
}

body.mode-text .gender-toggle.gender-pulse {
  animation: text-gender-pulse 0.58s cubic-bezier(0.18, 0.9, 0.2, 1);
}

body.mode-text .section-top .gender-toggle.gender-pulse {
  box-shadow:
    0 0 0 5px rgba(127, 184, 248, 0),
    0 0 32px rgba(127, 184, 248, 0.30);
}

body.mode-text .section-bottom .gender-toggle.gender-pulse {
  box-shadow:
    0 0 0 5px rgba(240, 135, 159, 0),
    0 0 32px rgba(240, 135, 159, 0.30);
}

@keyframes text-gender-pulse {
  0% { transform: scale(1); filter: brightness(1); }
  30% { transform: scale(1.14); filter: brightness(1.24); }
  58% { transform: scale(0.98); filter: brightness(1.08); }
  100% { transform: scale(1); filter: brightness(1); }
}

body.mode-text .section-top .section-body {
  position: relative;
  height: 100%;
  padding: 0 22px;
}

body.mode-text .section-top .text-display {
  position: absolute;
  inset: 0;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  pointer-events: auto;
}

body.mode-text .section-top .text-display:not(.has-content) {
  pointer-events: none;
}

body.mode-text .section-top .text-content {
  min-height: 100%;
  padding: 58px 26px 18px;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: rgba(238, 241, 248, 0.94);
}

body.mode-text.quick-text-editing .section-top .text-content,
body.mode-text .section-top:has(.quick-text-input:focus) .text-content {
  opacity: 0;
  visibility: hidden;
}

body.mode-text .quick-text-input {
  display: block;
  position: absolute;
  left: 22px;
  top: 28px;
  z-index: 5;
  width: calc(100% - 150px);
  height: 166px;
  max-height: min(182px, calc(100% - 70px));
  transform: none;
  border: 0;
  outline: 0;
  resize: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 8px 4px 18px;
  background: transparent;
  color: rgba(238, 241, 248, 0.92);
  font-family: var(--font);
  font-size: clamp(21px, 5.4vw, 31px);
  line-height: 1.16;
  letter-spacing: -0.045em;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: thin;
  scrollbar-color: rgba(127, 184, 248, 0.55) rgba(127, 184, 248, 0.10);
  direction: rtl;
  unicode-bidi: plaintext;
}

body.mode-text .quick-text-input::-webkit-scrollbar {
  width: 4px;
}

body.mode-text .quick-text-input::-webkit-scrollbar-track {
  background: rgba(127, 184, 248, 0.10);
  border-radius: 999px;
}

body.mode-text .quick-text-input::-webkit-scrollbar-thumb {
  background: rgba(127, 184, 248, 0.58);
  border-radius: 999px;
}

body.mode-text.quick-text-top-filled .quick-text-input::placeholder {
  color: transparent;
}

body.mode-text.quick-text-top-filled .quick-text-input {
  caret-color: transparent;
}

body.mode-text.quick-text-editing .quick-text-input {
  caret-color: #7fb8f8;
}

body.mode-text .quick-text-input::placeholder {
  color: rgba(168, 180, 205, 0.42);
  opacity: 1;
}

body.mode-text.quick-text-top-filled .quick-text-new,
body.mode-text.quick-text-has-draft .quick-text-new {
  display: inline-flex;
}

body.mode-text.quick-text-editing.quick-text-has-draft .quick-text-input {
  top: 50%;
}

.quick-text-new {
  position: absolute;
  right: calc(14px - var(--mic-lane));
  bottom: 12px;
  z-index: 8;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(174, 218, 255, 0.34);
  background: rgba(14, 21, 36, 0.5);
  color: rgba(226, 239, 255, 0.92);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  -webkit-tap-highlight-color: transparent;
}

.quick-text-new:active {
  transform: scale(0.96);
}

body.mode-text .divider {
  height: 54px;
  gap: 4px;
  padding: 0 30px;
  background: rgba(14, 18, 32, 0.44);
}

body.mode-text .divider-icon {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(127, 184, 248, 0.18);
  background:
    radial-gradient(circle at 35% 25%, rgba(127, 184, 248, 0.13), transparent 58%),
    rgba(20, 28, 45, 0.82);
  color: rgba(190, 202, 222, 0.92);
  align-items: center;
  justify-content: center;
  opacity: 1;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.035),
    0 8px 22px rgba(0, 0, 0, 0.20),
    inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

body.mode-text .divider-line {
  flex: 1 1 auto;
}

body.mode-text .camera-btn,
body.mode-text .mute-toggle-btn {
  flex: 0 0 0;
  width: 0;
  min-width: 0;
  padding: 0;
  border-width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: scale(0.72);
  background: transparent;
  box-shadow: none;
}

body.mode-text .quick-text-toggle.active {
  border-color: #4dff9a;
  color: #dffff0;
  background:
    radial-gradient(circle at 42% 34%, rgba(93, 217, 154, 0.18), rgba(18, 24, 42, 0.88) 70%);
  box-shadow:
    0 0 0 3px rgba(77, 255, 154, 0.92),
    0 0 18px rgba(77, 255, 154, 0.42),
    0 8px 22px rgba(0, 0, 0, 0.20),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

body.mode-text .text-only-swap-btn {
  display: none;
}

body.mode-text .section-bottom {
  padding: 12px 20px 10px;
}

body.mode-text.quick-text-translating .section-bottom::before {
  content: "";
  position: absolute;
  inset: 18px 12px 88px;
  border-radius: 34px;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 110, 163, 0.36), transparent 34%),
    radial-gradient(circle at 50% 62%, rgba(127, 184, 248, 0.18), transparent 45%);
  filter: blur(18px);
  opacity: 0.78;
  animation: quickTextBottomGlow 1.05s ease-in-out infinite;
}

body.mode-text .section-bottom .section-body {
  height: 100%;
}

body.mode-text .section-bottom .text-display {
  min-height: 100%;
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(240, 135, 159, 0.12), transparent 42%),
    rgba(34, 43, 63, 0.74);
}

body.mode-text.quick-text-translating .section-bottom .text-display {
  border: 1px solid rgba(255, 137, 181, 0.52);
  border-color: rgba(255, 137, 181, 0.52);
  box-shadow:
    0 0 0 1px rgba(255, 137, 181, 0.24),
    0 0 28px rgba(255, 95, 155, 0.26),
    0 0 54px rgba(127, 184, 248, 0.14),
    inset 0 0 30px rgba(255, 137, 181, 0.1);
  animation: quickTextTargetCardPulse 1.05s ease-in-out infinite;
}

body.mode-text.quick-text-translating .section-bottom .text-display::after {
  content: "Translating";
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 4;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 176, 204, 0.36);
  background: rgba(18, 20, 34, 0.74);
  color: rgba(255, 222, 234, 0.96);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow:
    0 0 18px rgba(255, 113, 170, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: quickTextStatusPulse 1.05s ease-in-out infinite;
}

body.mode-text .section-bottom .text-content {
  padding: 54px 18px 18px;
  font-size: clamp(25px, 6.4vw, 38px);
  line-height: 1.18;
  letter-spacing: -0.045em;
}

body.mode-text .quick-text-bottom-actions {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 10px;
  padding: 0 20px 10px;
  flex-shrink: 0;
}

.quick-text-action {
  min-height: 42px;
  border-radius: 15px;
  border: 1px solid rgba(200, 214, 240, 0.14);
  color: #e9f2ff;
  background: rgba(28, 36, 54, 0.78);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 650;
}

.quick-text-speak {
  color: #101827;
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.32), transparent 44%),
    linear-gradient(135deg, #f0879f, #ffd29a);
}

.quick-text-action:disabled {
  opacity: 0.46;
}

body.mode-text .quick-text-paste {
  display: block;
  min-height: var(--quick-text-paste-height);
  margin: 0 20px calc(env(safe-area-inset-bottom, 0px) + 14px);
  border: 1px solid rgba(174, 218, 255, 0.72);
  border-radius: 22px;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.46), transparent 30%),
    radial-gradient(circle at 88% 100%, rgba(240, 135, 159, 0.15), transparent 46%),
    linear-gradient(135deg, #7fb8f8 0%, #b5e6ff 48%, #7ad4d3 100%);
  color: #122035;
  font-family: var(--font);
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.025em;
  box-shadow:
    0 10px 24px rgba(87, 156, 218, 0.22),
    0 0 24px rgba(127, 184, 248, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

body.mode-text .quick-text-paste:active {
  transform: scale(0.988);
}

@keyframes quickTextBottomGlow {
  0%, 100% {
    opacity: 0.5;
    transform: scale(0.96);
  }
  50% {
    opacity: 0.98;
    transform: scale(1.03);
  }
}

@keyframes quickTextTargetCardPulse {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(255, 137, 181, 0.18),
      0 0 20px rgba(255, 95, 155, 0.18),
      0 0 44px rgba(127, 184, 248, 0.1),
      inset 0 0 22px rgba(255, 137, 181, 0.08);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 176, 204, 0.42),
      0 0 34px rgba(255, 95, 155, 0.34),
      0 0 70px rgba(127, 184, 248, 0.18),
      inset 0 0 36px rgba(255, 137, 181, 0.14);
  }
}

@keyframes quickTextStatusPulse {
  0%, 100% {
    opacity: 0.72;
    transform: translateX(-50%) scale(0.98);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) scale(1.03);
  }
}

/* ====== BOTTOM CONTROLS ====== */
.bottom-controls {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  left: 16px;
  display: flex;
  gap: 10px;
  z-index: 100;
}

@media (max-width: 420px) {
  .section-header {
    gap: 10px;
  }

  .header-right {
    gap: 8px;
  }

  .lang-selector {
    padding: 9px 11px;
    max-width: min(52vw, 250px);
  }

  .lang-code {
    font-size: 18px;
  }

  .lang-name {
    font-size: 14px;
  }

  .text-content {
    --adaptive-font-size-base: 17px;
    --adaptive-font-size-medium: 19px;
    --adaptive-font-size-large: 22px;
    --adaptive-font-size-hero: 26px;
    padding: 16px 48px 16px 16px;
  }

  .text-display.has-save-action .text-content {
    padding-left: 42px;
  }

  .tone-menu {
    width: min(35vw, 164px);
    min-width: 120px;
  }

  .gender-toggle {
    min-width: 88px;
  }

  :root {
    --mic-lane: calc(var(--mic-size) + 22px);
  }
}

@media (max-width: 360px) {
  .section-header {
    align-items: flex-start;
  }

  .header-right {
    gap: 6px;
  }

  .tone-menu {
    width: 116px;
    min-width: 116px;
  }

  .gender-label {
    min-width: auto;
    font-size: 9px;
  }

  :root {
    --mic-lane: calc(var(--mic-size) + 18px);
  }
}
.save-btn {
  transition: opacity 0.3s;
}
.save-btn.hidden { opacity: 0; pointer-events: none; }
.save-btn { color: var(--text-secondary); }
.save-btn.saving {
  opacity: 0.5;
  pointer-events: none;
  animation: pulse-opacity 0.8s ease-in-out infinite;
}
@keyframes pulse-opacity {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.9; }
}

/* ====== TOAST ====== */
#toast-container {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 50px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--font);
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.toast.visible { opacity: 1; }

/* ====== MIC HINT (per-language "hold" label) ====== */
.mic-hint {
  display: none;
}
.mic-hint.hidden { opacity: 0; }

/* ====== OVERLAY ====== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  z-index: 150;
  transition: opacity 0.3s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.overlay.hidden { opacity: 0; pointer-events: none; }

/* ====== HISTORY DRAWER ====== */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: var(--surface);
  z-index: 160;
  transform: translateX(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.36);
  border-right: 1px solid rgba(200, 214, 240, 0.1);
}
.drawer.hidden {
  transform: translateX(-100%);
  box-shadow: none;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.drawer-header h3 {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--text);
}
.drawer-header .icon-btn {
  color: var(--text-secondary);
}

/* ====== DRAWER TABS — elegant pill pair ====== */
.drawer-tabs {
  display: flex;
  gap: 0;
  padding: 12px 14px 4px;
  background: rgba(20, 26, 42, 0.6);
}

/* Outer pill container */
.drawer-tabs::before {
  display: none; /* handled per-tab */
}

.drawer-tab {
  flex: 1;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  padding: 9px 12px;
  font-size: 12px;
  font-family: var(--font);
  font-weight: 500;
  letter-spacing: 0.15px;
  transition: all 0.2s ease;
  /* flat inner segments */
  border-radius: 0;
}

/* Left tab rounded on left side only */
.drawer-tab:first-child {
  border-radius: 999px 0 0 999px;
  border-right-width: 0;
}

/* Right tab rounded on right side only */
.drawer-tab:last-child {
  border-radius: 0 999px 999px 0;
  border-left-width: 1px;
}

.drawer-tab.active {
  color: #fff;
  border-color: rgba(127, 184, 248, 0.55);
  background: rgba(127, 184, 248, 0.1);
}

.drawer-tab-launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 0 999px 999px 0 !important;
  color: #e4f0ff;
  border-color: rgba(127, 184, 248, 0.3);
  background: linear-gradient(180deg, rgba(28, 44, 70, 0.98), rgba(16, 26, 46, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -1px 0 rgba(0, 0, 0, 0.24);
}

.drawer-tab-launch svg {
  opacity: 0.82;
}

.drawer-tab-launch:active {
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.22);
}

.drawer-search {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.drawer-search input {
  width: 100%;
  background: rgba(16, 22, 36, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font);
  font-weight: 300;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-user-select: text;
  user-select: text;
}
.drawer-search input::placeholder {
  color: var(--text-dim);
  font-weight: 300;
}
.drawer-search input:focus {
  border-color: rgba(127, 184, 248, 0.44);
  box-shadow: 0 0 0 3px rgba(127, 184, 248, 0.08);
}

/* ====== LEARNING MODE BAR — segmented control pill ====== */
.learning-mode-bar {
  display: flex;
  gap: 0;
  background: rgba(14, 20, 34, 0.6);
  border: 1px solid rgba(200, 214, 240, 0.14);
  border-radius: 999px;
  padding: 3px;
  width: 100%;
}

#history-list.hidden,
.learning-screen.hidden {
  display: none;
}

.learning-mode-btn {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 8px 6px;
  font-size: 11px;
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: 0.25px;
  text-transform: uppercase;
  transition: all 0.26s cubic-bezier(0.34, 1.3, 0.64, 1);
  text-align: center;
}

.learning-mode-btn:active {
  transform: scale(0.94);
}

.learning-mode-btn.active {
  color: #fff;
  border-color: rgba(240, 112, 138, 0.52);
  background: rgba(240, 112, 138, 0.14);
  box-shadow:
    0 2px 10px rgba(240, 112, 138, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.history-list::-webkit-scrollbar { width: 3px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 2px;
}
.history-item:active { background: var(--surface-hover); }
.history-item-body { flex: 1; min-width: 0; }
.history-item-time {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 4px;
  letter-spacing: 0.4px;
  font-weight: 300;
}
.history-item-summary {
  font-size: 13px;
  font-weight: 300;
  color: var(--text);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* History loading spinner */
.history-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 20px;
  color: var(--text-secondary);
  font-size: 12px;
}
.history-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-en);
  border-radius: 50%;
  animation: spin-ring 0.8s linear infinite;
  flex-shrink: 0;
}
/* History item meta row */
.history-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.history-item-count {
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
  font-style: italic;
}
.history-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 300;
  line-height: 1.6;
}

/* ====== LEARNING SCREEN ====== */
.learning-screen {
  position: fixed;
  inset: 0;
  z-index: 175;
  background:
    radial-gradient(ellipse at top left, rgba(127, 184, 248, 0.12), transparent 40%),
    radial-gradient(ellipse at bottom right, rgba(240, 135, 159, 0.1), transparent 42%),
    radial-gradient(ellipse at center, rgba(40, 50, 80, 0.5), transparent 70%),
    var(--bg);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  opacity: 1;
  transition: transform 0.38s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.28s ease;
}

.learning-screen.hidden {
  transform: translateX(100%);
  opacity: 0;
}

.learning-screen-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px 12px;
  border-bottom: 1px solid rgba(200, 214, 240, 0.07);
  background: rgba(20, 26, 44, 0.88);
  backdrop-filter: blur(28px) saturate(1.2);
  -webkit-backdrop-filter: blur(28px) saturate(1.2);
}

.learning-screen-title-wrap {
  flex: 1;
  min-width: 0;
}

.learning-screen-title {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text);
}

.learning-screen-subtitle {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.learning-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(200, 214, 240, 0.07);
  background: rgba(18, 24, 40, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}


.learning-stage {
  flex: 1;
  min-height: 0;
  padding: 4px 0 0;
  overflow-y: auto;
  position: relative;
}

.learning-card-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 calc(env(safe-area-inset-bottom, 0px) + 16px);
  min-height: 36px;
  flex-shrink: 0;
}

.learning-card-counter:empty {
  display: none;
}

.learning-counter-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(200, 214, 240, 0.22);
  transition: background 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1), width 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
  flex-shrink: 0;
}

.learning-counter-dot.active {
  background: rgba(200, 214, 240, 0.72);
  width: 16px;
  border-radius: 999px;
  transform: scale(1);
}

.learning-stage::-webkit-scrollbar {
  width: 0;
}

.learning-carousel {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 20px 18px 28px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.learning-carousel::-webkit-scrollbar {
  display: none;
}

/* ====== LEARNING CARDS — glassmorphic floating flash cards ====== */
@keyframes card-float-up {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes reveal-answer {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.learning-card,
.learning-test-card {
  flex: 0 0 calc(100% - 44px);
  min-height: min(62vh, 560px);
  scroll-snap-align: center;
  scroll-snap-stop: always;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.024) 60%, rgba(255, 255, 255, 0.008) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-top-color: rgba(255, 255, 255, 0.22);
  border-radius: 32px;
  padding: 24px;
  box-shadow:
    0 28px 56px rgba(0, 0, 0, 0.36),
    0 10px 24px rgba(0, 0, 0, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  animation: card-float-up 0.42s cubic-bezier(0.34, 1.1, 0.64, 1) both;
  will-change: transform;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.learning-card {
  justify-content: space-between;
}

.learning-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.learning-card-badge,
.learning-test-prompt {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  font-weight: 600;
}

.learning-card-slow,
.learning-card-play,
.learning-action-btn,
.learning-test-reveal {
  border: 1px solid rgba(200, 214, 240, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 14px;
  font-family: var(--font);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.learning-card-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.learning-card-slow {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.45;
}

.learning-card-slow.is-active {
  opacity: 1;
  background: rgba(127, 184, 248, 0.2);
  border-color: rgba(127, 184, 248, 0.55);
  color: rgb(127, 184, 248);
}

.learning-card-slow:active {
  transform: scale(0.92);
}

.learning-card-play {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.learning-card-play:active {
  transform: scale(0.88);
  background: rgba(127, 184, 248, 0.18);
  border-color: rgba(127, 184, 248, 0.4);
}

@keyframes learning-play-spin {
  to { transform: rotate(360deg); }
}

@keyframes learning-play-glow {
  0%, 100% { box-shadow: 0 0 6px 2px rgba(52, 211, 153, 0.35); }
  50%       { box-shadow: 0 0 12px 4px rgba(52, 211, 153, 0.6); }
}

.learning-card-play[data-play-state="loading"] {
  pointer-events: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(200, 214, 240, 0.28);
}

.learning-card-play[data-play-state="loading"] svg {
  animation: learning-play-spin 0.9s linear infinite;
}

.learning-card-play[data-play-state="playing"] {
  pointer-events: none;
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.5);
  color: rgb(52, 211, 153);
  animation: learning-play-glow 1.4s ease-in-out infinite;
}

.learning-card-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.learning-card-block.reader-enabled {
  cursor: pointer;
}

.learning-card-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  font-weight: 600;
}

.learning-card-text {
  --adaptive-font-size-base: clamp(20px, 4.6vw, 28px);
  --adaptive-font-size-medium: clamp(22px, 4.9vw, 31px);
  --adaptive-font-size-large: clamp(24px, 5.3vw, 35px);
  --adaptive-font-size-hero: clamp(27px, 5.8vw, 40px);
  --adaptive-line-height-base: 1.32;
  --adaptive-line-height-medium: 1.26;
  --adaptive-line-height-large: 1.2;
  --adaptive-line-height-hero: 1.14;
  font-size: var(--adaptive-font-size, var(--adaptive-font-size-base));
  line-height: var(--adaptive-line-height, var(--adaptive-line-height-base));
  color: var(--text);
  word-break: break-word;
  overflow-wrap: anywhere;
  max-height: 8.2em;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.learning-card-text::-webkit-scrollbar {
  width: 4px;
}

.learning-card-text::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.learning-card-text.secondary {
  --adaptive-font-size-base: clamp(15px, 3.6vw, 18px);
  --adaptive-font-size-medium: clamp(16px, 3.8vw, 20px);
  --adaptive-font-size-large: clamp(17px, 4vw, 22px);
  --adaptive-font-size-hero: clamp(18px, 4.2vw, 24px);
  --adaptive-line-height-base: 1.42;
  --adaptive-line-height-medium: 1.36;
  --adaptive-line-height-large: 1.3;
  --adaptive-line-height-hero: 1.24;
  color: var(--text-secondary);
}

.learning-card-phonetic {
  font-size: 14px;
  line-height: 1.5;
  color: #f0d6b8;
}

.learning-card-actions,
.learning-test-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.learning-action-btn,
.learning-test-reveal {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
}

.learning-action-btn:active,
.learning-test-reveal:active {
  transform: scale(0.94);
  opacity: 0.82;
}

.learning-action-btn.primary,
.learning-test-reveal {
  border-color: rgba(127, 184, 248, 0.5);
  background: rgba(127, 184, 248, 0.12);
  box-shadow: 0 0 16px rgba(127, 184, 248, 0.08);
}

.learning-action-btn.success {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.1);
  box-shadow: 0 0 14px rgba(74, 222, 128, 0.07);
}

.learning-action-btn.subtle {
  color: var(--text-secondary);
}

/* Staggered card entrance delays */
.learning-carousel .learning-card:nth-child(1) { animation-delay: 0s; }
.learning-carousel .learning-card:nth-child(2) { animation-delay: 0.06s; }
.learning-carousel .learning-card:nth-child(3) { animation-delay: 0.11s; }
.learning-carousel .learning-card:nth-child(4) { animation-delay: 0.15s; }
.learning-carousel .learning-card:nth-child(n+5) { animation-delay: 0.18s; }


.learning-screen-empty {
  padding: 32px 22px;
}

.learning-test-shell {
  padding: 6px 16px 0;
}

.learning-test-card {
  width: 100%;
  min-height: 0;
  border-radius: 28px;
}

.learning-test-card .learning-card-text {
  font-size: clamp(22px, 5vw, 34px);
}

.learning-test-answer.hidden,
.learning-test-reveal.hidden,
.learning-test-actions.hidden {
  display: none;
}

.learning-test-answer {
  padding-top: 8px;
  animation: reveal-answer 0.35s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

.learning-test-actions:not(.hidden) {
  animation: reveal-answer 0.38s cubic-bezier(0.34, 1.2, 0.64, 1) 0.06s both;
}

@media (min-width: 900px) {
  .learning-card,
  .learning-test-card {
    flex-basis: min(520px, calc(100% - 180px));
  }
}

/* ====== DETAIL PANEL ====== */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--bg);
  z-index: 170;
  transform: translateX(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.detail-panel.hidden { transform: translateX(100%); }

.detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 10px 10px 8px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg);
}
.detail-header-info {
  flex: 1;
  min-width: 0;
}
.detail-title-text {
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  padding: 2px 0;
  transition: color 0.15s;
}
.detail-title-text:hover { color: var(--accent-en); }
.detail-title-input {
  font-size: 13px;
  font-weight: 400;
  background: var(--surface-raised);
  border: 1px solid var(--accent-en);
  border-radius: 10px;
  color: var(--text);
  padding: 3px 8px;
  width: 100%;
  font-family: var(--font);
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
.detail-date {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
  font-weight: 300;
}
.detail-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.detail-actions .icon-btn {
  padding: 7px;
}
.detail-delete-btn { transition: color 0.15s; }
.detail-delete-btn:active { color: #f06060; }

.detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.detail-content::-webkit-scrollbar { width: 3px; }
.detail-content::-webkit-scrollbar-track { background: transparent; }
.detail-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Chat bubbles */
.chat-bubble-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 88%;
  animation: bubble-in 0.3s ease both;
}
.chat-bubble-group.speaker-a { align-self: flex-start; }
.chat-bubble-group.speaker-b { align-self: flex-end; }

@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-bubble-meta {
  font-size: 10px;
  color: var(--text-dim);
  padding: 0 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  letter-spacing: 0.3px;
  font-weight: 300;
  margin-bottom: 1px;
}
.speaker-b .chat-bubble-meta { justify-content: flex-end; }

.chat-bubble {
  padding: 10px 14px;
  border-radius: 20px;
  --adaptive-font-size-base: 14px;
  --adaptive-font-size-medium: 15px;
  --adaptive-font-size-large: 17px;
  --adaptive-font-size-hero: 19px;
  --adaptive-line-height-base: 1.5;
  --adaptive-line-height-medium: 1.42;
  --adaptive-line-height-large: 1.34;
  --adaptive-line-height-hero: 1.24;
  font-size: var(--adaptive-font-size, var(--adaptive-font-size-base));
  line-height: var(--adaptive-line-height, var(--adaptive-line-height-base));
  font-weight: 300;
  position: relative;
  word-break: break-word;
  overflow-wrap: anywhere;
  -webkit-user-select: text;
  user-select: text;
  max-height: 9.5em;
  overflow: hidden;
}

.chat-bubble.original {
  background: var(--surface-raised);
  color: var(--text-secondary);
  --adaptive-font-size-base: 12px;
  --adaptive-font-size-medium: 13px;
  --adaptive-font-size-large: 14px;
  --adaptive-font-size-hero: 16px;
}
.speaker-a .chat-bubble.original {
  border-bottom-left-radius: 6px;
  border-top-left-radius: 20px;
}
.speaker-b .chat-bubble.original {
  border-bottom-right-radius: 6px;
  border-top-right-radius: 20px;
}

.chat-bubble.translated {
  --adaptive-font-size-base: 15px;
  --adaptive-font-size-medium: 17px;
  --adaptive-font-size-large: 19px;
  --adaptive-font-size-hero: 22px;
  font-weight: 400;
  color: var(--text);
}
.speaker-a .chat-bubble.translated {
  background: var(--accent-en-dim);
  border-top-left-radius: 6px;
  border-left: 2px solid rgba(127, 184, 248, 0.22);
}
.speaker-b .chat-bubble.translated {
  background: var(--accent-pl-dim);
  border-top-right-radius: 6px;
  border-right: 2px solid rgba(240, 135, 159, 0.22);
}

.chat-bubble.reader-enabled {
  cursor: pointer;
}

.chat-bubble.reader-enabled::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.chat-bubble.reader-enabled.chat-bubble-overflow::after {
  opacity: 1;
}

.speaker-a .chat-bubble.reader-enabled::after {
  background: linear-gradient(to top, rgba(30, 40, 58, 0.95), transparent);
}

.speaker-b .chat-bubble.original.reader-enabled::after,
.speaker-a .chat-bubble.original.reader-enabled::after {
  background: linear-gradient(to top, rgba(40, 50, 69, 0.95), transparent);
}

.speaker-a .chat-bubble.translated.reader-enabled::after {
  background: linear-gradient(to top, rgba(127, 184, 248, 0.18), transparent);
}

.speaker-b .chat-bubble.translated.reader-enabled::after {
  background: linear-gradient(to top, rgba(240, 135, 159, 0.18), transparent);
}

/* ====== PIN ROW ====== */
.pin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.pin-row input {
  flex: 1;
  width: auto;
  min-width: 120px;
  font-family: 'DM Sans', monospace;
  letter-spacing: 1.4px;
  font-weight: 400;
}

#pin-input {
  text-transform: uppercase;
}

#pin-input::placeholder {
  letter-spacing: 0.6px;
  text-transform: none;
}
.pin-action-btn {
  background: rgba(16, 22, 38, 0.8);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  cursor: pointer;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--glow-border);
}
.pin-action-btn:active,
.pin-action-btn.flash-green {
  color: var(--green);
  border-color: var(--green);
  background: rgba(74, 222, 128, 0.08);
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.22), 0 0 22px rgba(74, 222, 128, 0.12);
}
.pin-status {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 400;
  letter-spacing: 0.3px;
}
.pin-status.claimed { color: var(--green); }
.pin-status.error { color: #f06060; }

/* ====== CONFIRMATION MODAL ====== */
.confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.2s;
}
.confirm-modal.hidden { opacity: 0; pointer-events: none; }
.confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 26px 24px 22px;
  max-width: 280px;
  width: 85%;
  text-align: center;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.46);
  transform: scale(1);
  transition: transform 0.2s;
}
.confirm-modal.hidden .confirm-box { transform: scale(0.95); }
.confirm-box p {
  font-size: 14px;
  font-weight: 300;
  margin-bottom: 20px;
  line-height: 1.55;
  color: var(--text);
}
.confirm-actions {
  display: flex;
  gap: 10px;
}
.confirm-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 400;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.confirm-btn:active { background: var(--surface-hover); color: var(--text); }
.confirm-danger {
  background: rgba(240, 80, 80, 0.1);
  border-color: rgba(240, 80, 80, 0.22);
  color: #f06060;
}
.confirm-danger:active { background: rgba(240, 80, 80, 0.18); }
.confirm-safe {
  background: rgba(127, 184, 248, 0.1);
  border-color: rgba(127, 184, 248, 0.22);
  color: var(--accent-en);
}
.confirm-safe:active { background: rgba(127, 184, 248, 0.18); }

.confirm-live {
  background: rgba(93, 217, 154, 0.12);
  border-color: rgba(93, 217, 154, 0.32);
  color: #d7fff0;
}
.confirm-live:active { background: rgba(93, 217, 154, 0.2); }

.live-audio-box {
  max-width: 318px;
  padding: 28px 24px 22px;
  border-color: rgba(93, 217, 154, 0.22);
  background:
    radial-gradient(circle at 50% 0%, rgba(93, 217, 154, 0.11), transparent 42%),
    var(--surface);
}

.live-audio-icon {
  width: 66px;
  height: 66px;
  margin: 0 auto 16px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d7fff0;
  background: rgba(93, 217, 154, 0.1);
  border: 1px solid rgba(93, 217, 154, 0.22);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 14px 34px rgba(0, 0, 0, 0.2);
}

.confirm-box .live-audio-title {
  margin-bottom: 8px;
  font-size: 17px;
  font-weight: 500;
  color: #ffffff;
}

.confirm-box .live-audio-copy {
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.live-audio-tips {
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.42;
  text-align: left;
}

.live-audio-tips li {
  position: relative;
  padding-left: 16px;
}

.live-audio-tips li + li {
  margin-top: 7px;
}

.live-audio-tips li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(93, 217, 154, 0.78);
  box-shadow: 0 0 8px rgba(93, 217, 154, 0.24);
}

.live-guard-box {
  max-width: 320px;
  padding-top: 22px;
  border-color: rgba(93, 217, 154, 0.22);
  background:
    radial-gradient(circle at 50% 0%, rgba(93, 217, 154, 0.1), transparent 42%),
    var(--surface);
}

.live-guard-countdown {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d7fff0;
  border: 1px solid rgba(93, 217, 154, 0.38);
  background: rgba(93, 217, 154, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 22px rgba(93, 217, 154, 0.12);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.reader-box {
  width: min(92vw, 560px);
  max-height: min(78dvh, 760px);
  background: linear-gradient(180deg, rgba(24, 32, 50, 0.99), rgba(18, 24, 40, 0.99));
  border: 1px solid rgba(200, 214, 240, 0.13);
  border-radius: 28px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reader-box[data-theme="top"] {
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(127, 184, 248, 0.07),
    0 0 24px rgba(127, 184, 248, 0.1);
}

.reader-box[data-theme="bottom"] {
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(240, 135, 159, 0.07),
    0 0 24px rgba(240, 135, 159, 0.1);
}

.reader-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(200, 214, 240, 0.08);
}

.reader-heading {
  min-width: 0;
}

.reader-title {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.reader-subtitle {
  margin: 5px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.reader-body {
  padding: 18px;
  overflow-y: auto;
  --adaptive-font-size-base: clamp(20px, 4vw, 30px);
  --adaptive-font-size-medium: clamp(23px, 4.5vw, 34px);
  --adaptive-font-size-large: clamp(27px, 5vw, 40px);
  --adaptive-font-size-hero: clamp(31px, 5.8vw, 46px);
  --adaptive-line-height-base: 1.52;
  --adaptive-line-height-medium: 1.44;
  --adaptive-line-height-large: 1.34;
  --adaptive-line-height-hero: 1.22;
  font-size: var(--adaptive-font-size, var(--adaptive-font-size-base));
  line-height: var(--adaptive-line-height, var(--adaptive-line-height-base));
  color: var(--text);
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.reader-body::-webkit-scrollbar {
  width: 5px;
}

.reader-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.reader-phonetic {
  padding: 0 18px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #f0d6b8;
  letter-spacing: 0.01em;
}

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(200, 214, 240, 0.08);
}

.reader-action-btn {
  flex: 1 1 140px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 18px;
  border: 1px solid rgba(200, 214, 240, 0.13);
  background: rgba(26, 34, 52, 0.9);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  transition: transform 0.15s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.reader-action-btn.primary {
  background: rgba(127, 184, 248, 0.13);
  border-color: rgba(127, 184, 248, 0.28);
}

.reader-action-btn.accent {
  background: rgba(240, 135, 159, 0.13);
  border-color: rgba(240, 135, 159, 0.28);
}

.reader-action-btn.subtle {
  color: var(--text-secondary);
}

.reader-action-btn.success {
  background: rgba(93, 217, 154, 0.13);
  border-color: rgba(93, 217, 154, 0.4);
  color: #ecfff4;
}

.reader-action-btn.danger {
  background: rgba(244, 85, 85, 0.12);
  border-color: rgba(244, 85, 85, 0.38);
  color: #fff2f2;
}

.reader-action-btn.is-live {
  box-shadow:
    0 0 0 1px rgba(244, 85, 85, 0.07),
    0 0 16px rgba(244, 85, 85, 0.12);
}

.reader-action-btn.is-animated-success,
.reader-action-btn.saved-flash {
  animation: reader-success-pulse 900ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reader-action-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.reader-action-icon {
  position: relative;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.reader-action-icon--replay::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 1px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid currentColor;
}

.reader-action-icon--stop {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
  border-radius: 999px;
  background: rgba(244, 85, 85, 0.92);
  box-shadow: 0 0 12px rgba(244, 85, 85, 0.2);
}

.reader-action-icon--stop::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 2px;
  background: #fff;
}

.reader-action-icon--check::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 4px;
  width: 10px;
  height: 5px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.reader-action-icon--save::before {
  content: '';
  position: absolute;
  inset: 1px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.reader-action-icon--save::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  top: 3px;
  height: 4px;
  background: currentColor;
  border-radius: 1px;
}

.reader-action-icon--slow {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  box-sizing: border-box;
}

.reader-action-icon--slow::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 1.5px;
  height: 6px;
  background: currentColor;
  border-radius: 1px;
  transform-origin: bottom center;
  transform: rotate(0deg);
}

.reader-action-icon--slow::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 5px;
  width: 5px;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
}

.reader-action-btn.is-active-toggle {
  background: rgba(127, 184, 248, 0.18);
  border-color: rgba(127, 184, 248, 0.45);
  color: rgb(127, 184, 248);
}

.reader-action-btn:active {
  transform: scale(0.98);
}

.reader-action-btn:disabled {
  opacity: 0.45;
}

.reader-action-btn.success:disabled {
  opacity: 1;
}

@keyframes reader-success-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(93, 217, 154, 0);
  }
  35% {
    transform: scale(1.02);
    box-shadow:
      0 0 0 1px rgba(93, 217, 154, 0.14),
      0 0 20px rgba(93, 217, 154, 0.18);
  }
  100% {
    transform: scale(1);
    box-shadow:
      0 0 0 1px rgba(93, 217, 154, 0.08),
      0 0 16px rgba(93, 217, 154, 0.12);
  }
}

/* New conversation modal — wider to fit 3 buttons */
#new-conv-modal .confirm-box {
  max-width: 340px;
}
#new-conv-modal .confirm-actions {
  flex-wrap: wrap;
  gap: 8px;
}
#new-conv-modal .confirm-btn {
  flex: 1 1 calc(50% - 4px);
  font-size: 12px;
  padding: 10px;
}
#new-conv-modal #new-conv-cancel {
  flex: 1 1 100%;
}

/* New conversation button */
.new-conv-btn {
  color: var(--text-secondary);
  transition: opacity 0.3s, color 0.2s;
}
.new-conv-btn.hidden { opacity: 0; pointer-events: none; }
.new-conv-btn:hover { color: var(--accent-en); }

/* Save button glow when unsaved changes exist */
.save-btn.unsaved {
  color: var(--accent-en);
  filter: drop-shadow(0 0 5px var(--accent-en));
  animation: save-pulse 2s ease-in-out infinite;
}
@keyframes save-pulse {
  0%, 100% { filter: drop-shadow(0 0 3px var(--accent-en)); opacity: 0.9; }
  50% { filter: drop-shadow(0 0 9px var(--accent-en)); opacity: 1; }
}
.save-btn.saved {
  color: #4caf6e;
  filter: drop-shadow(0 0 5px #4caf6e);
  transition: color 0.3s, filter 0.3s;
}

.account-box {
  width: min(92vw, 420px);
  max-width: 420px;
  text-align: left;
  border-color: rgba(127, 184, 248, 0.18);
  box-shadow: 0 20px 58px rgba(0, 0, 0, 0.5), 0 0 20px rgba(127, 184, 248, 0.06);
  max-height: min(78dvh, 540px);
  overflow-y: auto;
  border-radius: 28px;
}

.account-title {
  margin-bottom: 6px !important;
  font-size: 19px !important;
  font-weight: 500 !important;
  letter-spacing: 0.2px;
}

.account-subtitle {
  margin-bottom: 14px !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
  color: var(--text-secondary) !important;
}

.account-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  background: rgba(16, 22, 38, 0.7);
  padding: 4px;
  border: 1px solid rgba(200, 214, 240, 0.12);
  border-radius: 16px;
}

.account-tabs .confirm-btn {
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  border-color: transparent;
}

.account-tabs .confirm-btn.active {
  background: rgba(127, 184, 248, 0.15);
  border-color: rgba(127, 184, 248, 0.42);
  color: #fff;
}

.account-fields {
  display: grid;
  gap: 10px;
  margin-bottom: 4px;
}

.account-input {
  width: 100%;
  background: rgba(16, 22, 38, 0.9);
  border: 1px solid rgba(200, 214, 240, 0.16);
  border-radius: 14px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  -webkit-user-select: text;
  user-select: text;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.account-input:focus {
  border-color: rgba(127, 184, 248, 0.9);
  box-shadow: 0 0 0 3px rgba(127, 184, 248, 0.16);
}

.account-input::placeholder {
  color: rgba(168, 180, 205, 0.48);
}

.account-error {
  min-height: 34px;
  margin: 10px 0 8px !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
  color: #f0708a !important;
  word-break: break-word;
}

.account-primary-btn {
  background: rgba(127, 184, 248, 0.15);
  border-color: rgba(127, 184, 248, 0.48);
  color: #cee4ff;
}

.account-primary-btn:active {
  background: rgba(127, 184, 248, 0.24);
  color: #fff;
}

.account-logout-btn {
  margin-top: 14px;
  width: 100%;
}

.account-element-hidden {
  display: none !important;
}

@media (max-width: 420px) {
  .account-box {
    width: 94vw;
    padding: 20px 18px 16px;
    max-height: 80dvh;
  }

  .account-title {
    font-size: 18px !important;
  }
}

/* ====== INITIALIZATION OVERLAY ====== */
.init-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.init-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
}
.init-overlay.hidden {
  display: none;
}
.init-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.init-logo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 36px rgba(255, 255, 255, 0.07), 0 0 72px rgba(255, 255, 255, 0.03);
}
.init-logo img {
  width: 66px;
  height: auto;
}
.init-title {
  font-size: 16px;
  font-weight: 300;
  letter-spacing: 4px;
  text-transform: lowercase;
  color: var(--text-dim);
}
.init-status {
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  font-weight: 300;
  min-height: 18px;
  transition: opacity 0.2s;
}
.init-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-en);
  border-radius: 50%;
  animation: init-spin 0.8s linear infinite;
}
.init-spinner.done {
  border-color: var(--green);
  border-top-color: var(--green);
  animation: none;
}
@keyframes init-spin {
  to { transform: rotate(360deg); }
}

/* ====== SCREEN-READER ONLY ====== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ====== CAMERA BUTTON (DIVIDER) ====== */
@keyframes camera-float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-3px); }
}

.camera-btn {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(127, 184, 248, 0.32);
  background: radial-gradient(circle at 40% 35%, rgba(127, 184, 248, 0.14), rgba(18, 24, 42, 0.88) 70%);
  color: rgba(210, 230, 255, 0.92);
  box-shadow:
    0 0 12px rgba(127, 184, 248, 0.18),
    0 4px 14px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  animation: camera-float 3.2s ease-in-out infinite;
  transition:
    flex-basis 0.28s ease,
    width 0.28s ease,
    min-width 0.28s ease,
    opacity 0.22s ease,
    transform 0.24s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.camera-btn svg {
  filter: drop-shadow(0 0 4px rgba(160, 210, 255, 0.4));
}
.camera-btn:active {
  animation: none;
  transform: scale(0.93);
  box-shadow:
    0 0 18px rgba(127, 184, 248, 0.28),
    0 2px 8px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  border-color: rgba(127, 184, 248, 0.5);
}

/* ====== PHOTO TRANSLATION LIGHTBOX ====== */
.photo-lightbox {
  position: relative;
  width: min(92vw, 420px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: rgba(18, 24, 40, 0.99);
  border: 1px solid rgba(200, 214, 240, 0.13);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease-out;
}
.photo-modal-visible .photo-lightbox {
  transform: scale(1);
  opacity: 1;
}

.photo-image-wrap {
  position: relative;
  width: 100%;
  min-height: 60vh;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}

.photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  inset: 0;
}

.photo-blur-overlay {
  position: sticky;
  top: 0;
  width: 100%;
  min-height: 60vh;
  background: rgba(18, 24, 40, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  opacity: 0;
  transition: backdrop-filter 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              -webkit-backdrop-filter 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.5s ease-out,
              opacity 0.5s ease-out;
  pointer-events: none;
}
.photo-blur-overlay.active {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(18, 24, 44, 0.55);
  opacity: 1;
}

.photo-result {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 28px 40px;
  text-align: center;
  margin-top: -60vh;
  min-height: 60vh;
  justify-content: center;
  pointer-events: none;
}
/* Ensure blur covers content that extends beyond the 60vh overlay */
.photo-result::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(18, 24, 44, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transition: opacity 0.5s ease-out;
}
.photo-blur-overlay.active ~ .photo-result::after {
  opacity: 1;
}

/* — Sweep reveal animation — */
@keyframes photo-text-sweep {
  0% {
    opacity: 0;
    transform: translateY(14px);
    clip-path: inset(0 0 100% 0);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    clip-path: inset(0 0 0 0);
  }
}

.photo-translation {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1.38;
  margin: 0;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(14px);
  clip-path: inset(0 0 100% 0);
}
.photo-translation.visible {
  animation: photo-text-sweep 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.photo-explanation {
  font-size: 15px;
  font-weight: 400;
  color: rgba(225, 232, 248, 0.9);
  line-height: 1.55;
  margin: 18px 0 0;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(14px);
  clip-path: inset(0 0 100% 0);
}
.photo-explanation.visible {
  animation: photo-text-sweep 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.12s forwards;
}

/* --- Structured text/menu mode --- */
.photo-menu-container,
.photo-paragraph-container {
  width: 100%;
  text-align: left;
  opacity: 0;
  transform: translateY(14px);
  clip-path: inset(0 0 100% 0);
}

.photo-menu-container.visible,
.photo-paragraph-container.visible {
  animation: photo-text-sweep 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.photo-menu-section + .photo-menu-section {
  margin-top: 18px;
}

.photo-menu-title {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  color: rgba(184, 213, 255, 0.95);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.photo-menu-item {
  margin: 0;
  padding: 7px 0;
  border-top: 1px solid rgba(225, 232, 248, 0.14);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.38;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.photo-paragraph-container {
  max-width: 34em;
  margin: 0 auto;
}

.photo-paragraph-container p {
  margin: 0 0 12px;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.48;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.photo-paragraph-container p:last-child {
  margin-bottom: 0;
}

/* --- Object/Scene mode --- */
.photo-object-container {
  width: 100%;
  text-align: left;
  padding: 0 4px;
  opacity: 0;
  transform: translateY(14px);
  clip-path: inset(0 0 100% 0);
}

.photo-object-container.visible {
  animation: photo-text-sweep 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.photo-object-summary {
  font-size: 16px;
  color: rgba(225, 232, 248, 0.85);
  line-height: 1.45;
  margin: 0 0 18px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

.photo-object-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.photo-object-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.photo-object-foreign {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-pl);
  line-height: 1.3;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.photo-object-phonetic {
  font-size: 13px;
  font-style: italic;
  color: rgba(225, 232, 248, 0.55);
  line-height: 1.3;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.photo-object-english {
  font-size: 14px;
  color: rgba(225, 232, 248, 0.85);
  line-height: 1.45;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.photo-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 14px 20px;
  flex-shrink: 0;
  background: rgba(18, 24, 40, 0.99);
  border-top: 1px solid rgba(200, 214, 240, 0.08);
  position: relative;
}
.photo-actions #photo-close {
  position: absolute;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  opacity: 0.5;
}
.photo-actions #photo-close:active {
  opacity: 0.8;
}

.photo-action-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.photo-action-btn:active {
  background: var(--surface-hover);
  color: var(--text);
}
.photo-action-camera {
  width: 48px;
  height: 48px;
}
/* Play button loading spinner ring */
@keyframes photo-btn-spin {
  to { transform: rotate(360deg); }
}
.photo-action-btn.is-loading {
  position: relative;
  border-color: transparent;
  pointer-events: none;
}
.photo-action-btn.is-loading::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent-en);
  border-right-color: rgba(127, 184, 248, 0.25);
  animation: photo-btn-spin 0.8s linear infinite;
}
/* Play button active (playing) state */
.photo-action-btn.is-playing {
  border-color: rgba(127, 184, 248, 0.4);
  color: var(--accent-en);
}

/* — Loading: full-image sweep + breathing text — */
@keyframes photo-sweep {
  0% { transform: translateX(-100%) skewX(-15deg); }
  100% { transform: translateX(250%) skewX(-15deg); }
}
@keyframes photo-breathe {
  0%, 100% { opacity: 0.5; letter-spacing: 0.12em; }
  50% { opacity: 1; letter-spacing: 0.22em; }
}

.photo-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: rgba(14, 20, 36, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity 0.22s ease;
  overflow: hidden;
}
/* Full-width light sweep across the image */
.photo-loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(140, 195, 255, 0.06) 20%,
    rgba(180, 220, 255, 0.15) 45%,
    rgba(220, 240, 255, 0.22) 50%,
    rgba(180, 220, 255, 0.15) 55%,
    rgba(140, 195, 255, 0.06) 80%,
    transparent 100%);
  animation: photo-sweep 2s ease-in-out infinite;
}
.photo-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.photo-loading-pulse {
  display: none;
}

.photo-loading-text {
  font-size: 18px;
  font-weight: 500;
  color: rgba(220, 235, 255, 0.95);
  letter-spacing: 0.12em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5), 0 0 30px rgba(127, 184, 248, 0.2);
  animation: photo-breathe 2s ease-in-out infinite;
  z-index: 1;
  text-transform: lowercase;
}

/* ====== TURN-BASED LIVE CAPTION MIC LAYOUT ====== */
body.live-caption-turn .language-section {
  --listening-level: 0.08;
}

body.live-caption-turn.live-direction-top-to-bottom .section-top,
body.live-caption-turn.live-direction-bottom-to-top .section-bottom {
  flex: 0 0 clamp(116px, 15dvh, 146px);
  padding-block: 12px;
  justify-content: center;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, calc(0.02 + var(--listening-level) * 0.08)),
    inset 0 0 calc(30px + var(--listening-level) * 70px) rgba(128, 185, 248, calc(0.04 + var(--listening-level) * 0.12));
}

body.live-caption-turn.live-direction-bottom-to-top .section-bottom {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, calc(0.02 + var(--listening-level) * 0.08)),
    inset 0 0 calc(30px + var(--listening-level) * 70px) rgba(240, 135, 159, calc(0.04 + var(--listening-level) * 0.12));
}

body.live-caption-turn.live-direction-top-to-bottom .section-bottom,
body.live-caption-turn.live-direction-bottom-to-top .section-top {
  flex: 1 1 auto;
  transform: none;
}

body.live-caption-turn .language-section.live-caption-speaking .section-header {
  margin-bottom: 4px;
  transform: translateY(-2px);
}

body.live-caption-turn .language-section.live-caption-speaking .text-display,
body.live-caption-turn .language-section.live-caption-speaking .suggestions-shell {
  display: none !important;
}

body.live-caption-turn .language-section.live-caption-speaking .gender-wrap {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px) scale(0.92);
  visibility: hidden;
}

body.live-caption-turn .language-section.live-caption-speaking .section-body {
  flex: 0 0 auto;
  min-height: 0;
  padding: 0;
  z-index: 42;
}

body.live-caption-turn .language-section.live-caption-speaking .status-text.status-listening {
  --pulse-size: calc(1 + var(--listening-level) * 1.35);
  --bar-width: calc(24px + var(--listening-level) * 64px);
  --bar-opacity: calc(0.42 + var(--listening-level) * 0.44);
  font-size: clamp(17px, 2.5vw, 24px);
  font-weight: 650;
  letter-spacing: 0.01em;
  max-width: calc(100% - 96px);
  color: rgba(242, 247, 255, 0.96);
  text-shadow: 0 0 calc(12px + var(--listening-level) * 18px) rgba(190, 220, 255, 0.28);
  animation-duration: 0.9s;
}

body.live-caption-turn .language-section.live-caption-speaking .status-text.status-listening::before {
  width: 10px;
  height: 10px;
  transform: scale(var(--pulse-size));
  opacity: calc(0.62 + var(--listening-level) * 0.35);
  box-shadow: 0 0 calc(8px + var(--listening-level) * 24px) currentColor;
  animation-duration: 0.9s;
}

body.live-caption-turn .language-section.live-caption-speaking .status-text.status-listening::after {
  width: var(--bar-width);
  height: 5px;
  opacity: var(--bar-opacity);
  box-shadow: 0 0 calc(8px + var(--listening-level) * 22px) currentColor;
  animation-duration: 0.9s;
}

body.live-caption-turn .language-section.live-caption-speaking .mic-corner {
  top: 50%;
  right: 16px;
  bottom: auto;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(0.72);
  z-index: 44;
}

body.live-caption-turn .language-section.live-caption-speaking .mic-btn.recording {
  background: rgba(240, 72, 100, 0.18);
  border-color: rgba(255, 118, 145, 0.9);
  color: rgba(255, 148, 170, 0.98);
  box-shadow:
    0 0 calc(16px + var(--glow) * 28px) rgba(240, 112, 138, calc(0.26 + var(--glow) * 0.42)),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  transform: scale(calc(1 + var(--glow) * 0.05));
}

body.live-caption-turn .language-section.live-caption-speaking .mic-btn.recording .mic-icon {
  display: none !important;
}

body.live-caption-turn .language-section.live-caption-speaking .mic-btn.recording .stop-icon {
  display: block !important;
  color: rgba(255, 148, 170, 0.98);
  transform: scale(1.04);
  filter: drop-shadow(0 0 6px rgba(255, 118, 145, 0.55));
}

body.live-caption-turn .language-section.live-caption-speaking .mic-btn.recording .stop-icon rect {
  fill: currentColor;
}

body.live-caption-turn .language-section.live-caption-speaking .mic-ring,
body.live-caption-turn .language-section.live-caption-speaking .mic-ring-2 {
  border-color: rgba(255, 118, 145, 0.42);
  animation-duration: 1.1s;
}

/* ====== CONTINUOUS LIVE INTERPRETER MODE ====== */
body.live-interpreter-active {
  background: #101827;
}

body.live-interpreter-active .divider {
  display: none;
}

body.live-interpreter-active .language-section {
  border: 0;
}

body.live-interpreter-active.live-direction-bottom-to-top .section-top,
body.live-interpreter-active.live-direction-top-to-bottom .section-bottom {
  flex: 1 1 auto;
  padding: clamp(18px, 3vw, 34px);
  justify-content: flex-start;
}

body.live-interpreter-active.live-direction-bottom-to-top .section-bottom,
body.live-interpreter-active.live-direction-top-to-bottom .section-top {
  flex: 0 0 clamp(82px, 11dvh, 116px);
  padding-block: 10px;
  opacity: 0.72;
  filter: saturate(0.82);
}

body.live-interpreter-active .section-header {
  margin-bottom: clamp(16px, 3vh, 28px);
}

body.live-interpreter-active .gender-wrap {
  display: none;
}

body.live-interpreter-active .live-caption-target {
  width: 100%;
  max-width: 100%;
}

body.live-interpreter-active .text-display.live-caption-target,
body.live-interpreter-active .text-display.live-caption-target.has-content {
  width: 100%;
  max-width: 100%;
  min-height: clamp(360px, 56dvh, 720px);
  max-height: none;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    radial-gradient(circle at 16% 0%, rgba(127, 184, 248, 0.14), transparent 48%);
  border-color: rgba(185, 218, 255, 0.26);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.045) inset;
}

body.live-interpreter-active .text-display.live-caption-target.has-content::before {
  height: 16px;
  background: linear-gradient(180deg, rgba(30, 38, 56, 0.58), rgba(30, 38, 56, 0));
}

body.live-interpreter-active .live-caption-target .text-content {
  --adaptive-font-size-base: 21px;
  --adaptive-font-size-medium: 23px;
  --adaptive-font-size-large: 25px;
  --adaptive-font-size-hero: 28px;
  --adaptive-line-height-base: 1.28;
  --adaptive-line-height-medium: 1.24;
  --adaptive-line-height-large: 1.2;
  --adaptive-line-height-hero: 1.16;
  box-sizing: border-box;
  width: 100%;
  max-inline-size: 100%;
  margin: 0;
  padding: 14px clamp(18px, 3vw, 32px) 20px;
  font-weight: 560;
  overflow-wrap: break-word;
}

body.live-interpreter-active .text-display.live-caption-source.has-content {
  min-height: 0;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

body.live-interpreter-active .live-caption-source .text-content {
  display: none;
}

body.live-interpreter-active .mic-corner {
  opacity: 0;
  pointer-events: none;
}

body.live-interpreter-active .status-text.status-listening {
  font-size: 15px;
  opacity: 0.76;
}

@media (max-width: 520px) {
  body.live-interpreter-active .live-caption-target .text-content {
    --adaptive-font-size-base: 18px;
    --adaptive-font-size-medium: 20px;
    --adaptive-font-size-large: 22px;
    --adaptive-font-size-hero: 24px;
    padding: 14px 18px 18px;
  }
}
