/* AstroDub V3 - visual minimalista inspirado em estudios de voz por IA (estilo ElevenLabs):
 * fundo claro, cartoes brancos, botoes pretos em pilula, chips suaves e um "orb" em gradiente.
 * Segue o tema do celular: claro de dia, escuro automaticamente se o Android estiver no modo escuro.
 * Mantem alvos de toque >= 48px e foco visivel para o TalkBack. */
:root {
  color-scheme: light dark;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f2f2f0;
  --border: #e4e4e1;
  --border-strong: #cfcfcb;
  --text: #0b0b0c;
  --muted: #5d5d63;
  --primary: #0b0b0c;
  --primary-text: #ffffff;
  --primary-hover: #2a2a2e;
  --accent-a: #7c5cff;
  --accent-b: #ff7ab6;
  --accent-c: #4fd1c5;
  --ok: #138a42;
  --ok-bg: #e6f6ec;
  --warn: #8a5a00;
  --warn-bg: #fff4d6;
  --fail: #c62828;
  --fail-bg: #fde8e8;
  --info: #2952cc;
  --info-bg: #e8eeff;
  --focus: #7c5cff;
  --shadow: 0 1px 2px rgba(16, 16, 20, 0.04), 0 8px 24px rgba(16, 16, 20, 0.06);
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0e;
    --surface: #151518;
    --surface-2: #1d1d21;
    --border: #2a2a30;
    --border-strong: #3a3a42;
    --text: #f4f4f5;
    --muted: #a6a6ae;
    --primary: #f4f4f5;
    --primary-text: #0b0b0c;
    --primary-hover: #d9d9dd;
    --ok: #4ade80;
    --ok-bg: #0f2a1a;
    --warn: #fbbf24;
    --warn-bg: #2b2108;
    --fail: #f87171;
    --fail-bg: #2d1212;
    --info: #93b0ff;
    --info-bg: #141d38;
    --focus: #a48bff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: -0.005em;
  padding-bottom: calc(48px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 8px; top: -60px;
  background: var(--primary); color: var(--primary-text);
  padding: 12px 16px; border-radius: 999px; z-index: 200; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 8px; }

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

/* ---------- marca: orb em gradiente ---------- */
.orb {
  display: inline-block;
  width: 28px; height: 28px; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.85), transparent 45%),
    conic-gradient(from 200deg, var(--accent-a), var(--accent-b), var(--accent-c), var(--accent-a));
  box-shadow: 0 4px 14px rgba(124, 92, 255, 0.35);
  flex-shrink: 0;
}
.orb-lg { width: 72px; height: 72px; margin: 0 auto 16px; display: block; }

/* ---------- login ---------- */
.screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  padding: 32px 24px; box-shadow: var(--shadow);
}
.brand { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.03em; text-align: center; }
.brand small, .brand-small small {
  font-size: 0.7rem; font-weight: 600; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; vertical-align: middle; letter-spacing: 0;
}
.subtitle { text-align: center; color: var(--muted); margin: 4px 0 24px; font-size: 0.98rem; }

label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 0.92rem; }

input, textarea, select {
  width: 100%; min-height: 52px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 14px;
  padding: 12px 14px; font-size: 1rem; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 22%, transparent);
}
::placeholder { color: var(--muted); opacity: 0.75; }

/* ---------- topo e abas ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-small { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; }
.worker-status { font-size: 0.84rem; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.worker-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.worker-status.online { color: var(--ok); font-weight: 600; }
.worker-status.online::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.topbar-actions { display: flex; gap: 8px; }

.tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  margin: 4px 16px 0; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  position: sticky; top: 8px; z-index: 20;
  box-shadow: 0 -8px 0 8px var(--bg);
}
.tab {
  background: transparent; color: var(--muted); border: none; border-radius: 999px;
  min-height: 48px; padding: 8px 6px; font-size: 0.92rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.tab-count { white-space: nowrap; font-weight: 500; }
.tab.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.tab-panel { display: none; padding: 16px; max-width: 780px; margin: 0 auto; }
.tab-panel.active { display: block; }
#main-content:focus { outline: none; }
@media (min-width: 812px) { .tabs { max-width: 748px; margin-left: auto; margin-right: auto; } }

/* ---------- botoes ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  border: 1px solid transparent; border-radius: 999px;
  padding: 12px 18px; min-height: 48px;
  font-size: 0.98rem; font-weight: 600; font-family: inherit;
  cursor: pointer; text-decoration: none; color: var(--text);
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.55; cursor: progress; }
.btn-lg { width: 100%; min-height: 54px; font-size: 1.02rem; margin-top: 12px; }
.btn-block { width: 100%; margin-top: 10px; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover, .btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--fail); border-color: color-mix(in srgb, var(--fail) 45%, transparent); }
.btn-danger:hover { background: var(--fail-bg); }

/* ---------- cartoes ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.section-label { font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin: 12px 0 8px; color: var(--muted); }
.muted { color: var(--muted); font-size: 0.95rem; }
.small { font-size: 0.86rem; margin-top: 8px; }
.card-list { display: flex; flex-direction: column; gap: 12px; }

.toolbar-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar-row input { flex: 1 1 200px; }

/* ---------- estatisticas ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat-box { background: var(--surface-2); border-radius: 14px; padding: 12px 8px; text-align: center; }
.stat-label { display: block; font-size: 0.78rem; color: var(--muted); }
.stat-box strong { font-size: 1.05rem; font-weight: 700; }

.quota-bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.quota-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent-a), var(--accent-b)); transition: width 0.4s; }

/* ---------- diagnostico ---------- */
.health-results { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.health-item { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.health-item strong { display: block; font-weight: 600; }
.health-tag { display: inline-block; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 999px; margin-bottom: 4px; }
.health-item.ok .health-tag { color: var(--ok); background: var(--ok-bg); }
.health-item.warn .health-tag { color: var(--warn); background: var(--warn-bg); }
.health-item.fail .health-tag { color: var(--fail); background: var(--fail-bg); }
.health-item.fail { border-color: color-mix(in srgb, var(--fail) 40%, var(--border)); }
.health-summary { font-weight: 700; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }

.gpu-buttons { margin-top: 6px; display: grid; gap: 0; }

/* ---------- itens de video ---------- */
.video-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.video-item h3 { font-size: 1.04rem; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 6px; word-break: break-word; }
.meta-line { color: var(--muted); font-size: 0.88rem; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; margin-bottom: 8px; }
.badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-processing { background: var(--info-bg); color: var(--info); }
.badge-completed { background: var(--ok-bg); color: var(--ok); }
.badge-error { background: var(--fail-bg); color: var(--fail); }

.progress-steps { list-style: none; display: flex; gap: 4px; margin: 10px 0 6px; }
.progress-steps li { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); }
.progress-steps li.done { background: linear-gradient(90deg, var(--accent-a), var(--accent-b)); }

.item-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 12px; }

/* ---------- player ---------- */
.player-card { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 14px; margin-bottom: 18px; box-shadow: var(--shadow); }
.player-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.player-header h2 { font-size: 1.02rem; font-weight: 650; word-break: break-word; }
.player-header h2:focus { outline: none; }
.video-wrapper video, .video-wrapper iframe { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 14px; border: none; display: block; }
.video-wrapper video::cue { background: rgba(0, 0, 0, 0.78); color: #fff; font-size: 1.1em; }

.speed-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; padding: 4px; background: var(--surface-2); border-radius: 999px; }
.speed-label { color: var(--muted); font-weight: 600; font-size: 0.88rem; margin: 0 6px 0 10px; }
.speed-btn { background: transparent; min-width: 72px; flex: 1; }
.speed-btn[aria-pressed="true"] { background: var(--primary); color: var(--primary-text); }
.player-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

/* ---------- atalhos e cards ---------- */
.quick-channels { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.btn-chip { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); padding: 10px 16px; min-height: 48px; font-weight: 500; }
.btn-chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }

.fav-manager { margin-top: 10px; padding: 14px; background: var(--surface-2); border-radius: 16px; }
.fav-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.fav-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.fav-list .fav-text { flex: 1; min-width: 0; word-break: break-word; font-weight: 600; }
.fav-list .fav-text small { display: block; color: var(--muted); font-weight: 400; }
.fav-move { display: flex; gap: 6px; }
.fav-move .btn { min-width: 48px; padding: 8px 12px; }

.search-form { margin-top: 14px; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; border-radius: 999px; padding-left: 18px; }

.batch-bar {
  margin-top: 12px; padding: 12px; border-radius: 18px;
  background: var(--primary); color: var(--primary-text);
  display: flex; flex-direction: column; gap: 8px; position: sticky; top: 72px; z-index: 10; box-shadow: var(--shadow);
}
.batch-bar p { font-weight: 600; padding-left: 4px; }
.batch-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.batch-bar .btn-primary { background: var(--primary-text); color: var(--primary); }
.batch-bar .btn-ghost { color: var(--primary-text); border-color: color-mix(in srgb, var(--primary-text) 35%, transparent); }

.yt-card { display: grid; grid-template-columns: 140px 1fr; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.yt-card.selected { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.yt-thumb { position: relative; width: 140px; }
.yt-thumb img { width: 140px; height: 79px; object-fit: cover; border-radius: 12px; display: block; background: var(--surface-2); }
.yt-duration { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, 0.78); color: #fff; font-size: 0.78rem; font-weight: 600; padding: 1px 6px; border-radius: 6px; }
.yt-info { min-width: 0; }
.yt-info h4 { font-size: 0.98rem; font-weight: 650; line-height: 1.35; margin-bottom: 4px; word-break: break-word; }
.yt-meta { color: var(--muted); font-size: 0.86rem; }
.yt-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.yt-actions .btn-select[aria-pressed="true"] { background: var(--surface-2); border-color: var(--focus); color: var(--text); }

.options-grid { display: grid; grid-template-columns: 1fr; gap: 0 10px; margin-top: 8px; }
.options-grid.two-cols { grid-template-columns: 1fr 1fr; }
.error-text { color: var(--fail); margin-top: 10px; }
#login-error { text-align: center; }

/* ---------- tela Dublar (estilo estudio de voz) ---------- */
.btn-gradient {
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  color: #fff; border: none; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent-a) 35%, transparent);
}
.btn-gradient:hover { filter: brightness(1.06); }

.hero { text-align: center; padding: 18px 8px 12px; }
.orb-hero { width: 64px; height: 64px; margin: 0 auto 14px; display: block; animation: orb-breathe 6s ease-in-out infinite; }
@keyframes orb-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06) rotate(8deg); } }
.hero-title { font-size: 1.7rem; font-weight: 750; letter-spacing: -0.035em; line-height: 1.15; }
.hero-sub { color: var(--muted); margin: 8px auto 0; max-width: 34ch; }

.dub-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  padding: 10px; margin-top: 14px; box-shadow: var(--shadow);
}
.dub-box:focus-within { border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 18%, transparent), var(--shadow); }
.dub-box textarea {
  border: none; box-shadow: none !important; min-height: 64px; font-size: 1.05rem; resize: none; padding: 10px 12px; background: transparent;
}
.dub-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-top: 6px; }
.dub-actions .btn { min-height: 54px; font-size: 1.02rem; }

.options-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 12px; padding: 0 16px; }
.options-card > summary {
  min-height: 54px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; cursor: pointer; font-weight: 650; list-style: none; padding: 12px 0;
}
.options-card > summary::-webkit-details-marker { display: none; }
.options-card > summary::after { content: "+"; margin-left: auto; font-size: 1.3rem; color: var(--muted); }
.options-card[open] > summary::after { content: "\2212"; }
.options-card[open] { padding-bottom: 14px; }
.small-inline { font-weight: 500; font-size: 0.86rem; }

.shortcuts { margin-top: 10px; }

.dub-result { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.dub-result:empty { display: none; }
.skeleton { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

.preview-card { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); }
.preview-thumb { position: relative; background: var(--surface-2); aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; }
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-body { padding: 16px; }
.preview-body h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; word-break: break-word; }
.preview-body h2:focus, .list-head h2:focus { outline: none; }
.thumb-ph { color: var(--muted); font-weight: 700; font-size: 0.85rem; }
.badge-platform { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.badge-choose { background: linear-gradient(135deg, color-mix(in srgb, var(--accent-a) 18%, var(--surface)), color-mix(in srgb, var(--accent-b) 18%, var(--surface))); color: var(--text); }
.notice { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--info-bg); color: var(--info); font-size: 0.93rem; }
.known, .pick-known { color: var(--ok); font-weight: 600; }
.known-pending, .known-processing { color: var(--info); }
.known-error { color: var(--fail); }

.list-head { margin-bottom: 0; }
.list-head h2 { word-break: break-word; }
.list-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }

.pick-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.pick-row { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; transition: border-color 0.15s, box-shadow 0.15s; }
.pick-row:has(.pick-check:checked) { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.pick-row.is-known { opacity: 0.8; }
.pick-label { display: grid; grid-template-columns: 28px 112px 1fr; gap: 10px; align-items: center; padding: 10px; margin: 0; font-weight: 400; cursor: pointer; min-height: 64px; }
.pick-check { width: 26px; height: 26px; min-height: 0; accent-color: var(--accent-a); margin: 0; }
.pick-thumb { position: relative; width: 112px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.pick-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pick-title { font-weight: 600; font-size: 0.95rem; line-height: 1.3; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pick-meta { color: var(--muted); font-size: 0.82rem; }

.select-bar {
  position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30; margin-top: 12px;
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 18px; border-radius: 999px;
  background: var(--primary); color: var(--primary-text); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.select-bar p { flex: 1; font-weight: 650; font-size: 0.95rem; }
.select-bar .btn { min-height: 52px; white-space: nowrap; }

.recent { margin-top: 28px; }
.recent-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.recent-head h2 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; }
.recent-head h2:focus { outline: none; }
.recent-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 12px 14px; }
.recent-text { flex: 1; min-width: 0; }
.recent-text .badge { margin-bottom: 4px; }
.recent-text h3 { font-size: 0.98rem; font-weight: 650; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recent-action .btn { min-width: 110px; }
.card.empty { text-align: center; }

@media (max-width: 420px) {
  .pick-label { grid-template-columns: 26px 92px 1fr; }
  .pick-thumb { width: 92px; }
  .recent-item { flex-wrap: wrap; }
  .recent-action { width: 100%; }
  .recent-action .btn { width: 100%; }
  .hero-title { font-size: 1.5rem; }
}

/* ---------- modais e aviso ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 10, 12, 0.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; align-items: flex-end; justify-content: center; padding: 16px; z-index: 100; }
.modal-box { width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
@media (min-width: 600px) { .modal-backdrop { align-items: center; } }
.modal-box h3 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.modal-box h3:focus { outline: none; }
.modal-desc { margin: 8px 0 12px; }
.share-url { margin: 10px 0; padding: 12px; background: var(--surface-2); border-radius: 12px; word-break: break-all; font-size: 0.9rem; }

.toast {
  position: fixed; bottom: calc(92px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  max-width: 92vw; background: var(--primary); color: var(--primary-text);
  padding: 14px 20px; border-radius: 999px; font-weight: 600; z-index: 150; box-shadow: var(--shadow); text-align: center;
}

@media (max-width: 420px) {
  .options-grid.two-cols { grid-template-columns: 1fr; }
  .yt-card { grid-template-columns: 112px 1fr; }
  .yt-thumb, .yt-thumb img { width: 112px; }
  .yt-thumb img { height: 63px; }
  .tab { font-size: 0.86rem; }
  .player-extra { grid-template-columns: 1fr; }
  .btn-ghost.topbar-btn { padding: 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* V3.2: capinha de cada video na fila, na biblioteca e em "Seus videos" */
.job-thumb { width: 100%; aspect-ratio: 16 / 9; max-height: 220px; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.job-thumb img, .recent-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recent-thumb { flex: 0 0 112px; width: 112px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.recent-action { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 520px) {
  .recent-thumb { flex-basis: 96px; width: 96px; }
  .recent-action .btn { flex: 1; width: auto; min-width: 0; }
}
[hidden] { display: none !important; }
.btn-more { width: 100%; margin-top: 12px; }
.list-end { text-align: center; margin: 14px 0; }
.job-progress { margin: 10px 0 6px; }
.job-progress-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.15rem; margin-bottom: 6px; }
.job-progress-top strong { font-size: 1.6rem; }
.job-progress-bar { height: 16px; border-radius: 999px; background: var(--border); overflow: hidden; }
.job-progress-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7c5cff, #f472b6); transition: width .6s ease; }

/* ---------- V3.8: player estilo YouTube ---------- */
.video-wrapper { position: relative; border-radius: 14px; overflow: hidden; background: #000; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.video-wrapper video { border-radius: 0; }
.video-wrapper:fullscreen, .video-wrapper.yt-fake-fs { border-radius: 0; width: 100vw; height: 100vh; display: flex; align-items: center; justify-content: center; }
.video-wrapper:-webkit-full-screen { border-radius: 0; width: 100vw; height: 100vh; }
.video-wrapper:fullscreen video, .video-wrapper.yt-fake-fs video { width: 100%; height: 100%; aspect-ratio: auto; object-fit: contain; }
.video-wrapper.yt-fake-fs { position: fixed; inset: 0; z-index: 9999; }
.yt-ui { position: absolute; inset: 0; color: #fff; font-family: Roboto, Arial, system-ui, sans-serif; }
.yt-ui.drive-mode { display: none; }
.yt-top, .yt-center, .yt-bottom { transition: opacity .22s ease; }
.yt-ui:not(.show) .yt-top, .yt-ui:not(.show) .yt-center, .yt-ui:not(.show) .yt-bottom { opacity: 0; pointer-events: none; }
.yt-ui.show::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,.15) 30%, rgba(0,0,0,.15) 65%, rgba(0,0,0,.7)); pointer-events: none; }
.yt-top { position: absolute; top: 0; left: 0; right: 0; padding: 10px 14px; }
.yt-title { display: none; font-size: 1.05rem; font-weight: 600; text-shadow: 0 1px 3px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-wrapper:fullscreen .yt-title, .video-wrapper.yt-fake-fs .yt-title { display: block; }
.yt-center { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); display: flex; justify-content: center; align-items: center; gap: 12%; }
.yt-btn { background: transparent; border: 0; color: #fff; padding: 0; margin: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.yt-btn svg { fill: #fff; width: 100%; height: 100%; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.yt-btn svg text { fill: #fff; }
.yt-play { width: 68px; height: 68px; background: rgba(0,0,0,.45); padding: 12px; }
.yt-skip { width: 52px; height: 52px; background: rgba(0,0,0,.35); padding: 9px; }
.yt-play .i-pause, .yt-ui.playing .yt-play .i-play { display: none; }
.yt-ui.playing .yt-play .i-pause { display: block; }
.yt-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 12px 4px; }
.yt-row { display: flex; align-items: center; gap: 4px; }
.yt-time { font-size: .95rem; font-weight: 500; text-shadow: 0 1px 3px #000; font-variant-numeric: tabular-nums; }
.yt-spacer { flex: 1; }
.yt-small { width: 46px; height: 46px; padding: 10px; border-radius: 10px; }
.yt-speed { width: auto; min-width: 52px; font-size: 1rem; font-weight: 700; padding: 0 8px; text-shadow: 0 1px 3px #000; }
.yt-small[aria-pressed="true"] svg { fill: #ff3b3b; }
.yt-ui .i-fsx, .video-wrapper:fullscreen .yt-ui .i-fs, .video-wrapper.yt-fake-fs .yt-ui .i-fs { display: none; }
.video-wrapper:fullscreen .yt-ui .i-fsx, .video-wrapper.yt-fake-fs .yt-ui .i-fsx { display: block; }
.yt-bar { position: relative; height: 26px; display: flex; align-items: center; cursor: pointer; touch-action: none; outline: none; }
.yt-bar-track { position: relative; width: 100%; height: 4px; background: rgba(255,255,255,.3); border-radius: 2px; transition: height .12s; }
.yt-bar.drag .yt-bar-track, .yt-bar:focus-visible .yt-bar-track { height: 7px; }
.yt-bar-buf { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255,255,255,.5); border-radius: 2px; }
.yt-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #ff0000; border-radius: 2px; }
.yt-bar-knob { position: absolute; left: 0; width: 15px; height: 15px; margin-left: -7.5px; background: #ff0000; border-radius: 50%; transition: transform .12s; }
.yt-bar.drag .yt-bar-knob { transform: scale(1.35); }
.yt-bubble { position: absolute; bottom: 30px; left: 0; transform: translateX(-50%); background: rgba(0,0,0,.85); padding: 4px 10px; border-radius: 6px; font-size: 1rem; font-weight: 600; display: none; white-space: nowrap; }
.yt-bar.drag .yt-bubble { display: block; }
/* toque duplo: metade esquerda/direita */
.yt-tap { position: absolute; top: 0; bottom: 0; width: 40%; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; transition: opacity .25s; }
.yt-tap-left { left: 0; border-radius: 0 50% 50% 0 / 0 100% 100% 0; }
.yt-tap-right { right: 0; border-radius: 50% 0 0 50% / 100% 0 0 100%; }
.yt-tap.on { opacity: 1; background: rgba(255,255,255,.14); }
.yt-ripple { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 1.3rem; text-shadow: 0 1px 3px #000; }
.yt-ripple b { font-size: .95rem; font-weight: 600; }
.yt-hold { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); padding: 6px 16px; border-radius: 999px; font-weight: 700; font-size: 1rem; display: none; pointer-events: none; }
.yt-ui.holding .yt-hold { display: block; }
.yt-spinner { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border: 5px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: ytspin 0.9s linear infinite; display: none; pointer-events: none; }
.yt-ui.loading .yt-spinner { display: block; }
.yt-ui.loading .yt-play { opacity: 0; }
@keyframes ytspin { to { transform: rotate(360deg); } }
.video-wrapper:fullscreen .yt-play, .video-wrapper.yt-fake-fs .yt-play { width: 84px; height: 84px; }
.video-wrapper:fullscreen .yt-bottom, .video-wrapper.yt-fake-fs .yt-bottom { padding: 0 24px 14px; }
.video-wrapper:fullscreen video::cue { font-size: 1.5em; }
.speed-btn { min-width: 0; padding-left: 6px; padding-right: 6px; }
.speed-label { flex-basis: 100%; text-align: center; padding-top: 4px; }
.video-wrapper:fullscreen video, .video-wrapper.yt-fake-fs video { position: absolute; inset: 0; margin: auto; }

/* ---------- V3.10: telas mais limpas ---------- */
.hero { padding: 6px 4px 10px; }
.hero-title { font-size: 1.45rem; }
.hero-sub { font-size: .95rem; margin-top: 4px; }
.home-status { margin-top: 22px; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.status-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 14px 16px; color: inherit; font: inherit; cursor: pointer; min-height: 96px; }
.status-card strong { font-size: 1.9rem; line-height: 1; font-weight: 750; letter-spacing: -0.03em; }
.status-card span { font-weight: 650; }
.status-card small { color: var(--muted); font-size: .85rem; }
.status-card:active { transform: scale(.98); }

.row-item { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.row-item.is-watched { opacity: .78; }
.row-main { display: flex; gap: 12px; align-items: flex-start; }
.row-main .recent-text h3 { margin-top: 2px; }
.row-main .error-text { margin-top: 4px; font-size: .9rem; }
.row-thumb-wrap { position: relative; flex: 0 0 132px; width: 132px; border-radius: 10px; overflow: hidden; }
.row-thumb-wrap .recent-thumb { width: 100%; flex: none; border-radius: 10px; }
.row-main > .recent-thumb { flex: 0 0 132px; width: 132px; }
.watch-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.35); }
.watch-bar span { display: block; height: 100%; background: #ff0000; }
.row-actions { display: flex; gap: 8px; align-items: center; }
.row-actions > .btn, .row-actions > details { flex: 1; }
.row-actions .btn { min-height: 46px; padding-top: 8px; padding-bottom: 8px; width: 100%; }
.row-more { position: relative; }
.row-more > summary { list-style: none; display: flex; align-items: center; justify-content: center; }
.row-more > summary::-webkit-details-marker { display: none; }
.row-more[open] > summary { background: var(--surface-2); }
.row-more-menu { display: grid; gap: 6px; margin-top: 8px; }
.row-more[open] { flex-basis: 100%; }
.row-actions:has(.row-more[open]) { flex-wrap: wrap; }
.badge-watched { background: rgba(120,120,120,.22); color: var(--muted); }
.btn-danger-text { color: #f87171; }
.item-actions .btn-danger-text, .row-actions .btn-danger-text { border-color: rgba(248,113,113,.35); }
.row-item .job-progress { margin-top: 0; }
.gpu-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.gpu-card-head h2 { font-size: 1.05rem; margin: 0; }
.gpu-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.gpu-card .muted.small { margin-top: 8px; }
.more-tools { margin-top: 14px; }
.more-tools .section-label { margin-top: 14px; }
.more-tools .gpu-buttons { margin-top: 10px; }
#queue-list, #library-list, #recent-list { gap: 10px; }
@media (max-width: 380px) {
  .row-thumb-wrap, .row-main > .recent-thumb { flex-basis: 108px; width: 108px; }
}
#queue-list .row-actions { justify-content: flex-end; }
#queue-list .row-actions > .btn { flex: 0 0 auto; width: auto; min-height: 40px; padding: 6px 18px; }
#queue-list .row-item { gap: 6px; }
