/* ============================================
   译思 — Clean Translation Interface
   Design: Minimal Dark · Typography-First
   Fonts: Plus Jakarta Sans (UI) · Lora (text)
   ============================================ */

/* ── Variables ──────────────────────────────── */

:root {
  /* Core palette — Light theme (default) */
  --bg:            #F5F5F7;
  --surface:       #FFFFFF;
  --surface-2:     #EDEDF2;
  --surface-hover: #E4E4EC;

  --border:        #DCDCE8;
  --border-2:      #C8C8D8;

  --text-1:        #18181C;
  --text-2:        #505068;
  --text-3:        #8A8AA4;

  --accent:        #0D9488;        /* deeper teal for contrast on light */
  --accent-hover:  #0F766E;
  --accent-glow:   rgba(13, 148, 136, 0.14);
  --accent-dim:    rgba(13, 148, 136, 0.08);

  --live:          #DC2626;
  --live-glow:     rgba(220, 38, 38, 0.1);

  --transl-color:  #065F46;        /* deep emerald — readable on light */
  --orig-color:    #1D4ED8;        /* deep blue   — readable on light */

  --success:       #059669;
  --success-glow:  rgba(5, 150, 105, 0.15);
  --warning:       #D97706;
  --error:         #DC2626;

  /* Legacy aliases — used by inline JS styles in app.ts */
  --color-bg:               var(--bg);
  --color-surface:          var(--surface);
  --color-surface-elevated: var(--surface-2);
  --color-surface-hover:    var(--surface-hover);
  --color-text-primary:     var(--text-1);
  --color-text-secondary:   var(--text-2);
  --color-text-tertiary:    var(--text-3);
  --color-accent:           var(--accent);
  --color-accent-hover:     var(--accent-hover);
  --color-accent-glow:      var(--accent-glow);
  --color-success:          var(--success);
  --color-success-glow:     var(--success-glow);
  --color-warning:          var(--warning);
  --color-error:            var(--error);
  --color-border:           var(--border);
  --color-border-light:     var(--border-2);

  /* Typography */
  --font-ui:      'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-text:    'Lora', 'Noto Serif', 'Source Han Serif SC', Georgia, serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;
  --font-display: var(--font-text);   /* legacy alias */

  /* Spacing */
  --spacing-xs:  0.5rem;
  --spacing-sm:  0.75rem;
  --spacing-md:  1rem;
  --spacing-lg:  1.5rem;
  --spacing-xl:  2rem;
  --spacing-2xl: 3rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm:     0 1px 4px rgba(0, 0, 0, 0.10);
  --shadow-md:     0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg:     0 16px 48px rgba(0, 0, 0, 0.18);
  --shadow-accent: 0 4px 20px var(--accent-glow);

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 360ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  height: 100%;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-1);
  background: var(--bg);
  overflow: hidden;
}

/* ── App shell ────────────────────────────────── */

.app-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.875rem 1.25rem 1.25rem;
  gap: 0.75rem;
}

/* ── Top bar ──────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-text);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.01em;
}

.brand-tagline {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Status area */
.topbar-indicators {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.status-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-2);
}

.status-hint {
  /* hidden visually but kept in DOM */
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
  transition: background var(--transition-base), box-shadow var(--transition-base);
}

.status-item.connected .status-dot {
  background: var(--success);
  box-shadow: 0 0 8px var(--success-glow);
  animation: dot-pulse 2.5s ease-in-out infinite;
}

.status-item.reconnecting .status-dot {
  background: var(--warning);
  animation: dot-pulse 1s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Recording badge */
.rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--live);
  background: var(--live-glow);
  border: 1px solid rgba(248, 113, 113, 0.22);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
}

.rec-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--live);
  animation: rec-blink 1.1s ease-in-out infinite;
}

@keyframes rec-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

/* User nav */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

/* .user-panel class alias for JS querySelector compatibility */
.user-panel {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.topbar-username {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-2);
}

.topbar-balance {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-3);
  padding: 0.15rem 0.42rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.topbar-btn:hover {
  color: var(--text-1);
  background: var(--surface-2);
}

/* Language switcher button — created by i18n.ts createLangSwitcher('btn-lang') */
.btn-lang {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-3);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.48rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-lang:hover {
  color: var(--text-2);
  border-color: var(--border-2);
  background: var(--surface-2);
}

/* ── Session controls bar ─────────────────────── */

.session-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.input-row {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.input-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.input-label svg {
  color: var(--accent);
  flex-shrink: 0;
}

.mic-select {
  width: 100%;
  padding: 0.48rem 0.75rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.mic-select:hover:not(:disabled) {
  border-color: var(--border-2);
}

.mic-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.mic-select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Session action buttons group */
.session-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.48rem 1rem;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  outline: none;
  white-space: nowrap;
  transition: all var(--transition-base);
}

.btn svg {
  flex-shrink: 0;
}

/* Keep legacy .btn-icon class for any pre-existing references */
.btn-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0d;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: var(--shadow-accent);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-stop {
  background: var(--live);
  color: #fff;
}

.btn-stop:hover:not(:disabled) {
  background: #ef4444;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: var(--border-2);
}

/* ── Translation feed ─────────────────────────── */

.translation-feed {
  flex: 1;
  min-height: 0;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem 1.5rem;   /* top padding leaves room for feed-controls */
  overflow-y: auto;
}

/* Feed display mode hide rules */
.translation-feed[data-display-mode="translation_only"] .utterance-text[data-kind="original"] {
  display: none;
}

.translation-feed[data-display-mode="original_only"] .utterance-text[data-kind="translation"] {
  display: none;
}

/* Fullscreen */
.translation-feed:fullscreen {
  border-radius: 0;
  border: none;
  padding-top: 3.5rem;
}

:-webkit-full-screen .translation-feed {
  border-radius: 0;
  border: none;
}

/* Custom scrollbar */
.translation-feed::-webkit-scrollbar { width: 5px; }
.translation-feed::-webkit-scrollbar-track { background: transparent; }
.translation-feed::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}
.translation-feed::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

/* ── Feed controls overlay ────────────────────── */

.feed-controls {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.feed-display-toggle {
  display: inline-flex;
  background: rgba(22, 22, 25, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.feed-toggle-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.32rem 0.58rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.feed-toggle-btn + .feed-toggle-btn {
  border-left: 1px solid var(--border);
}

.feed-toggle-btn:hover {
  color: var(--text-1);
  background: var(--surface-2);
}

.feed-toggle-btn[aria-pressed="true"] {
  background: var(--accent-dim);
  color: var(--accent);
}

.feed-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(22, 22, 25, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-3);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all var(--transition-fast);
}

.feed-icon-btn:hover {
  color: var(--text-1);
  border-color: var(--border-2);
  background: var(--surface-2);
}

/* Legacy btn-icon-link support */
.btn-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.btn-icon-link:hover {
  color: var(--text-1);
  background: var(--surface-2);
}

/* fullscreen label — visually hidden but in DOM for JS access */
.fullscreen-label {
  display: none;
}

/* ── Empty state ──────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  text-align: center;
  gap: 0.65rem;
  animation: fade-in 0.5s ease;
}

.empty-icon {
  width: 52px;
  height: 52px;
  color: var(--text-3);
  margin-bottom: 0.35rem;
  opacity: 0.7;
}

.empty-icon svg {
  width: 100%;
  height: 100%;
}

.empty-title {
  font-family: var(--font-text);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text-2);
}

.empty-message {
  font-size: 0.83rem;
  color: var(--text-3);
  max-width: 320px;
  line-height: 1.7;
}

/* ── Utterance blocks ─────────────────────────── */

.utterance-block {
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  animation: slide-up 0.28s ease;
}

.utterance-block:last-child {
  border-bottom: none;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.utterance-block.updating {
  /* live / in-progress utterance */
}

.utterance-block.updating .text-content {
  animation: breathe 1.8s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* Timestamp */
.utterance-timestamp {
  order: -2;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-3);
  letter-spacing: 0.05em;
  margin-bottom: 0.55rem;
}

/* Translation section — show FIRST via CSS order */
.utterance-text[data-kind="translation"] {
  order: -1;
  margin-bottom: 0.35rem;
}

/* Original section — default order: 0 (shows after translation) */
.utterance-text[data-kind="original"] {
  /* inherits default order: 0 */
}

/* Text labels ("Original" / "Translation") — visually hidden */
.text-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* Translation text (output) — prominent */
.text-content.translation {
  font-family: var(--font-text);
  font-size: 1.2rem;
  line-height: 1.75;
  color: var(--transl-color);
  word-break: break-word;
}

/* Original text (input) — secondary */
.text-content.original {
  font-family: var(--font-text);
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--orig-color);
  opacity: 0.7;
  word-break: break-word;
}

/* Generic .text-content fallback */
.text-content {
  font-family: var(--font-text);
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--text-1);
  word-break: break-word;
}

/* Loading placeholder when content is empty */
.text-content:empty::before {
  content: '···';
  color: var(--text-3);
  letter-spacing: 0.25em;
  font-style: normal;
  font-size: 0.85em;
}

/* Fade-in highlight for newly added text */
@keyframes text-highlight-fade {
  0%   { color: var(--accent); }
  100% { color: inherit; }
}

.text-content .text-highlight,
.pip-translation .text-highlight,
.pip-original .text-highlight {
  animation: text-highlight-fade 2s ease-out forwards;
}

/* ── Modal ────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 12, 0.82);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--spacing-xl);
  animation: fade-in 0.2s ease;
}

.modal-dialog {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  max-width: 760px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modal-up 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-up {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-family: var(--font-text);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-1);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-close:hover {
  background: var(--surface-2);
  color: var(--text-1);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Summary content */
.summary-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-2xl);
  gap: 1rem;
  text-align: center;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.summary-loading p {
  font-size: 0.85rem;
  color: var(--text-2);
}

.summary-field {
  margin-bottom: var(--spacing-xl);
  animation: fade-in 0.4s ease backwards;
}

.summary-field:nth-child(1) { animation-delay: 0.05s; }
.summary-field:nth-child(2) { animation-delay: 0.1s; }
.summary-field:nth-child(3) { animation-delay: 0.15s; }
.summary-field:nth-child(4) { animation-delay: 0.2s; }

.summary-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.summary-label::before {
  content: '';
  width: 10px;
  height: 2px;
  background: var(--accent);
  opacity: 0.7;
}

.summary-value {
  font-family: var(--font-text);
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-1);
  padding: 1rem 1.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-md);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.summary-error {
  padding: 1rem 1.25rem;
  background: rgba(248, 113, 113, 0.07);
  border: 1px solid var(--error);
  border-left: 2px solid var(--error);
  border-radius: var(--radius-md);
  color: #fca5a5;
  font-size: 0.85rem;
}

/* ── Picture-in-Picture pill window ──────────────────── */

.pip-pill-body {
  margin: 0;
  padding: 0;
  background: rgba(245, 245, 247, 0.98);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  box-sizing: border-box;
}

.pip-pill {
  position: relative;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  padding: 28px 18px 14px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.pip-pill-controls {
  position: absolute;
  top: 5px;
  right: 7px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.15s;
}

.pip-pill:hover .pip-pill-controls {
  opacity: 1;
}

.pip-pill-controls button {
  background: rgba(0, 0, 0, 0.07);
  border: none;
  border-radius: 4px;
  color: #333;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.pip-pill-controls button:hover {
  background: rgba(0, 0, 0, 0.15);
}

.pip-pill-controls button.active {
  background: rgba(13, 148, 136, 0.35);
  color: #065F46;
}

.pip-controls-sep {
  width: 1px;
  height: 14px;
  background: rgba(0, 0, 0, 0.15);
  margin: 0 2px;
  align-self: center;
}

.pip-pill .pip-translation {
  color: #065F46;
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: break-word;
}

.pip-pill .pip-original {
  color: rgba(0, 0, 0, 0.5);
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 12px;
  line-height: 1.4;
  margin-top: 4px;
  word-break: break-word;
  overflow-wrap: break-word;
}

.pip-pill .pip-original:empty {
  display: none;
}

.pip-translation p,
.pip-original p {
  margin: 0;
}

.pip-translation p + p {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(128, 128, 128, 0.15);
}

.pip-original p + p {
  margin-top: 3px;
}

/* Dark theme pip overrides */
[data-theme="dark"] .pip-pill-body {
  background: #08080a;
}
[data-theme="dark"] .pip-pill {
  background: rgba(0, 0, 0, 0.86);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .pip-pill-controls button {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
[data-theme="dark"] .pip-pill-controls button:hover {
  background: rgba(255, 255, 255, 0.3);
}
[data-theme="dark"] .pip-pill-controls button.active {
  background: rgba(45, 212, 191, 0.45);
  color: #fff;
}
[data-theme="dark"] .pip-controls-sep {
  background: rgba(255, 255, 255, 0.15);
}
[data-theme="dark"] .pip-pill .pip-translation {
  color: #ffffff;
}
[data-theme="dark"] .pip-pill .pip-original {
  color: rgba(255, 255, 255, 0.45);
}

/* ── Utility ──────────────────────────────────── */

.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;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Dark theme ───────────────────────────────── */

[data-theme="dark"] {
  --bg:            #0C0C0F;
  --surface:       #161619;
  --surface-2:     #1E1E24;
  --surface-hover: #252530;

  --border:        #2B2B36;
  --border-2:      #393948;

  --text-1:        #F0F0F3;
  --text-2:        #8A8AA0;
  --text-3:        #4C4C66;

  --accent:        #2DD4BF;
  --accent-hover:  #5EEAD4;
  --accent-glow:   rgba(45, 212, 191, 0.12);
  --accent-dim:    rgba(45, 212, 191, 0.08);

  --live:          #F87171;
  --live-glow:     rgba(248, 113, 113, 0.18);

  --transl-color:  #A7F3D0;   /* translation output — soft mint  */
  --orig-color:    #93C5FD;   /* original speech   — soft blue   */

  --success:       #34D399;
  --success-glow:  rgba(52, 211, 153, 0.15);
  --warning:       #FCD34D;
  --error:         #F87171;

  /* Shadows override for dark */
  --shadow-sm:     0 1px 4px rgba(0, 0, 0, 0.35);
  --shadow-md:     0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg:     0 16px 48px rgba(0, 0, 0, 0.6);
}

/* Feed control overlay: default light glass; swap to dark glass in dark mode */
.feed-display-toggle,
.feed-icon-btn {
  background: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .feed-display-toggle,
[data-theme="dark"] .feed-icon-btn {
  background: rgba(22, 22, 25, 0.92);
}

/* Theme toggle icon visibility — default: light theme, show moon (to switch to dark) */
.theme-icon-sun  { display: none; }
.theme-icon-moon { display: block; }

[data-theme="dark"] .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun  { display: block; }

/* ── Accessibility ────────────────────────────── */

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Responsive ───────────────────────────────── */

@media (max-width: 768px) {
  .app-container {
    padding: 0.6rem 0.75rem 0.75rem;
    gap: 0.6rem;
  }

  .topbar {
    padding-bottom: 0.6rem;
    flex-wrap: wrap;
  }

  .brand-tagline { display: none; }

  .session-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .input-row {
    width: 100%;
    min-width: 0;
  }

  .session-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .btn {
    flex: 1;
    justify-content: center;
    min-width: 72px;
  }

  .translation-feed {
    padding: 2.75rem 1rem 1rem;
  }

  .utterance-block {
    padding: 0.85rem 0;
  }
}

@media (max-width: 480px) {
  .topbar-username,
  .topbar-balance { display: none; }

  .text-content.translation { font-size: 1.05rem; }
  .text-content.original    { font-size: 0.88rem; }

  .empty-title  { font-size: 1.1rem; }
  .empty-state  { min-height: 280px; }
}
