:root {
  color-scheme: dark;
  --background: #050505;
  --panel: #0b0b0c;
  --panel-soft: #101012;
  --border: #242428;
  --border-soft: #18181b;
  --text: #f3f3f5;
  --muted: #aaaab2;
  --red: #f31325;
  --red-dark: #8b0f18;
  --purple: #5124a6;
  --green: #50df78;
  --disabled: #55555b;
  --header-height: 98px;
  --footer-height: 118px;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--background); color: var(--text); font-family: Inter, "Segoe UI", Arial, sans-serif; }
html { position: fixed; inset: 0; }
body { position: fixed; inset: 0; min-height: 0; }
body { min-width: 320px; }
button, input { font: inherit; }
button { color: inherit; }
.site-shell { position: fixed; inset: 0; width: auto; height: auto; min-height: 0; display: grid; grid-template-rows: var(--header-height) minmax(0, 1fr) var(--footer-height); overflow: hidden; }
.site-header { display: grid; grid-template-columns: minmax(250px, 1fr) auto minmax(250px, 1fr); align-items: center; gap: 24px; padding: 0 26px; border-bottom: 1px solid #080808; background: #020203; }
.brand { display: inline-flex; width: 236px; max-width: 100%; }
.brand img { display: block; width: 100%; height: auto; object-fit: contain; }
.top-navigation { height: 100%; display: flex; align-items: stretch; gap: 28px; }
.nav-item { min-width: 160px; display: flex; align-items: center; justify-content: center; gap: 13px; border-bottom: 2px solid transparent; color: #dedee2; text-decoration: none; text-transform: uppercase; font-weight: 600; letter-spacing: .02em; }
.nav-item.active { color: var(--red); border-bottom-color: var(--red); }
.nav-icon { font-size: 28px; line-height: 1; }
.nav-icon.muted { color: #b4b4ba; }
.twitch-login { justify-self: end; min-height: 48px; padding: 0 22px; border: 0; border-radius: 5px; background: var(--purple); font-weight: 700; opacity: 1; display: inline-flex; align-items: center; justify-content: center; gap: 10px; line-height: 1; }
.twitch-login { cursor: pointer; }
.twitch-login:disabled { cursor: wait; }
.twitch-mark { width: 22px; height: 22px; display: block; flex: 0 0 auto; filter: brightness(0) invert(1); }
.twitch-login-label { display: block; line-height: 1; }
.page-frame { height: 100%; min-height: 0; overflow: hidden; display: grid; grid-template-columns: 288px minmax(0, 1fr); gap: 8px; padding: 0 13px 20px; }
.panel { border: 1px solid var(--border-soft); border-radius: 4px; background: linear-gradient(135deg, #0b0b0c 0%, #080809 100%); }
.sidebar { min-height: 0; padding: 20px 13px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.section-label { margin: 0 8px 14px; color: var(--red); font-size: 13px; text-transform: uppercase; }
.stats-row { width: 100%; min-height: 43px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px; color: #c8c8ce; }
.stats-row > span { min-width: 0; display: flex; align-items: center; gap: 11px; }
.stats-row strong { flex: 0 0 auto; color: #e0e0e4; font-weight: 400; }
.row-icon { width: 20px; font-size: 21px; text-align: center; }
.sidebar-divider { height: 1px; margin: 16px 0 18px; background: #222225; }
.section-heading-row { display: flex; justify-content: space-between; align-items: center; }
.text-button { margin-right: 9px; border: 0; background: none; color: var(--red); }
.text-button:disabled { opacity: .9; }
.filter-placeholder { padding: 5px 8px 12px; }
.filter-placeholder h3 { display: flex; justify-content: space-between; margin: 7px 0; font-size: 13px; text-transform: uppercase; }
.filter-placeholder p { margin: 0; color: #77777f; font-size: 12px; line-height: 1.55; }
.content-panel { min-width: 0; min-height: 0; padding: 18px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.route-page { display: none; min-height: 100%; }
.route-page.active { display: block; }
.toolbar { display: grid; grid-template-columns: minmax(280px, 1fr) 238px; gap: 24px; align-items: center; }
.search-field { position: relative; display: block; height: 52px; }
.search-field input { width: 100%; height: 52px; padding: 0 50px 0 17px; border: 1px solid #26262a; border-radius: 5px; background: #121214; color: var(--text); }
.search-field input::placeholder { color: #cdccd1; opacity: 1; }
.search-field input:disabled { opacity: 1; }
.search-icon { position: absolute; top: 50%; right: 17px; width: 26px; height: 26px; display: grid; place-items: center; transform: translateY(-50%); pointer-events: none; }
.search-icon svg { width: 24px; height: 24px; display: block; overflow: visible; fill: none; stroke: #d1d1d6; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.sort-control { height: 52px; display: flex; justify-content: space-between; align-items: center; padding: 0 16px; border: 1px solid #28282c; border-radius: 5px; background: #101012; color: #e0e0e4; }
.sort-control:disabled { opacity: 1; }
.framework-stage { min-height: calc(100% - 76px); display: grid; place-items: center; padding: 60px 20px; }
.framework-card { width: min(650px, 100%); padding: 38px; border: 1px solid #2c2c31; border-top-color: var(--red-dark); border-radius: 7px; background: radial-gradient(circle at top, rgba(120,15,24,.14), transparent 42%), #0d0d0f; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.framework-symbol { width: 70px; height: 70px; display: grid; place-items: center; margin: 0 auto 20px; border: 1px solid var(--red); border-radius: 50%; color: var(--red); font-weight: 800; }
.framework-card h1, .placeholder-page h1 { margin: 0 0 10px; font-size: 28px; }
.framework-card > p { color: var(--muted); }
.export-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 28px 0; }
.export-summary div { padding: 14px 10px; border: 1px solid #252529; border-radius: 4px; background: #09090a; }
.export-summary dt { margin-bottom: 6px; color: #777780; font-size: 11px; text-transform: uppercase; }
.export-summary dd { margin: 0; font-size: 13px; }
.export-summary dd.ok { color: var(--green); }
.export-summary dd.error { color: #ff6470; }
.next-step { font-size: 13px; }
.placeholder-page { min-height: 600px; display: grid; place-content: center; justify-items: center; text-align: center; }
.placeholder-page p { color: var(--muted); }
.large-icon { margin-bottom: 18px; color: var(--red); font-size: 60px; }
.outline-button { margin-top: 14px; padding: 11px 20px; border: 1px solid var(--red); border-radius: 4px; color: var(--red); text-decoration: none; }
.live-bar { min-height: 0; overflow: hidden; display: grid; grid-template-columns: 1.05fr 1.55fr 1fr 1.25fr; border-top: 1px solid var(--red-dark); background: #080809; }
.status-block { min-width: 0; display: flex; align-items: center; gap: 18px; padding: 16px 5vw; border-right: 1px solid #353539; }
.status-block:last-child { border-right: 0; }
.status-block div:not(.status-dot):not(.artwork-placeholder) { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.status-block strong, .status-block span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-block strong { font-size: 18px; }
.status-block span { color: #bdbdc4; }
.status-dot { width: 11px; height: 11px; flex: 0 0 auto; border-radius: 50%; background: #77777c; box-shadow: 0 0 13px rgba(120,120,125,.25); }
.status-dot.online { background: var(--green); box-shadow: 0 0 13px rgba(80,223,120,.4); }
.radio-block strong { color: #a2a2a8; text-transform: uppercase; }
.radio-block strong.online { color: var(--green); }
.artwork-placeholder { width: 72px; height: 72px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #34343a; border-radius: 4px; background: #111114 center/cover no-repeat; color: #777; font-size: 30px; }
.eyebrow { color: var(--red) !important; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.twitch-footer-mark { width: 42px; height: 42px; display: block; flex: 0 0 auto; filter: invert(20%) sepia(99%) saturate(3394%) hue-rotate(257deg) brightness(78%) contrast(94%); }
.twitch-footer-link, .twitch-footer-link:link, .twitch-footer-link:visited, .twitch-footer-link:hover, .twitch-footer-link:active { color: inherit; text-decoration: none; background: transparent; }
.twitch-footer-link { cursor: pointer; }
.twitch-footer-link:hover, .twitch-footer-link:active { filter: none; transform: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
/* Legacy early responsive rules removed in v0.4.28.
   Responsive behaviour is intentionally consolidated into only two ranges:
   801–1024px tablet and <=800px mobile. Desktop >1024px stays untouched. */

/* Phase 1, Chunk 2: catalogue browser */
.filter-group { padding: 5px 8px 12px; }
.filter-group h3 { display: flex; justify-content: space-between; align-items: center; margin: 7px 0 10px; font-size: 13px; text-transform: uppercase; }
.disclosure-arrow { width: 18px; height: 18px; flex: 0 0 18px; display: grid; place-items: center; color: #fff; font-family: Arial, sans-serif; font-size: 12px; font-weight: 900; line-height: 1; }
.disclosure-arrow::before { content: none; }
.filter-list { display: grid; gap: 2px; }
.filter-option { min-height: 29px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #c9c9cf; font-size: 13px; cursor: pointer; }
.filter-option-main { min-width: 0; display: flex; align-items: center; gap: 10px; }
.filter-option input { position: absolute; opacity: 0; pointer-events: none; }
.custom-checkbox { width: 17px; height: 17px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #5b5b62; border-radius: 2px; background: #0a0a0b; }
.filter-option input:checked + .custom-checkbox { border-color: var(--red); background: var(--red-dark); }
.filter-option input:checked + .custom-checkbox::after { content: "✓"; color: #fff; font-size: 12px; line-height: 1; }
.filter-option input:focus-visible + .custom-checkbox { outline: 2px solid #fff; outline-offset: 2px; }
.filter-option-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-count { flex: 0 0 auto; color: #bebec4; }
.year-list .extra-year,
.platform-list .extra-platform { display: none; }
.year-list.expanded .extra-year,
.platform-list.expanded .extra-platform { display: flex; }
.show-more-button { margin-top: 8px; padding: 3px 0; border: 0; background: none; color: var(--red); cursor: pointer; }
.show-more-button[hidden] { display: none; }
.text-button:not(:disabled) { cursor: pointer; }
.text-button:disabled { color: #66666d; }
.search-field input:focus, .sort-control:focus-within { border-color: #6e6e75; outline: none; }
.sort-control { position: relative; padding: 0; }
.sort-control select { width: 100%; height: 100%; padding: 0 50px 0 16px; appearance: none; -webkit-appearance: none; -moz-appearance: none; border: 0; outline: 0; background: transparent; color: #e0e0e4; cursor: pointer; }
.sort-control select::-ms-expand { display: none; }
.sort-control select option { background: #111113; color: #eee; }
.sort-arrow { position: absolute; top: 50%; right: 17px; width: 20px; height: 20px; display: grid; place-items: center; transform: translateY(-50%); color: #fff; font-family: Arial, sans-serif; font-size: 15px; font-weight: 900; line-height: 1; pointer-events: none; }
.sort-arrow::before { content: none; }
.catalogue-message-card { min-height: 520px; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); }
.catalogue-message-card[hidden] { display: none; }
.catalogue-message-card h1 { margin: 18px 0 7px; color: var(--text); font-size: 24px; }
.catalogue-message-card p { margin: 0; }
.loading-spinner { width: 38px; height: 38px; border: 3px solid #2c2c30; border-top-color: var(--red); border-radius: 50%; animation: catalogue-spin .8s linear infinite; }
@keyframes catalogue-spin { to { transform: rotate(360deg); } }
.catalogue-meta { min-height: 37px; display: flex; align-items: center; justify-content: flex-end; color: #8e8e95; font-size: 12px; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 285px)); gap: 13px; align-items: start; justify-content: start; }
.album-card { width: 285px; max-width: 100%; min-width: 0; overflow: hidden; border: 1px solid #222226; border-radius: 5px; background: linear-gradient(145deg, #101012, #09090a); cursor: pointer; transition: border-color .15s ease, transform .15s ease, background .15s ease; }
.album-card:hover, .album-card:focus-visible { border-color: #8f111c; background: linear-gradient(145deg, #151517, #0b0b0c); transform: translateY(-2px); outline: none; }
.album-artwork-wrap { position: relative; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; background: #151517; }
.album-artwork { width: 100%; height: 100%; display: block; object-fit: cover; }
.album-card-body { min-width: 0; min-height: 118px; padding: 15px 12px 13px; }
.album-card h3 { min-width: 0; min-height: 42px; margin: 0 0 8px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: #f4f4f6; font-size: 16px; line-height: 1.28; }
.album-card p { margin: 0 0 7px; overflow: hidden; color: #b8b8bf; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { min-height: 420px; display: grid; place-content: center; text-align: center; }
.empty-state[hidden] { display: none; }
.empty-state h2 { margin: 0 0 7px; }
.empty-state p { margin: 0; color: var(--muted); }
.load-more-wrap { display: flex; justify-content: center; padding: 24px 0 8px; }
.load-more-button { min-width: 210px; min-height: 42px; padding: 0 20px; border: 1px solid #6f1119; border-radius: 4px; background: #121214; color: #eee; cursor: pointer; }
.load-more-button:hover { border-color: var(--red); color: var(--red); }
.load-more-button[hidden] { display: none; }
@media (max-width: 900px) { .album-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 285px)); } }

/* Phase 1, Chunk 3: expandable album track lists */
.album-card.expanded { border-color: var(--red); box-shadow: 0 0 0 1px rgba(243, 19, 37, .16); transform: none; }
.album-expansion { grid-column: 1 / -1; min-width: 0; overflow: hidden; margin: 2px 0 4px; border: 1px solid var(--red-dark); border-radius: 5px; background: linear-gradient(145deg, #0d0d0f, #080809); }
.album-expansion-header { min-height: 116px; display: flex; align-items: center; gap: 20px; padding: 14px; border-bottom: 1px solid #29292d; }
.expanded-artwork { width: 88px; height: 88px; flex: 0 0 auto; object-fit: cover; border: 1px solid #4b1118; border-radius: 4px; background: #111; }
.expanded-album-details { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 15px; }
.expanded-album-details h2 { width: 100%; margin: 0; overflow: hidden; color: #f7f7f8; font-size: 24px; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.expanded-album-details p { margin: 0; color: #b9b9c0; font-size: 14px; }
.collapse-album-button { height: 46px; display: inline-grid; grid-template-columns: auto 36px; align-items: stretch; padding: 0; overflow: hidden; border: 1px solid var(--red); border-radius: 5px; background: #0f0f11; color: var(--red); cursor: pointer; }
.collapse-label { display: grid; place-items: center; padding: 0 15px; font-size: 16px; line-height: 1; }
.collapse-arrow { width: 36px; height: 100%; display: grid; place-items: center; border-left: 1px solid var(--red); background: #9d1724; color: #fff; font-family: Arial, sans-serif; font-size: 15px; font-weight: 900; line-height: 1; }
.collapse-arrow::before { content: none; }
.collapse-album-button:hover { border-color: var(--red); background: #171719; }
.collapse-album-button:hover .collapse-arrow { background: var(--red); }
.collapse-album-button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.track-table { min-width: 0; }
.track-row { min-height: 48px; display: grid; grid-template-columns: 68px minmax(220px, 1fr) 110px 190px; align-items: center; border-bottom: 1px solid #222226; }
.track-row:last-child { border-bottom: 0; }
.track-table-header { min-height: 42px; color: #c4c4ca; font-size: 12px; text-transform: uppercase; }
.track-number { padding: 0 14px; color: #c8c8cf; text-align: center; }
.track-title { min-width: 0; overflow: hidden; padding: 0 12px; text-overflow: ellipsis; white-space: nowrap; }
.track-duration { padding: 0 12px; color: #d5d5da; font-variant-numeric: tabular-nums; }
.track-request { display: flex; justify-content: flex-end; padding: 7px 18px 7px 10px; }
.track-row.current-track .track-number, .track-row.current-track .track-title, .track-row.current-track .track-duration { color: var(--red); }
.now-playing-equaliser { margin-left: 22px; color: var(--red); font-size: 18px; }
.request-button { min-width: 142px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 4px; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 8px; line-height: 1; }
.request-twitch-mark { width: 17px; height: 17px; display: block; flex: 0 0 auto; filter: brightness(0) invert(1); }
.request-button.available { background: var(--purple); color: #fff; opacity: 1; }
.request-button.pending { background: var(--purple); color: #fff; opacity: .72; cursor: wait; }
.request-button.available:not(:disabled) { cursor: pointer; }
.request-button.closed, .request-button.cooldown, .request-button.offline, .request-button.login-required { background: #242426; color: #c0c0c5; opacity: 1; }
.request-button:disabled { cursor: not-allowed; }
@media (max-width: 800px) {
  .track-row { grid-template-columns: 54px minmax(150px, 1fr) 72px 145px; }
  .track-number, .track-title, .track-duration { padding-left: 8px; padding-right: 8px; }
  .track-request { padding-right: 8px; }
  .request-button { min-width: 126px; font-size: 12px; }
}

/* v0.4.6: fixed search toolbar and track-based search results */
.content-panel {
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
}
#music-page.route-page.active {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
}
#music-page .toolbar {
  position: relative;
  z-index: 2;
  padding: 18px;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  background: linear-gradient(135deg, #0b0b0c 0%, #080809 100%);
}
.catalogue-scroll {
  min-width: 0;
  min-height: 0;
  padding: 0 18px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  background: linear-gradient(135deg, #0b0b0c 0%, #080809 100%);
}
#request-page.route-page.active {
  height: 100%;
  display: block;
  padding: 18px;
  overflow-y: auto;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  background: linear-gradient(135deg, #0b0b0c 0%, #080809 100%);
}
.search-results-table {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #28282c;
  border-radius: 5px;
  background: linear-gradient(145deg, #0d0d0f, #080809);
}
.search-results-table[hidden] { display: none; }
.search-result-row {
  min-height: 50px;
  display: grid;
  grid-template-columns: minmax(150px, .75fr) minmax(260px, 1.5fr) 110px 190px;
  align-items: center;
  border-bottom: 1px solid #222226;
}
.search-result-row:last-child { border-bottom: 0; }
.search-result-header {
  min-height: 43px;
  color: #c4c4ca;
  font-size: 12px;
  text-transform: uppercase;
}
.search-result-artist,
.search-result-title,
.search-result-duration {
  min-width: 0;
  overflow: hidden;
  padding: 0 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-artist { color: #c8c8cf; }
.search-result-title { color: #ededf0; }
.search-result-duration {
  color: #d5d5da;
  font-variant-numeric: tabular-nums;
}
.search-result-request {
  display: flex;
  justify-content: flex-end;
  padding: 7px 18px 7px 10px;
}
.search-result-row.current-track .search-result-artist,
.search-result-row.current-track .search-result-title,
.search-result-row.current-track .search-result-duration { color: var(--red); }
@media (max-width: 900px) {
  .search-result-row { grid-template-columns: minmax(120px, .7fr) minmax(180px, 1.3fr) 78px 145px; }
  .search-result-artist, .search-result-title, .search-result-duration { padding-left: 8px; padding-right: 8px; }
  .search-result-request { padding-right: 8px; }
}
@media (max-width: 720px) {
  #music-page .toolbar { padding: 10px; }
  .catalogue-scroll { padding: 0 10px 10px; }
}
#music-page .toolbar.search-mode { grid-template-columns: minmax(280px, 1fr); }


/* v0.4.7: track search is a mutually exclusive catalogue state. */
.album-grid[hidden],
.search-results-table[hidden] {
  display: none !important;
}
#catalogue-browser.track-search-mode .album-grid {
  display: none !important;
}
#catalogue-browser:not(.track-search-mode) .search-results-table {
  display: none !important;
}


/* v0.4.8: author display rules must never override the HTML hidden state. */
.sort-control[hidden],
.album-grid[hidden],
.search-results-table[hidden],
.catalogue-meta[hidden] {
  display: none !important;
}

#catalogue-browser.track-search-mode #album-grid {
  display: none !important;
}

#catalogue-browser.track-search-mode #track-search-results:not([hidden]) {
  display: block !important;
}

/* v0.4.10: search/album exclusivity is enforced in JavaScript; hidden remains authoritative. */


/* v0.4.18: lock the application chrome to the viewport.
   Filter focus/scrolling is confined to the sidebar and can no longer move
   the header/footer frame or shrink the main grid. */
.sidebar,
.catalogue-scroll {
  min-height: 0;
  max-height: 100%;
}


/* v0.4.19: authoritative viewport frame.
   Header/footer are positioned independently of the scrollable panes, so
   focusing a checkbox near the bottom of an expanded filter list cannot
   reflow or scroll the application chrome. */
html,
body {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  overflow: hidden !important;
  overscroll-behavior: none;
  overflow-anchor: none;
}

.site-shell {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  display: block !important;
  overflow: hidden !important;
  overflow-anchor: none;
}

.site-header {
  position: absolute !important;
  z-index: 100;
  top: 0;
  right: 0;
  left: 0;
  height: var(--header-height);
  min-height: 0;
  overflow: hidden;
}

.page-frame {
  position: absolute !important;
  z-index: 1;
  top: var(--header-height);
  right: 0;
  bottom: var(--footer-height);
  left: 0;
  width: auto;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: hidden !important;
}

.live-bar {
  position: absolute !important;
  z-index: 100;
  right: 0;
  bottom: 0;
  left: 0;
  height: var(--footer-height);
  min-height: 0 !important;
  max-height: var(--footer-height);
  overflow: hidden !important;
}

.sidebar,
.content-panel,
.catalogue-scroll {
  min-height: 0 !important;
  max-height: 100% !important;
  overflow-anchor: none;
}

.sidebar {
  height: 100%;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

.content-panel {
  height: 100%;
  overflow: hidden !important;
}

/* Keep keyboard/mouse focus inside a filter from making the browser try to
   scroll the root document. Only the sidebar is allowed to scroll. */
.filter-option,
.filter-option input,
.show-more-button {
  scroll-margin: 0;
}


/* v0.4.20: only the sidebar and catalogue viewport may scroll.
   `overflow: hidden` still creates a scroll container, so browser focus
   handling could silently change the scrollTop of the page frame/content
   panel when a checkbox near the bottom of the sidebar was activated. That
   shifted the application contents inside otherwise fixed chrome. `clip`
   prevents those containers from being scrollable at all. */
html,
body,
.site-shell,
.page-frame,
.content-panel {
  overflow: clip !important;
}

/* These are the two intentional independent scrolling panes. */
.sidebar {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

.catalogue-scroll {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

/* v0.4.21: Year/Platform disclosure arrows mirror Show more / Show less. */
.disclosure-button {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.disclosure-button[hidden] { display: none; }
.disclosure-button .disclosure-arrow { pointer-events: none; }
.disclosure-button:hover,
.disclosure-button:active {
  background: transparent;
  color: #fff;
  transform: none;
}
.disclosure-button:focus-visible {
  outline: 1px solid #77777e;
  outline-offset: 1px;
  border-radius: 2px;
}


/* v0.4.25: persistent Recently Added ticker. */
.recently-added-bar {
  min-width: 0;
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #d91425;
  border-radius: 4px;
  background: #b50f1e;
  color: #fff;
}
.recently-added-viewport {
  width: 100%;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.recently-added-track {
  width: max-content;
  display: flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
  animation: recently-added-scroll var(--recently-added-duration, 24s) linear infinite;
}
.recently-added-cycle {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding-right: var(--recently-added-gap, 100vw);
}
.recently-added-group {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  line-height: 1.35;
  padding-block: 1px 2px;
}
.recently-added-group strong {
  font-weight: 800;
}
@keyframes recently-added-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .recently-added-track { animation: none; }
}

/* v0.4.25: responsive presentation layer. Desktop (>1024px) remains governed
   by the existing rules above. These controls are hidden by default. */
.mobile-menu-button,
.mobile-catalogue-controls,
.drawer-close,
.drawer-backdrop { display: none; }

/* Narrow tablet: keep the desktop structure, only tighten spacing and allow
   the catalogue to choose fewer columns naturally. */
@media (min-width: 801px) and (max-width: 1024px) {
  :root { --header-height: 88px; --footer-height: 118px; }
  .site-header { grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr); gap: 12px; padding: 0 18px; }
  .brand { width: 190px; }
  .top-navigation { grid-column: auto; grid-row: auto; height: 100%; gap: 10px; }
  .nav-item { min-width: 130px; font-size: 13px; }
  .page-frame { grid-template-columns: 250px minmax(0, 1fr); padding: 0 8px 10px; }
  .toolbar { grid-template-columns: minmax(220px, 1fr) 210px; gap: 12px; }
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
  .album-card { width: 100%; }
  .status-block { padding: 12px 2.5vw; gap: 12px; }
  .status-block strong { font-size: 15px; }
  .artwork-placeholder { width: 58px; height: 58px; }
}

/* Phone / portrait tablet. The existing sidebar becomes the drawer. */
@media (max-width: 800px) {
  :root { --header-height: 64px; --footer-height: 154px; }
  .site-header {
    position: relative;
    z-index: 50;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px 42px;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
  }
  .brand { width: min(168px, 55vw); justify-self: start; }
  .twitch-login { grid-column: 3; grid-row: 1; min-width: 38px; width: 38px; min-height: 38px; height: 38px; padding: 0; border-radius: 4px; }
  .twitch-login-label { display: none; }
  .twitch-mark { width: 20px; height: 20px; }
  .mobile-menu-button {
    grid-column: 2; grid-row: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px; width: 38px; height: 38px;
    padding: 0; border: 0; background: transparent; cursor: pointer;
  }
  .mobile-menu-button span { width: 22px; height: 2px; background: #fff; }
  .top-navigation {
    position: absolute; top: calc(100% - 2px); right: 54px; z-index: 70;
    display: none; width: min(260px, calc(100vw - 24px)); height: auto;
    padding: 6px; gap: 2px; border: 1px solid #2b2b30; border-radius: 5px;
    background: #0c0c0e; box-shadow: 0 12px 30px rgba(0,0,0,.5);
  }
  .top-navigation.mobile-open { display: grid; }
  .nav-item { min-width: 0; min-height: 44px; justify-content: flex-start; padding: 0 12px; border: 0; border-radius: 3px; font-size: 12px; }
  .nav-item.active { background: rgba(243,19,37,.12); border: 0; }
  .nav-icon { font-size: 18px; }

  .page-frame { display: block; height: 100%; padding: 0 6px 6px; }
  .content-panel { width: 100%; height: 100%; }
  .sidebar {
    position: fixed; z-index: 100; top: 0; bottom: 0; left: 0;
    width: min(430px, 92vw); max-height: none; margin: 0; padding: 22px 18px;
    border-radius: 0 6px 6px 0; transform: translateX(-105%);
    transition: transform .2s ease; box-shadow: 18px 0 50px rgba(0,0,0,.55);
  }
  .sidebar.drawer-open { transform: translateX(0); }
  .drawer-close { position: absolute; top: 10px; right: 12px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; background: transparent; color: #ddd; font-size: 27px; cursor: pointer; }
  .drawer-backdrop { position: fixed; z-index: 90; inset: 0; display: block; background: rgba(0,0,0,.64); }
  .drawer-backdrop[hidden] { display: none; }

  #music-page.route-page.active { gap: 6px; grid-template-rows: auto auto auto minmax(0,1fr); }
  .recently-added-bar { border-radius: 3px; }
  .mobile-catalogue-controls { display: flex; align-items: center; padding: 0 8px; }
  .filters-trigger { min-height: 38px; padding: 0 16px; border: 1px solid #d91425; border-radius: 4px; background: #b50f1e; color: #fff; font-weight: 700; text-transform: uppercase; cursor: pointer; }
  #music-page .toolbar { padding: 8px; gap: 8px; grid-template-columns: minmax(0, 1fr) 150px; }
  #music-page .toolbar.search-mode { grid-template-columns: minmax(0, 1fr); }
  .search-field, .search-field input, .sort-control { height: 44px; }
  .sort-control select { padding-left: 10px; font-size: 12px; }
  .catalogue-scroll { padding: 0 8px 8px; }
  .catalogue-meta { min-height: 30px; }

  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
  .album-card { width: 100%; max-width: none; }
  .album-card-body { min-height: 92px; padding: 9px 8px; }
  .album-card h3 { min-height: 0; margin-bottom: 6px; font-size: 13px; -webkit-line-clamp: 2; }
  .album-card p { margin-bottom: 4px; font-size: 11px; }
  .album-expansion { grid-column: 1 / -1; width: 100%; }
  .album-expansion-header { min-height: 88px; gap: 10px; padding: 10px; }
  .expanded-artwork { width: 66px; height: 66px; }
  .expanded-album-details h2 { font-size: 18px; }
  .expanded-album-details p { font-size: 12px; }
  .collapse-album-button { height: 38px; }
  .collapse-label { padding: 0 10px; font-size: 13px; }

  .track-row { grid-template-columns: 38px minmax(0, 1fr) 54px 94px; min-height: 44px; }
  .track-number, .track-title, .track-duration { min-width: 0; padding: 0 5px; font-size: 11px; }
  .track-title { text-overflow: ellipsis; white-space: nowrap; }
  .track-request { padding: 5px; }
  .request-button { min-width: 84px; min-height: 30px; padding: 0 6px; gap: 4px; font-size: 10px; }
  .request-twitch-mark { width: 14px; height: 14px; }
  .track-table-header { font-size: 10px; }

  .search-result-row { grid-template-columns: minmax(72px,.7fr) minmax(0,1.4fr) 52px 94px; min-height: 44px; }
  .search-result-artist, .search-result-title, .search-result-duration { min-width: 0; padding: 0 5px; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .search-result-request { padding: 5px; }

  .live-bar { grid-template-columns: 1fr 1.35fr; grid-template-rows: 1fr 1fr; overflow: hidden; }
  .status-block { min-width: 0; padding: 8px 12px; gap: 9px; border-right: 1px solid #353539; border-bottom: 1px solid #353539; }
  .status-block:nth-child(2) { border-right: 0; }
  .status-block:nth-child(3), .status-block:nth-child(4) { border-bottom: 0; }
  .status-block:nth-child(4) { border-right: 0; }
  .status-block strong { font-size: 12px; }
  .status-block span { font-size: 10px; }
  .eyebrow { font-size: 9px !important; }
  .status-dot { width: 8px; height: 8px; }
  .artwork-placeholder { width: 38px; height: 38px; font-size: 17px; }
  .twitch-footer-mark { width: 27px; height: 27px; }
}

@media (max-width: 430px) {
  :root { --footer-height: 164px; }
  .site-header { padding-inline: 9px; }
  .brand { width: min(154px, 52vw); }
  #music-page .toolbar { grid-template-columns: minmax(0,1fr) 136px; padding: 6px; }
  .filters-trigger { min-height: 36px; padding-inline: 12px; font-size: 11px; }
  .album-grid { gap: 7px; }
  .album-card h3 { font-size: 12px; }
  .album-card p { font-size: 10px; }
  .track-row { grid-template-columns: 32px minmax(0,1fr) 48px 82px; }
  .request-button { min-width: 72px; font-size: 9px; }
  .request-twitch-mark { display: none; }
  .search-result-row { grid-template-columns: minmax(58px,.65fr) minmax(0,1.35fr) 46px 82px; }
  .status-block { padding: 7px 9px; }
}

@media (max-width: 340px) {
  .album-grid { grid-template-columns: 1fr; }
}


/* v0.4.26: responsive chrome corrections.
   These rules intentionally apply only at/below the tablet breakpoint so the
   established desktop presentation remains untouched. */

/* At the first responsive breakpoint the footer is already two rows (from the
   existing <=1050px rule). Give those rows enough reserved viewport height so
   text/artwork never spill below the screen or get clipped before the stack. */
@media (min-width: 801px) and (max-width: 1024px) {
  :root { --footer-height: 184px; }
  .live-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
  .status-block {
    min-height: 0;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .artwork-placeholder { width: 50px; height: 50px; }
}

@media (max-width: 800px) {
  :root { --footer-height: 172px; }

  /* Header/menu: keep the menu outside the header's layout box so it cannot be
     visually swallowed by the main panel. */
  .top-navigation {
    position: fixed !important;
    top: calc(var(--header-height) - 1px) !important;
    right: 10px !important;
    left: auto !important;
    z-index: 140 !important;
    display: none !important;
    width: min(270px, calc(100vw - 20px)) !important;
    height: auto !important;
    padding: 6px !important;
    border: 1px solid #2b2b30 !important;
    border-radius: 5px !important;
    background: #0c0c0e !important;
    box-shadow: 0 12px 30px rgba(0,0,0,.58) !important;
  }
  .top-navigation.mobile-open { display: grid !important; }
  .mobile-menu-button { position: relative; z-index: 145; }

  /* Drawer occupies the usable app area between fixed header and footer. This
     leaves both pieces of chrome available while filters are open. */
  .sidebar {
    top: var(--header-height) !important;
    bottom: var(--footer-height) !important;
    height: auto !important;
    max-height: none !important;
    padding-top: 56px !important;
  }
  .drawer-backdrop {
    top: var(--header-height) !important;
    bottom: var(--footer-height) !important;
  }
  .drawer-close {
    position: absolute !important;
    top: 10px !important;
    right: 12px !important;
    z-index: 2 !important;
    display: grid !important;
    place-items: center !important;
    width: 38px !important;
    height: 38px !important;
    border: 1px solid var(--red) !important;
    border-radius: 4px !important;
    background: #151517 !important;
    color: #fff !important;
    font-size: 25px !important;
    line-height: 1 !important;
    cursor: pointer !important;
  }

  /* Mobile control ordering: reuse the existing Filters trigger, sort select,
     and search input. display:contents lets those same controls participate in
     one grid without cloning state or handlers. */
  #music-page.route-page.active {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(136px, 42%) !important;
    grid-template-rows: auto auto auto minmax(0, 1fr) !important;
    column-gap: 8px !important;
    row-gap: 6px !important;
  }
  .recently-added-bar {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
  }
  .mobile-catalogue-controls,
  #music-page .toolbar {
    display: contents !important;
  }
  .filters-trigger {
    grid-column: 1 !important;
    grid-row: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 40px !important;
    min-height: 40px !important;
    justify-self: stretch !important;
  }
  #music-page .sort-control {
    grid-column: 2 !important;
    grid-row: 2 !important;
    width: 100% !important;
    height: 40px !important;
    min-width: 0 !important;
    padding-inline: 10px !important;
  }
  #music-page .sort-control[hidden] { display: none !important; }
  #music-page .search-field {
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
    width: 100% !important;
    height: 44px !important;
    margin: 0 !important;
  }
  #music-page .search-field input { height: 44px !important; }
  #music-page .catalogue-scroll {
    grid-column: 1 / -1 !important;
    grid-row: 4 !important;
  }

  /* Footer is always a contained 2x2 grid in mobile mode. The reserved footer
     height above is part of the site-shell grid, so no row can fall off-screen. */
  .live-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .status-block {
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 7px 10px !important;
    overflow: hidden !important;
  }
  .status-block strong,
  .status-block span { max-width: 100%; }
  .artwork-placeholder {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    font-size: 16px !important;
  }
}

@media (max-width: 430px) {
  :root { --footer-height: 180px; }
  #music-page.route-page.active {
    grid-template-columns: minmax(0, 1fr) minmax(128px, 44%) !important;
  }
  .filters-trigger,
  #music-page .sort-control { height: 38px !important; min-height: 38px !important; }
  #music-page .sort-control select { font-size: 11px !important; }
}

@media (max-width: 360px) {
  :root { --footer-height: 184px; }
  #music-page.route-page.active {
    grid-template-columns: minmax(0, 1fr) minmax(120px, 45%) !important;
    column-gap: 6px !important;
  }
  .filters-trigger { padding-inline: 8px !important; }
  #music-page .sort-control { padding-inline: 8px !important; }
  .status-block { padding-inline: 7px !important; }
}

/* v0.4.28: remove the unintended intermediate tablet footer state.
   801–1024px keeps the compact desktop-style single-row live bar while the
   catalogue itself naturally reduces columns. The stacked 2x2 live bar now
   begins only with the <=800px mobile/portrait-tablet layout. */
@media (min-width: 801px) and (max-width: 1024px) {
  :root { --footer-height: 118px; }

  .live-bar {
    grid-template-columns: 1.05fr 1.55fr 1fr 1.25fr !important;
    grid-template-rows: 1fr !important;
  }

  .status-block {
    min-width: 0;
    min-height: 0;
    padding: 12px 2.5vw;
    gap: 12px;
    border-bottom: 0;
  }

  .status-block:nth-child(1),
  .status-block:nth-child(2),
  .status-block:nth-child(3) {
    border-right: 1px solid #353539;
  }

  .status-block:nth-child(4) { border-right: 0; }
  .artwork-placeholder { width: 50px; height: 50px; }
}


/* v0.4.28: breakpoint consolidation.
   There are deliberately no presentation-mode changes between 1025px and
   desktop. Tablet is 801–1024px; mobile/portrait tablet begins at 800px. */
@media (min-width: 1025px) {
  .mobile-menu-button,
  .mobile-catalogue-controls,
  .drawer-close,
  .drawer-backdrop { display: none !important; }
}

/* v0.5.0: local website request bridge feedback. */
.request-notice {
  position: fixed;
  z-index: 10000;
  right: 20px;
  bottom: calc(var(--footer-height, 88px) + 18px);
  max-width: min(430px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid #5a2028;
  border-radius: 5px;
  background: #171719;
  color: #fff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.request-notice.accepted { border-color: #2c7a43; }
.request-notice.visible { opacity: 1; transform: translateY(0); }
@media (max-width: 800px) {
  .request-notice { right: 12px; bottom: 16px; }
}
