/* Wider screens expose reading speed and reserve space for optional diagrams. */
#readerFocusSpeedDirect[hidden], #readerFocusDiagramButton[hidden],
#readerFocusSidePanel[hidden], #readerFocusSideToggle[hidden],
.reader-focus-setting[hidden] { display: none !important; }
/* One opaque fullscreen surface owns both reading and playback. Flex layout
   reserves the player's actual height without fixed siblings or exposed gaps. */
.reader-focus-surface[hidden] { display: none !important; }
.reader-focus-surface {
  position: fixed; inset: 0; z-index: 85; height: 100dvh; width: 100%;
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  isolation: isolate; background: var(--bg);
}
body.reader-focus { overflow: hidden; }
body.sheet-open.sheet-full.reader-focus .wrap { visibility: visible; }
body.reader-focus .ctxmenu, body.reader-focus .projmenu { visibility: hidden; }
body.reader-focus .reader-focus-surface .notation-sheet {
  position: relative; inset: auto; flex: 1 1 0; min-height: 0; width: 100%;
  z-index: auto; border: 0; box-shadow: none; transform: none; transition: none;
}
body.reader-focus .reader-focus-surface #transport {
  position: relative; inset: auto; flex: 0 0 auto; z-index: auto;
  width: auto; margin: 8px max(8px, env(safe-area-inset-right, 0px))
    calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  background: var(--panel); backdrop-filter: none; -webkit-backdrop-filter: none;
}


.reader-focus-bar #readerFocusSpeedDirect { width: 180px; }
.reader-focus-bar #readerFocusSpeedDirect .scroll-speed {
  display: flex; align-items: center; gap: 8px; margin: 0; width: 100%; min-width: 0;
}
.reader-focus-bar #readerFocusSpeedDirect input[type="range"] {
  flex: 1; width: 0; min-width: 100px; height: 44px; margin: 0;
}
.reader-focus-bar #readerFocusSpeedDirect output {
  min-width: 44px; font-size: 12px; font-variant-numeric: tabular-nums;
}
.reader-focus-bar .reader-focus-diagram-button {
  height: 44px; min-height: 44px; flex-shrink: 0; padding: 0 12px; margin: 0;
  white-space: nowrap; touch-action: manipulation;
}
.reader-focus-bar .reader-focus-diagram-button[aria-expanded="true"] {
  color: var(--amber); border-color: var(--amber);
}
.reader-focus-options #readerFocusSideToggle {
  width: 100%; min-height: 44px; margin: 0; touch-action: manipulation;
}
.reader-focus-options #readerFocusSideToggle[aria-pressed="true"] {
  color: var(--amber); border-color: var(--amber);
}
.reader-focus-side-panel {
  position: absolute; right: 0; top: var(--reader-focus-bar-h, 56px); bottom: 0; z-index: 4;
  display: flex; flex-direction: column; width: var(--reader-side-w, 320px); min-height: 0;
  border-left: 1px solid var(--edge); background: #1b1e24; box-sizing: border-box;
}
.reader-focus-side-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 56px; padding: 6px 12px; border-bottom: 1px solid var(--edge); box-sizing: border-box;
}
.reader-focus-side-head strong { font: 600 14px "Chakra Petch", sans-serif; }
.reader-focus-side-head .chip {
  width: 44px; min-width: 44px; height: 44px; padding: 0; touch-action: manipulation;
}
#readerFocusSideDock {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 12px;
  overscroll-behavior: contain;
}
body.reader-focus #readerFocusSideDock .cd-dock {
  display: block !important; border: 0; background: none; padding: 0;
}
body.reader-focus #readerFocusSideDock .cd-dock[hidden] { display: none !important; }
#readerFocusSideDock .cd-bar {
  flex-wrap: wrap; gap: 6px; padding: 0 0 12px; overflow: visible;
}
#readerFocusSideDock .cd-segb, #readerFocusSideDock .chip,
#readerFocusSideDock .cd-toggle, #readerFocusSideDock .cd-nav,
#readerFocusSideDock .cd-capo-x {
  min-width: 44px; min-height: 44px; touch-action: manipulation;
}
#readerFocusSideDock .cd-strip {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start;
  gap: 8px; max-height: none; min-height: 0; padding: 0; overflow: visible;
  scroll-snap-type: none; touch-action: pan-y;
}
#readerFocusSideDock .cd-dock.focusing .cd-strip { min-height: 0; }
#readerFocusSideDock .cd-dock.collapsed .cd-strip,
#readerFocusSideDock .cd-dock.collapsed .cd-capo,
#readerFocusSideDock .cd-dock.collapsed .cd-focus { display: none; }
#readerFocusSideDock .cd-card { width: 100%; min-width: 0; box-sizing: border-box; }
#readerFocusSideDock .cd-capo { flex-wrap: wrap; padding: 0 0 12px; }
#readerFocusSideDock .cd-focus {
  position: relative; inset: auto; max-height: none; margin-top: 12px;
  border: 1px solid var(--edge); border-radius: var(--r-sm); box-shadow: none;
}

@media (min-width: 900px) {
  body.reader-diagrams-side { --reader-side-w: 320px; }
  body.reader-focus.reader-diagrams-side .ns-body {
    width: calc(100% - var(--reader-side-w)); max-width: none; margin-left: 0; margin-right: var(--reader-side-w);
  }
}
