:root {
    --bg: #0a0b14;
    --surface: #13142a;
    --surface-2: #1c1d38;
    --text: #eaeaf0;
    --text-muted: #7d7f96;
    --accent: #ff4d6d;
    --accent-glow: rgba(255,77,109,.25);
    --border: rgba(255,255,255,.07);
    --radius: 10px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; color: inherit; }

/* ════ Topbar ════ */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(10,11,20,.88); border-bottom: 1px solid var(--border); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
.topbar-inner { max-width: 1480px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 900; color: var(--accent); white-space: nowrap; letter-spacing: -.5px; }
.brand-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: var(--accent); color: #fff; border-radius: 8px; font-size: 14px; }
.search-wrap { flex: 1; position: relative; max-width: 440px; margin-left: auto; }
.search-input { width: 100%; height: 40px; border: 1.5px solid var(--border); border-radius: 10px; padding: 0 14px 0 40px; font-size: 14px; outline: none; background: var(--surface); color: var(--text); transition: border .2s, background .2s; }
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); background: var(--surface-2); }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.lang-wrap { flex-shrink: 0; }
.lang-select { height: 40px; border: 1.5px solid var(--border); border-radius: 10px; padding: 0 10px; font-size: 13px; font-weight: 700; color: var(--text); background: var(--surface); cursor: pointer; outline: none; }
.lang-select:focus { border-color: var(--accent); }

/* ════ Search Dropdown ════ */
.search-dropdown { display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.5); max-height: 460px; overflow-y: auto; z-index: 100; }
.search-dropdown.open { display: block; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.search-item { display: grid; grid-template-columns: 48px 1fr; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); transition: background .12s; }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--surface-2); }
.search-item img { width: 48px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.search-meta h4 { font-size: 13px; font-weight: 700; margin-bottom: 4px; line-height: 1.3; }
.search-meta p { font-size: 11px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.search-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ════ Provider Bar ════ */
.provider-bar { background: var(--surface); border-bottom: 1px solid var(--border); }
/* Same width/gutters as the topbar and content rows: the chip strip scrolls inside this box */
.provider-bar-inner { max-width: 1480px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 12px; }
.prov-select-wrap { flex-shrink: 0; }
.prov-select { height: 38px; max-width: 190px; border: 1.5px solid var(--border); border-radius: 24px; padding: 0 34px 0 16px; font-size: 13px; font-weight: 700; color: var(--text); background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d7f96' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center; -webkit-appearance: none; appearance: none; cursor: pointer; outline: none; }
.prov-select:focus { border-color: var(--accent); }
.prov-select option { background: var(--surface); color: var(--text); }
.prov-scroll-wrap { position: relative; flex: 1; min-width: 0; }
.prov-scroll { position: relative; display: flex; gap: 8px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px 0; }
.prov-scroll::-webkit-scrollbar { display: none; }
/* Fade the strip's edges only on the side(s) that have more chips */
.prov-scroll-wrap.can-right .prov-scroll { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); }
.prov-scroll-wrap.can-left .prov-scroll { -webkit-mask-image: linear-gradient(to right, transparent, #000 56px); mask-image: linear-gradient(to right, transparent, #000 56px); }
.prov-scroll-wrap.can-left.can-right .prov-scroll { -webkit-mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, transparent, #000 56px, #000 calc(100% - 56px), transparent); }
.prov-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); display: none; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.prov-arrow:hover { border-color: rgba(255,255,255,.25); }
.prov-arrow.prev { left: 0; }
.prov-arrow.next { right: 0; }
.prov-scroll-wrap.can-left .prov-arrow.prev, .prov-scroll-wrap.can-right .prov-arrow.next { display: flex; }
.prov-chip { padding: 8px 18px; border-radius: 24px; font-size: 13px; font-weight: 700; color: var(--text-muted); background: transparent; border: 1.5px solid var(--border); transition: all .18s; flex-shrink: 0; }
.prov-chip:hover { color: var(--text); border-color: rgba(255,255,255,.2); background: var(--surface-2); }
.prov-chip.active { color: #fff; background: var(--accent); border-color: var(--accent); }

/* ════ Content ════ */
.content { max-width: 1480px; margin: 0 auto; padding: 8px 0 48px; }
.empty-state { text-align: center; color: var(--text-muted); padding: 80px 24px; font-size: 15px; }

/* ════ Row Sections ════ */
.row-section { padding: 20px 0 8px; }
.row-header { display: flex; align-items: baseline; gap: 12px; padding: 0 24px 14px; }
.row-title { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.row-provider { font-size: 12px; font-weight: 700; color: var(--accent); opacity: .8; }

/* ════ Carousel ════ */
.carousel { position: relative; }
.carousel-track { display: flex; gap: 12px; overflow-x: auto; scroll-behavior: smooth; padding: 4px 24px 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-arrow { position: absolute; top: 4px; bottom: 16px; width: 44px; z-index: 5; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 300; color: #fff; opacity: 0; transition: opacity .2s; }
.carousel-arrow.left { left: 0; background: linear-gradient(to right, rgba(10,11,20,.85), transparent); border-radius: 8px 0 0 8px; }
.carousel-arrow.right { right: 0; background: linear-gradient(to left, rgba(10,11,20,.85), transparent); border-radius: 0 8px 8px 0; }
.carousel:hover .carousel-arrow:not(.hidden) { opacity: 1; }
.carousel-arrow.hidden { pointer-events: none; opacity: 0 !important; }

/* ════ Cards ════ */
.card { flex-shrink: 0; width: 155px; display: flex; flex-direction: column; transition: transform .22s ease; }
.card:hover { transform: translateY(-6px) scale(1.04); }
.card-poster { position: relative; width: 100%; aspect-ratio: 3/4; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.card-poster img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.card:hover .card-poster img { transform: scale(1.08); }
.card-poster.no-img { background: linear-gradient(135deg, var(--surface), var(--surface-2)); }
.card-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.35); opacity: 0; transition: opacity .22s; border-radius: var(--radius); }
.card:hover .card-overlay { opacity: 1; }
.card-title { display: block; padding: 8px 2px 4px; font-size: 12px; font-weight: 600; line-height: 1.35; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ════ Skeletons ════ */
.skel-bar, .card.skel .card-poster { background: linear-gradient(110deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 200%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { to { background-position: -200%; } }
.card.skel { pointer-events: none; }

/* ════ Settings Button ════ */
.settings-btn { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; color: var(--text-muted); transition: all .18s; }
.settings-btn:hover { color: var(--text); background: var(--surface-2); }

/* ════ Modal ════ */
.modal-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.7); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 440px; box-shadow: 0 24px 60px rgba(0,0,0,.5); animation: fadeIn .15s ease; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 800; }
.modal-close { font-size: 24px; color: var(--text-muted); line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px; }
.modal-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .5px; }
.modal-input-row { display: flex; gap: 8px; }
.modal-input-row input { flex: 1; height: 42px; border: 1.5px solid var(--border); border-radius: 10px; padding: 0 14px; font-size: 14px; font-family: monospace; background: var(--bg); color: var(--text); outline: none; transition: border .2s; }
.modal-input-row input:focus { border-color: var(--accent); }
.modal-save-btn { height: 42px; padding: 0 20px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 800; transition: opacity .15s; }
.modal-save-btn:hover { opacity: .85; }
.modal-save-btn:disabled { opacity: .5; cursor: not-allowed; }
.modal-status { font-size: 12px; font-weight: 600; margin-top: 10px; min-height: 18px; }
.modal-status.ok { color: #22c55e; }
.modal-status.err { color: #ef4444; }
.modal-status.warn { color: #eab308; }
.modal-license-info { margin-top: 16px; background: var(--bg); border-radius: 10px; padding: 14px 16px; }
.license-info-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 13px; }
.license-info-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.license-info-row span:first-child { color: var(--text-muted); font-weight: 600; }
.li-valid { color: #22c55e; font-weight: 700; }
.li-invalid { color: #ef4444; font-weight: 700; }

/* ════ License Gate ════ */
.license-gate { position: fixed; inset: 0; z-index: 150; background: rgba(10,11,20,.92); backdrop-filter: blur(20px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.license-gate-box { text-align: center; max-width: 420px; width: 100%; }
.license-gate-icon { color: var(--accent); margin-bottom: 20px; }
.license-gate-box h2 { font-size: 22px; font-weight: 800; margin-bottom: 10px; }
.license-gate-box > p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; line-height: 1.5; }
.license-gate-input { display: flex; gap: 8px; margin-bottom: 12px; }
.license-gate-input input { flex: 1; height: 46px; border: 1.5px solid var(--border); border-radius: 10px; padding: 0 16px; font-size: 14px; font-family: monospace; background: var(--surface); color: var(--text); outline: none; text-align: center; letter-spacing: .5px; }
.license-gate-input input:focus { border-color: var(--accent); }
.license-gate-input button { height: 46px; padding: 0 24px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 800; flex-shrink: 0; transition: opacity .15s; }
.license-gate-input button:hover { opacity: .85; }
.license-gate-input button:disabled { opacity: .5; }
.license-gate-status { font-size: 12px; font-weight: 600; min-height: 18px; margin-bottom: 16px; }
.license-gate-status.err { color: #ef4444; }
.license-gate-back { display: inline-block; color: var(--text-muted); font-size: 13px; font-weight: 600; transition: color .15s; }
.license-gate-back:hover { color: var(--text); }

/* ════ Footer ════ */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 32px 24px; text-align: center; }
.footer-brand { font-size: 16px; font-weight: 800; color: var(--accent); margin-bottom: 4px; }
.footer-muted { font-size: 12px; color: var(--text-muted); }

/* ══════════════════════════════════════════
   Player Page (watch.html)
   ══════════════════════════════════════════ */
.player-page { background: #0a0a0a; min-height: 100vh; }
.player-page .topbar { background: rgba(10,10,10,.97); border-color: #1a1a1a; }
.player-page .brand { color: #fff; }
.nav-title { color: #888; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 8px; }
.player-shell { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: 200px 1fr 260px; min-height: calc(100vh - 61px); }
.episode-sidebar { background: #111; border-right: 1px solid #1a1a1a; overflow-y: auto; max-height: calc(100vh - 61px); scrollbar-width: thin; scrollbar-color: #333 transparent; }
.side-head { color: #fff; font-size: 14px; font-weight: 800; padding: 16px; border-bottom: 1px solid #1a1a1a; letter-spacing: .3px; }
.ep-list { display: flex; flex-direction: column; gap: 2px; padding: 6px; }
.ep-item { display: block; padding: 10px 14px; color: #777; font-size: 13px; font-weight: 700; border-radius: 8px; cursor: pointer; transition: all .15s; }
.ep-item:hover { background: #1a1a2e; color: #ccc; }
.ep-item.active { background: var(--accent); color: #fff; }
.stage-wrap { display: flex; justify-content: center; align-items: center; background: #000; min-height: calc(100vh - 61px); }
.stage { position: relative; width: 100%; max-width: calc((100vh - 61px) * 9 / 16); aspect-ratio: 9/16; background: #000; overflow: hidden; }
.stage video { width: 100%; height: 100%; object-fit: contain; }
.hud { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; opacity: 0; transition: opacity .3s; z-index: 5; pointer-events: none; }
.hud > * { pointer-events: auto; }
.stage:hover .hud, .hud.show { opacity: 1; }
.hud-top { padding: 14px 16px; color: #fff; font-size: 13px; font-weight: 700; background: linear-gradient(rgba(0,0,0,.6), transparent); }
.hud-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); cursor: pointer; opacity: .85; transition: opacity .2s, transform .2s; filter: drop-shadow(0 2px 8px rgba(0,0,0,.5)); }
.hud-center:hover { opacity: 1; transform: translate(-50%,-50%) scale(1.1); }
.hud-center.hidden { display: none; }
.hud-bottom { padding: 10px 14px 14px; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.seek { width: 100%; height: 4px; -webkit-appearance: none; appearance: none; background: rgba(255,255,255,.2); border-radius: 2px; outline: none; cursor: pointer; margin-bottom: 8px; transition: height .15s; }
.seek:hover { height: 6px; }
.seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; background: var(--accent); border-radius: 50%; cursor: pointer; box-shadow: 0 0 6px rgba(255,77,109,.4); }
.hud-controls { display: flex; justify-content: space-between; align-items: center; color: #fff; font-size: 11px; font-weight: 600; }
.hud-right { display: flex; gap: 6px; align-items: center; }
.hud-btn { background: rgba(255,255,255,.12); border: none; color: #fff; padding: 5px 10px; border-radius: 6px; font-size: 11px; font-weight: 800; cursor: pointer; transition: background .15s; }
.hud-btn:hover { background: rgba(255,255,255,.25); }
.hud-btn.active { background: var(--accent); }
.hud-select { background: #1a1a1a; color: #fff; border: 1px solid #333; border-radius: 6px; padding: 4px 8px; font-size: 11px; cursor: pointer; }
.info-sidebar { background: #111; border-left: 1px solid #1a1a1a; padding: 20px; overflow-y: auto; max-height: calc(100vh - 61px); }
.info-poster { width: 100%; border-radius: 12px; margin-bottom: 14px; aspect-ratio: 3/4; object-fit: cover; }
.info-title { color: #fff; font-size: 17px; font-weight: 800; margin-bottom: 8px; line-height: 1.3; }
.info-desc { color: #777; font-size: 12px; line-height: 1.6; }

/* ════ Responsive ════ */
@media (max-width: 1100px) {
    .player-shell { grid-template-columns: 180px 1fr; }
    .info-sidebar { display: none; }
    .card { width: 140px; }
}
@media (max-width: 768px) {
    .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
    .brand { order: 1; font-size: 18px; }
    .brand-icon { width: 28px; height: 28px; font-size: 12px; }
    .lang-wrap { order: 2; margin-left: auto; }
    .search-wrap { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; }
    .search-input { height: 38px; }
    .lang-select { height: 36px; font-size: 12px; }
    .provider-bar-inner { padding: 10px 16px; gap: 8px; }
    .prov-scroll { gap: 6px; }
    .prov-chip { padding: 6px 14px; font-size: 12px; }
    .prov-select { height: 32px; max-width: 132px; font-size: 12px; padding: 0 28px 0 12px; background-position: right 10px center; }
    .prov-arrow { display: none !important; }   /* touch: swipe the strip */
    .row-header { padding: 0 16px 12px; }
    .carousel-track { padding: 4px 16px 12px; gap: 10px; }
    .carousel-arrow { display: none; }
    .card { width: 120px; }
    .card-title { font-size: 11px; }
    .row-title { font-size: 16px; }
    .player-shell { grid-template-columns: 1fr; }
    .episode-sidebar { max-height: none; border-right: none; border-top: 1px solid #1a1a1a; order: 2; }
    .ep-list { flex-direction: row; overflow-x: auto; padding: 8px; -webkit-overflow-scrolling: touch; }
    .ep-list::-webkit-scrollbar { display: none; }
    .ep-item { white-space: nowrap; padding: 8px 12px; font-size: 12px; flex-shrink: 0; }
    .stage-wrap { min-height: 60vh; order: 1; }
    .stage { max-width: 100%; }
    .player-page .topbar-inner { flex-wrap: nowrap; gap: 8px; }
    .player-page .nav-title { display: none; }
    .player-page .lang-wrap { margin-left: auto; }
}
@media (max-width: 480px) {
    .topbar-inner { padding: 8px 12px; gap: 8px; }
    .brand { font-size: 16px; }
    .brand-icon { width: 26px; height: 26px; font-size: 11px; border-radius: 7px; }
    .search-input { height: 36px; font-size: 13px; padding-left: 36px; }
    .search-icon { left: 11px; width: 16px; height: 16px; }
    .provider-bar-inner { padding: 8px 12px; gap: 6px; }
    .prov-scroll { gap: 5px; }
    .prov-chip { padding: 5px 12px; font-size: 11px; }
    .prov-select { height: 30px; max-width: 112px; font-size: 11px; }
    .row-header { padding: 0 12px 10px; }
    .row-title { font-size: 14px; }
    .carousel-track { padding: 4px 12px 10px; gap: 8px; }
    .card { width: 110px; }
    .card-poster { border-radius: 8px; }
    .card-title { font-size: 11px; padding: 6px 1px 2px; }
    .card-overlay { display: none; }
    .content { padding: 4px 0 32px; }
    .site-footer { padding: 24px 12px; }
    .stage-wrap { min-height: 50vh; }
    .hud-controls { flex-wrap: wrap; gap: 6px; }
    .hud-btn { padding: 4px 8px; font-size: 10px; }
    .hud-select { font-size: 10px; padding: 3px 6px; }
    .side-head { padding: 12px; font-size: 13px; }
}

/* Video error overlay */
#video-error-overlay {
    position: absolute; inset: 0; z-index: 50;
    display: none; align-items: center; justify-content: center;
    background: rgba(0,0,0,.85);
}
.video-error-box {
    text-align: center; max-width: 360px; padding: 32px;
}
.video-error-icon { font-size: 48px; margin-bottom: 12px; }
.video-error-title {
    font-size: 18px; font-weight: 600; color: #fff; margin-bottom: 8px;
}
.video-error-msg {
    font-size: 13px; color: #aaa; line-height: 1.5; margin-bottom: 20px;
}
.video-error-actions { display: flex; gap: 10px; justify-content: center; }
.ve-btn {
    padding: 8px 20px; border: none; border-radius: 6px;
    font-size: 13px; font-weight: 600; cursor: pointer; transition: opacity .2s;
}
.ve-btn:hover { opacity: .85; }
.ve-retry { background: var(--accent); color: #fff; }
.ve-next { background: rgba(255,255,255,.15); color: #fff; }

/* Locked episodes */
.ep-item.locked { opacity: .5; }
.ep-item.locked:hover { opacity: .7; }
.ep-item.locked .lock-icon { margin-left: 2px; vertical-align: -1px; opacity: .7; }
.hud-btn svg { display: block; }

/* Subtitle position menu */
.sub-pos-wrap { position: relative; display: inline-flex; }
.sub-pos-menu { display: none; position: absolute; bottom: calc(100% + 8px); right: 0; background: rgba(20,20,20,.96); border: 1px solid #333; border-radius: 8px; padding: 6px; min-width: 150px; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.sub-pos-menu.open { display: block; }
.sub-pos-head { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: #888; padding: 4px 8px 6px; }
.sub-pos-menu button { display: block; width: 100%; text-align: left; background: none; border: none; color: #ddd; font-size: 13px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.sub-pos-menu button:hover { background: rgba(255,255,255,.1); }
.sub-pos-menu button.active { color: #fff; background: var(--accent); }

/* AI subtitle progress chip */
.ai-sub-status { position: absolute; left: 50%; bottom: 72px; transform: translateX(-50%); z-index: 6; pointer-events: none; max-width: calc(100% - 32px); padding: 6px 12px; border-radius: 999px; background: rgba(0,0,0,.72); color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .25s; }
.ai-sub-status.show { opacity: 1; }
.ai-sub-status.ok { background: rgba(22,128,61,.85); }
.ai-sub-status.err { background: rgba(185,28,28,.85); }
.sub-pos-menu { min-width: 200px; }
.sub-pos-head:not(:first-child) { margin-top: 6px; border-top: 1px solid #2a2a2a; padding-top: 10px; }
.sub-opt-row { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.sub-pos-menu .sub-opt-row button { text-align: center; padding: 7px 6px; font-size: 12px; }

/* Subtitle overlay (cues drawn by the page; see renderCues in player.js) */
.sub-overlay { position: absolute; z-index: 4; pointer-events: none; --sub-base: 16px; --sub-scale: 1; }
.sub-box { position: absolute; left: 5%; right: 5%; bottom: 7%; text-align: center; transition: bottom .2s, top .2s; }
.sub-line { display: inline; background: rgba(0,0,0,.72); color: #fff; font-size: calc(var(--sub-base) * var(--sub-scale)); font-weight: 500; line-height: 1.4; padding: .08em .35em; border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; text-shadow: 0 1px 2px rgba(0,0,0,.6); white-space: pre-line; overflow-wrap: anywhere; }
.sub-overlay[data-pos="raised"] .sub-box { bottom: 22%; }
.sub-overlay[data-pos="middle"] .sub-box { bottom: auto; top: 50%; transform: translateY(-50%); }
.sub-overlay[data-pos="top"] .sub-box { bottom: auto; top: 7%; }
/* Keep bottom subtitles clear of the control bar while it is visible */
.stage:hover .sub-overlay[data-pos="bottom"] .sub-box,
.hud.show ~ .sub-overlay[data-pos="bottom"] .sub-box { bottom: max(7%, 76px); }

/* Search results page (Enter in the search box) */
.search-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; padding: 20px 24px 16px; }
.search-count { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.search-clear-btn { margin-left: auto; background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); border-radius: 20px; padding: 6px 14px; font-size: 12px; font-weight: 700; cursor: pointer; }
.search-clear-btn:hover { color: var(--text); border-color: rgba(255,255,255,.2); }
.search-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 16px; padding: 0 24px; }
.search-grid .card { width: auto; }
.search-all { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px; border: none; border-top: 1px solid var(--border); background: transparent; color: var(--accent); font-size: 13px; font-weight: 700; cursor: pointer; }
.search-all:hover { background: var(--surface-2); }
.search-all kbd { font: 600 10px/1 inherit; color: var(--text-muted); border: 1px solid var(--border); border-radius: 4px; padding: 3px 5px; }
@media (max-width: 768px) {
    .search-head { padding: 16px 16px 12px; }
    .search-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 16px 10px; padding: 0 16px; }
}
@media (max-width: 480px) {
    .search-head { padding: 14px 12px 10px; }
    .search-grid { grid-template-columns: repeat(3, 1fr); gap: 14px 8px; padding: 0 12px; }
}
