/* ==========================================================================
   SubLunio · preview player and subtitle text preview
   The player keeps a dark chrome in both themes, like a screening room.
   ========================================================================== */

.player-shell{position:relative;overflow:hidden;border:1px solid var(--line);border-radius:var(--radius);background:#080d1c;color:#f1f4ff;box-shadow:var(--shadow)}
.player-screen{position:relative;display:grid;place-items:center;aspect-ratio:16/9;overflow:hidden;background:#0b1123;container-type:inline-size}
.player-screen video,.player-poster{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}
.player-compatibility{position:relative;z-index:2;display:grid;justify-items:center;align-content:center;gap:1rem;width:100%;min-height:100%;padding:clamp(20px,5vw,48px);background:rgb(8 13 28/.96);text-align:center;color:#f1f4ff}
.player-compatibility>*{margin:0;max-width:560px}
.player-compatibility h3{font-size:1.15rem;color:inherit}
.player-compatibility p{line-height:1.75;font-size:.94rem;color:#ccd5ec;overflow-wrap:anywhere}
.player-compatibility-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:.75rem}
.player-compatibility-actions button{min-height:44px;white-space:normal}
.player-screen.compatibility-choice{aspect-ratio:auto;min-height:280px}
.player-poster{pointer-events:none;background:#0b1123}
.player-loading{position:absolute;inset:0;z-index:1;display:grid;place-content:center;justify-items:center;gap:.85rem;padding:24px;background:rgb(8 13 28/.4);color:#f1f4ff;font-size:.875rem;line-height:1.5;text-align:center;pointer-events:none}
.player-spinner,.player-note.is-loading::before,.player-compatibility p.is-loading::before{box-sizing:border-box;border:3px solid rgb(255 255 255/.25);border-top-color:currentColor;border-radius:50%;animation:player-spin .8s linear infinite}
.player-spinner{width:44px;height:44px}
.player-note.is-loading::before,.player-compatibility p.is-loading::before{content:"";display:inline-block;width:1em;height:1em;margin-inline-end:.6em;border-width:2px;border-color:currentColor;border-inline-end-color:transparent;vertical-align:-.15em}
@keyframes player-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.player-spinner,.player-note.is-loading::before,.player-compatibility p.is-loading::before{animation-duration:2s}}
.player-center-play{position:relative;display:grid;place-items:center;width:68px;height:68px;min-height:0;margin:0;padding:0;border:1px solid rgb(255 255 255/.2);border-radius:50%;background:linear-gradient(145deg,rgb(255 255 255/.14),rgb(255 255 255/.03)),rgb(15 23 42/.64);color:#fff;box-shadow:0 8px 28px rgb(0 0 0/.24),inset 0 1px 0 rgb(255 255 255/.12);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);transition:transform .18s ease,background-color .18s ease,border-color .18s ease,box-shadow .18s ease}
.player-center-play svg{display:block;width:26px;height:26px;fill:currentColor;stroke:currentColor;stroke-width:1.5;stroke-linejoin:round;pointer-events:none}
.player-center-play:hover{border-color:rgb(255 255 255/.2);background:linear-gradient(145deg,rgb(255 255 255/.14),rgb(255 255 255/.03)),rgb(15 23 42/.64);color:#fff}
@media(hover:hover){.player-center-play:hover{transform:scale(1.06);border-color:rgb(255 255 255/.36);background-color:rgb(30 41 59/.82);box-shadow:0 10px 32px rgb(0 0 0/.3),inset 0 1px 0 rgb(255 255 255/.16)}}
.player-center-play:active{transform:scale(.96);box-shadow:0 3px 12px rgb(0 0 0/.2),inset 0 1px 0 rgb(255 255 255/.08)}
.player-center-play:focus-visible{outline:2px solid #fff;outline-offset:5px}
@media(prefers-reduced-motion:reduce){.player-center-play{transition:none}.player-center-play:hover,.player-center-play:active{transform:none}}
.player-end{position:absolute;inset:0;display:grid;align-content:center;justify-items:center;gap:1.1rem;padding:24px;background:rgb(8 13 28/.88);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);text-align:center}
.player-end>*{margin-block-start:0}
.player-end p{max-width:420px;color:#f1f4ff;font-size:1.0625rem;font-weight:600;line-height:1.55}
.player-watch-notice{position:absolute;inset-block-start:12px;inset-inline:12px;width:fit-content;max-width:calc(100% - 24px);margin:0;padding:.55rem .8rem;border:1px solid rgb(255 255 255/.2);border-radius:8px;background:rgb(8 13 28/.82);color:#f1f4ff;font-size:.8125rem;line-height:1.5;pointer-events:none}
/* A transport bar keeps one direction in every locale. */
.player-controls{display:grid;grid-template-columns:auto minmax(40px,1fr) auto auto auto;gap:8px;align-items:center;padding:8px 12px;border-top:1px solid rgb(255 255 255/.07);background:#0c1329;direction:ltr}
.player-controls button{min-width:40px;min-height:40px;padding:4px;border-color:transparent;border-radius:50%;background:none;box-shadow:none;color:#fff;font-size:1rem;line-height:1}
.player-controls button:hover{border-color:transparent;background:rgb(255 255 255/.12);color:#fff}
.player-controls button:disabled{background:none;color:rgb(255 255 255/.4)}
.player-controls input{min-height:20px;margin:0;border:0;background:none;accent-color:var(--caption)}
.player-controls input:focus{box-shadow:none}
.player-clock{color:#ccd5ec;font-size:.75rem;font-variant-numeric:tabular-nums;white-space:nowrap;direction:ltr}
.player-tools{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:.6rem .75rem;padding-bottom:1rem}
.player-tools label{display:grid;gap:.3rem;color:var(--muted);font-size:.75rem;font-weight:550}
.player-tools label>select{margin:0}
.player-tools select{width:100%;min-height:40px;padding-block:.25rem;padding-inline-start:.7rem;font-size:.875rem}
.player-shell:fullscreen,.player-shell.page-fullscreen{display:flex;flex-direction:column;width:100%;height:100%;border:0;border-radius:0}
.player-shell:fullscreen .player-screen,.page-fullscreen .player-screen{flex:1;aspect-ratio:auto}
.player-shell:fullscreen .player-controls{min-height:60px}
.player-shell.page-fullscreen{position:fixed;inset:0;z-index:1000}
.player-note{margin-bottom:1rem;color:var(--muted);font-size:.8438rem;line-height:1.7}
.player-note:empty{display:none}
.player-note+.notice{margin:0 0 1rem}
.player-file-action{margin:0 0 1rem}
.player-captions{position:absolute;inset-inline:4%;bottom:6%;display:flex;flex-direction:column;align-items:center;gap:.2em;pointer-events:none;text-align:center;color:#ffd84d;font-family:Arial,sans-serif;font-size:calc(clamp(16px,2.8cqw,48px)*var(--caption-scale,1));line-height:1.3}
.player-caption-cue{max-width:100%}
.player-caption-group{white-space:pre-wrap;overflow-wrap:anywhere}
.player-caption-group>span{padding:.04em .15em;background:var(--caption-bg,rgb(0 0 0/.5));-webkit-box-decoration-break:clone;box-decoration-break:clone}
.player-caption-original{font-size:80%;color:#d0d0d0}
.player-shell[data-caption-size=".8"]{--caption-scale:.8}
.player-shell[data-caption-size="1.25"]{--caption-scale:1.25}
.player-shell[data-caption-size="1.5"]{--caption-scale:1.5}
.player-shell[data-caption-background="0"]{--caption-bg:transparent}
.player-shell[data-caption-background=".85"]{--caption-bg:rgb(0 0 0/.85)}

.subtitle-text-preview{min-width:0;overflow:hidden;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);box-shadow:var(--shadow-sm);container:subtitle-preview/inline-size}
.subtitle-text-preview>*{margin-block-start:0}
.subtitle-text-preview>header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.75rem 1rem;padding:1rem 1.4rem;border-bottom:1px solid var(--line);background:var(--surface-2)}
.subtitle-text-preview>header>*{margin-block-start:0}
.subtitle-text-preview h3{min-width:0;overflow-wrap:anywhere;font-size:1rem}
.subtitle-text-header-actions,.subtitle-search-toolbar,.subtitle-search-navigation{display:flex;align-items:center;gap:.35rem}
.subtitle-text-header-actions{flex-shrink:0;gap:.9rem}
.subtitle-format-options,.subtitle-format-buttons,.subtitle-view-options{display:flex;align-items:center;gap:.2rem;min-width:0}
.subtitle-format-buttons{padding:.2rem;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--surface)}
.subtitle-format-buttons button,.subtitle-view-options button{min-height:34px;padding:.35rem .65rem;border:1px solid transparent;border-radius:var(--radius-xs);background:transparent;color:var(--muted);font-size:.8125rem;box-shadow:none}
.subtitle-format-buttons button[aria-pressed=true],.subtitle-view-options button[aria-pressed=true]{border-color:var(--brand-line);background:var(--brand-soft);color:var(--brand-ink)}
.subtitle-format-buttons button:disabled,.subtitle-view-options button:disabled{opacity:.6}
.subtitle-format-select{display:none;width:auto;min-height:38px;margin:0;padding-block:.35rem;font-size:.8125rem}
/* Balance the visible chevron with the text inset, accounting for its SVG gutter. */
.subtitle-format-options .subtitle-format-select{padding-inline-start:.85rem;background-position:right calc(.85rem - 3px) center}
.subtitle-view-toolbar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.6rem 1rem;padding:.85rem 1.4rem;border-bottom:1px solid var(--line)}
.subtitle-view-options{flex-wrap:wrap}
.subtitle-format-hint,.subtitle-file-name{color:var(--muted);font-size:.75rem;overflow-wrap:anywhere}
.subtitle-file-preview{min-width:0;padding:1rem 1.4rem}
.subtitle-file-name{display:block}
.subtitle-file-preview pre{max-height:480px;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;margin:1rem 0 0;padding:.25rem 0;white-space:pre-wrap;overflow-wrap:anywhere;text-align:left;font:400 .8125rem/1.8 ui-monospace,SFMono-Regular,Consolas,monospace}
.subtitle-file-preview code{padding:0;background:transparent;color:var(--text);font:inherit;white-space:inherit}
@container subtitle-preview (max-width:38rem){
  .subtitle-format-buttons{display:none}
  .subtitle-format-select{display:block}
  .subtitle-text-header-actions{gap:.35rem}
}
.subtitle-search-icon{display:grid;place-items:center;min-width:36px;min-height:36px;padding:.45rem;border-radius:8px;color:var(--muted);box-shadow:none}
.subtitle-search-icon svg{display:block;width:19px;height:19px;pointer-events:none}
.subtitle-search-icon.is-active{background:var(--brand-soft);color:var(--brand-ink)}
.subtitle-search-panel{padding:1rem 1.4rem;border-bottom:1px solid var(--line);background:var(--surface-2)}
.subtitle-search-panel>p{margin:.65rem 0 0;font-size:.75rem;line-height:1.6}
.subtitle-search-fields{display:grid;grid-template-columns:minmax(0,1fr) minmax(150px,.55fr) auto;align-items:end;gap:.65rem}
.subtitle-search-panel label{display:grid;gap:.3rem;min-width:0;color:var(--text-2);font-size:.75rem;font-weight:550}
.subtitle-search-panel :is(input,select){width:100%;margin:0;min-height:40px;font-size:.875rem}
.subtitle-search-fields>.subtitle-search-icon{margin-bottom:2px}
.subtitle-search-summary{display:flex;align-items:center;justify-content:space-between;gap:.5rem;min-height:36px;margin-top:.35rem}
.subtitle-search-status{color:var(--muted);font-size:.8125rem;font-variant-numeric:tabular-nums}
.subtitle-search-replace{display:flex;align-items:end;gap:.65rem;margin-top:.45rem}
.subtitle-search-replace label{flex:1}
.subtitle-search-replace button{min-height:40px;white-space:normal}
.subtitle-search-notice{color:var(--brand-ink)}
.subtitle-search-match{border-radius:3px;background:#fff0ae;color:#563800;box-decoration-break:clone;-webkit-box-decoration-break:clone}
.subtitle-search-match.is-current{background:var(--brand);color:white;outline:2px solid var(--brand);outline-offset:1px}
.subtitle-text-rows{max-height:520px;padding:.25rem 1.4rem;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--line-strong) transparent}
.subtitle-text-rows:focus-visible{outline-offset:-3px}
.subtitle-text-rows>.muted{padding:1.5rem 0}
.subtitle-text-cue{display:grid;grid-template-columns:2.4rem minmax(0,1fr);column-gap:.75rem;row-gap:.35rem;padding:1.05rem 0}
.subtitle-text-cue+.subtitle-text-cue{border-top:1px solid var(--line)}
.subtitle-text-number{grid-column:1;grid-row:1;color:var(--muted);font-size:.75rem;font-variant-numeric:tabular-nums;line-height:1.7}
.subtitle-text-time{grid-column:2;color:var(--muted);font:500 .75rem/1.7 ui-monospace,SFMono-Regular,Consolas,monospace;overflow-wrap:anywhere;unicode-bidi:isolate}
.subtitle-text-line{grid-column:2;font-size:.9688rem;line-height:1.75;white-space:pre-wrap;overflow-wrap:anywhere}
.subtitle-text-line.subtitle-original{color:var(--muted);font-size:.875rem}
.subtitle-cue-actions{grid-column:2;display:flex;justify-content:flex-end;gap:.25rem;margin-top:.25rem}
.subtitle-cue-actions button{min-height:34px;padding:.3rem .6rem;font-size:.8125rem}
.subtitle-cue-editor{grid-column:2;display:grid;gap:.75rem;min-width:0;margin-top:.4rem;container-type:inline-size}
.subtitle-cue-editor textarea{width:100%;min-height:100px;line-height:1.6;resize:vertical}
.subtitle-cue-editor .row{gap:.5rem}
.subtitle-edit-fields{display:grid;gap:1rem;min-width:0;align-items:start}
.subtitle-edit-track{display:grid;gap:.75rem;min-width:0}
.subtitle-edit-track label{display:grid;gap:.4rem;min-width:0}
.subtitle-edit-label{display:flex;align-items:baseline;justify-content:space-between;gap:.35rem .75rem;flex-wrap:wrap;font-size:.8125rem;font-weight:600}
.subtitle-edit-time{font:400 .6875rem/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--muted);overflow-wrap:anywhere}
.subtitle-edit-hint{margin:0;line-height:1.6}
@container(min-width:36rem){.subtitle-edit-fields.has-two-tracks{grid-template-columns:repeat(2,minmax(0,1fr))}}
/* Each run keeps its own direction; only the alignment follows the page. */
.subtitle-text-time,.subtitle-text-line{text-align:left}
[dir=rtl] :is(.subtitle-text-time,.subtitle-text-line){text-align:right}
.subtitle-text-pagination{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:1rem;padding:.85rem 1.4rem;border-top:1px solid var(--line)}
.subtitle-text-pagination button:first-child{justify-self:start}
.subtitle-text-pagination button:last-child{justify-self:end}
.subtitle-text-pagination>*{margin-block-start:0}
.subtitle-text-pagination button{min-height:36px;padding:.35rem .85rem;border-radius:var(--radius-xs);font-size:.8125rem}
.subtitle-text-status{color:var(--muted);font-size:.8125rem;font-variant-numeric:tabular-nums;text-align:center}
.subtitle-text-end{display:flex;align-items:center;justify-content:space-between;gap:.9rem 1.5rem;flex-wrap:wrap;padding:1.1rem 1.4rem;border-top:1px solid var(--line);background:var(--surface-2)}
/* The side card holds the filled action; here the same action is the quiet one. */
.subtitle-text-end button.primary{min-height:40px;border-color:var(--brand);background:transparent;box-shadow:none;color:var(--brand-ink);font-size:.875rem}
.subtitle-text-end button.primary:hover{background:var(--brand-soft);color:var(--brand-ink)}
.subtitle-text-end button.primary:disabled{border-color:var(--line);background:transparent;color:var(--muted)}
.subtitle-text-end>*{margin-block-start:0}
.subtitle-text-end p{color:var(--text-2);font-size:.9rem}
@media(max-width:560px){
  .player-center-play{width:56px;height:56px}
  .player-center-play svg{width:23px;height:23px}
  .player-controls{gap:4px;padding:8px}
  .player-clock{font-size:.6875rem}
  .player-controls button{min-width:36px;min-height:36px}
  .player-end p{font-size:.9375rem}
  .subtitle-text-preview>header,.subtitle-text-pagination,.subtitle-text-end{padding:1rem}
  .subtitle-text-preview>header{gap:.5rem}
  .subtitle-text-header-actions{gap:.35rem}
  .subtitle-view-toolbar,.subtitle-file-preview{padding:.85rem 1rem}
  .subtitle-file-preview pre{max-height:400px}
  .subtitle-search-panel{padding:.85rem 1rem}
  .subtitle-search-fields{grid-template-columns:minmax(0,1fr) auto}
  .subtitle-search-fields>label:first-child{grid-column:1}
  .subtitle-search-fields>label:nth-child(2){grid-column:1;grid-row:2}
  .subtitle-search-fields>.subtitle-search-icon{grid-column:2;grid-row:1}
  .subtitle-text-rows{max-height:440px;padding:.25rem 1rem}
  .subtitle-text-cue{grid-template-columns:1.6rem minmax(0,1fr);column-gap:.45rem}
  .subtitle-text-time{font-size:.6875rem}
  .subtitle-text-pagination{gap:.5rem}
}
@media(max-width:845px){
  .player-tools{grid-template-columns:repeat(6,minmax(0,1fr));align-items:end}
  .player-tools label{grid-column:span 3;overflow-wrap:anywhere}
  .player-tools label:nth-child(n+3){grid-column:span 2}
}
@media(max-width:359px){
  .player-tools label:nth-child(n+3){grid-column:span 3}
  .player-tools label:last-child{grid-column:1/-1}
}
