.scene-voice-recorder{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.scene-voice-recorder button{min-height:40px}
.scene-voice-recorder audio{max-width:100%;height:36px}
.scene-voice-timestamp{background:#dbeafe!important}
.scene-voice-caption{position:absolute;z-index:6;left:10%;right:10%;bottom:12%;text-align:center;color:white;background:rgba(0,0,0,.18);text-shadow:0 1px 3px #000,0 0 5px #000;border-radius:7px;padding:8px 12px;font-weight:600;line-height:1.35;white-space:pre-line;pointer-events:none;font-size:clamp(13px,1.7vw,22px);max-height:30%;overflow:hidden}
.scene-voice-caption.hidden{display:none}
.voice-settings{display:grid;gap:9px;padding:10px;background:#eff6ff;color:#172554;border-radius:8px;margin:8px 0}
.voice-settings label{display:flex;gap:9px;align-items:center;flex-wrap:wrap}
.voice-settings input[type=range]{width:135px}
.voice-settings input[type=number]{width:68px;max-width:100%;box-sizing:border-box;padding:5px;border:1px solid #94a3b8;border-radius:5px;background:#fff;color:#172554}
.scene-voice-caption{backdrop-filter:none}
.comments-feed-voices{display:inline-flex;gap:6px;align-items:center;flex-wrap:wrap}
.comments-feed-voices button{border-radius:5px;padding:4px 9px;cursor:pointer}
@media(max-width:600px){.scene-voice-caption{left:4%;right:4%;bottom:16%;padding:5px 7px;font-size:13px;max-height:25%}}
.scene-panel{display:grid;gap:10px;margin:10px 0;padding:10px;border:1px solid #7775;border-radius:10px}.scene-panel.hidden{display:none}.scene-tools{display:flex;flex-wrap:wrap;align-items:center;gap:5px}.scene-panel button{cursor:pointer;border:1px solid #8886;border-radius:6px;padding:7px 9px;background:var(--surface,#252a33);color:inherit}.scene-panel button:hover{filter:brightness(1.2)}.scene-editor{display:grid;gap:7px}.scene-editor-head,.scene-editor-actions,.scene-list-head{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.scene-editor textarea{width:100%;box-sizing:border-box;min-height:60px;border-radius:7px;padding:9px;background:var(--surface,#20232a);color:inherit;border:1px solid #8886}.scene-ratings{display:flex;flex-wrap:wrap;gap:3px}.scene-ratings button{min-width:31px;padding:7px 4px}.scene-list{max-height:34vh;overflow-y:auto;display:grid;gap:5px}.scene-entry{display:flex;gap:8px;align-items:flex-start;padding:6px;border-bottom:1px solid #8883}.scene-entry span{overflow-wrap:anywhere;white-space:pre-wrap}.scene-entry strong{white-space:nowrap}.scene-panel #scene-message:not(:empty){font-size:.9em}@media(min-width:900px){.scene-panel{max-width:100%}.scene-list{max-height:42vh}}@media(max-width:600px){.scene-panel{padding:7px;gap:6px}.scene-tools button{padding:6px}.scene-entry{flex-wrap:wrap}.scene-editor-head button{padding:5px}.scene-list{max-height:35vh}}
.scene-panel{color:#0f172a;background:#f8fafc}
.scene-panel button{background:#e2e8f0;color:#0f172a;border-color:#cbd5e1}
.scene-panel textarea{background:#fff;color:#0f172a;border-color:#94a3b8}
@media(min-width:950px){
 .media-viewer-dialog:has(.scene-panel:not(.hidden)){display:grid;grid-template-columns:minmax(0,1fr) minmax(310px,380px);column-gap:14px;align-content:start;min-height:calc(100vh - 48px)}
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>.media-viewer-header,
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>#media-viewer-status,
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>#media-debug,
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>.media-viewer-bottom{grid-column:1/-1}
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>.media-viewer-player{grid-column:1;grid-row:auto;min-width:0;align-self:start}
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>.scene-panel{grid-column:2;margin:0;min-width:0;max-height:75vh;overflow-y:auto;align-self:start}
 .media-viewer-dialog:has(.scene-panel:not(.hidden)) .scene-list{max-height:40vh}
}
@media(max-width:949px){.media-viewer-dialog:has(.scene-panel:not(.hidden))>.media-viewer-player{min-height:0}.media-viewer-dialog:has(.scene-panel:not(.hidden)) .media-video{max-height:60vh}}

.scene-tools{display:flex;flex-direction:column;align-items:stretch}
.scene-transport{display:grid;grid-template-columns:repeat(13,minmax(0,1fr));gap:3px;width:100%}
.scene-speeds{display:grid;grid-template-columns:repeat(9,minmax(0,1fr));gap:3px;width:100%}
.scene-navigation{display:flex;flex-wrap:wrap;align-items:center;gap:5px}
.scene-transport button,.scene-speeds button{min-width:0;padding:7px 2px;font-size:clamp(.65rem,.9vw,.88rem);white-space:nowrap}
.scene-speeds button.selected{background:#2563eb;color:white;border-color:#1d4ed8;font-weight:700}
@media(max-width:600px){.scene-transport button,.scene-speeds button{font-size:.67rem;padding:7px 1px}}

#media-viewer-player .scene-exact-frame{display:block;position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#000;z-index:4;pointer-events:none}
#media-viewer-player .scene-exact-frame.hidden{display:none}
#media-viewer-player:has(.scene-exact-frame){position:relative}

.scene-scrub{display:flex;align-items:center;gap:8px;position:relative}
.scene-scrub input[type=range]{flex:1;min-width:0;touch-action:pan-y}
.scene-scrub-preview{position:absolute;bottom:28px;left:50%;transform:translateX(-50%);width:160px;height:90px;border:2px solid #fff;background-color:#000;background-repeat:no-repeat;border-radius:5px;pointer-events:none;z-index:5}
.scene-scrub-preview.hidden{display:none}
.scene-scrub #scene-scrub-time{font-variant-numeric:tabular-nums;white-space:nowrap}
.scene-group-heading{font-weight:700;padding:7px 6px;background:#dbeafe;color:#1e3a8a;border-radius:5px;position:sticky;top:0;z-index:1}
.scene-active-comment{padding:9px 12px;margin:7px 0;background:#eff6ff;color:#172554;border-left:4px solid #2563eb;border-radius:6px;max-height:145px;overflow:auto;overflow-wrap:anywhere}
.scene-active-comment.hidden{display:none}
.scene-active-comment>strong{display:block;margin-bottom:5px}
.scene-active-comment>div{padding:2px 0;white-space:pre-wrap}
.scene-tour-settings{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;padding:4px 0;width:100%}
.scene-tour-settings>label{display:flex;align-items:center;gap:5px;white-space:nowrap;font-size:.86rem}
.scene-tour-settings select,.scene-tour-settings input{box-sizing:border-box;height:32px;border:1px solid #94a3b8;border-radius:5px;background:#fff;color:#0f172a;padding:3px 5px;font:inherit}
.scene-tour-settings select{min-width:48px}
.scene-number-unit{display:inline-flex;align-items:center;gap:4px}
.scene-number-unit input{width:55px;min-width:0;text-align:right}
.scene-number-unit span{font-size:.8rem;color:#475569}
@media(min-width:950px){
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>.scene-active-comment{grid-column:1;grid-row:auto;align-self:start}
}
@media(max-width:949px){.scene-active-comment{max-height:120px}}

/* Stable desktop grid: scene panel always starts alongside the video. */
@media(min-width:950px){
 .media-viewer-dialog:has(.scene-panel:not(.hidden)){
   grid-template-areas:"header header" "status status" "player panel" "active panel" "bottom bottom" "debug debug";
   grid-template-rows:auto auto auto auto auto auto;
 }
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>.media-viewer-header{grid-area:header}
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>#media-viewer-status{grid-area:status}
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>.media-viewer-player{grid-area:player}
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>.scene-panel{grid-area:panel;grid-row:3 / span 2}
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>.scene-active-comment{grid-area:active;min-width:0}
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>.media-viewer-bottom{grid-area:bottom}
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>#media-debug{grid-area:debug}
}

.scene-share{display:flex;justify-content:flex-start;margin:3px 0 7px}.scene-share button{min-height:40px;padding:8px 12px;border-radius:7px;background:#dbeafe;color:#1e40af;border:1px solid #93c5fd;font-weight:750;cursor:pointer;touch-action:manipulation}

.scene-tour-settings>.scene-share-btn{min-height:34px;padding:5px 10px;border-radius:6px;background:#dbeafe;color:#1e40af;border:1px solid #93c5fd;font-weight:750;cursor:pointer;touch-action:manipulation}

/* Large video-width hover and touch scrub preview (native browser controls stay intact). */
.media-viewer-dialog>.scene-scrub{display:flex;min-width:0;width:100%;box-sizing:border-box;padding:8px 10px;background:#eef2ff;border:1px solid #c7d2fe;border-radius:8px;margin:5px 0;touch-action:pan-y}
.media-viewer-dialog>.scene-scrub.hidden{display:none}
.media-viewer-dialog>.scene-scrub input[type=range]{height:32px;cursor:crosshair}
.media-viewer-dialog>.scene-scrub .scene-scrub-preview{bottom:48px}
@media(min-width:950px){.media-viewer-dialog:has(.scene-panel:not(.hidden))>.scene-scrub{grid-area:scrub;grid-column:1;align-self:start}}
/* Video-column comments: current scene immediately below video, full list below it. */
.scene-history{display:grid;gap:7px;padding:10px 12px;margin:7px 0 14px;background:#f8fafc;color:#0f172a;border:1px solid #cbd5e1;border-radius:9px;min-width:0;box-sizing:border-box;width:100%}
.scene-history.hidden{display:none}
.scene-history>.scene-list-head{justify-content:space-between;flex-wrap:wrap}
.scene-history>.scene-list{max-height:none;overflow:visible;min-width:0}
.scene-history .scene-entry{align-items:flex-start}
@media(min-width:950px){
 .media-viewer-dialog:has(.scene-panel:not(.hidden)){
  grid-template-areas:"header header" "status status" "player panel" "scrub panel" "active panel" "history panel" "bottom bottom" "debug debug";
  grid-template-rows:auto auto auto auto auto auto auto auto auto;
 }
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>.scene-panel{grid-area:panel;grid-row:3 / span 4}
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>.scene-history{grid-area:history;grid-column:1;min-width:0}
 .media-viewer-dialog:has(.scene-panel:not(.hidden))>.scene-history>.scene-list{max-height:none}
}
@media(max-width:949px){.scene-history{margin:7px 0 12px;padding:8px}.scene-history>.scene-list{max-height:none}}

/* Preserve full written captions, including simultaneous text comments. */
.scene-voice-caption.text-priority{max-height:45%;overflow-y:auto;pointer-events:auto;text-align:left}
@media(max-width:600px){.scene-voice-caption.text-priority{max-height:50%}}
