/* -----------------------------------------------------------------------
       GLASSMORPHISM THEME TOKENS
       The existing reader controls share these light/dark design tokens.
    ----------------------------------------------------------------------- */
    :root {
      color-scheme: light;

      --r: 14px;
      --r2: 11px;
      --r3: 9px;
      --pill: 999px;
      --e: cubic-bezier(.4, 0, .2, 1);
      --e2: cubic-bezier(.22, 1, .36, 1);
      --t1: .15s;
      --t2: .24s;
      --t3: .4s;
      --sans: 'Vazirmatn', system-ui, sans-serif;
      --mono: 'JetBrains Mono', ui-monospace, monospace;

      /* Light palette */
      --bg: #f3f5f9;
      --s1: rgba(255, 255, 255, .8);
      --s2: rgba(15, 23, 42, .04);
      --s3: rgba(15, 23, 42, .075);
      --ln: rgba(15, 23, 42, .09);
      --ln2: rgba(15, 23, 42, .16);
      --tx: #111826;
      --tx2: #54606f;
      --tx3: #828d9b;
      --ac: #059669;
      --ac2: #10b981;
      --ac1: rgba(5, 150, 105, .13);
      --ac0: rgba(5, 150, 105, .06);
      --bl: #2563eb;
      --bl1: rgba(37, 99, 235, .14);
      --bl0: rgba(37, 99, 235, .07);
      --vi: #7c3aed;
      --vi1: rgba(124, 58, 237, .14);
      --vi0: rgba(124, 58, 237, .07);
      --cy: #0891b2;
      --cy1: rgba(8, 145, 178, .14);
      --cy0: rgba(8, 145, 178, .07);
      --am: #d97706;
      --am1: rgba(217, 119, 6, .15);
      --am0: rgba(217, 119, 6, .07);
      --rd: #dc2626;
      --rd1: rgba(220, 38, 38, .12);
      --rd0: rgba(220, 38, 38, .06);
      --sh: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .07);
      --glass-bg: rgba(255, 255, 255, .7);
      --glass-bd: rgba(15, 23, 42, .12);
      --glass-hv: rgba(255, 255, 255, .9);

      /* Existing app variable aliases */
      --bg-body: var(--bg);
      --bg-panel: var(--glass-bg);
      --bg-panel-alt: rgba(255, 255, 255, .52);
      --bg-input: var(--s2);
      --bg-hover: var(--s3);
      --border-color: var(--ln);
      --border-focus: var(--ac);
      --text-main: var(--tx);
      --text-muted: var(--tx2);
      --accent: var(--ac);
      --accent-hover: var(--ac2);
      --accent-soft: var(--ac1);
      --accent-selection-text: var(--tx);
      --highlight-bg: linear-gradient(110deg, rgba(5, 150, 105, .16), rgba(16, 185, 129, .22));
      --highlight-ink: #064e3b;
      --highlight-edge: rgba(5, 150, 105, .36);
      --highlight-glow: 0 3px 12px rgba(5, 150, 105, .13);
      --danger: var(--rd);
      --danger-bg: var(--rd0);
      --danger-border: var(--rd1);
      --shadow-panel: var(--sh);
      --focus-ring: rgba(5, 150, 105, .16);
      --page-glow-a: rgba(16, 185, 129, .12);
      --page-glow-b: rgba(37, 99, 235, .07);
      --accent-shadow: rgba(5, 150, 105, .18);
      --radius-sm: var(--r3);
      --radius-md: var(--r2);
      --radius-lg: var(--r);
      --font: var(--sans);
    }

    :root[data-theme="light"] {
      color-scheme: light;
    }

    :root[data-theme="dark"] {
      color-scheme: dark;

      /* Dark palette */
      --bg: #0b0b10;
      --s1: rgba(255, 255, 255, .035);
      --s2: rgba(255, 255, 255, .055);
      --s3: rgba(255, 255, 255, .09);
      --ln: rgba(255, 255, 255, .08);
      --ln2: rgba(255, 255, 255, .14);
      --tx: #eceff5;
      --tx2: #9aa4b2;
      --tx3: #5f6a79;
      --ac: #10b981;
      --ac2: #34d399;
      --ac1: rgba(16, 185, 129, .14);
      --ac0: rgba(16, 185, 129, .07);
      --bl: #60a5fa;
      --bl1: rgba(96, 165, 250, .14);
      --bl0: rgba(96, 165, 250, .07);
      --vi: #a78bfa;
      --vi1: rgba(167, 139, 250, .14);
      --vi0: rgba(167, 139, 250, .07);
      --cy: #22d3ee;
      --cy1: rgba(34, 211, 238, .14);
      --cy0: rgba(34, 211, 238, .07);
      --am: #fbbf24;
      --am1: rgba(251, 191, 36, .14);
      --am0: rgba(251, 191, 36, .07);
      --rd: #f87171;
      --rd1: rgba(248, 113, 113, .13);
      --rd0: rgba(248, 113, 113, .06);
      --sh: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 26px rgba(0, 0, 0, .3);
      --glass-bg: rgba(255, 255, 255, .06);
      --glass-bd: rgba(255, 255, 255, .11);
      --glass-hv: rgba(255, 255, 255, .1);

      /* Existing app variable aliases */
      --bg-body: var(--bg);
      --bg-panel: var(--glass-bg);
      --bg-panel-alt: rgba(255, 255, 255, .035);
      --bg-input: var(--s2);
      --bg-hover: var(--s3);
      --border-color: var(--ln);
      --border-focus: var(--ac2);
      --text-main: var(--tx);
      --text-muted: var(--tx2);
      --accent: var(--ac);
      --accent-hover: var(--ac2);
      --accent-soft: var(--ac1);
      --accent-selection-text: var(--tx);
      --highlight-bg: linear-gradient(110deg, rgba(16, 185, 129, .28), rgba(52, 211, 153, .19));
      --highlight-ink: #ecfdf5;
      --highlight-edge: rgba(52, 211, 153, .48);
      --highlight-glow: 0 3px 15px rgba(16, 185, 129, .2);
      --danger: var(--rd);
      --danger-bg: var(--rd0);
      --danger-border: var(--rd1);
      --shadow-panel: var(--sh);
      --focus-ring: rgba(52, 211, 153, .2);
      --page-glow-a: rgba(16, 185, 129, .13);
      --page-glow-b: rgba(96, 165, 250, .055);
      --accent-shadow: rgba(16, 185, 129, .2);
      --radius-sm: var(--r3);
      --radius-md: var(--r2);
      --radius-lg: var(--r);
      --font: var(--sans);
    }

    /* -----------------------------------------------------------------------
       BASE STYLES
    ----------------------------------------------------------------------- */
    *, *::before, *::after { box-sizing: border-box; }

    html { min-height: 100%; }

    body {
      min-height: 100vh;
      margin: 0;
      padding: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--bg-body);
      color: var(--text-main);
      font-family: var(--font);
      transition: background-color 0.22s ease, color 0.22s ease;
    }

    button, select, textarea { font: inherit; }

    ::selection {
      background: var(--accent-soft);
      color: var(--accent-selection-text);
    }

    /* -----------------------------------------------------------------------
       PANEL / HEADER
    ----------------------------------------------------------------------- */
    .app-container {
      width: 100%;
      max-width: 720px;
      padding: 32px;
      background: var(--bg-panel);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-panel);
      transition: background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
    }

    header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 20px;
      margin-bottom: 26px;
      padding-bottom: 22px;
      border-bottom: 1px solid var(--border-color);
    }

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

    h1 {
      margin: 0 0 7px;
      color: var(--text-main);
      font-size: 1.55rem;
      font-weight: 750;
      letter-spacing: -0.035em;
    }

    .subtitle {
      margin: 0;
      color: var(--text-muted);
      font-size: 0.92rem;
      line-height: 1.55;
    }

    .theme-toggle {
      flex: 0 0 auto;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 9px;
      min-height: 40px;
      padding: 9px 12px;
      border: 1px solid var(--border-color);
      border-radius: 11px;
      background: var(--bg-input);
      color: var(--text-main);
      font-size: 0.84rem;
      font-weight: 650;
      cursor: pointer;
      transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    }

    .theme-toggle:hover { background: var(--bg-hover); }
    .theme-toggle:active { transform: scale(0.98); }
    .theme-toggle svg { width: 17px; height: 17px; flex: 0 0 auto; }

    /* -----------------------------------------------------------------------
       VOICE SELECTOR
    ----------------------------------------------------------------------- */
    .voice-selector-wrap {
      display: flex;
      align-items: center;
      gap: 16px;
      min-height: 58px;
      margin-bottom: 20px;
      padding: 13px 16px;
      background: var(--bg-input);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      transition: background-color 0.22s ease, border-color 0.22s ease;
    }

    .voice-selector-wrap label {
      color: var(--text-muted);
      font-size: 0.78rem;
      font-weight: 750;
      letter-spacing: 0.075em;
      text-transform: uppercase;
      white-space: nowrap;
    }

    .select-container {
      position: relative;
      display: flex;
      align-items: center;
      flex: 1;
      min-width: 0;
      min-height: 28px;
    }

    select {
      width: 100%;
      padding: 4px 24px 4px 0;
      border: 0;
      outline: 0;
      background: transparent;
      color: var(--text-main);
      font-size: 0.94rem;
      font-weight: 550;
      cursor: pointer;
      appearance: none;
    }

    select:disabled { opacity: 0.75; cursor: wait; }
    select option { background: var(--bg-panel); color: var(--text-main); }

    .select-container::after {
      content: "";
      position: absolute;
      right: 3px;
      top: 50%;
      width: 8px;
      height: 8px;
      border-right: 1.8px solid var(--text-muted);
      border-bottom: 1.8px solid var(--text-muted);
      transform: translateY(-70%) rotate(45deg);
      pointer-events: none;
    }

    .loader-overlay {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 0;
      border-radius: var(--radius-md);
      background: var(--bg-input);
      pointer-events: none;
      transition: opacity 0.28s ease;
    }

    .loader-text {
      color: var(--accent);
      font-size: 0.84rem;
      font-weight: 700;
      white-space: nowrap;
    }

    .progress-bar-bg {
      width: 104px;
      height: 6px;
      flex: 0 0 auto;
      overflow: hidden;
      border-radius: 999px;
      background: var(--border-color);
    }

    .progress-bar-fill {
      width: 0%;
      height: 100%;
      border-radius: inherit;
      background: var(--accent);
      transition: width 0.18s ease;
    }

    /* -----------------------------------------------------------------------
       TEXTAREA + LIVE WORD HIGHLIGHT LAYER
    ----------------------------------------------------------------------- */
    .input-group { margin-bottom: 22px; }

    .input-hint {
      margin: 9px 2px 0;
      color: var(--text-muted);
      font-size: 0.78rem;
      line-height: 1.5;
    }

    .input-hint strong {
      color: var(--accent-hover);
      font-weight: 650;
    }

    .textarea-shell {
      position: relative;
      width: 100%;
      min-height: 240px;
      border-radius: var(--radius-md);
      isolation: isolate;
    }

    .text-highlight-backdrop {
      position: absolute;
      z-index: 1;
      inset: 1px;
      overflow: hidden;
      border-radius: calc(var(--radius-md) - 1px);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.18s ease;
    }

    .text-highlight-mirror {
      width: 100%;
      min-height: 100%;
      padding: 18px;
      color: var(--text-main);
      font-family: var(--font);
      font-size: 1rem;
      font-weight: 400;
      line-height: 1.75;
      letter-spacing: normal;
      text-align: start;
      white-space: pre-wrap;
      overflow-wrap: break-word;
      word-break: normal;
      tab-size: 8;
      will-change: transform;
    }

    .spoken-word-highlight {
      position: relative;
      display: inline;
      padding: 2px 2px 3px;
      border: 1px solid var(--highlight-edge);
      border-radius: 6px;
      background: var(--highlight-bg);
      box-shadow: var(--highlight-glow);
      color: var(--highlight-ink);
      font-weight: 750;
      -webkit-box-decoration-break: clone;
      box-decoration-break: clone;
      animation: spoken-word-enter 0.2s ease-out both;
    }

    @keyframes spoken-word-enter {
      from { filter: brightness(1.08); transform: translateY(1px); }
      to { filter: brightness(1); transform: translateY(0); }
    }

    textarea {
      position: relative;
      z-index: 2;
      display: block;
      width: 100%;
      min-height: 240px;
      padding: 18px;
      resize: vertical;
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      outline: none;
      background: var(--bg-input);
      color: var(--text-main);
      font-family: var(--font);
      font-size: 1rem;
      line-height: 1.75;
      transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.22s ease, color 0.22s ease;
    }

    textarea:focus {
      border-color: var(--border-focus);
      box-shadow: 0 0 0 3px var(--focus-ring);
    }

    textarea::placeholder { color: var(--text-muted); opacity: 0.78; }
    textarea:read-only { cursor: text; }
    textarea::selection { background: var(--accent-soft); color: var(--accent-selection-text); }

    .input-group.is-speaking .text-highlight-backdrop { opacity: 1; }

    .input-group.is-speaking textarea {
      background: transparent;
      color: transparent;
      -webkit-text-fill-color: transparent;
      caret-color: transparent;
    }

    .input-group.is-speaking textarea::selection { background: transparent; }

    /* -----------------------------------------------------------------------
       CONTROLS & BUTTONS
    ----------------------------------------------------------------------- */
    .controls {
      display: flex;
      gap: 12px;
      margin-bottom: 18px;
    }

    .control-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 9px;
      min-height: 48px;
      padding: 13px 20px;
      border: 1px solid transparent;
      border-radius: var(--radius-md);
      font-size: 0.94rem;
      font-weight: 700;
      cursor: pointer;
      transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    }

    .control-btn:active:not(:disabled) { transform: translateY(1px); }
    .control-btn:disabled { opacity: 0.48; cursor: not-allowed; }
    .control-btn svg { width: 18px; height: 18px; flex: 0 0 auto; }

    .btn-primary {
      flex: 2;
      background: var(--accent);
      color: #ffffff;
    }

    .btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
    .btn-primary.waiting { background: #64748b; cursor: wait; }

    .btn-secondary {
      flex: 1;
      border-color: var(--border-color);
      background: var(--bg-panel);
      color: var(--text-main);
    }

    .btn-secondary:hover:not(:disabled) { background: var(--bg-hover); }

    .btn-danger {
      flex: 1;
      border-color: var(--danger-border);
      background: var(--danger-bg);
      color: var(--danger);
    }

    .btn-danger:hover:not(:disabled) {
      border-color: var(--danger);
      background: var(--danger);
      color: #ffffff;
    }

    /* -----------------------------------------------------------------------
       VISUALIZER
    ----------------------------------------------------------------------- */
    .visualizer-container {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      height: 28px;
      opacity: 0;
      transition: opacity 0.25s ease;
    }

    .visualizer-container.active { opacity: 1; }

    .bar {
      width: 4px;
      height: 10%;
      border-radius: 2px;
      background: var(--accent);
    }

    .visualizer-container.active .bar { animation: wave 1.15s ease-in-out infinite; }
    .bar:nth-child(1) { animation-delay: 0s; }
    .bar:nth-child(2) { animation-delay: 0.1s; }
    .bar:nth-child(3) { animation-delay: 0.2s; }
    .bar:nth-child(4) { animation-delay: 0.3s; }
    .bar:nth-child(5) { animation-delay: 0.4s; }
    .bar:nth-child(6) { animation-delay: 0.5s; }
    .bar:nth-child(7) { animation-delay: 0.6s; }
    .bar:nth-child(8) { animation-delay: 0.7s; }

    .visualizer-container.paused .bar { animation-play-state: paused; }

    @keyframes wave {
      0%, 100% { height: 15%; }
      50% { height: 88%; }
    }

    /* -------------------------------------------------------------------
       PLAYBACK SPEED
       Clear named presets replace the difficult-to-follow 2x jump.
    ------------------------------------------------------------------- */
    .speed-control {
      display: flex;
      flex-direction: column;
      gap: 11px;
      margin: 4px 0 14px;
      padding: 14px 15px;
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      background: var(--bg-input);
    }

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

    .speed-copy { min-width: 0; }

    .speed-title {
      margin: 0 0 3px;
      color: var(--text-main);
      font-size: 0.86rem;
      font-weight: 750;
    }

    .speed-help {
      margin: 0;
      color: var(--text-muted);
      font-size: 0.74rem;
      line-height: 1.4;
    }

    .speed-current {
      display: flex;
      flex: 0 0 auto;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      min-width: 76px;
      padding: 6px 10px;
      border: 1px solid var(--border-color);
      border-radius: 10px;
      background: var(--bg-panel);
    }

    .speed-current strong {
      color: var(--accent);
      font-size: 0.94rem;
      line-height: 1.2;
    }

    .speed-current span {
      margin-top: 2px;
      color: var(--text-muted);
      font-size: 0.66rem;
      font-weight: 650;
    }

    .speed-options {
      display: grid;
      grid-template-columns: repeat(5, minmax(0, 1fr));
      gap: 6px;
    }

    .speed-btn {
      display: flex;
      min-width: 0;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
      padding: 9px 5px;
      border: 1px solid var(--border-color);
      border-radius: 10px;
      background: var(--bg-panel);
      color: var(--text-muted);
      cursor: pointer;
      transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    }

    .speed-rate {
      color: var(--text-main);
      font-size: 0.82rem;
      font-weight: 800;
      line-height: 1.2;
      white-space: nowrap;
    }

    .speed-name {
      font-size: 0.65rem;
      font-weight: 650;
      line-height: 1.2;
    }

    .speed-btn:hover:not(.is-active) {
      border-color: var(--accent);
      background: var(--bg-hover);
      color: var(--text-main);
    }

    .speed-btn.is-active {
      border-color: var(--accent);
      background: var(--accent-soft);
      color: var(--text-main);
      box-shadow: 0 2px 8px rgba(5, 150, 105, 0.12);
    }

    .speed-btn.is-active .speed-rate { color: var(--accent); }

    .speed-btn:focus-visible {
      outline: 2px solid var(--border-focus);
      outline-offset: 3px;
    }

    .speed-note {
      margin: -2px 0 0;
      color: var(--text-muted);
      font-size: 0.7rem;
      line-height: 1.45;
    }

    /* -------------------------------------------------------------------
       CREATOR CREDIT
    ------------------------------------------------------------------- */
    .footer-bottom {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: center;
      gap: 6px;
      margin-top: 20px;
      padding-top: 18px;
      border-top: 1px solid var(--border-color);
      color: var(--text-muted);
      font-size: .7rem;
      line-height: 1.7;
      text-align: center;
    }

    .footer-bottom .heart,
    .footer-bottom .coffee {
      display: inline-block;
      font-size: 1em;
      line-height: 1;
      transform-origin: center;
    }

    .footer-bottom .heart {
      animation: heart-beat 1.8s ease-in-out infinite;
    }

    @keyframes heart-beat {
      0%, 100% { transform: scale(1); }
      15%      { transform: scale(1.25); }
      30%      { transform: scale(1); }
      45%      { transform: scale(1.15); }
    }

    .footer-bottom .coffee {
      animation: coffee-bob 2.6s ease-in-out infinite;
    }

    @keyframes coffee-bob {
      0%, 100% { transform: translateY(0) rotate(0deg); }
      40%      { transform: translateY(-2px) rotate(-6deg); }
      70%      { transform: translateY(0) rotate(3deg); }
    }

    .footer-bottom .credit-name {
      color: var(--text-main);
      font-weight: 700;
    }

    .github-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 26px;
      height: 26px;
      margin-left: 2px;
      color: var(--text-main);
      background: var(--bg-input);
      border: 1px solid var(--border-color);
      border-radius: 50%;
      text-decoration: none;
      transition: transform .22s ease, background .22s ease, color .22s ease, border-color .22s ease;
    }

    .github-link:hover {
      transform: scale(1.12) translateY(-1px);
      background: var(--accent);
      color: #fff;
      border-color: var(--accent);
    }

    .github-link:active { transform: scale(0.94); }

    .github-link:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 3px;
    }

    .github-link svg {
      display: block;
      width: 14px;
      height: 14px;
      fill: currentColor;
    }

    @media (max-width: 400px) {
      .footer-bottom { font-size: .65rem; }
      .speed-control { padding: 12px 10px; }
      .speed-options { gap: 4px; }
      .speed-btn { padding: 8px 2px; }
      .speed-rate { font-size: 0.74rem; }
      .speed-name { font-size: 0.58rem; }
    }

    @media (max-width: 560px) {
      body { padding: 14px; align-items: flex-start; }
      .app-container { margin: 12px 0; padding: 22px 18px; }
      header { gap: 12px; }
      h1 { font-size: 1.32rem; }
      .subtitle { font-size: 0.85rem; }
      .theme-toggle { padding: 9px; }
      .theme-toggle span { display: none; }
      .voice-selector-wrap { gap: 12px; padding: 12px; }
      textarea, .text-highlight-mirror { min-height: 220px; padding: 14px; }
      .textarea-shell { min-height: 220px; }
      .controls { gap: 8px; }
      .control-btn { min-height: 46px; padding: 12px 10px; font-size: 0.86rem; }
    }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
      .footer-bottom .heart,
      .footer-bottom .coffee { animation: none !important; }
      .github-link { transition: none !important; }
    }


    /* -------------------------------------------------------------------
       GLASSMORPHISM FINISH
       Theme the existing reader interface without introducing new sections.
    ------------------------------------------------------------------- */
    html {
      background: var(--bg-body);
      scroll-behavior: smooth;
    }

    body {
      position: relative;
      isolation: isolate;
      background: var(--bg-body);
      color: var(--text-main);
      font-family: var(--sans);
      -webkit-font-smoothing: antialiased;
      transition: background-color var(--t3) var(--e), color var(--t3) var(--e);
    }

    body::before {
      content: "";
      position: fixed;
      z-index: -1;
      inset: 0;
      pointer-events: none;
      background:
        radial-gradient(circle at 88% 7%, var(--page-glow-a), transparent 34%),
        radial-gradient(circle at 8% 92%, var(--page-glow-b), transparent 32%);
    }

    .app-container {
      position: relative;
      z-index: 1;
      background: var(--glass-bg);
      border: 1px solid var(--glass-bd);
      border-radius: var(--r);
      box-shadow: var(--sh);
      -webkit-backdrop-filter: blur(16px);
      backdrop-filter: blur(16px);
      transition: background-color var(--t3) var(--e), border-color var(--t3) var(--e), box-shadow var(--t3) var(--e);
    }

    header {
      border-bottom-color: var(--ln);
      transition: border-color var(--t3) var(--e);
    }

    h1 { color: var(--tx); }
    .subtitle { color: var(--tx2); }

    .theme-toggle {
      min-height: 38px;
      border: 1px solid var(--ln);
      border-radius: var(--r3);
      background: var(--s2);
      color: var(--tx2);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
      transition: background-color var(--t1) var(--e), color var(--t1) var(--e), border-color var(--t1) var(--e), transform var(--t1) var(--e);
      -webkit-tap-highlight-color: transparent;
    }

    .theme-toggle:hover {
      color: var(--tx);
      background: var(--s3);
      border-color: var(--ln2);
    }

    .theme-toggle svg { color: var(--ac); }

    .voice-selector-wrap,
    .speed-control {
      border: 1px solid var(--ln);
      border-radius: var(--r2);
      background: var(--s2);
      -webkit-backdrop-filter: blur(12px);
      backdrop-filter: blur(12px);
      transition: background-color var(--t3) var(--e), border-color var(--t3) var(--e);
    }

    .voice-selector-wrap label,
    .speed-title { color: var(--tx2); }

    select { color: var(--tx); }
    select option { background: var(--bg); color: var(--tx); }

    .loader-overlay {
      border: 1px solid transparent;
      background: var(--glass-bg);
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
    }

    .loader-text { color: var(--ac2); }

    .progress-bar-bg {
      height: 7px;
      background: var(--s3);
    }

    .progress-bar-fill {
      background: linear-gradient(90deg, var(--ac), var(--ac2));
    }

    .textarea-shell { border-radius: var(--r2); }

    textarea {
      border: 1px solid var(--ln);
      border-radius: var(--r2);
      background: var(--s2);
      color: var(--tx);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
      transition: background-color var(--t3) var(--e), color var(--t3) var(--e), border-color var(--t1) var(--e), box-shadow var(--t1) var(--e);
    }

    textarea:focus {
      border-color: var(--ac);
      background: var(--s2);
      box-shadow: 0 0 0 3px var(--focus-ring), inset 0 1px 0 rgba(255, 255, 255, .035);
    }

    textarea::placeholder { color: var(--tx3); }
    .input-hint { color: var(--tx3); }
    .input-hint strong { color: var(--ac); }

    .spoken-word-highlight {
      border-color: var(--highlight-edge);
      border-radius: var(--r3);
      background: var(--highlight-bg);
      color: var(--highlight-ink);
      box-shadow: var(--highlight-glow);
      font-weight: 800;
    }

    .control-btn {
      border-radius: var(--r2);
      transition: background-color var(--t2) var(--e), border-color var(--t2) var(--e), color var(--t2) var(--e), transform var(--t1) var(--e), opacity var(--t1) var(--e);
      -webkit-tap-highlight-color: transparent;
    }

    .btn-primary {
      background: var(--ac);
      border-color: var(--ac);
      color: #ffffff;
      box-shadow: 0 4px 14px var(--accent-shadow);
    }

    .btn-primary:hover:not(:disabled) {
      background: var(--ac2);
      border-color: var(--ac2);
      color: #ffffff;
      box-shadow: 0 6px 18px var(--accent-shadow);
      transform: translateY(-1px);
    }

    .btn-primary.waiting {
      background: var(--s3);
      border-color: var(--ln2);
      color: var(--tx2);
      box-shadow: none;
    }

    .btn-primary.is-paused {
      background: var(--ac);
      border-color: var(--ac);
      color: #ffffff;
    }

    .btn-secondary {
      border-color: var(--ln);
      background: var(--glass-bg);
      color: var(--tx);
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
    }

    .btn-secondary:hover:not(:disabled) {
      border-color: var(--ln2);
      background: var(--glass-hv);
      color: var(--tx);
    }

    .btn-danger {
      border-color: var(--rd1);
      background: var(--rd0);
      color: var(--rd);
    }

    .btn-danger:hover:not(:disabled) {
      border-color: var(--rd);
      background: var(--rd);
      color: #ffffff;
    }

    .speed-current {
      border-color: var(--ln);
      border-radius: var(--r3);
      background: var(--glass-bg);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
    }

    .speed-current strong { color: var(--ac2); }
    .speed-current span,
    .speed-help,
    .speed-note { color: var(--tx3); }

    .speed-btn {
      border-color: var(--ln);
      border-radius: var(--r3);
      background: var(--s2);
      color: var(--tx2);
      -webkit-tap-highlight-color: transparent;
      transition: background-color var(--t1) var(--e), color var(--t1) var(--e), border-color var(--t1) var(--e), transform var(--t1) var(--e);
    }

    .speed-btn:hover:not(.is-active) {
      border-color: var(--ln2);
      background: var(--glass-hv);
      color: var(--tx);
    }

    .speed-rate { color: var(--tx); }

    .speed-btn.is-active {
      border-color: var(--ac);
      background: var(--ac0);
      color: var(--tx);
      box-shadow: inset 0 0 0 1px var(--ac1), 0 3px 10px var(--accent-shadow);
    }

    .speed-btn.is-active .speed-rate { color: var(--ac2); }

    .visualizer-container .bar {
      background: linear-gradient(180deg, var(--ac2), var(--ac));
      border-radius: var(--pill);
    }

    .footer-bottom {
      border-top-color: var(--ln);
      color: var(--tx3);
    }

    .footer-bottom .credit-name { color: var(--tx); }

    .github-link {
      border-color: var(--glass-bd);
      background: var(--glass-bg);
      color: var(--tx2);
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
      -webkit-tap-highlight-color: transparent;
    }

    .github-link:hover {
      border-color: var(--ac);
      background: var(--ac);
      color: #ffffff;
    }

    button:focus-visible,
    a:focus-visible,
    select:focus-visible {
      outline: 1.5px solid var(--ac);
      outline-offset: 2px;
      border-radius: 6px;
    }

    html.tz,
    html.tz * {
      transition: background-color var(--t3) var(--e), color var(--t3) var(--e), border-color var(--t3) var(--e);
    }

    :root[data-theme="dark"] .btn-primary,
    :root[data-theme="dark"] .btn-primary.is-paused {
      color: #04120c;
    }

    :root[data-theme="dark"] .btn-primary:hover:not(:disabled) {
      color: #04120c;
    }

    @media (max-width: 560px) {
      .app-container { padding: 24px 18px; border-radius: var(--r); }
      h1 { font-size: 1.42rem; }
    }
