/* The Library — "Broadsheet" design. One stylesheet, desktop and mobile. */

:root {
  --paper: #fbf8f2;
  --paper-2: #f2ece0;
  --card: #ffffff;
  --ink: #1f2629;
  --muted: #4b5458;
  --faint: #6f7578;
  --rule: #c9c4b8;
  --rule-soft: #e6e2da;
  --accent: #a4553b;
  --accent-dark: #7d3d28;
  --ok: #3f6b3a;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 10; }

/* ---------- type helpers ---------- */
.kicker {
  font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
}
.kicker.accent { color: var(--accent); }
.serif { font-family: var(--serif); }
.italic { font-style: italic; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.small { font-size: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  font-weight: 600; text-decoration: none; cursor: pointer; border-radius: 0;
}
.btn:hover { background: var(--paper-2); color: var(--ink); }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover { background: #000; color: var(--paper); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn.accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: var(--paper); }
.btn.caps { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.link-btn {
  background: none; border: 0; padding: 0; min-height: 44px; cursor: pointer;
  color: var(--ink); text-decoration: underline; font-weight: inherit;
}
.link-btn.accent { color: var(--accent); font-weight: 600; text-decoration: none; }
.link-btn.accent:hover { text-decoration: underline; }

/* ---------- top bar & masthead ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--ink);
  font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
}
.topbar nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.topbar a { color: var(--ink); text-decoration: none; }
.badge-admin { color: var(--accent); font-weight: 600; }

.masthead { text-align: center; padding: 28px 0 20px; border-bottom: 4px double var(--ink); }
.masthead h1 {
  margin: 0; font-family: var(--serif); font-weight: 800;
  font-size: clamp(48px, 9.5vw, 128px); line-height: 0.92; letter-spacing: -0.03em;
  font-variation-settings: "opsz" 144;
}
.masthead p { margin: 14px 0 0; font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 20px; }
.masthead .art-hero { margin: 0 auto 18px; max-height: 240px; width: auto; }

.compact-head {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 14px 0; border-bottom: 4px double var(--ink);
}
.compact-head .brand {
  font-family: var(--serif); font-weight: 800; font-size: 28px; letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none; line-height: 1.1;
}
.compact-head .grow { flex: 1 1 320px; min-width: 0; }
.compact-head .admin-tools { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- sections nav ---------- */
.sections {
  display: flex; justify-content: center; flex-wrap: wrap;
  border-bottom: 1px solid var(--ink);
  font-size: 15px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
}
.sections a { color: var(--ink); text-decoration: none; padding: 14px 20px; border-right: 1px solid var(--rule); }
.sections a:last-child { border-right: 0; color: var(--accent); }
.sections a:hover { background: var(--paper-2); }

/* ---------- the big search line ---------- */
.hero-search { display: flex; flex-wrap: wrap; gap: 32px; align-items: center; padding: 56px 0 36px; }
.hero-search .margin-art { flex: 1 1 150px; max-width: 180px; max-height: 240px; object-fit: contain; }
.search-line { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 14px; margin: 0; }
.search-line .line { display: flex; align-items: flex-end; gap: 16px; border-bottom: 1.5px solid var(--ink); }
.search-line input[type=search] {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font-family: var(--serif); font-weight: 300; font-size: clamp(30px, 5vw, 64px);
  letter-spacing: -0.02em; padding: 4px 0 10px;
}
.search-line input[type=search]::placeholder { color: #8b8f90; font-style: italic; }
.search-line input[type=search]:focus-visible { outline: none; }
.search-line .line:focus-within { border-bottom-color: var(--accent); }
.search-line .go {
  font-family: var(--serif); font-size: 52px; line-height: 1; background: none; border: 0;
  color: var(--ink); padding: 0 0 12px; min-width: 44px; cursor: pointer;
}
.search-line .go:hover { color: var(--accent); }
.search-line .hint { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 15px; color: var(--muted); }
.search-line .hint i { font-family: var(--serif); }

.inline-search { display: flex; align-items: flex-end; gap: 12px; border-bottom: 1.5px solid var(--ink); margin: 0; }
.inline-search input[type=search] {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font-family: var(--serif); font-weight: 300; font-size: 30px; padding: 2px 0 6px;
}
.inline-search .go { font-family: var(--serif); font-size: 30px; background: none; border: 0; padding: 0 0 6px; cursor: pointer; min-width: 44px; }
.inline-search a { font-size: 13px; font-weight: 600; white-space: nowrap; padding-bottom: 10px; }

/* ---------- forms (underlined fields) ---------- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field > .label, .field > label, legend.label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
}
.field .help { font-size: 13px; color: var(--muted); }
.field .error, .error-text { font-size: 14px; color: #a12a1a; font-weight: 600; }
.u-input, .u-select, .u-textarea {
  width: 100%; border: 0; border-bottom: 1px solid var(--ink); background: transparent;
  font-family: var(--serif); font-weight: 300; font-size: 22px; padding: 6px 0; border-radius: 0;
}
.u-input.big { font-size: 34px; font-weight: 500; letter-spacing: -0.01em; }
.u-input.italic { font-style: italic; }
.u-input.code { font-family: var(--mono); font-size: 16px; padding: 10px 0; }
.u-select { min-height: 44px; }
.u-textarea { resize: vertical; min-height: 3.2em; }
.u-input:focus, .u-select:focus, .u-textarea:focus { outline: none; border-bottom: 2px solid var(--accent); }
.box-input {
  width: 100%; border: 1px solid var(--ink); background: var(--card); padding: 12px;
  font-family: var(--mono); font-size: 15px;
}
.grid-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 22px 32px; }
.grid-fields .full { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 16px; }
.checks label { display: flex; gap: 8px; align-items: center; min-height: 36px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); }
.dashed-box { border: 1px dashed var(--ink); padding: 18px 20px 20px; margin: 0; }
.dashed-box > legend { padding: 0 8px; color: var(--accent); }

/* ---------- advanced search ---------- */
.advanced { border-top: 1.5px solid var(--ink); padding: 22px 0 48px; display: flex; flex-wrap: wrap; gap: 40px; }
.advanced .main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.advanced h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 30px; }
.grammar { flex: 1 1 260px; max-width: 320px; border-left: 1px solid var(--rule); padding-left: 28px; display: flex; flex-direction: column; gap: 12px; }
.grammar dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; font-size: 15px; line-height: 1.4; }
.grammar dt { font-family: var(--mono); color: var(--accent); }
.grammar dd { margin: 0; }
.row-actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.row-actions.end { justify-content: flex-end; }

/* ---------- results ---------- */
.sentence {
  margin: 0; font-family: var(--serif); font-weight: 300;
  font-size: clamp(20px, 2.6vw, 32px); line-height: 1.55;
}
.sentence select {
  font: inherit; font-weight: 500; color: var(--accent); border: 0;
  border-bottom: 2px solid var(--accent); padding: 0 1.1em 0 2px; cursor: pointer; border-radius: 0;
  max-width: 100%; field-sizing: content; appearance: none; -webkit-appearance: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a4553b' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 2px center / 0.55em auto;
}
.filters { padding: 28px 0 18px; border-bottom: 1px solid var(--ink); display: flex; flex-direction: column; gap: 10px; }
.counts { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

.results { list-style: none; margin: 0; padding: 0; }
.result { border-bottom: 1px solid var(--rule); }
.result .row { display: flex; gap: 24px; align-items: center; padding: 22px 0; }
.result .num { flex: none; width: 44px; align-self: baseline; font-family: var(--serif); font-weight: 300; font-size: 28px; color: #8b8f90; }
.result .body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.result h3 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.1; letter-spacing: -0.01em; }
.result h3 a { color: var(--ink); text-decoration: none; }
.result h3 a:hover { color: var(--accent); }
.result .creator { font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 19px; }
.result .meta { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.result .meta .why { color: var(--accent); }
.result .out { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--accent); }
.result .actions { flex: none; display: flex; gap: 18px; align-items: center; font-size: 14px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.result .actions a.edit { min-height: 44px; display: flex; align-items: center; }
.thumb {
  flex: none; position: relative; width: 62px; height: 82px; padding: 4px;
  background: var(--card); border: 1px solid var(--rule); box-shadow: 2px 2px 0 var(--rule-soft);
  cursor: zoom-in;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .count { position: absolute; right: -6px; bottom: -6px; background: var(--ink); color: var(--paper); font-size: 11px; font-weight: 600; padding: 2px 6px; }

.loan-form {
  margin: 0 0 22px 68px; padding: 18px 22px; background: var(--paper-2); border-top: 3px solid var(--ink);
  display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end;
}
.loan-form .title { flex: 1 1 100%; font-family: var(--serif); font-size: 20px; }
.loan-form .field { flex: 1 1 260px; }
.loan-form .dated { font-size: 15px; color: var(--muted); padding-bottom: 8px; }
.loan-form .dated b { color: var(--ink); }

.see-also { padding-top: 32px; display: flex; flex-wrap: wrap; gap: 24px; }
.see-also h2 { flex: 1 1 100%; margin: 0; }
.see-also a { flex: 1 1 260px; color: var(--ink); text-decoration: none; border-top: 1.5px solid var(--ink); padding-top: 12px; }
.see-also a strong { display: block; font-family: var(--serif); font-weight: 500; font-size: 22px; }
.see-also a span { display: block; font-size: 14px; color: var(--muted); margin-top: 4px; }
.empty { padding: 48px 0; text-align: center; }
.empty p { font-family: var(--serif); font-size: 24px; font-weight: 300; margin: 0 0 12px; }
.empty img { margin: 0 auto 18px; max-height: 220px; width: auto; }
.more { padding: 20px 0; }

/* ---------- item page ---------- */
.item-page { display: flex; flex-wrap: wrap; gap: 48px; padding: 32px 0 64px; align-items: flex-start; }
.item-page .main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.item-page .side { flex: 1 1 300px; max-width: 420px; display: flex; flex-direction: column; gap: 24px; }
.item-page h1 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: clamp(36px, 5vw, 56px); line-height: 1.05; letter-spacing: -0.02em; }
.item-page .creator { font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 24px; }
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; border-top: 1px solid var(--ink); padding-top: 16px; }
.facts dt { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; padding-top: 4px; }
.facts dd { margin: 0; font-family: var(--serif); font-size: 19px; }
.prose { font-family: var(--serif); font-size: 19px; line-height: 1.6; font-weight: 300; white-space: pre-line; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.gallery a { display: block; background: var(--card); border: 1px solid var(--rule); padding: 5px; }
.gallery img { aspect-ratio: 3 / 4; object-fit: cover; width: 100%; }
.gallery figcaption { font-size: 13px; color: var(--muted); }
.gallery .photo-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.panel { border-top: 3px solid var(--ink); background: var(--paper-2); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.panel h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 22px; }
.history { list-style: none; margin: 0; padding: 0; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }

/* ---------- admin: add / edit ---------- */
.page-title { margin: 28px 0 8px; font-family: var(--serif); font-weight: 300; font-size: clamp(40px, 5vw, 64px); letter-spacing: -0.02em; line-height: 1; }
.page-sub { margin: 0 0 24px; font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 19px; color: var(--muted); }
.two-col { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; border-top: 1.5px solid var(--ink); padding-top: 24px; padding-bottom: 64px; }
.two-col > .left { flex: 1 1 360px; max-width: 460px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.two-col > .right { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.candidates { list-style: none; margin: 0; padding: 0; }
.candidates li { border-bottom: 1px solid var(--rule); }
.candidates a { display: flex; gap: 14px; align-items: baseline; padding: 14px 0; color: var(--ink); text-decoration: none; }
.candidates a:hover { background: var(--paper-2); }
.candidates .mark { font-family: var(--serif); color: #8b8f90; font-size: 22px; width: 18px; flex: none; }
.candidates .picked .mark { color: var(--accent); }
.candidates strong { display: block; font-family: var(--serif); font-weight: 500; font-size: 22px; line-height: 1.2; }
.candidates span.meta { display: block; font-size: 14px; color: var(--muted); }
.candidates .src { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.12em; color: var(--accent); margin-top: 4px; text-transform: uppercase; }
.picked-row { display: flex; gap: 12px; align-items: baseline; padding: 12px 14px; background: var(--paper-2); }
.notice { padding: 12px 14px; background: #eef1ea; font-size: 15px; }
.notice.warn { background: #fbefe9; }
.dupe-note { border: 1.5px solid var(--ink); box-shadow: 6px 6px 0 var(--accent); padding: 18px 22px; display: flex; flex-direction: column; gap: 10px; background: var(--card); }
.dupe-note p { margin: 0; font-family: var(--serif); font-weight: 300; font-size: 20px; line-height: 1.4; }
.dupe-note ul { margin: 0; padding-left: 20px; font-family: var(--serif); font-size: 18px; }
.photo-drop { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--rule); padding-top: 18px; }
.photo-drop label.drop {
  width: 120px; height: 110px; border: 1px dashed var(--ink); display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; cursor: pointer; font-weight: 600; gap: 2px;
}
.photo-drop label.drop small { font-weight: 400; color: var(--muted); }
.photo-drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photo-previews { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-previews img { width: 62px; height: 82px; object-fit: cover; border: 1px solid var(--rule); }
.new-field { background: var(--card); border: 1.5px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); padding: 16px 18px; display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end; }
.new-field summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
details.add-field > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--ink); font-weight: 600; }
details.add-field > summary::-webkit-details-marker { display: none; }
details.add-field[open] > summary { margin-bottom: 14px; }
.save-bar { display: flex; gap: 14px; justify-content: flex-end; flex-wrap: wrap; border-top: 1.5px solid var(--ink); padding-top: 20px; }
.scan-panel { display: flex; flex-direction: column; gap: 10px; }
.scan-panel video { width: 100%; max-height: 280px; background: #000; object-fit: cover; }

/* ---------- admin pages ---------- */
.stack { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; margin: 0 0 12px; }
.stack > .field { align-self: stretch; }
.stack > .btn { margin-top: 4px; }
.desk-actions { margin: 8px 0 32px; }
.two-col h2.kicker { margin: 8px 0 4px; }
.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-list li { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--rule); padding: 10px 0; }
.admin-list li .grow { flex: 1 1 240px; min-width: 0; }
.admin-list form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.admin-list input[type=text] { border: 0; border-bottom: 1px solid var(--ink); background: transparent; padding: 6px 0; min-width: 160px; }

/* ---------- sheet (mobile unlock, flash) ---------- */
.unlock-pop {
  position: absolute; top: 58px; right: var(--gutter); width: 300px; max-width: calc(100% - 32px);
  background: var(--paper); border: 1.5px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); z-index: 5;
  padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 12px;
}
.unlock-pop .head { display: flex; justify-content: space-between; align-items: center; }
.unlock-pop .head span { font-family: var(--serif); font-weight: 500; font-size: 24px; }
.unlock-pop .x { font-size: 26px; background: none; border: 0; width: 44px; height: 44px; cursor: pointer; }
.flash { margin: 16px 0 0; padding: 12px 16px; background: #eef1ea; border-left: 0; font-size: 15px; }
.flash.err { background: #fbefe9; }
.unlock-page { max-width: 440px; margin: 48px auto; display: flex; flex-direction: column; gap: 16px; }

footer.site { border-top: 1px solid var(--ink); margin-top: 48px; padding: 18px 0 32px; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
footer.site .footer-links { display: flex; gap: 16px; flex-wrap: wrap; }

/* Library Rip: connecting, downloads, the desk's connected rippers. */
.connect-question { font-family: var(--serif); font-size: 22px; line-height: 1.35; margin: 0; }
.connect .row-actions { gap: 12px; }
#rippers { border-top: 1.5px solid var(--ink); padding: 18px 0 48px; }
.builds .sha { overflow-wrap: anywhere; margin-top: 4px; }
.makemkv { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; }
.makemkv dt { font-weight: 600; }
.makemkv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .makemkv { grid-template-columns: 1fr; } .makemkv dd { margin-bottom: 8px; } }
.archive-files a { overflow-wrap: anywhere; }

/* Smooth page-to-page navigation where supported (no blank frame). */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* htmx request indicator (htmx's own CSS is disabled for the CSP) */
.htmx-indicator { opacity: 0; transition: opacity 150ms ease-in 200ms; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ---------- phones ---------- */
@media (max-width: 719px) {
  body { font-size: 15px; }
  .topbar { font-size: 12px; }
  .masthead { padding: 22px 0 16px; }
  .masthead h1 { font-size: 50px; }
  .masthead p { font-size: 16px; }
  .hero-search { padding: 32px 0 8px; gap: 16px; }
  .hero-search .margin-art { display: none; }
  .search-line input[type=search] { font-size: 26px; }
  .search-line .go { font-size: 36px; padding-bottom: 10px; }
  .sections {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--ink);
    border-bottom: 0; justify-content: stretch;
  }
  .sections a { min-height: 56px; display: flex; align-items: center; padding: 0 14px; border-bottom: 1px solid var(--rule); }
  .sections a:nth-child(2n) { border-right: 0; }
  .sections a:last-child { grid-column: 1 / -1; border-bottom: 1px solid var(--ink); }
  .compact-head { gap: 12px; padding: 8px 0; }
  .compact-head .brand { font-size: 20px; }
  .compact-head .grow { flex-basis: 100%; order: 3; }
  .inline-search input[type=search] { font-size: 28px; }
  .sentence { font-size: 19px; line-height: 1.7; }
  .result .row { flex-wrap: wrap; gap: 6px 12px; padding: 18px 0; align-items: flex-start; }
  .result .num { width: 28px; font-size: 20px; }
  .result .body { flex: 1 1 calc(100% - 110px); }
  .result h3 { font-size: 24px; }
  .result .creator { font-size: 17px; }
  .result .meta { font-size: 11px; letter-spacing: 0.1em; line-height: 1.6; }
  .thumb { width: 54px; height: 72px; padding: 3px; }
  .result .actions { flex: 1 1 100%; padding-left: 40px; gap: 10px; font-size: 13px; }
  .result .actions .btn { flex: 1; }
  .result .actions a.edit { border: 1.5px solid var(--accent); padding: 0 16px; text-decoration: none; }
  .loan-form { margin: 8px 0 18px 40px; padding: 16px; flex-direction: column; align-items: stretch; }
  .loan-form .btn { width: 100%; }
  .advanced { gap: 24px; }
  .grammar { border-left: 0; padding-left: 0; max-width: none; border-top: 1px solid var(--ink); padding-top: 14px; }
  .two-col { gap: 28px; }
  .two-col > .left { max-width: none; }
  .save-bar { position: sticky; bottom: 0; background: var(--paper); padding: 12px 0; z-index: 2; }
  .save-bar .btn.accent { flex: 1; }
  .unlock-pop { position: fixed; top: auto; bottom: 0; left: 0; right: 0; width: auto; max-width: none; box-shadow: 0 -8px 30px rgba(31,38,41,0.25); border-width: 1.5px 0 0; }
  .item-page { gap: 28px; }
}

@media print {
  .topbar, .sections, .actions, .loan-form, footer.site, .compact-head .admin-tools { display: none !important; }
}

/* ---------- the Player link, restriction badge, accounts ---------- */
.player-link { gap: 6px; }
.topbar .player-link { min-height: 32px; }
.badge-restricted {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border: 1.5px solid var(--accent);
  color: var(--accent); font-size: 11px; letter-spacing: 0.12em; vertical-align: 2px;
}
.ok { color: var(--ok); font-weight: 600; }
.accounts .access-select { width: auto; min-width: 120px; font-size: 18px; }
.digital-files { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-family: var(--serif); font-size: 17px; }
.digital-files .mono { color: var(--muted); }

/* ---------- the upload studio ---------- */
.studio { display: flex; flex-direction: column; gap: 18px; border-top: 1.5px solid var(--ink); padding: 24px 0 32px; }
.studio-existing { border-top: 1.5px solid var(--ink); padding: 24px 0 64px; display: flex; flex-direction: column; gap: 14px; }
.drop-zone {
  border: 2px dashed var(--ink); background: var(--card); padding: 44px 24px 36px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.drop-zone:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.drop-zone.over { background: var(--paper-2); border-color: var(--accent); box-shadow: 8px 8px 0 var(--accent); }
.drop-zone .drop-title { margin: 0; font-family: var(--serif); font-weight: 300; font-size: clamp(26px, 4vw, 40px); letter-spacing: -0.01em; }
.drop-zone .small { margin: 0; max-width: 46em; }
.row-actions.center { justify-content: center; margin-top: 8px; }
.drop-zone .picker { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pending { display: flex; flex-direction: column; gap: 10px; }
.pending-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.pending-head h3 { margin: 0; }
.table-scroll { overflow-x: auto; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.pending-table { width: 100%; border-collapse: collapse; min-width: 880px; }
.pending-table th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--rule);
}
.pending-table td { padding: 8px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.pending-table tr:last-child td { border-bottom: 0; }
.pending-table .u-input { font-size: 18px; padding: 4px 0; }
.pending-table .u-input.num, .media-edit .u-input.num { width: 3.2em; text-align: center; font-family: var(--mono); font-size: 15px; }
.pending-table .u-select { font-size: 16px; min-height: 36px; width: auto; }
.pending-table td.title { min-width: 240px; }
.pending-table td.title .path { display: block; margin-top: 2px; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12px; }
.pending-table td.order { white-space: nowrap; }
.pending-table td.order .btn { min-height: 30px; padding: 0 8px; }
.pending-table .grip { cursor: grab; color: var(--faint); padding: 0 6px 0 2px; user-select: none; letter-spacing: -2px; }
.pending-table tr.dragging td { background: var(--paper-2); }
.pending-table td.progress { min-width: 170px; }
.pending-table progress { width: 100%; height: 8px; accent-color: var(--accent); display: block; margin-bottom: 4px; }
.pending-table tr.status-done td { color: var(--muted); }
.pending-table tr.status-done progress { accent-color: var(--ok); }
.pending-table tr.status-error [data-cell="note"] { color: #a12a1a; font-weight: 600; }
.pending-table tr.status-error td.progress .btn { margin-top: 4px; }
.x { background: none; border: 0; font-size: 22px; line-height: 1; width: 36px; height: 36px; cursor: pointer; color: var(--muted); }
.x:hover { color: var(--accent); }
.x:disabled { visibility: hidden; }
.kind-badge {
  display: inline-block; padding: 2px 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; border: 1px solid currentColor; white-space: nowrap;
}
.kind-audio { color: var(--accent); }
.kind-video { color: #2f5d7c; }
.kind-document { color: var(--ok); }
.sub-chip {
  display: inline-flex; align-items: center; gap: 2px; margin: 2px 6px 2px 0; padding: 0 0 0 10px;
  background: var(--paper-2); border: 1px solid var(--rule); font-size: 14px;
}
.sub-chip .x { width: 30px; height: 30px; font-size: 18px; }
.sub-chip.status-error { border-color: #a12a1a; }
.pending .save-bar { align-items: center; }
.studio .btn:disabled { opacity: 0.4; cursor: default; }
.pending .save-bar .grow { flex: 1 1 200px; }

.media-files { list-style: none; margin: 0; padding: 0; counter-reset: media; }
.media-file { border-bottom: 1px solid var(--rule); padding: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.media-main { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.media-main > .kind-badge { flex: none; }
.media-edit { flex: 999 1 420px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; margin: 0; }
.media-edit label.mini {
  display: flex; flex-direction: column; gap: 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}
.media-edit label.mini.grow { flex: 1 1 240px; }
.media-edit .u-input { font-size: 20px; padding: 4px 0; color: var(--ink); text-transform: none; letter-spacing: 0; }
.media-tools { flex: 1 1 260px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: space-between; }
.media-tools .mono { overflow-wrap: anywhere; }
.media-tools form { margin: 0; display: flex; gap: 6px; }
.media-tools .btn.small { min-height: 34px; padding: 0 10px; }
.media-tools .btn:disabled { opacity: 0.35; cursor: default; }
.subtitles { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding-left: 4px; }
.subtitles > .label { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.subtitles form.sub-chip { margin: 0; }
.sub-add { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0; }
.sub-add .u-input { font-size: 16px; width: auto; max-width: 180px; }
.sub-add .u-input.num { width: 4em; }
.sub-add input[type=file] { font-size: 14px; max-width: 240px; }

@media (max-width: 719px) {
  .drop-zone { padding: 28px 16px; }
  .media-edit label.mini.grow { flex-basis: 100%; }
}

/* ---------- the studio's "Fill from MusicBrainz" panel ---------- */
.mb-fill {
  border: 1.5px solid var(--ink); background: var(--card); padding: 16px 20px 18px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 6px 6px 0 var(--rule-soft);
}
.mb-head { display: flex; flex-direction: column; gap: 4px; }
.mb-head h3, .mb-head p, .mb-fill > p { margin: 0; }
.mb-off { color: var(--muted); }
.mb-search { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.mb-search .u-input { flex: 1 1 260px; width: auto; font-size: 20px; }
#mb-status:empty { display: none; }
#mb-status.err { color: #a12a1a; font-weight: 600; }
.mb-candidates { list-style: none; margin: 0; padding: 0; }
.mb-candidates:not(:empty) { border-top: 1px solid var(--rule); }
.mb-candidates[aria-busy="true"] { opacity: 0.5; }
.mb-candidate { display: flex; align-items: center; gap: 4px 14px; border-bottom: 1px solid var(--rule-soft); flex-wrap: wrap; }
.mb-pick {
  flex: 1 1 320px; display: flex; gap: 8px 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  text-align: left; background: none; border: 0; border-left: 3px solid transparent; padding: 12px 8px;
  font: inherit; color: var(--ink); cursor: pointer;
}
.mb-pick:hover { background: var(--paper-2); }
.mb-candidate.picked .mb-pick { background: var(--paper-2); border-left-color: var(--accent); }
.mb-cand-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.mb-cand-title { font-family: var(--serif); font-size: 20px; }
.mb-cand-meta { flex-basis: 100%; font-size: 14px; color: var(--muted); }
.mb-best { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.mb-link { padding: 0 8px 0 0; white-space: nowrap; }
.mb-fit {
  display: inline-block; padding: 2px 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; border: 1.5px solid currentColor; white-space: nowrap;
}
.fit-good { color: var(--ok); }
.fit-check { color: var(--accent); }
.fit-poor, .fit-none { color: var(--faint); }
.mb-preview { display: flex; flex-direction: column; gap: 10px; border-top: 1.5px solid var(--ink); padding-top: 14px; }
.mb-preview p { margin: 0; }
.mb-preview-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.mb-preview-head h4 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 22px; }
.mb-preview-table { min-width: 760px; }
.mb-preview-table td.mb-file { max-width: 260px; overflow-wrap: anywhere; }
.mb-preview-table .mb-artist { display: block; }
.mb-preview-table tr.mb-row-none td { color: var(--muted); }
.mb-conf { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.mb-conf.good { color: var(--ok); }
.mb-conf.check { color: var(--accent); }
.mb-conf.none { color: #a12a1a; }
.mb-note { display: block; color: var(--muted); max-width: 300px; }
.mb-options { display: flex; flex-direction: column; gap: 6px; }
.mb-option { display: flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; }
.mb-actions { justify-content: flex-end; }
.mb-mark { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 600; }
.mb-mark.mb-good { color: var(--ok); }
.mb-mark.mb-check { color: var(--accent); }

/* ---------- accounts waiting for approval ---------- */
.count-badge {
  display: inline-block; min-width: 1.6em; margin-left: 8px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--paper); font-size: 12px; font-weight: 600; line-height: 1.6;
  text-align: center; letter-spacing: 0; vertical-align: 1px;
}
.waiting { border: 1.5px solid var(--accent); padding: 4px 16px 8px; margin-bottom: 28px; }
.waiting .kicker { display: flex; align-items: center; }
