:root {
  --bg: var(--tg-theme-bg-color, #16191d);
  --text: var(--tg-theme-text-color, #e8ebee);
  --muted: var(--tg-theme-hint-color, #8a93a0);
  --card: var(--tg-theme-secondary-bg-color, #1f242a);
  --accent: var(--tg-theme-button-color, #4a90ff);
  --accent-text: var(--tg-theme-button-text-color, #fff);
  --danger: #ff5a5a;
  --ok: #6dd28a;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; overscroll-behavior: contain; }
main { max-width: 560px; margin: 0 auto; padding: 16px 14px 100px; }
.head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 500; }
.ghost { background: transparent; border: 1px solid rgba(255,255,255,0.08); border-radius: 8px;
  color: var(--text); padding: 6px 10px; cursor: pointer; font-size: 15px; }
.panel { background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.langs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.lang-row { display: flex; flex-direction: column; gap: 4px; }
.lang-row label, .voice-row label { color: var(--muted); font-size: 12px; }
select { background: rgba(255,255,255,0.05); color: var(--text); border: 0;
  border-radius: 8px; padding: 8px 10px; font-size: 15px; width: 100%; appearance: none; }
.swap { font-size: 18px; width: 40px; height: 40px; align-self: end; }
.voice-row { display: flex; align-items: center; gap: 10px; }
.voice-row select { max-width: 200px; }
.audio-opts { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { accent-color: var(--accent); }

.status-line { display: flex; gap: 8px; align-items: center; padding: 8px 4px; color: var(--muted); font-size: 13px; }
.cost-badge { margin-left: auto; background: rgba(255,255,255,0.06); padding: 3px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; font-size: 12px; }
.stats-btn { padding: 4px 8px; font-size: 14px; }
.stats ul { list-style: none; padding: 0; margin: 0 0 10px; }
.stats li { padding: 4px 0; display: flex; justify-content: space-between; font-size: 14px; }
.stats-note { color: var(--muted); font-size: 11px; line-height: 1.4; margin: 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #6a737d; }
.dot.live { background: var(--danger); box-shadow: 0 0 0 0 rgba(255,90,90,0.7); animation: pulse 1.4s infinite; }
.dot.ready { background: var(--ok); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,90,90,0.7); }
  70% { box-shadow: 0 0 0 12px rgba(255,90,90,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,90,90,0); }
}

.subtitles { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.sub-block { background: var(--card); border-radius: 14px; padding: 12px 14px; }
.sub-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.sub-text { font-size: 16px; line-height: 1.5; min-height: 80px; max-height: 220px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }

.mic-wrap { position: fixed; left: 0; right: 0; bottom: 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mic-btn { background: var(--accent); color: var(--accent-text); border: 0; border-radius: 999px;
  padding: 14px 28px; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 4px 20px rgba(74,144,255,0.4); cursor: pointer; touch-action: manipulation; user-select: none; }
.mic-btn.active { background: var(--danger); box-shadow: 0 4px 24px rgba(255,90,90,0.5); }
.mic-icon { font-size: 22px; }
.mic-hint { color: var(--muted); font-size: 12px; }

.health ul { list-style: none; padding: 0; margin: 0 0 10px; }
.health li { padding: 4px 0; display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.health code { background: rgba(255,255,255,0.05); padding: 2px 6px; border-radius: 4px; font-size: 11px; word-break: break-all; max-width: 60%; }
.health button { background: var(--accent); color: var(--accent-text); border: 0; border-radius: 10px;
  padding: 8px 14px; font-size: 14px; cursor: pointer; width: 100%; }
.ok { color: var(--ok); }
.err { color: var(--danger); }
.warn { color: #ffb547; }
.hidden { display: none; }
