/* Visible playback scope, selected video context, and clear exits. */
.screen-ready .studio-heading { gap: 8px; }
.screen-ready .mode-switch button { white-space: nowrap; }
.workspace-help { order: 6; border: 1px solid #bbc9b4; border-radius: 7px; background: white; padding: 8px 12px; font-size: 16px; min-height: 40px; }
.screen-ready .insights-toggle { display: none; }
.screen-ready .analysis-target > span { display: inline; margin-right: 3px; color: #4c5d44; }
.screen-ready .analysis-target button { min-height: 40px; font-size: 16px; }
.screen-ready .analysis-target button[aria-pressed=true] { background: #354f3d; color: white; border-color: #354f3d; }
.screen-ready .screen-tabs button[aria-selected=true] { background: #354f3d; color: #fff; border-color: #354f3d; }
.screen-ready .screen-tabs button { min-height: 40px; }
.screen-ready .screen-panel-heading #closePanel { font-size: 14px; width: auto; padding: 8px; min-height: 40px; white-space: nowrap; }
.screen-panel:focus-visible { outline: 2px solid #789b3e; outline-offset: 3px; }
.screen-ready .comparison-bar { flex-wrap: wrap; }
.screen-ready .comparison-bar #syncHint { flex: 1; font-size: 14px; }
.screen-ready #align { min-height: 40px; padding: 7px 10px; font-size: 16px; border: 1px solid #c7d2bf; border-radius: 6px; background: #fff; }
.screen-ready #align:disabled { opacity: .6; }
.screen-ready .screen-transport .main-play { width: auto; min-width: 100px; padding: 0 12px; display: flex; gap: 7px; align-items: center; justify-content: center; font-size: 16px; }
.screen-ready .screen-transport .play-buttons > button { min-height: 40px; }
.screen-ready .review-context { border: 0; border-bottom: 1px dotted #8b9c7f; padding: 5px 3px; background: none; color: #4c603f; font-size: 14px; min-height: 36px; }
.screen-ready .screen-commands { gap: 10px; }
/* Every comparison clip has local controls; the footer always controls both. */
.screen-ready .analysis-target { display: none; }
.screen-ready .video-top .slot-badge { border: 1px solid #aec999; background: #e6efdb; color: #203128; font-size: 16px; padding: 2px; min-width: 28px; }
.screen-ready .video-top .slot-badge[aria-pressed=true] { background: #d2ed8c; border-color: #d2ed8c; box-shadow: 0 0 0 2px #d2ed8c55; }
.screen-ready .clip-transport { grid-template-columns: minmax(0,1fr); }
.screen-ready .clip-timeline-row { display: flex; grid-column: 1; grid-row: 1; flex-wrap: nowrap; gap: 6px; }
.screen-ready .clip-timeline-row .clip-timeline { display: block; flex: 1; width: 30px; min-width: 0; height: 24px; margin: 0; }
.screen-ready .clip-duration { font-size: 14px; white-space: nowrap; color: #e4eddf; }
.screen-ready .clip-restart { flex: none; min-width: 28px; min-height: 32px; padding: 2px 5px; font-size: 22px; color: #e4eddf; background: #ffffff09; border: 1px solid #ffffff30; border-radius: 6px; }
.screen-ready .clip-frame-controls { grid-column: 1; grid-row: 2; flex-wrap: nowrap; justify-content: center; gap: 4px; }
.screen-ready .clip-frame-controls .clip-speed-label { display: flex; width: auto; margin: 0 0 0 auto; font-size: 14px; gap: 5px; }
.screen-ready .clip-speed { min-height: 36px; padding: 3px; }
.screen-ready .clip-frame-controls > button { min-height: 36px; }
.screen-ready #viewResults { border: 0; background: none; color: #354f3d; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; min-height: 36px; margin-left: auto; white-space: nowrap; }
.screen-ready #viewResults:not([hidden]) ~ * { display: none; }
.screen-notice:has(#viewResults:not([hidden])) .drawing-instruction { display: none; }
.screen-ready .screen-video-settings .fps-label { grid-column: 1 / -1; }
.screen-ready .screen-video-settings .fps-label select { min-width: 100px; }
.screen-ready #resultsEmpty { background: #f0f4e8; padding: 12px; border-radius: 8px; font-size: 16px; }
/* Native dialogs preserve focus and provide a predictable Escape route. */
.header-right > button { margin-left: 24px; font-size: 16px; }
#aboutDialog { width: min(640px, calc(100vw - 24px)); max-width: 640px; padding: 22px; }
#aboutDialog .task-dialog-heading { position: sticky; top: -22px; z-index: 1; margin: -22px -22px 0; padding: 16px 22px; background: #fff; border-bottom: 1px solid var(--line); }
.about-brand { display: flex; align-items: center; gap: 10px; overflow-wrap: anywhere; }
.about-brand img { flex: none; }
.about-guide { margin: 24px 0; border-top: 1px solid var(--line); }
.about-guide h3 { font-size: 20px; margin: 20px 0 16px; }
.about-guide article { display: flex; gap: 14px; margin: 18px 0; }
.about-guide article > span { font-size: 14px; color: #526846; padding-top: 3px; }
.about-guide h4 { margin: 0 0 6px; font-size: 18px; }
.about-guide article p { margin: 0; }
.task-dialog { width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 22px; border-radius: 14px; background: #fff; overflow: auto; overscroll-behavior: contain; }
.task-dialog h2 { margin: 0; font-size: 23px; }
.task-dialog p { color: #53634c; font-size: 16px; line-height: 1.45; }
.task-dialog-heading { display: flex; gap: 14px; justify-content: space-between; align-items: center; }
.task-dialog-heading > button { padding: 8px; border: 1px solid #ccd7c1; background: white; border-radius: 6px; min-height: 40px; }
.help-task { width: 100%; display: grid; gap: 6px; text-align: left; padding: 12px; margin: 9px 0; background: #f4f7ee; border: 1px solid #d6dfca; border-radius: 8px; }
.help-task strong { font-size: 17px; display: flex; justify-content: space-between; }
.help-task > span { color: #53634c; font-size: 14px; line-height: 1.45; }
.task-dialog .help-shortcuts { font-size: 14px; line-height: 1.7; margin-bottom: 0; }
#discardFile { overflow-wrap: anywhere; font-weight: 600; }
.discard-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.discard-actions button { min-height: 44px; padding: 10px 14px; border: 1px solid #bdcbb1; border-radius: 7px; background: #fff; }
.discard-actions #discardCancel { background: #354f3d; color: white; border-color: #354f3d; }
.discard-actions #discardConfirm { color: #924a34; }
@media (max-width: 1350px) {
  .workspace-help { margin-left: auto; order: 4; }
}
@media (max-width: 1000px) {
  .screen-ready .screen-commands .review-context { display: none; }
  .screen-ready .analysis-panel { box-shadow: 0 10px 30px #17251f55; }
}
@media (max-width: 600px) {
  .screen-ready .studio-heading { gap: 3px; }
  .screen-ready .mode-switch { width: calc(100% - 57px); }
  .screen-ready .mode-switch button { font-size: 16px; padding: 7px 4px; }
  .workspace-help { order: 0; width: 51px; padding: 7px 3px; font-size: 16px; margin: 0; }
  .screen-ready .analysis-target { order: 1; }
  .screen-ready .analysis-target > span { display: none; }
  .screen-ready .analysis-target button { min-height: 36px; font-size: 14px; }
  .screen-ready .screen-tabs { order: 2; }
  .screen-ready .screen-tabs button { font-size: 16px; padding: 5px; }
  .screen-ready #align { min-height: 36px; padding: 5px 7px; font-size: 14px; }
  .screen-ready .comparison-bar { gap: 3px; }
  .screen-ready .screen-transport .main-play { min-width: 42px; padding: 0 8px; }
  .screen-ready .main-play .play-word { display: none; }
  .screen-ready .clip-timeline-row { display: grid; grid-template-columns: minmax(0,1fr) 28px; gap: 2px; }
  .screen-ready .clip-timeline-row .clip-duration { grid-column: 1; grid-row: 1; font-size: 14px; }
  .screen-ready .clip-restart { grid-column: 2; grid-row: 1; min-height: 28px; }
  .screen-ready .clip-timeline-row .clip-timeline { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .screen-ready .clip-frame-controls { flex-wrap: wrap; }
  .screen-ready .clip-frame-controls > button { min-height: 36px; }
  .screen-ready .clip-frame-controls .clip-speed-label { width: 100%; justify-content: space-between; margin: 0; }
  .screen-ready .clip-speed { width: 66px; min-height: 32px; }
  .screen-ready .screen-video-settings .fps-label { grid-column: 1 / -1; }
  .screen-ready .screen-panel-heading #closePanel { padding: 5px 7px; min-height: 36px; }
  .screen-ready .screen-panel-heading h2 { font-size: 20px; }
  .task-dialog { padding: 16px; }
  .screen-ready .range-heading { display: none; }
}
@media (max-height: 740px) {
  .screen-ready #resultsEmpty { padding: 8px; font-size: 14px; margin-bottom: 8px; }
}
@media (max-height: 600px) and (max-width: 600px) {
  .screen-ready .screen-notice { min-height: 20px; }
  .screen-ready .clip-frame-controls > button { min-height: 30px; }
  .screen-ready .clip-speed { min-height: 28px; }
  .screen-ready .clip-timeline { height: 24px; }
  .screen-ready .clip-frame-controls .clip-speed-label { font-size: 14px; }
}
@media (max-height: 500px) and (min-width: 601px) {
  .screen-ready .screen-tabs { margin-left: auto; }
  .workspace-help { order: 4; min-height: 32px; padding: 5px; font-size: 14px; margin-left: 0; }
  .screen-ready .analysis-target { margin-left: 0; }
  .screen-ready .mode-switch button { font-size: 14px; }
  .screen-ready #align { min-height: 30px; padding: 3px 6px; font-size: 14px; }
  .screen-ready .screen-tabs button { min-height: 32px; padding: 5px; font-size: 14px; }
  .screen-ready .clip-transport { display: grid; }
  .screen-ready .clip-frame-controls { grid-row: 2; }
  .screen-ready .clip-timeline { grid-row: 2; height: 22px; }
  .screen-ready .clip-frame-controls .clip-speed-label { font-size: 0; }
  .screen-ready .clip-speed { font-size: 14px; min-height: 28px; }
  .screen-ready .clip-frame-controls > button { min-height: 28px; }
  .screen-ready #panel-pose #resultsEmpty { grid-column: 2; grid-row: 1 / 3; margin: 0; }
}
.screen-ready .timeline-row input { height: 28px; }
.screen-ready .video-top .remove { width: 32px; min-width: 32px; }
.screen-ready .studio-heading, .screen-ready .screen-tabs { min-width: 0; }
@media (max-width: 600px) and (max-height: 740px) {
  .screen-ready .screen-panel-help { margin-bottom: 8px; }
  .screen-ready #panel-moments .metric-note { margin: 2px 0; }
}

/* Keep the common scope and restart reachable on small screens too. */
@media (max-width: 600px) {
  .screen-ready .screen-transport .timeline-row .small-label { display: inline; font-size: 14px; }
  .screen-ready .screen-transport #restart { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; min-height: 36px; padding: 2px; }
  .screen-ready .restart-word { display: none; }
  .screen-ready .screen-transport .transport-row { gap: 4px; }
  .screen-ready .screen-transport .speed-label select { width: 62px; min-width: 0; }
  .screen-ready .screen-commands { gap: 3px; }
  .screen-ready .screen-commands .analyze-button { padding: 7px; }
}
@media (max-width: 600px) and (max-height: 640px) {
  /* Keep all playback actions in three rows; exact time stays on the image. */
  .screen-ready.is-compare .video-top .file-name { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
  .screen-ready.is-compare .video-top { flex-wrap: nowrap; }
  .screen-ready.is-compare .video-top .replace { padding: 2px; min-width: 0; }
  .screen-ready.is-compare .video-top .remove { min-width: 28px; width: 28px; }
  .screen-ready .clip-transport { grid-template-columns: 28px minmax(0,1fr) 28px; gap: 2px; }
  .screen-ready .clip-timeline-row, .screen-ready .clip-frame-controls { display: contents; }
  .screen-ready .clip-timeline-row .clip-duration { display: none; }
  .screen-ready .clip-timeline-row .clip-timeline { grid-column: 1 / -1; grid-row: 1; height: 24px; }
  .screen-ready .clip-previous { grid-column: 1; grid-row: 2; }
  .screen-ready .clip-play { grid-column: 2; grid-row: 2; }
  .screen-ready .clip-next { grid-column: 3; grid-row: 2; }
  .screen-ready .clip-restart { grid-column: 1; grid-row: 3; min-height: 28px; }
  .screen-ready .clip-frame-controls .clip-speed-label { grid-column: 2 / -1; grid-row: 3; width: auto; font-size: 0; }
  .screen-ready .clip-speed { width: 100%; font-size: 14px; }
  .screen-ready .compare .corner-label { padding: 2px; max-width: calc(100% - 8px); }
  .screen-ready .compare .corner-label .clip-time { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-height: 500px) and (min-width: 601px) {
  .screen-ready .screen-transport { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 10px; align-items: center; }
  .screen-ready .screen-transport .transport-row { margin: 0; gap: 8px; }
  .screen-ready .screen-transport .timeline-row { gap: 6px; }
  .screen-ready .screen-notice { grid-column: 1 / -1; }
  .screen-ready .screen-transport .speed-label { font-size: 0; gap: 0; }
  .screen-ready .screen-transport .speed-label select { font-size: 14px; width: 65px; }
  .screen-ready .restart-word { display: none; }
  .screen-ready #restart { min-width: 28px; padding: 2px; }
}
@media (max-width: 600px) {
  .screen-ready .screen-transport #time { font-size: 0; min-width: 0; }
  .screen-ready .screen-transport #time::after { content: attr(data-short-time); font-size: 14px; }
}
