* { box-sizing: border-box; }
[data-theme="lavender"] {
  --paper: light-dark(#f7f5f9, #19151f);
  --surface: light-dark(#fffdfd, #251f2d);
  --ink: light-dark(#30283a, #f4edf8);
  --accent: light-dark(#695180, #c8a9e0);
  --secondary: light-dark(#dabbd1, #ebbad7);
  --hero: light-dark(#46364f, #392a47);
}
:where(:root), [data-theme="seaglass"] {
  --paper: light-dark(#edf5f1, #101f1c);
  --surface: light-dark(#fbfffc, #1b2e29);
  --ink: light-dark(#223a34, #e4f3ec);
  --accent: light-dark(#32695e, #94d0b9);
  --secondary: light-dark(#b5cdaf, #c3d2a3);
  --hero: light-dark(#244d45, #1e4037);
}
[data-theme="sandstone"] {
  --paper: light-dark(#f9f2e8, #221a16);
  --surface: light-dark(#fffcf6, #32271f);
  --ink: light-dark(#443029, #f8ebdc);
  --accent: light-dark(#865637, #e9b68e);
  --secondary: light-dark(#e4b18a, #e6ac94);
  --hero: light-dark(#5d4032, #513725);
}
[data-theme="cobalt"] {
  --paper: light-dark(#edf2ff, #0c162d);
  --surface: light-dark(#fbfcff, #172643);
  --ink: light-dark(#16274d, #eff5ff);
  --accent: light-dark(#204ed7, #8ab2ff);
  --secondary: light-dark(#38e6ce, #28e6ce);
  --hero: light-dark(#1437a3, #1a3986);
}
[data-theme="dragonfruit"] {
  --paper: light-dark(#fff0f5, #270f1d);
  --surface: light-dark(#fffafd, #391a2b);
  --ink: light-dark(#49162d, #ffedf4);
  --accent: light-dark(#b31559, #ff85b4);
  --secondary: light-dark(#ffaa4c, #ffab51);
  --hero: light-dark(#861440, #701b45);
}
[data-theme="citrus"] {
  --paper: light-dark(#f2f7df, #16200c);
  --surface: light-dark(#fcfff3, #222f18);
  --ink: light-dark(#243516, #f1f8de);
  --accent: light-dark(#477015, #c5ef52);
  --secondary: light-dark(#c5ef39, #efcf4d);
  --hero: light-dark(#34561a, #304c15);
}
[data-theme="maroongold"] {
  --paper: light-dark(#fbf4e8, #251017);
  --surface: light-dark(#fffbf5, #351a24);
  --ink: light-dark(#401a27, #fff0dd);
  --accent: light-dark(#781e3a, #f2ca6d);
  --secondary: light-dark(#e6b650, #daa944);
  --hero: light-dark(#55182d, #701e37);
}
:root, .theme-art {
  --muted: color-mix(in srgb, var(--ink) 72%, var(--paper));
  --line: color-mix(in srgb, var(--ink) 24%, var(--surface));
  --tint: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --on-accent: light-dark(#fff, #15141a);
  --surround: light-dark(color-mix(in srgb, var(--ink) 12%, var(--paper)), color-mix(in srgb, var(--paper) 78%, black));
}
:root {
  color-scheme: light;
  background-color: var(--paper);
  --sans: Inter, "Segoe UI", Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
}
:root[data-mode="dark"] { color-scheme: dark; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 var(--sans); }
button, input, select, summary { font: inherit; color: inherit; }
button, select, summary, input[type=range] { cursor: pointer; }
button, a, summary, select, input { -webkit-tap-highlight-color: transparent; }
button { border: 0; background: none; }
button:disabled { cursor: default; opacity: .43; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
#main:focus { outline: none; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 400; }
[hidden], .symbols { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.skip-link { position: fixed; left: 12px; top: -100px; z-index: 10; background: var(--surface); padding: 12px; }
.skip-link:focus { top: 10px; }
.masthead { background: var(--surface); }
.masthead-inner, .library-shell { width: min(1136px, calc(100% - 96px)); margin: auto; }
.masthead-inner { height: 68px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 22px; font-weight: 650; letter-spacing: -1px; }
.brand-mark { background: var(--hero); color: var(--secondary); width: 35px; height: 35px; border-radius: 9px; display: grid; place-items: center; }
.brand-mark .icon { width: 26px; height: 26px; }
.header-part { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
select { min-height: 40px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); padding: 0 9px; font-size: 14px; }
.header-part select { color: var(--ink); font-weight: 600; }
.masthead::after { content: ""; display: block; height: 2px; background: linear-gradient(90deg, var(--accent), var(--secondary)); }
.header-actions, .mode-switch, .mode-switch button, #settings-link { display: flex; align-items: center; }
.header-actions { gap: 14px; }
#header-action:empty { display: none; }
.mode-switch { background: var(--paper); border: 1px solid var(--line); padding: 3px; border-radius: 9px; gap: 2px; }
.mode-switch button { gap: 5px; justify-content: center; border-radius: 6px; min-height: 33px; padding: 0 10px; font-size: 13px; font-weight: 600; }
.mode-switch .icon { width: 15px; height: 15px; }
.mode-switch button[aria-pressed="true"] { color: var(--on-accent); background: var(--accent); }
.mode-switch button[aria-pressed="false"]:hover { background: var(--tint); }
#settings-link { width: 41px; height: 41px; justify-content: center; border-radius: 9px; border: 1px solid var(--line); }
#settings-link:hover, #settings-link[aria-current="page"] { color: var(--accent); background: var(--tint); border-color: var(--accent); }
.settings-shell { width: min(960px, calc(100% - 64px)); margin: auto; padding: clamp(18px, 3vw, 36px) 0 48px; }
.settings-back { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; margin-bottom: 8px; color: var(--accent); font-size: 13px; font-weight: 600; }
.settings-back .icon { width: 15px; }
.settings-back:hover { text-decoration: underline; }
.settings-shell h1 { font-size: clamp(36px, 4vw, 48px); line-height: 1.1; letter-spacing: -.04em; }
.settings-help { margin-top: 8px; color: var(--muted); font-size: 14px; }
.theme-group { margin-top: 25px; }
.theme-group h2 { font-size: 25px; line-height: 1.2; margin-bottom: 10px; letter-spacing: -.025em; }
.theme-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
@media (min-width: 800px) {
  .theme-grid:has(> :nth-child(4)) { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
@media (min-width: 571px) and (max-width: 799px) {
  .theme-grid:has(> :nth-child(4)) { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
.theme-card { padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-align: left; }
.theme-card:hover { border-color: var(--accent); }
.theme-card[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: -1px; }
.theme-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.theme-art { display: block; position: relative; height: clamp(86px, 9vw, 112px); overflow: hidden; isolation: isolate; background: linear-gradient(125deg, var(--tint), color-mix(in srgb, var(--paper) 77%, var(--secondary))); }
.record, .record-sleeve { position: absolute; top: 50%; height: 126%; aspect-ratio: 1; }
.record { left: 46%; transform: translateY(-45%); border-radius: 50%; background:
  radial-gradient(circle, var(--hero) 0 3%, var(--secondary) 3.5% 26%, transparent 26.5%),
  repeating-radial-gradient(circle, transparent 0 4px, #ffffff30 4px 5px, transparent 5px 7px),
  linear-gradient(135deg, var(--hero) 15%, var(--accent) 60%, var(--hero)); }
.record-sleeve { left: 14%; transform: translateY(-40%) rotate(-10deg); box-shadow: 3px 3px 8px #10081840; background:
  radial-gradient(ellipse at 100% 0%, var(--secondary) 0 35%, transparent 35.5%),
  radial-gradient(ellipse at 0% 100%, var(--hero) 0 48%, transparent 48.5%), var(--accent); }
[data-theme="seaglass"] > .record-sleeve, [data-theme="dragonfruit"] > .record-sleeve { background: repeating-linear-gradient(138deg, var(--secondary) 0 13%, var(--accent) 13% 27%, var(--hero) 27% 39%); }
[data-theme="sandstone"] > .record-sleeve, [data-theme="citrus"] > .record-sleeve { background: repeating-radial-gradient(ellipse at 15% 100%, var(--accent) 0 15%, var(--secondary) 16% 30%, var(--hero) 31% 45%); }
.theme-caption { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; gap: 6px; }
[data-theme="maroongold"] > .record-sleeve { background: linear-gradient(125deg, var(--hero) 0 41%, var(--secondary) 41.5% 46%, var(--hero) 46.5% 50%, var(--secondary) 50.5% 55%, var(--accent) 55.5%); }
.theme-caption strong { font-size: 15px; }
.theme-check { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; visibility: hidden; color: var(--on-accent); background: var(--accent); }
.theme-check .icon { width: 14px; height: 14px; stroke-width: 2.5; }
.theme-card[aria-pressed="true"] .theme-check { visibility: visible; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.welcome { max-width: 1060px; width: calc(100% - 96px); margin: clamp(36px, 8vh, 92px) auto; display: grid; grid-template-columns: 1.1fr 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.welcome-intro { background: var(--hero); color: #fffaf4; padding: clamp(26px, 3.5vw, 48px); overflow: hidden; position: relative; }
.welcome h1 { font-size: clamp(40px, 4.4vw, 65px); letter-spacing: -.045em; line-height: 1.04; max-width: 10em; }
.welcome-intro p { font-size: 16px; line-height: 1.55; max-width: 36ch; margin-top: 18px; color: #f3eef3; }
.welcome-intro strong { font-weight: 650; color: white; }
.welcome-music { height: 135px; margin: 28px -15px -52px 16px; overflow: hidden; transform: rotate(-4deg); background: var(--surface); padding: 0 9px; border-radius: 2px; box-shadow: 6px 6px 0 var(--secondary); }
.welcome-music img { width: 100%; display: block; margin-top: -19%; }
.welcome-parts { padding: clamp(26px, 3.5vw, 48px); align-self: center; }
.welcome-parts h2 { font-size: clamp(28px, 3vw, 38px); line-height: 1.12; letter-spacing: -.03em; }
.welcome-parts p { margin-top: 9px; font-size: 14px; color: var(--muted); max-width: 35ch; }
.voice-choices { display: grid; gap: 9px; margin-top: 22px; }
.voice-choices button { display: flex; align-items: center; justify-content: space-between; padding: 11px 15px; min-height: 48px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); font-weight: 600; }
.voice-choices .icon { width: 17px; color: var(--accent); }
.voice-choices button:hover, .voice-choices button:focus-visible { background: var(--tint); border-color: var(--accent); }
.library-shell { padding: clamp(25px, 4vw, 52px) 0 60px; }
.list-title { display: flex; align-items: baseline; gap: 16px; margin-bottom: 19px; }
.list-title h1 { font-size: clamp(35px, 4vw, 48px); letter-spacing: -.04em; line-height: 1.1; }
#result-count { font-size: 13px; color: var(--muted); }
.library-tools { display: flex; gap: 10px; margin-bottom: 20px; }
.library-tools select { padding: 0 10px; max-width: 220px; }
.search-field { display: flex; align-items: center; flex: 1; min-width: 100px; gap: 10px; border: 1px solid var(--line); border-radius: 7px; padding: 0 13px; background: var(--surface); color: var(--muted); }
.search-field:focus-within { outline: 2px solid var(--accent); }
.search-field .icon { width: 17px; }
.search-field input { font-size: 14px; height: 41px; width: 100%; min-width: 0; border: 0; outline: none; background: none; }
.search-field input::placeholder { color: var(--muted); }
#results { border-top: 1px solid var(--line); }
.catalog-row { display: grid; grid-template-columns: minmax(0,1fr) 20px; gap: 14px; align-items: center; min-height: 70px; border-bottom: 1px solid var(--line); padding: 10px 12px; }
.catalog-row:hover { background: var(--tint); }
.catalog-row:focus-visible { outline-offset: -3px; }
.catalog-row > .icon { width: 15px; color: var(--accent); }
.row-title { display: flex; align-items: center; gap: 15px; min-width: 0; }
.row-title strong { display: block; font-weight: 610; line-height: 1.3; font-size: 16px; overflow-wrap: anywhere; }
.row-title small { display: block; font-size: 12px; margin-top: 3px; color: var(--muted); }
.mini-score { flex: none; width: 34px; height: 45px; object-fit: cover; object-position: top center; border: 1px solid var(--line); border-radius: 2px; box-shadow: 2px 2px 0 var(--line); background: white; }
.row-title .score-only { color: var(--accent); }
.empty-state { padding: 45px 16px; text-align: center; }
.empty-state h3 { font-size: 18px; margin-bottom: 12px; }
.secondary, .back-library { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font-size: 14px; font-weight: 600; color: var(--accent); }
.secondary:hover, .back-library:hover { text-decoration: underline; }
.back-library .icon { width: 15px; }
.reader-mode { height: 100dvh; overflow: hidden; }
.reader-mode .masthead { display: none; }
.reader-mode #main { height: 100%; display: grid; grid-template-rows: minmax(0,1fr) auto; }
.workspace { display: grid; grid-template: minmax(0,1fr) / minmax(0,1fr); min-height: 0; }
.workspace.tools-open { grid-template-columns: minmax(0,1fr) clamp(300px, 26vw, 380px); }
#score-viewport { min-width: 0; min-height: 0; overflow: auto; padding: 6px; overscroll-behavior: contain; background: var(--surround); }
#score-viewport:focus-visible { outline-offset: -3px; }
#score-paper { margin: 0 auto; background: white; box-shadow: 0 1px 6px #29233124; }
#score-image { display: block; width: 100%; height: auto; user-select: none; }
#page-error { text-align: center; padding: 20px; }
.reader-bar { min-width: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4px; padding: 3px clamp(7px, 2vw, 30px) max(3px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.reader-bar .back-library { justify-self: start; min-height: 44px; padding: 0 6px; }
.page-tools, .zoom-tools { display: flex; align-items: center; gap: 4px; }
.icon-button, #zoom-label { display: inline-grid; place-items: center; border-radius: 6px; height: 44px; min-width: 44px; font-size: 20px; }
.icon-button:hover:enabled, #zoom-label:hover, #tools-toggle:hover { background: var(--tint); }
#page-position { font-size: 13px; text-align: center; min-width: 46px; font-variant-numeric: tabular-nums; color: var(--muted); }
#tools-toggle { display: inline-flex; align-items: center; justify-self: end; justify-content: center; gap: 7px; min-height: 44px; padding-inline: 10px; border-radius: 6px; font-weight: 620; font-size: 14px; color: var(--accent); }
#tools-toggle[aria-expanded=true] { background: var(--tint); }
#tools-toggle .icon { width: 18px; }
#reader-tools { min-width: 0; min-height: 0; padding: clamp(16px,2vw,28px); overflow-y: auto; overscroll-behavior: contain; border-left: 1px solid var(--line); background: var(--surface); }
.tools-heading { margin-bottom: 20px; }
.tools-heading h2 { font-size: 28px; line-height: 1.1; letter-spacing: -.7px; }
.tools-heading h2:focus { outline: none; }
.tools-heading p { margin-top: 4px; font-size: 13px; color: var(--muted); }
.part-play { display: grid; grid-template-columns: 1.1fr 1fr; align-items: end; gap: 10px; }
.balance-field { margin-top: 12px; }
#audio-status { font-size: 11px; color: var(--muted); }
.part-field { display: grid; gap: 7px; font-size: 13px; font-weight: 600; }
.part-field select { width: 100%; min-height: 44px; font-size: 15px; font-weight: 500; }
.play-button { display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 8px; font-size: 16px; font-weight: 650; min-height: 44px; width: 100%; margin: 0; color: var(--on-accent); background: var(--accent); }
.play-button:hover:enabled { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.play-button .icon { width: 17px; }
.play-button .icon:nth-child(2), .play-button.playing .icon:first-child { display: none; }
.play-button.playing .icon:nth-child(2) { display: inline; }
.timeline { margin-top: 18px; }
input[type=range] { accent-color: var(--accent); margin: 0; width: 100%; min-width: 0; height: 24px; }
.timeline input { display: block; appearance: none; background: transparent; }
.timeline input::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--played, 0%), var(--line) var(--played, 0%)); }
.timeline input::-webkit-slider-thumb { appearance: none; margin-top: -5px; width: 14px; height: 14px; background: var(--accent); border-radius: 50%; }
.timeline input::-moz-range-track { height: 4px; background: var(--line); }
.timeline input::-moz-range-thumb { background: var(--accent); width: 13px; height: 13px; border: 0; }
.timeline > div, .level label, .tempo-meta { display: flex; justify-content: space-between; align-items: center; }
.timeline > div, .tempo-meta, .level output { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.player-actions { display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 5px 0 11px; }
.subtle { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 36px; padding: 3px 7px; border-radius: 5px; font-size: 13px; }
.subtle:hover:enabled, .tool-section summary:hover { background: var(--tint); }
.subtle .icon { width: 15px; }
.tool-section { border-top: 1px solid var(--line); }
.tool-section summary { display: flex; align-items: center; justify-content: space-between; min-height: 47px; font-size: 14px; font-weight: 600; cursor: pointer; list-style: none; }
.tool-section summary::-webkit-details-marker { display: none; }
.tool-section summary .icon { width: 15px; }
.tool-section[open] summary .icon { transform: rotate(180deg); }
#score-settings .part-field { margin: 4px 0 8px; }
.zoom-tools { justify-content: space-between; border-top: 1px solid var(--line); }
.zoom-tools span { font-size: 13px; font-weight: 600; margin-right: auto; }
#zoom-label { font-size: 13px; }
#channels { padding-bottom: 12px; }
.level { padding: 2px 0 13px; }
.level label { font-size: 13px; }
.tempo-meta button { color: var(--accent); padding: 4px; font-size: 12px; text-decoration: underline; }
.pending-notice { color: var(--ink); background: var(--tint); font-size: 13px; text-align: center; padding: 8px; }
.channel { border-top: 1px solid var(--line); margin-top: 15px; padding-top: 12px; }
.channel-heading, .channel-volume { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.channel-heading strong { font-size: 15px; }
.channel-enable { display: flex; align-items: center; gap: 5px; min-height: 30px; font-size: 13px; }
.channel-enable input { width: 16px; height: 16px; accent-color: var(--accent); }
.channel-volume { margin-bottom: 5px; }
.channel-volume output { min-width: 44px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.channel select { width: 100%; min-height: 36px; }
.reader-footer.with-player { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: clamp(12px,1.5vw,25px); padding: 8px clamp(12px,1.7vw,28px); border-top: 1px solid var(--line); background: var(--surface); }
.with-player .reader-bar { display: flex; gap: 5px; padding: 0 0 0 12px; border: 0; border-left: 1px solid var(--line); }
#desktop-player { min-width: 0; display: grid; grid-template-columns: auto minmax(130px,1fr) minmax(148px,185px) minmax(210px,280px); gap: clamp(12px,1.5vw,25px); align-items: center; }
#desktop-player .play-button { min-width: 84px; padding-inline: 12px; }
#desktop-player .timeline, #desktop-player .balance-field { margin: 0; }
#desktop-player #audio-status { display: block; }
#desktop-player .balance-field { min-width: 0; gap: 2px; }
#desktop-player .balance-field select { min-height: 34px; font-size: 14px; }
#desktop-player .level-body { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; align-items: start; }
#desktop-player .level { padding: 0; min-width: 0; }
#desktop-player .level label { font-weight: 600; }
#desktop-player .level input { display: block; }
#desktop-player .tempo-meta { gap: 4px; font-size: 11px; }
#desktop-player .tempo-meta button { padding: 0; font-size: 11px; }
.part-play:has(> :only-child) { grid-template-columns: 1fr; }
@media (max-width: 1100px) {
  .reader-footer.with-player { display: block; padding: 0; }
  #desktop-player { padding: 7px 14px; grid-template-columns: auto minmax(100px,1fr) minmax(145px,180px) minmax(184px,250px); }
  .with-player .reader-bar { display: grid; padding: 1px 12px; border: 0; border-top: 1px solid var(--line); }
}
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); border-radius: 7px; background: var(--hero); color: white; font-size: 13px; padding: 10px 18px; opacity: 0; pointer-events: none; z-index: 3; }
#toast.show { opacity: 1; }
@media (max-width: 820px), (pointer: coarse) and (max-height: 600px) and (max-width: 1050px) {
  .masthead-inner, .library-shell, .welcome { width: calc(100% - 40px); }
  .workspace.tools-open { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr) min(42dvh, 390px); }
  #reader-tools { padding: 14px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left)); border-left: 0; border-top: 1px solid var(--line); }
  .tools-heading { margin-bottom: 12px; }
  .tools-heading h2 { font-size: 23px; }
  .tools-heading p { font-size: 12px; }
  .timeline { margin-top: 6px; }
  .player-actions { padding-bottom: 4px; }
  #score-viewport { padding: 2px; }
}
@media (max-width: 650px) {
  .masthead-inner { height: 56px; }
  .masthead-inner, .library-shell, .welcome { width: calc(100% - 32px); }
  .brand { font-size: 20px; gap: 8px; }
  .brand-mark { width: 30px; height: 30px; }
  .header-part { font-size: 12px; gap: 6px; }
  .header-part select { font-size: 13px; }
  .welcome { grid-template-columns: minmax(0,1fr); margin: 20px auto 30px; border-radius: 12px; }
  .welcome-intro { padding: 23px; }
  .welcome h1 { font-size: 38px; max-width: none; }
  .welcome-intro p { font-size: 14px; margin-top: 10px; }
  .welcome-music { display: none; }
  .welcome-parts { padding: 20px 23px 24px; }
  .welcome-parts p { margin-top: 5px; }
  .voice-choices { margin-top: 15px; gap: 7px; }
  .voice-choices button { min-height: 44px; }
  .library-tools { flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
  .search-field { flex-basis: 100%; }
  .library-tools select { font-size: 12px; min-height: 39px; min-width: 0; flex: 1; max-width: none; }
  .catalog-row { padding: 9px 2px; min-height: 62px; }
  .row-title { gap: 11px; }
  .row-title strong { font-size: 15px; }
  .mini-score { width: 29px; height: 39px; }
  .reader-bar { padding-inline: 4px; }
  .reader-bar .back-library, #tools-toggle { font-size: 13px; gap: 2px; }
  .page-tools { gap: 0; }
  #page-position { min-width: 41px; }
}
@media (max-width: 570px) {
  .header-actions { gap: 6px; }
  .masthead-inner { gap: 8px; }
  .masthead-inner:has(#library-part) .brand-name,
  .part-caption { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .mode-switch button { min-height: 34px; padding: 0 7px; font-size: 12px; }
  .mode-switch .icon { display: none; }
  .header-part select { padding: 0 3px; }
  #settings-link { width: 38px; height: 40px; }
  .settings-shell { width: calc(100% - 32px); padding-top: 14px; }
  .theme-grid { grid-template-columns: 1fr; gap: 8px; }
  .theme-card { display: grid; grid-template-columns: 30% minmax(0,1fr); }
  .theme-art { height: 58px; }
  .theme-caption { padding-inline: 13px; }
  .record-sleeve { left: 4%; }
  .theme-group { margin-top: 20px; }
}
