/* Shared accessibility and responsive refinements. Keep the existing theme. */
[hidden] { display: none !important; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
.skip-link { position:fixed; top:8px; left:12px; z-index:10000; padding:12px 18px; background:#fff; color:#111; border-radius:8px; transform:translateY(-160%); }
.skip-link:focus { transform:none; }
:where(a,button,input,select,summary):focus-visible { outline:2px solid #f5f5f7; outline-offset:3px; }
button:disabled { opacity:.55; cursor:wait; }
.card { transition:transform 200ms ease-out, box-shadow 200ms ease-out; }
.card-detail-link { position:absolute; inset:0; z-index:2; border-radius:inherit; }
.card-detail-link:focus-visible { outline-offset:-3px; }
.card-overlay { z-index:3; pointer-events:none; }
.card-overlay a,.card-overlay button { pointer-events:auto; }
.card:focus-within .card-overlay,.card:focus-within .card-save { opacity:1; }
.card-title { display:block; white-space:nowrap; text-overflow:ellipsis; line-height:1.35; min-height:0; overflow:hidden; font-size:13.5px; }
.card-meta { font-size:12px; margin-top:4px; }
.card-progress.is-complete { background:#4caf64; }
.cast-item,.cred-row { color:inherit; text-decoration:none; }
.col-hero { margin-inline:0; }
/* html already reserves --header-h + 16px with scroll-padding-top. */
.episode-section { scroll-margin-top:0; }
.overview-toggle,.genre-picker,.genre-picker-label,#languageTrigger { display:none; }
.detail-meta { color:#c9c9d2; }
.col-count { font-size:12px; }
.history-tile-action-row { flex-wrap:wrap; row-gap:6px; }
.history-tile-action-row > span { white-space:normal; }
.password-toggle { min-height:40px; margin:4px 0 8px; }
.gate-card label,.modal label { display:block; font-size:12px; color:#b9b9c4; margin-bottom:7px; }
.dialog-back { margin:0 0 16px; }
.advanced-settings { margin:18px 0; }
.advanced-settings summary,.player-help summary { cursor:pointer; min-height:44px; display:flex; align-items:center; color:#c5c5ce; }
.advanced-settings[open] summary { margin-bottom:12px; }
.advanced-settings summary::after { content:''; margin-left:auto; width:18px; height:18px; background:currentColor; mask:url('/icons/ui-chevron-down.svg') center/contain no-repeat; -webkit-mask:url('/icons/ui-chevron-down.svg') center/contain no-repeat; }
.advanced-settings[open] summary::after { transform:rotate(180deg); }
.language-choices { display:flex; gap:12px; }
.language-choices .btn { flex:1; min-height:48px; }
.search-page-form { display:flex; align-items:center; gap:12px; margin:0 0 20px; padding:2px 0 14px; background:transparent; border-radius:0; border-bottom:1px solid var(--line); }
.search-page-form > svg { width:22px; height:22px; flex-shrink:0; color:var(--muted); }
.search-page-form input { min-width:0; flex:1; width:100%; min-height:44px; padding:8px 0; appearance:none; border:0; border-radius:0; background:transparent; color:var(--text); font:inherit; font-size:16px; }
.search-page-form input::placeholder { color:var(--muted); }
.search-page-form input:focus-visible { outline:none; }
.search-page-form:focus-within { box-shadow:none; }
.search-page-form .btn { min-height:44px; padding:10px 18px; border-radius:8px; }
.search-filters { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:20px; }
.search-filters button { min-height:44px; padding:10px 18px; border:0; border-radius:8px; background:transparent; color:var(--muted); font:inherit; cursor:pointer; }
.search-filters button:hover { color:var(--text); background:#ffffff09; }
.search-filters button[aria-pressed="true"] { background:#ffffff16; color:var(--text); }
:is(.search-filters button,.tabs button,.chips .chip):focus { outline:none; }
html.keyboard-input :is(.search-filters button,.tabs button,.chips .chip):focus-visible { outline:2px solid var(--text); outline-offset:3px; }
.search-hint { text-align:center; padding:36px 10px; }
.search-hint .big { display:flex; align-items:center; justify-content:center; margin:0 0 10px; font-size:42px; }
.search-hint .big svg { width:40px; height:40px; }
#searchPageGrid { grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); }
#searchPageGrid .card { width:auto; min-width:0; }
.search-backdrop,.search-modal,.search-head,.search-head input,.search-page-form,.search-page-form input,.search-modal .close { animation:none !important; transition:none !important; }
.modal-backdrop.closing .search-modal,.search-modal .close:hover { transform:none; }
/* The scrim covers the layout viewport; only the content follows the keyboard.
   Sizing the scrim to visualViewport leaves an undimmed strip on iOS Safari. */
.modal-viewport { display:flex; align-items:center; justify-content:center; width:100%; height:100%; min-height:0; }
@media (max-width:760px), (max-width:1040px) and (pointer:coarse) {
  .modal-backdrop { inset:0; height:auto; padding:0; overflow:visible; }
  .modal-viewport {
    position:absolute; inset:var(--visual-top,0px) 0 auto;
    height:var(--visual-height,100dvh);
    padding:max(12px,env(safe-area-inset-top,0px)) max(12px,env(safe-area-inset-right,0px)) max(12px,env(safe-area-inset-bottom,0px)) max(12px,env(safe-area-inset-left,0px));
    overflow-y:auto; overscroll-behavior-y:contain;
  }
}
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; }
/* One quiet control treatment; only keyboard navigation draws a focus ring. */
select:not([multiple]),.tabs .tab,.search-filters button,.chips button.chip { min-height:44px; border:0; border-radius:8px; background-color:var(--card); color:var(--muted); font-family:inherit; font-size:13.5px; font-weight:500; box-shadow:none; }
select:not([multiple]):hover,.tabs .tab:hover,.search-filters button:hover,.chips button.chip:hover { background-color:var(--card2); color:var(--text); }
.tabs .tab.active,.search-filters button[aria-pressed="true"],.chips button.chip.active { background-color:#ffffff16; color:var(--text); }
html select:not([multiple]):focus,html select:not([multiple]):focus-visible { outline:none; border:0; box-shadow:none; }
html.keyboard-input select:not([multiple]):focus-visible { outline:2px solid var(--text); outline-offset:3px; }
html:not(.keyboard-input) :is(button,input):focus-visible { outline:none; }
#searchModalInput:focus-visible { outline:none; }
html.keyboard-input .search-page-form:focus-within,html.keyboard-input .search-head:focus-within { border-bottom-color:var(--text); }
@media(max-width:1040px) {
  #searchPageGrid { grid-template-columns:repeat(auto-fill,minmax(118px,1fr)); }
}
#searchPageGrid > .empty { grid-column:1 / -1; width:100%; text-align:center; }
@media(max-width:480px) {
  .search-page-form { gap:8px; padding-left:12px; }
  .search-page-form .btn { padding:10px 12px; }
  .search-filters button { padding:10px 14px; }
}
.shelf-error { display:flex; align-items:center; gap:16px; flex-wrap:wrap; padding:24px 0; color:var(--muted); }
.shelf-arrows { display:flex; gap:6px; margin-left:auto; }
.shelf-arrows button { width:36px; height:36px; padding:0; border:0; background:#ffffff0a; color:var(--text); border-radius:50%; cursor:pointer; font-size:22px; }
.shelf-arrows button:disabled { opacity:.2; cursor:default; }
.section-head:has(.shelf-arrows) { flex-wrap:wrap; }
.shelf-arrows + a { margin-left:12px; }
.player-help { margin:12px 0 0; padding:0; border:0; }
.player-help summary { display:inline-flex; gap:8px; min-height:44px; padding:0; list-style:none; color:var(--muted); font-size:13px; font-weight:500; }
.player-help summary::-webkit-details-marker { display:none; }
.player-help summary::after { content:none; }
.player-help summary:hover,.player-help[open] summary { color:var(--text); }
.player-help-chevron { flex-shrink:0; transition:transform .16s ease; }
.player-help[open] .player-help-chevron { transform:rotate(180deg); }
.player-help-body { display:flex; flex-direction:column; align-items:flex-start; gap:12px; border-top:1px solid var(--line); padding:12px 0 4px; }
.player-help-body p { flex:1; max-width:64ch; margin:0; color:var(--muted); font-size:13px; line-height:1.6; }
.player-help-notes { min-width:0; display:grid; gap:8px; }
.player-help-actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px; max-width:100%; }
.player-help-actions .btn { min-height:44px; gap:7px; padding:8px 12px; background:var(--card); color:var(--text); font-size:13px; font-weight:500; line-height:1.3; text-decoration:none; border:1px solid var(--line); border-radius:8px; }
.player-help-actions .btn:hover { background:var(--card2); border-color:var(--muted); }
.player-help-actions .source-confirm { background:transparent; color:var(--muted); }
.player-help-actions .source-confirm:hover { color:var(--text); }
.player-nav { align-items:center; gap:12px; }
.player-episode-controls,.player-utility-controls { display:flex; align-items:stretch; gap:8px; min-width:0; }
.player-utility-controls { margin-left:auto; }
.player-nav .btn { min-height:44px; gap:7px; padding:9px 12px; border:0; border-radius:9px; background:var(--card); color:var(--text); font-size:13px; font-weight:500; line-height:1.3; transition:background-color 120ms ease,color 120ms ease,transform 120ms cubic-bezier(.2,0,0,1); }
.player-nav .btn:hover { background:var(--card2); filter:none; }
.player-nav .btn:active { transform:scale(.96); }
.player-nav .btn .ui-icon { width:16px; height:16px; flex:0 0 16px; }
.player-nav .btn-primary { background:var(--text); color:var(--bg); }
.player-nav .btn-primary:hover { background:#fff; }
.player-nav .btn-ghost { background:transparent; color:var(--muted); }
.player-nav .btn-ghost:hover { background:#ffffff0a; color:var(--text); }
.player-nav .btn:disabled { opacity:.35; cursor:default; pointer-events:none; }
.player-next { max-width:min(420px,100%); }
.player-next-title { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:400; opacity:.7; }
.player-more-button { flex:0 0 44px; border-radius:9px; }
.player-more-menu { padding:6px; }
.player-more-menu .filter-option { justify-content:flex-start; gap:10px; }
.player-more-menu .filter-option .ui-icon { width:16px; height:16px; flex:0 0 16px; color:var(--muted); }
.player-more-menu .filter-option:disabled { opacity:.5; cursor:default; }
@media (max-width:640px) {
  .player-help summary,.player-help-body p { font-size:14px; }
  .player-help-actions { width:100%; }
  .player-help-actions .btn { min-height:44px; }
  .player-nav { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; width:100%; }
  .player-episode-controls { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); width:100%; }
  .player-episode-controls .btn { min-width:0; justify-content:center; text-align:center; padding:9px 8px; }
  .player-episode-controls .btn span { min-width:0; overflow-wrap:anywhere; }
  .player-next-title { display:none; }
  /* Four controls share a phone row: Replay keeps its label for screen readers only. */
  .player-episode-controls { grid-template-columns:minmax(0,1fr) 48px minmax(0,1fr); }
  .player-episode-controls [data-action="restart"] { padding:9px 0; }
  .player-episode-controls [data-action="restart"] span { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
  .player-utility-controls { margin-left:0; justify-content:space-between; }
  .player-utility-controls:only-child { grid-column:1 / -1; }
}
@media (prefers-reduced-motion:reduce) { .player-help-chevron,.player-nav .btn,.source-more .ui-icon { transition:none; } .player-nav .btn:active { transform:none; } }
.welcome-banner { --welcome-surface:#111118; position:relative; isolation:isolate; overflow:hidden; align-items:center; min-height:188px; margin:0 0 28px; padding:34px 64px 34px 34px; border:0; border-radius:14px; background:var(--welcome-surface); box-shadow:none; }
.welcome-copy { position:relative; z-index:2; min-width:0; max-width:64%; }
.welcome-copy h2 { margin:0 0 12px; font-size:clamp(24px,2.35vw,32px); line-height:1.15; letter-spacing:-.025em; font-weight:650; text-wrap:balance; max-width:24ch; }
.welcome-copy p { margin:0; color:#c1c1cc; font-size:14px; line-height:1.6; max-width:55ch; text-wrap:pretty; }
.welcome-montage { position:absolute; z-index:0; pointer-events:none; inset:-28px -24px -32px auto; width:49%; display:flex; gap:10px; transform:rotate(6deg); }
.welcome-montage img { display:block; width:calc((100% - 20px)/3); min-width:0; height:100%; object-fit:cover; object-position:center 24%; border-radius:6px; }
.welcome-montage img:nth-child(2) { transform:translateY(14px); }
.welcome-banner::after { content:''; position:absolute; inset:0; z-index:1; pointer-events:none; background:linear-gradient(90deg,var(--welcome-surface) 38%,#111118f0 53%,#11111855 76%,#11111836 100%); }
.welcome-dismiss { position:absolute; top:10px; right:10px; z-index:3; display:grid; place-items:center; width:44px; height:44px; padding:0; border:0; border-radius:50%; cursor:pointer; }
.welcome-dismiss .ui-icon { display:block; }
@media(prefers-reduced-motion:reduce) { .welcome-dismiss { transition:none; } }
@media(max-width:850px) { .welcome-copy { max-width:74%; } }
@media(max-width:560px) {
  .welcome-banner { padding:28px 22px; border-radius:12px; }
  .welcome-copy { max-width:100%; padding-right:10px; }
  .welcome-copy h2 { font-size:25px; max-width:20ch; margin-bottom:10px; }
  .welcome-copy p { font-size:14px; max-width:30ch; }
  .welcome-dismiss { top:3px; right:3px; }
  .welcome-dismiss .ui-icon { width:16px; height:16px; }
  .welcome-montage { width:64%; inset:-22px -44px -22px auto; gap:8px; transform:rotate(7deg); }
  .welcome-montage img { width:calc((100% - 8px)/2); object-position:center 23%; }
  .welcome-montage img:first-child { display:none; }
  .welcome-banner::after { background:linear-gradient(90deg,var(--welcome-surface) 12%,#111118ed 42%,#111118b0 72%,#11111868); }
}
.update-notice { position:fixed; z-index:1100; bottom:calc(20px + env(safe-area-inset-bottom,0px)); inset-inline-end:max(20px,env(safe-area-inset-right,0px)); width:344px; max-width:calc(100% - 40px); padding:8px; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:center; background:var(--card2); color:var(--text); box-shadow:0 12px 36px #0008; border:0; border-radius:var(--radius); }
.update-notice-copy { min-width:0; }
.update-notice-copy strong { display:block; padding-inline-start:8px; font-size:14px; font-weight:600; line-height:1.4; overflow-wrap:anywhere; }
.update-notice-actions { display:flex; align-items:center; gap:4px; }
.update-notice-actions .btn { justify-content:center; min-height:44px; padding:8px 12px; border-radius:8px; font-size:13px; line-height:1.3; white-space:normal; }
.update-notice-actions .update-dismiss { width:44px; min-width:44px; padding:0; }
.update-notice-actions .btn-ghost { color:#c5c5ce; }
.update-notice-actions .btn-ghost:hover { color:var(--text); }
@media(max-width:720px) {
  .update-notice { bottom:calc(12px + env(safe-area-inset-bottom,0px)); inset-inline-end:max(12px,env(safe-area-inset-right,0px)); max-width:calc(100% - 24px); }
}
.collection-upcoming { margin-top:32px; }
.collection-search { display:block; flex:0 1 260px; width:260px; max-width:100%; min-width:0; box-sizing:border-box; margin-left:auto; padding:10px 14px; min-height:44px; border:1px solid var(--line); border-radius:12px; background:var(--card); color:var(--text); font:inherit; font-size:14px; }
.collection-search::placeholder { color:var(--muted); }
.upcoming-art { margin:12px 0 24px; align-items:stretch; }
.upcoming-art:empty { display:none; }
.upcoming-art-item { min-width:0; display:flex; flex-direction:column; }
.upcoming-art-item .card { flex:1; width:100%; }
.upcoming-art-item .card-info { min-height:60px; }
.upcoming-date { color:var(--muted); font-size:12px; line-height:1.5; margin:10px 0 0; min-height:36px; }
.collection-upcoming summary { cursor:pointer; padding:16px 0; color:var(--muted); font-weight:600; }
.upcoming-rows { display:grid; gap:8px; }
.upcoming-row { display:flex; align-items:center; gap:16px; padding:12px 16px; background:var(--surface, #14141e); border-radius:12px; }
.upcoming-row a { flex:1; min-width:0; color:inherit; overflow-wrap:anywhere; }
.upcoming-row small { display:block; color:var(--muted); margin-top:4px; }
.upcoming-row .btn { flex-shrink:0; min-width:44px; }
.library-controls { display:flex; gap:12px; flex-wrap:wrap; align-items:center; margin-bottom:20px; }
.library-controls label { display:flex; gap:8px; align-items:center; font-size:13px; color:var(--muted); }
.library-controls select { max-width:100%; min-height:44px; }
.filter-select { display:inline-flex; max-width:100%; }
.filter-trigger { display:flex; align-items:center; justify-content:space-between; gap:20px; min-height:44px; padding:10px 14px; border:0; border-radius:8px; background:var(--card); color:var(--text); font:inherit; cursor:pointer; text-align:left; }
.filter-trigger::after { content:''; width:16px; height:16px; background:var(--muted); mask:url('/icons/ui-chevron-down.svg') center/contain no-repeat; -webkit-mask:url('/icons/ui-chevron-down.svg') center/contain no-repeat; flex-shrink:0; }
.filter-trigger:hover,.filter-trigger[aria-expanded="true"] { background:var(--card2); }
.filter-menu { position:fixed; inset:auto; margin:0; padding:6px; max-height:min(320px,60dvh); overflow-y:auto; overscroll-behavior:contain; border:1px solid var(--line); border-radius:10px; background:var(--card); color:var(--text); box-shadow:0 12px 36px #0008; }
.filter-option { display:flex; align-items:center; justify-content:space-between; gap:16px; width:100%; min-height:44px; padding:10px 12px; border:0; border-radius:6px; color:var(--text); background:transparent; font:inherit; font-size:13.5px; text-align:left; cursor:pointer; }
.filter-option[aria-selected="true"] { background:transparent; font-weight:600; }
.filter-option[aria-selected="true"]::after { content:''; width:16px; height:16px; background:currentColor; mask:url('/icons/ui-check.svg') center/contain no-repeat; -webkit-mask:url('/icons/ui-check.svg') center/contain no-repeat; flex-shrink:0; }
.filter-option:focus { outline:none; }
.filter-option:hover { background:#ffffff08; }
html.keyboard-input .filter-option:focus { background:#ffffff12; text-decoration:underline; text-underline-offset:4px; }
html.keyboard-input .filter-trigger:focus-visible { outline:2px solid var(--text); outline-offset:3px; }
.source-menu .filter-option { min-height:52px; gap:12px; padding:10px 12px; }
.source-option-content { display:flex; flex-direction:column; gap:5px; min-width:0; flex:1; }
.source-option-name { line-height:1.35; overflow-wrap:anywhere; }
.source-option-badges { display:flex; gap:5px; flex-wrap:wrap; }
.source-badge { display:inline-flex; align-items:center; padding:2px 6px; border-radius:999px; background:var(--card2); color:var(--text); font-size:11px; font-weight:500; line-height:1.4; white-space:nowrap; }
.source-menu:not(.show-all) .filter-option[data-extra]:not([aria-selected="true"]) { display:none; }
.source-more { color:var(--muted); min-height:44px !important; border-top:1px solid var(--line); border-radius:0 0 6px 6px; }
.source-more .ui-icon { width:16px; height:16px; transition:transform .16s ease; }
.source-more[aria-expanded="true"] .ui-icon { transform:rotate(180deg); }
.source-menu .filter-option[data-state="failed"] .source-option-name { color:var(--muted); }
.source-badge-worked { --source-ok:#86efac; color:var(--source-ok); background:color-mix(in srgb,var(--source-ok) 12%,var(--card)); }
.source-badge-failed { --source-bad:#fca5a5; color:var(--source-bad); background:color-mix(in srgb,var(--source-bad) 12%,var(--card)); }
.source-menu-note { margin:6px 12px 8px; padding-top:10px; border-top:1px solid var(--line); color:var(--text); opacity:.75; font-size:11px; line-height:1.5; }
.list-title { white-space:normal; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; }
.list-context { text-align:center; color:var(--muted); font-size:12px; margin-top:5px; }
.image-failed { visibility:hidden; }
@media (max-width:760px) {
  #languageTrigger { display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; }
  .header-actions .lang-switch { display:none; }
  .header-actions { grid-template-columns:repeat(4,44px); gap:2px; }
  .nav-shell { border-top:1px solid var(--line); }
  #nav { padding-block:3px; scrollbar-width:none; }
  #nav::-webkit-scrollbar { display:none; }
  #nav a { position:relative; padding-inline:12px; }
  #nav a.active::after { content:''; position:absolute; inset:auto 12px 3px; height:2px; background:var(--accent); }
  .overview-toggle { display:inline-flex; min-height:44px; }
  #detailOverview:not(.is-expanded) { display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; overflow:hidden; }
  .detail-meta { color:#dedee4; text-shadow:0 1px 5px #000; }
  .detail-hero .hero-grad { background:linear-gradient(180deg,rgba(0,0,0,.18),rgba(10,10,14,.87) 68%,#0a0a0e); }
  /* Title actions: the main action gets the full row, the rest share one row as icon-over-label buttons. */
  .detail-hero .btn-row { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
  .detail-hero .btn-row:not(:has([data-action="trailer"])) { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .detail-hero .btn-row > :first-child { grid-column:1 / -1; justify-content:center; min-height:48px; font-size:15px; }
  .detail-hero .btn-row > .btn:not(:first-child) { flex-direction:column; justify-content:center; gap:4px; min-height:60px; padding:8px 4px; font-size:12px; line-height:1.2; text-align:center; background:rgba(255,255,255,.08); color:var(--text); }
  .genre-picker,.genre-picker-label { display:block; }
  .genre-picker { width:100%; min-height:44px; margin-bottom:18px; }
  .genre-picker-label { font-size:12px; color:var(--muted); margin-bottom:8px; }
  .section:has(#genrePicker) #genreChips { display:none; }
  .shelf-arrows { display:none; }
  .tabs { gap:4px; }
  .tabs button { padding:10px 12px; font-size:13px; min-height:44px; }
  .history-tile-badges { font-size:11.5px; gap:8px; }
  .history-tile-content h4 { font-size:13px; line-height:1.25; }
  .hist-section-title { font-size:12px; }
  .card-title { font-size:13px; }
  .card-meta,.card-year { font-size:12px; }
  .library-controls { gap:8px; }
  /* Collection filters: a compact two-column grid instead of one row per filter. */
  .library-controls:not(.player-source-picker) { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); align-items:end; }
  .library-controls:not(.player-source-picker) label { flex-direction:column; align-items:stretch; gap:4px; min-width:0; font-size:12px; }
  .library-controls:not(.player-source-picker) .filter-select,
  .library-controls:not(.player-source-picker) .filter-trigger,
  .library-controls:not(.player-source-picker) select { width:100%; min-width:0; }
  .library-controls:not(.player-source-picker) .filter-trigger { gap:8px; padding:10px 12px; }
  .library-controls .collection-search { grid-column:1 / -1; order:-1; width:100%; margin:0; }
  #collectionLengthStatus { grid-column:1 / -1; }
}
@media (hover:none), (pointer:coarse) {
  .card-overlay a,.card-overlay button { pointer-events:none; }
  .history-touch-resume { width:44px; height:44px; right:7px; bottom:7px; top:auto; }
  .history-tile-content { right:56px; }
  .history-tile-details { visibility:hidden; }
  .history-touch-resume .ui-icon { width:16px; height:16px; }
  .he-more { min-width:44px; min-height:44px; }
}
@media (max-width:360px) {
  .header-actions { gap:0; }
  .header-inner .logo { gap:5px; }
  .header-inner .logo-wordmark { font-size:17px; }
  .history-tile-badges { gap:5px; font-size:11px; }
  .history-episode-count { display:none; }
}
@media (prefers-reduced-motion:reduce) {
  .card,.history-tile { transition:none; }
  .card:hover,.history-tile:hover { transform:none; }
  .modal-backdrop,.modal-backdrop.closing,.modal-backdrop.closing .modal,.modal-backdrop.closing .search-modal,.modal-backdrop.closing .trailer-modal,.modal,.search-modal,.trailer-modal,.toast { animation:none !important; transition:none !important; }
  .modal-backdrop.closing { opacity:0; }
}

@media (pointer:coarse) {
  .btn { min-height:44px; }
  .btn-sm { min-height:40px; }
  .gate-lang-switch { width:94px; grid-template-columns:44px 44px; }
  .gate-lang-switch .lang-option { min-height:44px; }
  .gate-lang-switch.lang-switch { height:50px; }
  .modal .close,.search-modal .close { width:44px; height:44px; }
}

/* ---------- search: browse shortcuts ---------- */
.search-browse { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; max-width:380px; margin:22px auto 0; }
.search-browse-item { display:flex; align-items:center; gap:10px; min-height:48px; padding:0 14px; border:1px solid var(--line); border-radius:10px; background:var(--card); color:var(--text); font:inherit; font-size:14px; font-weight:600; text-align:left; cursor:pointer; transition:background-color .15s ease, border-color .15s ease; }
.search-browse-item:hover { background:var(--card2); border-color:#34344a; }
.search-browse-item .ui-icon { flex:0 0 auto; color:var(--muted); }

/* ---------- phone navigation: bottom tab bar ---------- */
.tabbar, .mine-switch { display:none; }
@media (max-width:760px) {
  :root { --tabbar-h:56px; }
  .nav-shell, #searchTrigger, #quickPlayBtn { display:none; }
  .header-inner { grid-template-rows:auto; }
  .header-actions { grid-template-columns:repeat(2,44px); }
  body { padding-bottom:calc(var(--tabbar-h) + env(safe-area-inset-bottom,0px)); }
  .tabbar {
    position:fixed; z-index:60; inset:auto 0 0;
    display:grid; grid-template-columns:repeat(4,minmax(0,1fr));
    padding:0 max(4px,env(safe-area-inset-right,0px)) env(safe-area-inset-bottom,0px) max(4px,env(safe-area-inset-left,0px));
    background:var(--bg); border-top:1px solid var(--line);
  }
  .tabbar a, .tabbar button {
    position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
    min-height:var(--tabbar-h); padding:6px 2px 5px; border:0; background:none;
    color:var(--muted); font:inherit; font-size:11px; font-weight:600; line-height:1.1; text-decoration:none; cursor:pointer;
  }
  .tabbar span { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .tabbar .active { color:var(--text); }
  .tabbar .active::before { content:''; position:absolute; inset:0 28% auto; height:2px; border-radius:0 0 2px 2px; background:var(--accent); }
  .tabbar :focus-visible { outline:2px solid var(--text); outline-offset:-4px; border-radius:10px; }
  html.auth-pending .tabbar, html.auth-locked .tabbar, body.is-theatre .tabbar { display:none; }
  body.is-theatre { padding-bottom:0; }
  #toast-root { bottom:calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom,0px)); }
  .update-notice { bottom:calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom,0px)); }
  body.is-theatre #toast-root { bottom:max(22px,env(safe-area-inset-bottom,0px)); }
  .mine-switch { display:flex; gap:2px; width:fit-content; margin:2px 0 16px; padding:3px; border-radius:10px; background:var(--card); }
  .mine-switch a { display:flex; align-items:center; min-height:40px; padding:0 16px; border-radius:8px; color:var(--muted); font-size:14px; font-weight:600; text-decoration:none; }
  .mine-switch a[aria-current="page"] { background:var(--card2); color:var(--text); }
  .search-browse { max-width:none; }
}

/* ---------- My List on touch screens ---------- */
/* An add button on every poster is easy to hit while scrolling. Phones save from the title
   page or player; posters only mark what is already saved (removal asks first). */
@media (max-width:720px), (hover:none), (pointer:coarse) {
  .card-save:not(.saved) { display:none; }
  .card-list .card-save { display:flex; }
}
