/* ==========================================================================
   ListenToMe — Apple-Grade Design System & Liquid Glass UI
   ========================================================================== */

:root {
  /* Core Palette */
  --text-primary: #111113;
  --text-secondary: #3a3a3c;
  --text-tertiary: #636366;
  --text-inverse: #ffffff;

  /* Accent & Action Colors */
  --accent-blue: #0071e3;
  --accent-blue-hover: #0077ed;
  --accent-blue-active: #0062c4;
  --accent-dark: #111113;
  --accent-dark-hover: #222226;

  /* System Feedback Colors (WCAG AA Compliant) */
  --color-success: #1a7f37;
  --color-success-bg: rgba(52, 199, 89, 0.14);
  --color-success-border: rgba(52, 199, 89, 0.32);
  
  --color-warning: #9a5b00;
  --color-warning-bg: rgba(255, 149, 0, 0.14);
  --color-warning-border: rgba(255, 149, 0, 0.32);

  --color-error: #cf222e;
  --color-error-bg: rgba(255, 59, 48, 0.14);
  --color-error-border: rgba(255, 59, 48, 0.32);

  --color-info: #0062c4;
  --color-info-bg: rgba(0, 113, 227, 0.14);
  --color-info-border: rgba(0, 113, 227, 0.32);

  /* Liquid Glass System */
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-hover: rgba(255, 255, 255, 0.85);
  --glass-fallback: rgba(255, 255, 255, 0.96);
  --glass-border: rgba(255, 255, 255, 0.85);
  --glass-border-subtle: rgba(0, 0, 0, 0.08);
  --glass-shadow: 0 20px 48px -12px rgba(15, 30, 60, 0.1),
                  0 8px 24px -4px rgba(15, 30, 60, 0.05),
                  inset 0 1px 1px 0 rgba(255, 255, 255, 0.95),
                  inset 0 -1px 1px 0 rgba(0, 0, 0, 0.02);
  --glass-shadow-sm: 0 4px 16px -2px rgba(15, 30, 60, 0.06),
                     inset 0 1px 1px 0 rgba(255, 255, 255, 0.9);
  --glass-text-scrim: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.15) 100%);

  /* Border Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-pill: 9999px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --maxw-page: 1040px;
  --maxw-reading: 680px;
}

/* ==========================================================================
   CSS Reset & Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  background-color: #d8edf9;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ==========================================================================
   Video Wallpaper & Fallbacks
   ========================================================================== */
.wallpaper-container {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: url('./wallpaper-poster.jpg') center/cover no-repeat,
              linear-gradient(180deg, #94cbee 0%, #cce6f8 40%, #eaf4fc 70%, #d8edf9 100%);
}

.wallpaper-video {
  /* Kept at the video's native 16:9 so liquidGL's refraction (which stretches
     the frame to the element rect, ignoring object-fit) lines up with the
     visible cover-crop. The fixed container crops the overflow. */
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100vw, 177.7778vh);
  height: max(100vh, 56.25vw);
  transform: translate(-50%, -50%);
  object-fit: cover;
  pointer-events: none;
}

.wallpaper-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(240, 248, 255, 0.2) 50%, rgba(225, 240, 255, 0.3) 100%);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .wallpaper-video {
    display: none !important;
  }
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Accessibility Focus Rings */
:focus-visible {
  outline: 3px solid var(--accent-blue);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 20px;
  background: var(--text-primary);
  color: var(--text-inverse);
  padding: 12px 20px;
  z-index: 1000;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 20px;
}

/* ==========================================================================
   Liquid Glass Components
   ========================================================================== */
.liquid-glass {
  background: var(--glass-fallback);
  border: 1px solid var(--glass-border-subtle);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
}

@supports (backdrop-filter: blur(20px)) or (-webkit-backdrop-filter: blur(20px)) {
  .liquid-glass {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(32px) saturate(190%);
    backdrop-filter: blur(32px) saturate(190%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
  }
}

.liquid-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--glass-text-scrim);
  pointer-events: none;
  z-index: 0;
}

.liquid-glass > * {
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Site Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.liquid-glass-header {
  background: var(--glass-fallback);
  border-bottom: 1px solid var(--glass-border-subtle);
}

@supports (backdrop-filter: blur(20px)) or (-webkit-backdrop-filter: blur(20px)) {
  .liquid-glass-header {
    background: rgba(255, 255, 255, 0.75);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px -2px rgba(15, 30, 60, 0.05);
  }
}

.header-inner {
  max-width: var(--maxw-page);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 20px;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.025em;
  transition: opacity 0.2s ease;
}

.brand:hover {
  opacity: 0.85;
}

.brand-logo {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.brand-name {
  color: var(--text-primary);
  font-weight: 700;
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.user-email {
  font-weight: 500;
  color: var(--text-secondary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.04);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   Buttons & Action Controls (Strict High Contrast)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  background: transparent;
  color: inherit;
  text-decoration: none;
  min-height: 44px;
  padding: 10px 20px;
  line-height: 1;
}

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

/* Dark Pill Primary Button */
.btn-primary {
  background: #000000;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  font-size: 15px;
  padding: 14px 28px;
}

.btn-primary:hover:not(:disabled) {
  background: #1f1f22;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  background: #000000;
}

/* Apple Blue Accent Button */
.btn-accent {
  background: var(--accent-blue);
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  font-size: 16px;
  font-weight: 600;
  padding: 14px 28px;
}

.btn-accent:hover:not(:disabled) {
  background: var(--accent-blue-hover);
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.35);
}

.btn-accent:active:not(:disabled) {
  background: var(--accent-blue-active);
  transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.14);
  color: var(--text-primary) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  font-size: 14px;
  padding: 10px 20px;
}

.btn-secondary:hover:not(:disabled) {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.24);
  color: #000000 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-secondary:active:not(:disabled) {
  transform: translateY(0);
}

/* Ghost Button */
.btn-ghost {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 8px 14px;
  min-height: 36px;
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 17px;
  min-height: 52px;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  min-height: 36px;
}

.btn-full {
  width: 100%;
}

.google-icon {
  flex-shrink: 0;
  display: block;
}

/* ==========================================================================
   Main Layout & Spacing
   ========================================================================== */
main {
  flex: 1;
  width: 100%;
  max-width: var(--maxw-page);
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 72px;
}

/* ==========================================================================
   Hero Section (Signed-Out View)
   ========================================================================== */
.hero-landing {
  display: flex;
  flex-direction: column;
  gap: 64px;
  width: 100%;
}

.hero-content {
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.hero-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.9);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  letter-spacing: -0.01em;
}

.hero-headline {
  font-size: clamp(42px, 7.5vw, 68px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  color: var(--text-primary);
  text-wrap: balance;
}

.hero-lede {
  font-size: clamp(18px, 2.5vw, 22px);
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 1.45;
  text-wrap: balance;
  max-width: 640px;
}

.hero-actions {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.hero-subtext {
  font-size: 14px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ==========================================================================
   Player Cards (Apple Audio Aesthetics)
   ========================================================================== */
.player-showcase {
  display: flex;
  justify-content: center;
  width: 100%;
}

.player-card {
  width: 100%;
  max-width: 480px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.player-header-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cover-art {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, #cde3fb 0%, #e2effd 100%);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 26px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06), inset 0 1px 1px rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.8);
  flex-shrink: 0;
}

.track-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.track-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Waveforms */
.waveform-container {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 48px;
  cursor: pointer;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.035);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.waveform-container:hover {
  background: rgba(0, 0, 0, 0.055);
  border-color: rgba(0, 0, 0, 0.08);
}

.wave-bar {
  flex: 1;
  min-width: 2px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: var(--radius-pill);
  min-height: 4px;
  transform: scaleY(0.4);
  transition: transform 0.15s ease, background-color 0.2s ease, opacity 0.2s ease;
}

/* Fallback static waveform bars */
.waveform-container:not(.real) .wave-bar.w1 { height: 35%; }
.waveform-container:not(.real) .wave-bar.w2 { height: 75%; }
.waveform-container:not(.real) .wave-bar.w3 { height: 95%; }
.waveform-container:not(.real) .wave-bar.w4 { height: 45%; }
.waveform-container:not(.real) .wave-bar.w5 { height: 60%; }
.waveform-container:not(.real) .wave-bar.w6 { height: 85%; }
.waveform-container:not(.real) .wave-bar.w7 { height: 100%; }
.waveform-container:not(.real) .wave-bar.w8 { height: 70%; }
.waveform-container:not(.real) .wave-bar.w9 { height: 40%; }
.waveform-container:not(.real) .wave-bar.w10 { height: 80%; }
.waveform-container:not(.real) .wave-bar.w11 { height: 65%; }
.waveform-container:not(.real) .wave-bar.w12 { height: 90%; }
.waveform-container:not(.real) .wave-bar.w13 { height: 50%; }
.waveform-container:not(.real) .wave-bar.w14 { height: 70%; }
.waveform-container:not(.real) .wave-bar.w15 { height: 40%; }
.waveform-container:not(.real) .wave-bar.w16 { height: 25%; }

/* Real Waveform Contract with player.js */
.waveform-container.real .wave-bar {
  transform: scaleY(1) !important;
  animation: none !important;
  background: rgba(0, 0, 0, 0.22);
  opacity: 1;
}

.waveform-container.real .wave-bar.played {
  background: var(--text-primary);
}

/* Timeline & Progress Track */
.player-timeline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.time-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-pill);
  position: relative;
  cursor: pointer;
  transition: height 0.15s ease;
}

.progress-track:hover {
  height: 8px;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--accent-blue);
  border-radius: var(--radius-pill);
  width: 0%;
  pointer-events: none;
  transition: width 0.05s linear;
}

/* Player Controls */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.player-speed {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  min-height: 36px;
  transition: all 0.2s ease;
}

.player-speed:hover {
  background: rgba(0, 0, 0, 0.09);
  color: var(--text-primary);
}

.player-format {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: rgba(0, 0, 0, 0.05);
  padding: 6px 10px;
  border-radius: var(--radius-xs);
}

.main-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ctrl-btn {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.ctrl-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #000000;
  transform: scale(1.05);
}

.ctrl-btn:active {
  transform: scale(0.96);
}

.play-btn {
  background: var(--text-primary);
  color: #ffffff !important;
  width: 54px;
  height: 54px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.play-btn:hover {
  background: #000000;
  color: #ffffff !important;
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

.play-btn:active {
  transform: scale(0.96);
}

.play-btn svg {
  fill: #ffffff !important;
  color: #ffffff !important;
}

/* ==========================================================================
   Content Sections & Feature Grid
   ========================================================================== */
.section-divider {
  width: 100%;
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
  margin: 8px 0;
}

.content-section {
  display: flex;
  flex-direction: column;
  gap: 40px;
  max-width: 880px;
  margin: 0 auto;
  width: 100%;
}

.text-center {
  text-align: center;
}

.section-headline {
  font-size: clamp(30px, 4.5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 12px;
}

.section-lede {
  font-size: clamp(16px, 2.2vw, 19px);
  color: var(--text-secondary);
  line-height: 1.45;
  text-wrap: balance;
  max-width: 640px;
  margin: 0 auto;
}

/* Feature Grid */
.feature-rows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 12px;
}

.feature-item {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.feature-item h3 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.feature-item p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   25+ Languages Section
   ========================================================================== */
.language-chips-container {
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  text-align: left;
}

.chip-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chip-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.lang-chip {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  min-height: 44px;
}

.lang-chip span {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
}

.lang-chip:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.lang-chip[aria-pressed="true"] {
  background: var(--text-primary);
  color: #ffffff !important;
  border-color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.lang-chip[aria-pressed="true"] span {
  color: rgba(255, 255, 255, 0.85) !important;
}

/* ==========================================================================
   FAQ Section
   ========================================================================== */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
  text-align: left;
}

.faq-item {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.faq-item p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   Signed-In App Workspace (#app-section)
   ========================================================================== */
.app-workspace {
  display: flex;
  flex-direction: column;
  gap: 40px;
  width: 100%;
}

.workspace-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workspace-title {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.app-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

@media (min-width: 768px) {
  .app-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.extra-grid {
  margin-top: 8px;
}

.app-panel {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.app-panel h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.panel-sub {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: -10px;
}

/* Dropzone */
.dropzone {
  border: 2px dashed rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
}

.dropzone svg {
  color: var(--text-secondary);
  transition: transform 0.2s ease, color 0.2s ease;
}

.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(0, 113, 227, 0.04);
}

.dropzone:hover svg, .dropzone:focus-visible svg {
  color: var(--accent-blue);
  transform: translateY(-2px);
}

.dropzone.dragover {
  border-color: var(--accent-blue);
  background: rgba(0, 113, 227, 0.08);
  transform: scale(1.01);
}

.dropzone.has-file {
  border-color: var(--color-success);
  background: rgba(52, 199, 89, 0.06);
  color: var(--text-primary);
}

.dropzone.has-file svg {
  color: var(--color-success);
}

.dz-primary {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Form Groups & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.input-glass {
  width: 100%;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  font-size: 16px; /* 16px prevents iOS zoom */
  color: var(--text-primary);
  font-family: inherit;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

select.input-glass {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233a3a3c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

textarea.input-glass {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

.input-glass:focus {
  outline: none;
  border-color: var(--accent-blue);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

/* Status Notifications */
.form-status {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  min-height: 22px;
  line-height: 1.4;
}

.form-status.ok {
  color: var(--color-success);
  font-weight: 600;
}

.form-status.error {
  color: var(--color-error);
  font-weight: 600;
}

/* Convert Button in upload panel */
#convert-btn {
  background: var(--accent-blue);
  color: #ffffff !important;
  font-weight: 600;
  font-size: 16px;
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.25);
}

#convert-btn:hover:not(:disabled) {
  background: var(--accent-blue-hover);
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.35);
  transform: translateY(-1px);
}

#convert-btn:disabled {
  background: rgba(0, 0, 0, 0.12);
  color: rgba(0, 0, 0, 0.35) !important;
  box-shadow: none;
}

/* Jobs Scroll Area & Job Cards */
.flex-col {
  display: flex;
  flex-direction: column;
}

.jobs-scroll-area {
  flex: 1;
  min-height: 240px;
  max-height: 480px;
  overflow-y: auto;
  position: relative;
  padding-right: 4px;
}

.jobs {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.job {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.job-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.job-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.badge-done {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success-border);
}

.badge-failed {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid var(--color-error-border);
}

.badge-pending {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid var(--color-warning-border);
}

.badge-processing {
  background: var(--color-info-bg);
  color: var(--color-info);
  border: 1px solid var(--color-info-border);
}

.job-meta {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.job-error {
  font-size: 13px;
  color: var(--color-error);
  font-weight: 500;
}

.job audio {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.job-actions .btn {
  font-size: 13px;
  padding: 8px 14px;
  min-height: 36px;
}

.jobs-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  padding: 20px;
}

/* Extra Panels (App Links & Feedback) */
.app-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
}

.app-links a {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.12);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
  min-height: 44px;
}

.app-links a:hover {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   Site Footer
   ========================================================================== */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--glass-border-subtle);
  padding: 32px 24px;
  text-align: center;
  border-radius: 0 !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: none !important;
}

.footer-inner {
  max-width: var(--maxw-page);
  margin: 0 auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.footer-inner a {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  transition: opacity 0.2s ease;
}

.footer-inner a:hover {
  opacity: 0.7;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */
@media (max-width: 640px) {
  main {
    padding: 32px 16px 60px;
    gap: 56px;
  }
  
  .player-card {
    padding: 20px;
  }

  .language-chips-container {
    padding: 24px 16px;
  }

  .app-panel {
    padding: 24px 18px;
  }

  .header-inner {
    padding: 12px 16px;
  }
}

/* ===================================================================
   Dark lofi-video theme — white text + dark liquid glass
   =================================================================== */
:root {
  --text-primary: #ffffff;
  --text-secondary: #ffffff;
  --text-tertiary: #ffffff;
  --text-inverse: #111114;
  --glass-bg: rgba(20, 22, 30, 0.08);
  --glass-bg-hover: rgba(30, 33, 43, 0.14);
  --glass-fallback: rgba(18, 20, 27, 0.58);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-border-subtle: rgba(255, 255, 255, 0.10);
  --glass-shadow: 0 24px 60px -12px rgba(0,0,0,0.55),
                  inset 0 1px 1px 0 rgba(255,255,255,0.18),
                  inset 0 -1px 1px 0 rgba(0,0,0,0.25);
  --glass-shadow-sm: 0 6px 20px -4px rgba(0,0,0,0.42),
                     inset 0 1px 1px 0 rgba(255,255,255,0.14);
  --glass-text-scrim: linear-gradient(rgba(0,0,0,0.30), rgba(0,0,0,0.30));
  --accent-blue: #5ac8fa;
  --accent-blue-hover: #7ad3ff;
  --accent-blue-active: #3bb8f0;
  --accent-dark: #f5f7fa;
}
/* Primary CTA: pure black vanishes on the dark scene -> light pill with dark ink */
.btn-primary { background: #ffffff !important; color: #111114 !important;
  box-shadow: 0 6px 22px rgba(0,0,0,0.40), inset 0 1px 0 rgba(255,255,255,0.6) !important; }
.btn-primary:hover:not(:disabled) { background: #eef1f6 !important; color: #111114 !important; }
.btn-primary:active:not(:disabled) { background: #ffffff !important; }
/* Secondary as subtle glass on dark */
.btn-secondary { background: rgba(255,255,255,0.10) !important;
  border-color: rgba(255,255,255,0.18) !important; color: var(--text-primary) !important; }
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.16) !important; }
.skip-link { background: #ffffff; color: #111114; }
/* Controls whose fill is --text-primary (now light) need dark ink */
.play-btn { color: #111114 !important; }
.lang-chip[aria-pressed="true"], .lang-chip[aria-pressed="true"] span { color: #111114 !important; }
/* Waveform recoloured for the dark glass */
.waveform-container { background: rgba(255,255,255,0.055) !important; border-color: rgba(255,255,255,0.10) !important; }
.waveform-container.real .wave-bar { background: rgba(255,255,255,0.30) !important; }
.waveform-container.real .wave-bar.played { background: #ffffff !important; }
/* Plain sharp white text — no shadow (owner call). */
main h1, main h2, .hero-lede, .hero-content p, .section-header, .section-header * {
  text-shadow: none !important;
}
/* Brighten the video (it read too gloomy) and pull the warm/yellow cast out:
   brightness up, saturation slightly down (kills the oversaturated warm look),
   plus a whisper-light cool daylight wash so the picture reads neutral, not amber.
   Brightness comes from the filter, NOT a darkening scrim. */
.wallpaper-video { filter: brightness(1.22) saturate(0.84) contrast(1.02) !important; }
/* Dark scrim weighted to the TOP of the scene — mutes the bright cyberpunk
   building glare behind the hero text and improves contrast, while leaving the
   train/player area below bright. Cool-dark tone keeps the palette. */
.wallpaper-scrim {
  background: linear-gradient(180deg,
      rgba(14, 20, 32, 0.62) 0%,
      rgba(14, 20, 32, 0.30) 22%,
      rgba(14, 20, 32, 0.08) 42%,
      rgba(14, 20, 32, 0.00) 60%) !important;
}
/* Header glass -> dark (it hardcoded a light background) */
.liquid-glass-header { background: rgba(18,20,27,0.28) !important;
  border-bottom: 1px solid rgba(255,255,255,0.10) !important;
  box-shadow: 0 4px 20px -2px rgba(0,0,0,0.30) !important; }
.user-email { background: rgba(255,255,255,0.08) !important; border-color: rgba(255,255,255,0.14) !important; }
body { background-color: #14161d !important; }
/* Language chips on the dark theme: default = subtle glass + white text,
   active = white pill + dark text (handled above). */
.lang-chip { background: rgba(255,255,255,0.10) !important;
  border: 1px solid rgba(255,255,255,0.18) !important; color: var(--text-primary) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25) !important; }
.lang-chip span { color: rgba(255,255,255,0.62) !important; }
.lang-chip:hover { background: rgba(255,255,255,0.18) !important; border-color: rgba(255,255,255,0.30) !important; }
/* Play/pause matches the seek buttons: subtle glass circle + white icon (no white fill) */
.ctrl-btn { background: rgba(255,255,255,0.10) !important; color: #ffffff !important; }
.ctrl-btn:hover { background: rgba(255,255,255,0.18) !important; }
.play-btn { background: rgba(255,255,255,0.16) !important; color: #ffffff !important; box-shadow: none !important; }
.play-btn:hover { background: rgba(255,255,255,0.26) !important; }
.play-btn svg { color: #ffffff !important; fill: #ffffff !important; }
/* fully-white chip native-script text too */
.lang-chip span { color: #ffffff !important; }
/* Stop the elastic rubber-band overscroll (bounce) past the top/bottom */
html, body { overscroll-behavior: none; overscroll-behavior-y: none; }

/* ===================================================================
   CSS-only transparent liquid glass (the 0-warp look), over the LIVE video.
   No WebGL / html2canvas / video-blit — a crisp translucent tint + a specular
   edge highlight. Cheapest possible; keeps the background live.
   =================================================================== */
.player-card,
.language-chips-container,
.feature-item,
.faq-item {
  /* crisp see-through: a faint white film, essentially no blur, so the live
     wallpaper reads through 1:1 (matches the loved 0-warp liquidGL look). */
  background: rgba(255, 255, 255, 0.09) !important;
  -webkit-backdrop-filter: blur(1px) saturate(112%) !important;
  backdrop-filter: blur(1px) saturate(112%) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.40),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.06),
    0 16px 44px -16px rgba(0, 0, 0, 0.40) !important;
}
/* Drop the dark text-scrim ::before so these panels read transparent, not black. */
.player-card::before,
.language-chips-container::before,
.feature-item::before,
.faq-item::before {
  background: none !important;
}

/* ===================================================================
   Darker player controls — stand out over the transparent liquid glass.
   =================================================================== */
.player-card .ctrl-btn {
  /* dark smoky glass: still translucent (wallpaper shows faintly through),
     just a much blacker tint so the controls read over the light glass. */
  background: rgba(0, 0, 0, 0.55) !important;
  color: #ffffff !important;
  -webkit-backdrop-filter: blur(3px) saturate(120%) !important;
  backdrop-filter: blur(3px) saturate(120%) !important;
}
.player-card .ctrl-btn:hover { background: rgba(0, 0, 0, 0.66) !important; }
.player-card .play-btn {
  background: rgba(0, 0, 0, 0.62) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.5) !important;
}
.player-card .play-btn:hover { background: rgba(0, 0, 0, 0.72) !important; }
.player-card .play-btn svg { color: #ffffff !important; fill: #ffffff !important; }
/* Waveform rectangle: dark smoky translucent panel. Bars go LIGHT on it (dark
   bars on a dark panel would vanish); progress lights to bright white. */
.player-card .waveform-container {
  background: rgba(0, 0, 0, 0.42) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  -webkit-backdrop-filter: blur(3px) saturate(120%) !important;
  backdrop-filter: blur(3px) saturate(120%) !important;
}
.player-card .waveform-container.real .wave-bar { background: rgba(255, 255, 255, 0.34) !important; }
.player-card .waveform-container.real .wave-bar.played { background: rgba(255, 255, 255, 0.95) !important; }

/* Language chips: same dark smoky-glass treatment as the player controls;
   the playing chip lights up to a bright pill so it's clearly the active one. */
.language-chips-container .lang-chip {
  background: rgba(0, 0, 0, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
  -webkit-backdrop-filter: blur(3px) saturate(120%) !important;
  backdrop-filter: blur(3px) saturate(120%) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28) !important;
}
.language-chips-container .lang-chip span { color: rgba(255, 255, 255, 0.66) !important; }
.language-chips-container .lang-chip:hover { background: rgba(0, 0, 0, 0.62) !important; }
.language-chips-container .lang-chip[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.92) !important;
  color: #111114 !important;
  border-color: rgba(255, 255, 255, 0.9) !important;
}
.language-chips-container .lang-chip[aria-pressed="true"] span { color: #333333 !important; }
/* time labels + speed/format text a bit stronger too */
.player-card .time-label,
.player-card .ctrl-btn.text-btn { color: rgba(255, 255, 255, 0.95) !important; text-shadow: 0 1px 3px rgba(0,0,0,0.5) !important; }

/* Track title/subtitle: white text on a dark smoky backing (the play-button
   treatment) so it reads with contrast over the transparent glass. */
.player-card .track-details {
  background: rgba(0, 0, 0, 0.5) !important;
  -webkit-backdrop-filter: blur(3px) saturate(120%) !important;
  backdrop-filter: blur(3px) saturate(120%) !important;
  padding: 8px 14px !important;
  border-radius: 12px !important;
}
.player-card .track-title {
  color: #ffffff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
}
.player-card .track-subtitle {
  color: rgba(255, 255, 255, 0.82) !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
}

/* Player cover-art shows the ListenToMe logo — no framed box (drop the light
   border/gradient/shadow so the logo sits clean). */
.player-card .cover-art {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}
.player-card .cover-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

/* Darker seekbar + a draggable thumb at the current position. */
.player-card .progress-track {
  background: rgba(0, 0, 0, 0.5) !important;
  height: 7px !important;
}
.player-card .progress-track:hover { height: 9px !important; }
.player-card .progress-fill {
  background: rgba(255, 255, 255, 0.92) !important;
}
/* thumb: white circle at the fill's leading edge (current position) */
.player-card .progress-fill::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}

/* Hero headline + lede and the "Hear the difference." heading/lede -> white
   (reverted from pitch black, owner call). */
.hero-content .hero-headline,
.hero-content .hero-lede,
.pitch-black {
  color: #ffffff !important;
}

/* ===================================================================
   Signed-in workspace: fix white-on-white inputs + mobile polish.
   The dropzone/inputs kept light backgrounds from the original theme while the
   dark theme turned their text white -> invisible. Make them dark glass.
   =================================================================== */
.dropzone {
  background: rgba(0, 0, 0, 0.32) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  color: rgba(255, 255, 255, 0.85) !important;
}
.dropzone svg { color: rgba(255, 255, 255, 0.8) !important; }
.dz-primary { color: #ffffff !important; }
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--accent-blue) !important;
  background: rgba(90, 200, 250, 0.12) !important;
  color: #ffffff !important;
}
.dropzone:hover svg, .dropzone:focus-visible svg { color: #ffffff !important; }
.dropzone.has-file { background: rgba(52, 199, 89, 0.16) !important; color: #ffffff !important; }

.input-glass {
  background-color: rgba(0, 0, 0, 0.4) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}
.input-glass::placeholder { color: rgba(255, 255, 255, 0.55) !important; }
.input-glass:focus {
  border-color: var(--accent-blue) !important;
  background-color: rgba(0, 0, 0, 0.5) !important;
}
/* native select dropdown list was white-on-white; give it a dark list + light chevron */
select.input-glass option { background: #171b26; color: #ffffff; }
select.input-glass {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
}

@media (max-width: 640px) {
  .workspace-title { font-size: 28px; }
  .app-grid { gap: 16px; }
  .extra-grid { margin-top: 16px; }
  .header-auth { gap: 8px; font-size: 12px; }
  .user-email { max-width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-links { flex-wrap: wrap; }
}

/* =====================================================================
   Signed-in library. Matches the native iPad/Mac app palette.
   Landing page rules above this block stay as they are.
   ===================================================================== */
body.signed-in {
  --dark-bg: #1A1A1A;
  --card-bg: #2A2A2A;
  --accent: #E0E0E0;
  --subtle: #999999;
  --warning: #FFB74D;
  --danger: #EF5350;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", sans-serif;
  color-scheme: dark;
  background: var(--dark-bg) !important;
  background-image: none !important;
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
}

body.signed-in #landing-header,
body.signed-in .wallpaper-container,
body.signed-in .site-footer,
body.signed-in #ambient-toggle,
body.signed-in #hero-section { display: none !important; }

body.signed-in main {
  width: 75vw;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0;
  gap: 0;
  display: block;
  min-width: 0;
}

body.signed-in #app-section {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

body.signed-in.has-player #app-section {
  padding-bottom: 128px;
}

body.signed-in h1,
body.signed-in h2,
body.signed-in h3,
body.signed-in button,
body.signed-in input,
body.signed-in select,
body.signed-in textarea {
  font-family: var(--font-sans);
}

body.signed-in h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0;
  color: var(--accent);
}

body.signed-in :focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

body.signed-in .icon {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

body.signed-in .icon-fill { fill: currentColor; stroke: none; }

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

body.signed-in #app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

body.signed-in #books-heading {
  min-width: 0;
  overflow-wrap: anywhere;
}

body.signed-in .icon-chips {
  display: flex;
  gap: 8px;
  flex: none;
  margin-left: auto;
}

body.signed-in .icon-chip {
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
}

body.signed-in .icon-chip.danger { color: var(--danger); }

body.signed-in .action-row {
  display: flex;
  gap: 12px;
  min-width: 0;
}

body.signed-in .action-row button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 64px;
  padding: 8px 10px;
  border: none;
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.signed-in .action-row button:disabled {
  opacity: 1;
  cursor: default;
}

body.signed-in .books-empty {
  margin: 48px 0;
  text-align: center;
  color: var(--subtle);
  font-size: 16px;
  line-height: 1.45;
}

body.signed-in #jobs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

body.signed-in .book-card {
  min-height: 88px;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

body.signed-in .book-main {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: default;
}

body.signed-in button.book-main { cursor: pointer; }

body.signed-in .book-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

body.signed-in .book-status-line {
  font-size: 14px;
  color: var(--subtle);
  overflow-wrap: anywhere;
}

body.signed-in .book-notice {
  color: var(--warning);
  font-size: 14px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

body.signed-in .book-actions {
  display: flex;
  align-items: center;
  flex: none;
  gap: 0;
}

body.signed-in .card-icon,
body.signed-in .card-text,
body.signed-in .mini-ctrl,
body.signed-in .sq-btn,
body.signed-in .full-back,
body.signed-in .mini-open {
  font-family: inherit;
}

body.signed-in .card-icon {
  width: 48px;
  height: 56px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
}

body.signed-in .card-icon.wide { width: 56px; }

body.signed-in .card-icon.danger,
body.signed-in .card-text.danger { color: var(--danger); }

body.signed-in .card-text {
  min-height: 56px;
  padding: 0 8px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

body.signed-in .progress {
  height: 6px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--dark-bg);
  overflow: hidden;
  border: none;
}

body.signed-in .progress > span {
  display: block;
  height: 100%;
  width: 40%;
  background: var(--accent);
  border-radius: 999px;
}

body.signed-in .progress-indeterminate > span {
  animation: ltm-slide 1.4s linear infinite;
}

@keyframes ltm-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}

body.signed-in #mini-player-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 0 16px calc(12px + env(safe-area-inset-bottom));
  pointer-events: none;
  background: transparent;
}

body.signed-in .mini-card {
  pointer-events: auto;
  width: 75vw;
  max-width: 1500px;
  margin: 0 auto;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

body.signed-in .mini-open {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
}

body.signed-in .mini-art {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--dark-bg);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex: none;
}

body.signed-in .mini-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

body.signed-in .mini-title {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.signed-in .mini-time {
  display: block;
  font-size: 13px;
  color: var(--subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.signed-in .mini-ctrl {
  width: 48px;
  height: 56px;
  flex: none;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  display: grid;
  place-items: center;
}

body.signed-in #full-player-view {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--dark-bg);
  overflow: auto;
}

body.signed-in .full-player-inner {
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
  min-height: 100%;
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body.signed-in .full-back {
  align-self: flex-start;
  min-height: 44px;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 18px;
  cursor: pointer;
}

body.signed-in .full-title {
  margin: 0;
  font-size: 24px;
  font-weight: 400;
  color: var(--accent);
  overflow-wrap: anywhere;
}

body.signed-in .full-spacer { flex: 1 1 16px; }

body.signed-in .time-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  padding: 0 8px;
}

body.signed-in .sq-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

body.signed-in .sq-btn {
  aspect-ratio: 1;
  width: 100%;
  min-width: 0;
  min-height: 88px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  display: grid;
  place-items: center;
}

body.signed-in .sq-btn .icon { width: 44px; height: 44px; }
body.signed-in .sq-btn.is-dim { color: var(--subtle); }

body.signed-in input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 48px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  min-width: 0;
}

body.signed-in input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) var(--fill, 0%), var(--card-bg) var(--fill, 0%));
}

body.signed-in input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

body.signed-in input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--card-bg);
  border: none;
}

body.signed-in input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

body.signed-in input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

body.signed-in .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 16px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: none;
}

body.signed-in .btn-primary {
  background: var(--accent) !important;
  color: var(--dark-bg) !important;
  box-shadow: none !important;
}

body.signed-in .btn-primary:hover:not(:disabled) {
  background: #ffffff !important;
  color: var(--dark-bg) !important;
  transform: none;
}

body.signed-in .btn-quiet {
  color: var(--accent) !important;
  background: transparent !important;
}

body.signed-in .btn-danger,
body.signed-in #signout-confirm {
  background: transparent !important;
  color: var(--danger) !important;
  border: none !important;
  box-shadow: none !important;
}

body.signed-in #convert-btn {
  background: var(--accent);
  color: var(--dark-bg) !important;
  border-radius: 12px;
  box-shadow: none;
}

body.signed-in #convert-btn:disabled {
  background: #3a3a3a;
  color: var(--subtle) !important;
}

dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  width: min(520px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: min(85vh, 720px);
  padding: 0;
  border: none;
  border-radius: 16px;
  background: #2A2A2A;
  color: #E0E0E0;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

#ask-ai-dialog,
#notes-dialog {
  margin: auto !important;
  inset: 0 !important;
  background: #2A2A2A;
  color: #E0E0E0;
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

body.signed-in .dlg-head,
body.signed-in .dlg-body,
body.signed-in .dlg-foot {
  min-width: 0;
}

body.signed-in .dlg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid #3a3a3a;
}

body.signed-in .dlg-head h2,
body.signed-in .dlg-body h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  overflow-wrap: anywhere;
}

body.signed-in .dlg-body {
  display: grid;
  gap: 16px;
  padding: 24px;
  overflow: auto;
  color: var(--accent);
  font-size: 16px;
  line-height: 1.45;
}

body.signed-in .dlg-body p { margin: 0; }

body.signed-in .dlg-foot {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid #3a3a3a;
}

body.signed-in #text-dialog .dlg-foot { flex-wrap: wrap; }

body.signed-in .text-download-menu { position: relative; }

body.signed-in .text-download-menu > summary {
  list-style: none;
}

body.signed-in .text-download-menu > summary::-webkit-details-marker { display: none; }

body.signed-in .text-download-options {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 2;
  display: grid;
  gap: 8px;
  min-width: max-content;
  padding: 12px;
  background: #2A2A2A;
  border: 1px solid #555555;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body.signed-in .text-download-options .btn { width: 100%; white-space: nowrap; }

body.signed-in .about-actions {
  display: grid;
  gap: 12px;
}

body.signed-in .about-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--dark-bg);
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

body.signed-in .book-main .btn.btn-lg,
body.signed-in #unlock-submit {
  min-height: 56px;
  font-size: 17px;
}

body.signed-in .book-main .btn.btn-lg {
  width: 100%;
  margin-top: 12px;
}

body.signed-in #unlock-dialog form,
body.signed-in #unlock-form {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

body.signed-in .unlock-pass {
  display: flex;
  gap: 8px;
  align-items: center;
}

body.signed-in .unlock-pass .input {
  flex: 1;
  min-width: 0;
}

body.signed-in #unlock-toggle {
  flex: none;
  min-height: 48px;
}

body.signed-in .field { display: grid; gap: 8px; }
body.signed-in .field label { font-weight: 600; color: var(--accent); }
body.signed-in .hint { margin: 0; font-size: 14px; color: var(--subtle); }
body.signed-in #add-status.is-error { color: var(--danger); }

body.signed-in .input,
body.signed-in .select,
body.signed-in .textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--dark-bg);
  color: var(--accent);
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
}

body.signed-in .textarea { min-height: 120px; resize: vertical; }

body.signed-in .select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23E0E0E0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-inline-end: 42px;
}

body.signed-in select option { background: #2A2A2A; color: #E0E0E0; }

.voice-picker-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

body.signed-in .voice-picker-row .grow {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  max-width: 100%;
}

body.signed-in #btn-preview-ta-voice {
  flex: none;
  width: 48px;
  min-width: 48px;
  height: 48px;
  padding: 0;
}

body.signed-in #btn-preview-ta-voice .icon {
  fill: currentColor;
  stroke: none;
}

body.signed-in #settings-dialog .dlg-body h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

#settings-dialog {
  background: #2A2A2A;
  color: #E0E0E0;
}

#settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

#settings-dialog :focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

body.signed-in .dropzone {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 28px 16px;
  text-align: center;
  border: 2px dashed #666666 !important;
  border-radius: 12px;
  background: var(--dark-bg) !important;
  color: var(--accent) !important;
  cursor: pointer;
}

body.signed-in .dropzone strong { font-size: 16px; color: var(--accent); }
body.signed-in .dropzone .icon { width: 28px; height: 28px; color: var(--accent) !important; }

body.signed-in .filerow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--dark-bg);
  border-radius: 12px;
  min-width: 0;
}

body.signed-in .filerow .grow { flex: 1; min-width: 0; }
body.signed-in .filerow .name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.signed-in .chapters,
body.signed-in #player-chapters-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

body.signed-in .chapters button,
body.signed-in #player-chapters-list button {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  text-align: start;
  border: none;
  border-radius: 12px;
  background: var(--dark-bg);
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

body.signed-in .chapters .num,
body.signed-in #player-chapters-list .num { color: var(--subtle); }

body.signed-in .chapters .time,
body.signed-in #player-chapters-list .time {
  color: var(--subtle);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

body.signed-in .chapters button > span:nth-child(2),
body.signed-in #player-chapters-list button > span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.signed-in .transcript {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: min(52vh, 480px);
  overflow: auto;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  background: var(--dark-bg);
  color: var(--accent);
  border-radius: 12px;
  padding: 16px;
}

body.signed-in #ask-ai-dialog,
body.signed-in #notes-dialog {
  background: #2A2A2A;
  color: #E0E0E0;
}

body.signed-in .muted {
  margin: 0;
  color: #999999;
}

body.signed-in .chat-messages,
body.signed-in .notes-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  max-height: min(42vh, 360px);
  overflow: auto;
  background: #1A1A1A;
  color: #E0E0E0;
  border-radius: 12px;
  padding: 14px;
}

body.signed-in .chat-line,
body.signed-in .note-item p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: #E0E0E0;
}

body.signed-in .chat-user {
  justify-self: end;
  max-width: 100%;
  background: #2A2A2A;
  border-radius: 12px;
  padding: 10px 12px;
}

body.signed-in .chat-answer,
body.signed-in .chat-status {
  max-width: 100%;
}

body.signed-in .note-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  background: #2A2A2A;
  border-radius: 12px;
  padding: 12px;
}

body.signed-in .note-item time {
  color: #999999;
  font-size: 13px;
}

body.signed-in .chat-form,
body.signed-in .notes-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  min-width: 0;
}

body.signed-in .chat-form .input,
body.signed-in .notes-form .textarea {
  flex: 1 1 12rem;
  width: auto;
  max-width: 100%;
  min-width: 0;
  background: #1A1A1A;
  color: #E0E0E0;
}

body.signed-in .toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 24px;
  z-index: 70;
  display: grid;
  justify-items: center;
  gap: 10px;
  pointer-events: none;
  padding: 0 16px;
}

body.signed-in.has-player .toasts { bottom: 112px; }

body.signed-in .toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(560px, 100%);
  padding: 14px 18px;
  background: var(--card-bg);
  color: var(--accent);
  border-radius: 12px;
  font-weight: 600;
}

@media (max-width: 860px) {
  body.signed-in main,
  body.signed-in .mini-card {
    width: calc(100% - 32px);
    max-width: 100%;
    margin: 0 auto;
  }
  body.signed-in #app-section {
    padding: 16px 0;
  }
}

@media (max-width: 420px) {
  body.signed-in .dlg-head,
  body.signed-in .dlg-body,
  body.signed-in .dlg-foot { padding: 16px; }
  body.signed-in .book-card { padding: 16px 12px; gap: 8px; }
}

@media (forced-colors: active) {
  body.signed-in .icon-chip,
  body.signed-in .action-row button,
  body.signed-in .book-card,
  body.signed-in .mini-card,
  body.signed-in .sq-btn,
  body.signed-in dialog { border: 2px solid CanvasText; }
}

/* Sign in with Apple (Apple HIG: black button, white logo and text; white in dark mode). */
.btn-apple { background: #000; color: #fff; border: 1px solid #000; }
.btn-apple:hover:not(:disabled) { background: #1d1d1f; }
.apple-icon { margin-right: 10px; vertical-align: -3px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-apple { background: #fff; color: #000; border-color: #fff; }
  :root:not([data-theme="light"]) .btn-apple:hover:not(:disabled) { background: #e8e8ed; }
}
:root[data-theme="dark"] .btn-apple { background: #fff; color: #000; border-color: #fff; }
:root[data-theme="dark"] .btn-apple:hover:not(:disabled) { background: #e8e8ed; }
/* Hero sits on a dark video: Apple HIG says use the white style on dark backgrounds,
   and both sign-in buttons share one width. */
.hero-actions .btn-apple,
:root[data-theme="dark"] .hero-actions .btn-apple { background: #fff; color: #000; border-color: #fff; }
.hero-actions .btn-apple:hover:not(:disabled) { background: #f2f2f7; }
.hero-actions #sign-in-btn,
.hero-actions .btn-apple { width: min(100%, 384px); justify-content: center; }
@media (min-width: 440px) {
  .hero-actions #sign-in-btn,
  .hero-actions .btn-apple { white-space: nowrap; }
}

/* Official store badges under the hero sign-in buttons (unmodified artwork; the
   Google PNG is trimmed to its badge edge, so no margin tricks). The row is exactly
   as wide as the sign-in buttons (width 0 + min-width 100% keeps it from widening
   them), and each badge's share is proportional to its aspect ratio, so both badges
   always have the same height and their outer edges line up with the buttons. */
.store-badges { display: flex; align-items: center; gap: 12px; width: 0; min-width: 100%; margin-top: 2px; }
.store-badges a { display: block; flex: 1 1 0; min-width: 0; line-height: 0; border-radius: 9px; }
.store-badges a.badge-app-store { flex-grow: 2.9916; }   /* 119.664 x 40 */
.store-badges a.badge-google-play { flex-grow: 3.3571; } /* 564 x 168 */
.store-badges a:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.store-badges img { display: block; width: 100%; height: auto; }
