/* Phase 1a: a quiet browse surface and an uncropped, viewport-sized player. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
button { -webkit-touch-callout: none; user-select: none; }
body[data-input=pointer] button:focus-visible, body[data-input=pointer] a:focus-visible { outline: none; }
body[data-view=library] main, body[data-view=saved] main { padding-top: 0; }
body[data-view=library] .topbar, body[data-view=saved] .topbar { border: 0; }
body[data-view=library] .connection:not(.offline), body[data-view=saved] .connection:not(.offline) { display: none; }
.library-controls { padding: 4px 0 14px; }
.library-toolbar { gap: 8px; }
.search { border-color: transparent; background: #1a1c20; border-radius: 14px; }
.filter-trigger { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; padding: 0 13px; max-width: 47%; border-radius: 14px; border: 1px solid #37332c; background: #211e19; color: #edbd79; font-size: 13px; }
.filter-trigger .icon { width: 20px; }
#active-filter { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#library-grid { gap: 14px 10px; }
#library-grid .drill-card { border: 0; background: none; border-radius: 10px; overflow: visible; }
#library-grid .drill-visual { border-radius: 10px; background: #16181b; }
#library-grid .drill-copy { padding: 10px 2px 2px; }
#library-grid .drill-copy h3 { font-size: 14px; line-height: 1.35; font-weight: 550; color: #e6e6e9; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#library-grid .drill-copy .eyebrow, #library-grid .drill-copy small { display: none; }
.tile-loop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.notes-only-label { position: absolute; bottom: 14px; font-size: 12px; color: var(--muted); }
.filter-sheet { width: min(480px,100%); max-height: 90dvh; }
.filter-sheet[open] { display: flex; flex-direction: column; }
.filter-sheet .dialog-header h2 { flex: 1; }
.filter-body { padding: 8px 20px 20px; overflow-y: auto; }
.filter-body .filters { flex-wrap: wrap; overflow: visible; gap: 9px; padding: 12px 0 24px; }
.sort-label { display: flex; align-items: center; justify-content: space-between; }
.sort-label #sort { width: 150px; }
.preview-preference { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.preview-preference input { width: 44px; height: 28px; accent-color: var(--orange); }
.detail-screen { position: fixed; inset: 0; margin: 0; width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none; border: 0; border-radius: 0; background: #090a0b; overflow: clip; }
.detail-screen[open] { display: grid; grid-template-rows: auto minmax(0,1fr) auto auto; isolation: isolate; }
.drill-backdrop { position: absolute; inset: 0; height: 100%; width: 100%; object-fit: cover; filter: blur(30px) brightness(.16); pointer-events: none; z-index: -1; }
.drill-backdrop:not([src]) { display: none; }
.stage-header { display: flex; align-items: center; gap: 8px; padding: max(10px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) 6px max(14px,env(safe-area-inset-left)); z-index: 1; }
.stage-button { border: 1px solid #ffffff16; background: #1113159c; border-radius: 50%; color: #fafafa; flex-shrink: 0; }
.stage-button:hover { background: #303236; }
.stage-button .icon { width: 21px; height: 21px; }
.deck-position { margin-right: auto; font-size: 11px; color: #a5a7ad; font-variant-numeric: tabular-nums; letter-spacing: .1em; }
#drill-music-toggle { border-radius: 24px; font-size: 12px; padding: 8px 12px; min-height: 44px; }
.detail-screen .player { position: relative; display: grid; place-items: center; min-height: 0; height: 100%; width: 100%; overflow: hidden; background: transparent; touch-action: pinch-zoom; }
.detail-screen .player video { display: block; width: 100%; height: 100%; max-height: none; min-height: 0; object-fit: contain; }
#player-status { position: absolute; top: calc(74px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 36px); background: #141619ed; border: 1px solid #ffffff26; border-radius: 12px; padding: 9px 13px; color: #ddd; font-size: 12px; text-align: center; }
.drill-summary { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; width: 100%; max-width: 900px; margin: auto; padding: 14px max(20px,env(safe-area-inset-right)) max(14px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left)); background: linear-gradient(transparent,#090a0b88); }
.drill-caption { min-width: 0; }
#clip-duration { color: #aeafb6; font-size: 11px; margin-bottom: 5px; }
#drill-title { font-family: var(--ff-font-heading); text-transform: uppercase; font-size: clamp(22px,3vw,34px); line-height: 1.1; letter-spacing: .015em; overflow-wrap: anywhere; }
.notes-trigger { display: flex; gap: 18px; align-items: center; min-height: 44px; padding: 6px 0; font-size: 13px; font-weight: 550; color: #efbd76; border: 0; background: none; }
.notes-trigger span { font-size: 20px; }
.deck-controls { display: flex; gap: 6px; padding-bottom: 5px; }
.deck-controls .icon-button { width: 44px; height: 44px; }
.stage-scrub { display: flex; align-items: center; gap: 10px; max-width: 900px; width: 100%; margin: auto; padding: 0 20px; min-height: 44px; color: #c5c6cc; font-size: 11px; font-variant-numeric: tabular-nums; }
.stage-scrub input { flex: 1; min-width: 0; height: 44px; accent-color: var(--orange); }
.notes-sheet { position: fixed; inset: auto 0 0; width: min(640px,100%); max-width: none; max-height: 88vh; max-height: 88dvh; margin: auto auto 0; border: 1px solid #373a40; border-bottom: 0; border-radius: 24px 24px 0 0; background: #141619; overflow: hidden; }
.notes-sheet[open] { display: flex; flex-direction: column; }
.notes-sheet::backdrop, .filter-sheet::backdrop { background: #0005; backdrop-filter: blur(4px); }
.notes-sheet .dialog-header { background: transparent; padding: 20px 16px 10px 22px; min-height: 72px; }
.notes-sheet .dialog-header > div { flex: 1; min-width: 0; }
.notes-sheet .dialog-header .eyebrow { margin-bottom: 3px; font-size: 10px; }
.sheet-handle { touch-action: none; position: relative; }
.sheet-handle::before { content: ''; position: absolute; top: 8px; left: calc(50% - 18px); width: 36px; height: 4px; border-radius: 8px; background: #55575e; }
.notes-sheet .detail-scroll { display: block; overflow-y: auto; min-height: 0; }
.notes-sheet .dialog-body { padding: 4px 22px 22px; }
.notes-sheet .detail-tags { margin: 8px 0 16px; }
.notes-sheet .detail-actions { display: flex; gap: 10px; padding: 12px 18px max(12px,env(safe-area-inset-bottom)); background: #181a1e; }
.notes-sheet .detail-actions #save-drill { width: auto; min-width: 94px; }
.notes-sheet .detail-actions #show-log { justify-content: center; }
.detail-screen[data-mode=log] .player { display: grid; }
.detail-screen[data-mode=log] .detail-tags { display: none; }
.detail-screen[data-mode=log] #save-drill { display: none; }
@media (max-width: 900px) {
  body[data-view=library] main, body[data-view=saved] main { padding-left: max(10px,env(safe-area-inset-left)); padding-right: max(10px,env(safe-area-inset-right)); }
  .library-controls { margin: 0 4px; }
  .filter-sheet { position: fixed; inset: auto 0 0; margin: auto auto 0; max-width: none; border-radius: 24px 24px 0 0; }
}
@media (max-height: 500px) and (orientation: landscape) {
  #library-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .detail-screen[open] { grid-template-columns: minmax(0,1fr) minmax(200px,30%); grid-template-rows: auto minmax(0,1fr) auto; }
  .stage-header { grid-column: 1/-1; }
  .detail-screen .player { grid-column: 1; grid-row: 2; }
  .drill-summary { grid-column: 2; grid-row: 2; display: block; align-self: end; }
  .stage-scrub { grid-column: 1/-1; grid-row: 3; }
  .notes-sheet { max-height: 94dvh; }
}
@media (prefers-reduced-motion: no-preference) {
  .notes-sheet[open], .filter-sheet[open] { animation: sheet-in .2s ease-out; }
  @keyframes sheet-in { from { transform: translateY(22px); opacity: .7; } to { transform: none; opacity: 1; } }
}
