:root {
  color-scheme: dark;
  --ink: #f5f0e6;
  --muted: #a9a49b;
  --panel: #1a1b1d;
  --panel-2: #222326;
  --line: #343538;
  --red: #ee5b47;
  --red-deep: #b6382c;
  --cyan: #6dd9cd;
  --yellow: #f2ca61;
  --bg: #101112;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 75% 5%, rgba(238, 91, 71, .12), transparent 31rem),
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px), var(--bg);
  background-size: auto, 36px 36px, 36px 36px;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.icon {
  width: 1.05em; height: 1.05em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -.15em; pointer-events: none;
}

.topbar {
  height: 76px; display: flex; align-items: center; gap: 32px; padding: 0 clamp(18px, 4vw, 64px);
  border-bottom: 1px solid var(--line); background: rgba(16,17,18,.9); backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: max-content; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
  color: #161616; background: var(--red); font-weight: 900; transform: rotate(-5deg);
  box-shadow: 4px 4px 0 #69251f;
}
.brand strong { display: block; font-size: 18px; letter-spacing: .08em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; letter-spacing: .22em; }
.main-nav { display: flex; gap: 7px; flex: 1; }
.main-nav a { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); padding: 10px 13px; border-radius: 8px; font-size: 14px; }
.main-nav a:hover, .main-nav a.active { color: var(--ink); background: var(--panel-2); }
.avatar {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
  background: var(--yellow); color: #181818; font-weight: 900;
}
.user-menu-wrap { position: relative; }
.user-menu-trigger {
  min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 4px 7px 4px 4px;
  border: 1px solid transparent; border-radius: 999px; color: var(--muted); background: transparent; cursor: pointer;
}
.user-menu-trigger:hover, .user-menu-trigger.active, .user-menu-trigger[aria-expanded="true"] { color: var(--ink); border-color: var(--line); background: var(--panel-2); }
.user-menu-trigger > .icon { width: 15px; height: 15px; }
.user-menu-popover {
  position: absolute; z-index: 60; top: calc(100% + 9px); right: 0; width: 220px; padding: 8px;
  border: 1px solid #45464a; border-radius: 12px; background: rgba(29,30,33,.98); box-shadow: 0 18px 50px rgba(0,0,0,.52);
}
.user-menu-heading { display: grid; gap: 3px; padding: 9px 10px 11px; }
.user-menu-heading small { color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.user-menu-popover a, .user-menu-popover > button {
  width: 100%; min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; text-align: left;
}
.user-menu-popover a:hover, .user-menu-popover a.active, .user-menu-popover > button:hover { color: var(--ink); background: #343538; }
.user-menu-divider { height: 1px; margin: 6px 4px; background: var(--line); }

#app { min-height: calc(100vh - 126px); padding: clamp(30px, 5vw, 72px) clamp(18px, 6vw, 92px); }
.site-footer {
  min-height: 50px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(18px, 4vw, 64px); border-top: 1px solid var(--line); color: #777; font-size: 11px; letter-spacing: .12em;
}
.status-dot { display: flex; align-items: center; gap: 7px; }
.status-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }

.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(310px, .8fr); gap: clamp(36px, 8vw, 120px); align-items: center; max-width: 1200px; margin: 2vh auto 7vh; }
.eyebrow { color: var(--red); font: 700 11px/1 monospace; letter-spacing: .18em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
.hero h1 { margin: 18px 0 24px; max-width: 720px; font-size: clamp(46px, 8vw, 96px); line-height: .94; letter-spacing: -.055em; }
.hero h1 em { color: var(--red); font-style: normal; }
.hero-copy { color: var(--muted); max-width: 610px; line-height: 1.8; font-size: 16px; }
.hero-art {
  aspect-ratio: 1; display: grid; place-items: center; position: relative; min-height: 330px;
  background: radial-gradient(circle, rgba(238,91,71,.12), transparent 62%);
}
.vinyl {
  width: min(78%, 340px); aspect-ratio: 1; border-radius: 50%; position: relative;
  background: repeating-radial-gradient(circle, #222 0 3px, #171719 4px 8px);
  box-shadow: 0 30px 70px #000, inset 0 0 0 2px #333;
  animation: spin 14s linear infinite;
}
.vinyl::before { content: ""; position: absolute; inset: 33%; border-radius: 50%; background: var(--red); border: 5px solid #252525; }
.vinyl::after { content: ""; position: absolute; inset: 48%; border-radius: 50%; background: #111; }
.mic-line { position: absolute; width: 52%; height: 9px; border-radius: 9px; background: var(--ink); transform: rotate(-45deg) translate(20%, 40%); box-shadow: 0 4px 0 #777; }
.mic-line::before { content: ""; position: absolute; width: 55px; height: 74px; border-radius: 45%; background: var(--yellow); right: -18px; top: -32px; border: 6px solid #242424; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-card, .panel {
  background: rgba(26,27,29,.93); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 55px rgba(0,0,0,.25);
}
.auth-card { padding: 24px; margin-top: 32px; max-width: 580px; }
.auth-card h3 { margin-bottom: 8px; }
.auth-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.button {
  border: 1px solid transparent; border-radius: 9px; background: var(--red); color: #171717;
  padding: 11px 17px; font-weight: 800; cursor: pointer; transition: .16s ease; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.button.secondary { color: var(--ink); border-color: var(--line); background: var(--panel-2); }
.button.ghost { color: var(--muted); border-color: var(--line); background: transparent; }
.button.danger { color: #fff; background: var(--red-deep); }
.button.small { padding: 7px 10px; font-size: 12px; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.is-pending:disabled { opacity: .82; }
.button.is-pending .icon { animation: action-spin .8s linear infinite; }
.button.is-success, .button.is-success:disabled {
  color: #10201e; border-color: rgba(109,217,205,.5); background: var(--cyan); opacity: 1;
}
@keyframes action-spin { to { transform: rotate(360deg); } }

.page-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 32px; }
.page-head h1 { margin: 6px 0 0; font-size: clamp(32px, 5vw, 57px); letter-spacing: -.04em; }
.compact-page-head { align-items: center; margin-bottom: 18px; }
.subtle { color: var(--muted); font-size: 13px; line-height: 1.6; }
.dashboard-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 20px; }
.panel { padding: 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-head h2, .panel-head h3 { margin: 0; }
.panel h2 { font-size: 19px; }
.room-list { display: grid; gap: 10px; }
.room-row, .queue-row, .library-row {
  display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--panel-2);
  border: 1px solid transparent; border-radius: 10px;
}
.room-row:hover { border-color: #4a4b4f; }
.room-number { font: 800 12px/1 monospace; color: var(--red); }
.grow { flex: 1; min-width: 0; }
.text-left { text-align: left; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll-title { min-width: 0; max-width: 100%; display: block; overflow: hidden; white-space: nowrap; }
.scroll-title > span { width: max-content; min-width: 100%; display: inline-block; will-change: transform; }
.meta { color: var(--muted); font-size: 12px; margin-top: 5px; }

.form-stack { display: grid; gap: 12px; }
.field { display: grid; gap: 7px; }
.field label { color: var(--muted); font-size: 12px; }
.check-field {
  display: grid; grid-template-columns: 20px 1fr; align-items: start; gap: 10px;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #151618; cursor: pointer;
}
.check-field input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--red); }
.check-field strong, .check-field small { display: block; }
.check-field strong { font-size: 13px; }
.check-field small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
input, select, textarea {
  width: 100%; min-width: 0; border-radius: 9px; border: 1px solid var(--line); background: #111214;
  color: var(--ink); padding: 12px 13px; outline: none;
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(238,91,71,.12); }
.inline-form { display: flex; gap: 9px; }
.inline-form input { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 22px 0; }
.inline-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.empty { padding: 34px 15px; text-align: center; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 6px; }

.room-titlebar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.room-back {
  width: 38px; height: 38px; flex: 0 0 auto; display: none; place-items: center;
  border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--panel-2);
}
.room-back:hover { color: var(--ink); }
.room-back .icon { width: 19px; height: 19px; }
.join-code { font: 800 14px/1 monospace; letter-spacing: .15em; border: 1px dashed #5a5b60; border-radius: 8px; padding: 9px 11px; cursor: pointer; }
.online { color: var(--cyan); }
.offline { color: var(--muted); }
.has-player-bar { padding-top: 24px !important; padding-bottom: 150px !important; }
.room-page-head {
  max-width: 1120px; margin: 0 auto 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.room-page-head h1 { margin: 0; font-size: clamp(24px, 3vw, 34px); line-height: 1.08; letter-spacing: -.035em; }
.room-head-status { display: flex; flex-direction: column; align-items: end; gap: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.room-view-tabs {
  max-width: 1120px; margin: 0 auto 18px; display: flex; gap: 4px; padding: 4px;
  border: 1px solid var(--line); border-radius: 12px; background: rgba(17,18,20,.92);
}
.room-view-tabs button {
  flex: 1; min-height: 36px; padding: 7px 9px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; font-size: 13px; font-weight: 800;
}
.room-view-tabs button .icon { width: 16px; height: 16px; }
.room-view-tabs button:hover { color: var(--ink); }
.room-view-tabs button.active { color: #181818; background: var(--red); }
.room-view-tabs button span { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 4px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 10px; }
.room-tab-content { width: 100%; min-width: 0; max-width: 1120px; margin: 0 auto; }
.room-tab-panel { width: 100%; min-width: 0; min-height: 320px; }
.source-tabs { max-width: 720px; }
.request-form { max-width: 680px; }
.search-form { width: 100%; min-width: 0; max-width: 720px; margin-bottom: 22px; }
.search-form:last-child { margin-bottom: 0; }
.search-options { min-width: 0; margin: 0; padding: 0; border: 0; }
.search-options-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; }
.search-option-title { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.choice-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.choice-chips label { cursor: pointer; }
.choice-chips input {
  position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0;
  clip-path: inset(50%); pointer-events: none;
}
.choice-chips span {
  min-height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #191a1c; font-size: 12px;
}
.choice-chips input:checked + span { color: #171717; border-color: var(--red); background: var(--red); font-weight: 800; }
.choice-chips input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
.choice-chips .icon { width: 15px; height: 15px; }
.quick-pick-list { width: 100%; min-width: 0; display: grid; gap: 8px; }
.quick-pick-row { width: 100%; min-width: 0; max-width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; overflow: hidden; border-radius: 10px; background: var(--panel-2); }
.quick-pick-row > .grow { min-width: 0; overflow: hidden; }
.quick-pick-row .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-pick-row .button, .quick-pick-row > .tag { flex: 0 0 auto; }
.quick-pick-icon { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: var(--yellow); background: #303135; }
.quick-pick-icon .icon { width: 19px; height: 19px; }
.quick-pick-icon img, .favorite-icon img, .history-cover img { width: 100%; height: 100%; object-fit: cover; }
.feed-more { width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--panel-2); cursor: pointer; }
.feed-more .icon { width: 17px; height: 17px; margin-right: 6px; vertical-align: middle; }
.feed-more:disabled .icon { animation: action-spin .8s linear infinite; }
.feed-end { padding: 14px; color: var(--muted); text-align: center; font-size: 12px; }
.favorite-grid > .feed-more, .favorite-grid > .feed-end, .timeline > .feed-more, .timeline > .feed-end { grid-column: 1 / -1; }
.management-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.management-card { min-width: 0; }
.screen-client-recommendation, .screen-web-fallback {
  padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #151618;
}
.screen-client-recommendation { border-color: rgba(97,214,202,.5); background: rgba(97,214,202,.07); }
.screen-option-heading { display: flex; align-items: center; gap: 8px; }
.screen-option-heading strong { font-size: 13px; }
.screen-option-heading .recommended { color: #14211f; background: var(--cyan); }
.screen-client-recommendation p, .screen-web-fallback p { margin: 8px 0 11px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.screen-pair-actions { margin: 12px 0; }
.screen-web-fallback { margin-top: 12px; }
.members-card { grid-column: 1 / -1; }
.queue-list { width: 100%; min-width: 0; display: grid; gap: 8px; }
.queue-panel-head { align-items: end; flex-wrap: wrap; }
.queue-global-actions { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 7px; }
.queue-global-actions .button .icon { width: 14px; height: 14px; }
.queue-row { min-width: 0; max-width: 100%; }
.queue-row > .grow { overflow: hidden; }
.queue-row .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-row.playing { border-color: var(--red); }
.queue-cover {
  width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden;
  border-radius: 7px; color: #171717; background: var(--red); font-size: 18px; font-weight: 900;
}
.queue-cover img, .player-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.queue-cover .icon { width: 22px; height: 22px; }
.provider-pill, .tag {
  border-radius: 999px; padding: 4px 8px; background: #35363a; color: #d7d3ca; font: 700 10px/1 monospace; text-transform: uppercase;
}
.provider-pill.bilibili { color: #ff9bb3; }
.provider-pill.youtube { color: #ff7b70; }
.queue-actions { display: flex; gap: 4px; }
.queue-actions button { border: 0; background: #303135; color: var(--muted); border-radius: 6px; width: 29px; height: 29px; cursor: pointer; }
.queue-actions button:hover { color: var(--ink); background: #414247; }
.queue-actions button .icon { width: 15px; height: 15px; }
.tabs { display: flex; gap: 5px; padding: 4px; background: #111214; border-radius: 9px; margin-bottom: 16px; }
.tabs button { flex: 1; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; color: var(--muted); background: transparent; padding: 9px; border-radius: 6px; cursor: pointer; }
.tabs button.active { color: var(--ink); background: #303135; }
.search-result {
  margin-top: 12px; padding: 13px; display: grid; grid-template-columns: 144px minmax(0, 1fr); align-items: start; gap: 15px;
  border: 1px solid var(--line); border-radius: 9px;
}
.search-result.search-fallback { display: block; }
.search-result-cover {
  width: 144px; aspect-ratio: 16 / 9; display: grid; place-items: center; overflow: hidden;
  border-radius: 7px; color: var(--muted); background: #292a2e;
}
.search-result-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.search-result-cover .icon { width: 26px; height: 26px; }
.search-result-body { min-width: 0; height: 100%; display: flex; flex-direction: column; }
.search-result-body > strong { display: block; line-height: 1.4; }
.search-result-actions { margin-top: auto; padding-top: 15px; display: flex; justify-content: flex-end; }
.search-result-actions .button { display: inline-flex; align-items: center; gap: 6px; }
.search-result-actions .icon { width: 15px; height: 15px; }
.search-result a { color: var(--cyan); }
.search-result a, .mapping a { display: inline-flex; align-items: center; gap: 5px; }
.search-groups { min-width: 0; display: grid; gap: 12px; }
.search-group { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: rgba(19,20,22,.68); }
.search-group > summary {
  min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px;
  cursor: pointer; list-style: none; background: #191a1c;
}
.search-group > summary::-webkit-details-marker { display: none; }
.search-group > summary > span { display: inline-flex; align-items: center; gap: 8px; }
.search-group > summary .icon { width: 17px; height: 17px; }
.search-group-count { color: var(--muted); font-size: 11px; }
.search-group-count .icon { transition: transform .18s ease; }
.search-group[open] .search-group-count .icon { transform: rotate(180deg); }
.search-group-body { min-width: 0; padding: 12px; }
.search-group-error { padding: 22px; border-radius: 9px; background: #211b1b; }
.search-group-error p { margin: 7px 0 11px; color: var(--muted); }
.search-group-error a { color: var(--cyan); }
.search-card-grid { min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 11px; }
.search-card {
  position: relative; min-width: 0; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid #45464a; border-radius: 10px;
  color: #fff; background: #292a2d;
}
.search-card-image, .search-card-placeholder { position: absolute; inset: 0; width: 100%; height: 100%; }
.search-card-image { display: block; object-fit: cover; transition: transform .25s ease; }
.search-card-placeholder { display: grid; place-items: center; color: #777; background: linear-gradient(135deg, #303136, #17181a); }
.search-card-placeholder .icon { width: 38px; height: 38px; }
.search-card-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.16) 4%, rgba(0,0,0,.68) 57%, rgba(0,0,0,.94) 100%); }
.search-card-open { position: absolute; z-index: 2; inset: 0; width: 100%; border: 0; cursor: pointer; background: transparent; }
.search-card-open:focus-visible { outline: 3px solid var(--cyan); outline-offset: -4px; }
.search-card:hover .search-card-image { transform: scale(1.035); }
.search-card-content { position: absolute; z-index: 3; inset: 0; display: flex; flex-direction: column; justify-content: end; padding: 13px; pointer-events: none; }
.search-card-source { align-self: start; margin-bottom: auto; padding: 4px 7px; border-radius: 999px; background: rgba(0,0,0,.68); font: 700 9px/1 monospace; text-transform: uppercase; }
.search-card-content > strong { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 15px; line-height: 1.3; text-shadow: 0 2px 8px #000; }
.search-card-meta { margin-top: 5px; overflow: hidden; color: #c9c4bb; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.search-card-actions { display: flex; justify-content: end; margin-top: 9px; pointer-events: auto; }
.search-card-actions .button { position: relative; z-index: 4; display: inline-flex; align-items: center; gap: 5px; }
.search-card-actions .icon { width: 14px; height: 14px; }
.catalog-dialog {
  width: min(760px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: min(84vh, 820px); padding: 0; overflow: auto hidden;
  color: var(--ink); border: 1px solid #4b4c50; border-radius: 15px; background: #1b1c1f; box-shadow: 0 28px 90px rgba(0,0,0,.7);
}
.catalog-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
#catalog-detail-content { min-width: 0; padding: 20px; }
.catalog-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-close { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: #303135; cursor: pointer; }
.dialog-close .icon { width: 17px; height: 17px; }
.catalog-hero { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: center; gap: 18px; margin: 17px 0 22px; }
.catalog-hero > div { min-width: 0; }
.catalog-cover { width: 220px; aspect-ratio: 16 / 9; display: grid; place-items: center; overflow: hidden; border-radius: 10px; color: var(--muted); background: #292a2e; }
.catalog-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.catalog-cover .icon { width: 34px; height: 34px; }
.catalog-hero h2 { margin: 0; overflow-wrap: anywhere; font-size: clamp(21px, 3vw, 30px); line-height: 1.22; }
.catalog-hero p { margin: 8px 0 0; color: var(--muted); }
.catalog-variants-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.catalog-variants-head h3 { margin: 0; }
.catalog-variants { display: grid; gap: 8px; }
.catalog-variant { min-width: 0; display: flex; align-items: center; gap: 11px; padding: 11px; border-radius: 9px; background: #242529; }
.catalog-variant strong { overflow-wrap: anywhere; }
.catalog-variant-icon { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; color: #171717; background: var(--red); }
.catalog-variant-icon .icon { width: 17px; height: 17px; }
.catalog-variant .button { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.catalog-variant .button .icon { width: 14px; height: 14px; }
.catalog-loading { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 13px; color: var(--muted); }
.catalog-loading .icon { width: 30px; height: 30px; animation: spin 1s linear infinite; }
.pair-code-value { margin: 10px 0; letter-spacing: .22em; }
.members { display: flex; flex-wrap: wrap; gap: 8px; }
.member { padding: 6px 9px 6px 6px; display: flex; align-items: center; gap: 6px; border-radius: 999px; background: #27282b; font-size: 12px; }
.member .avatar { width: 24px; height: 24px; font-size: 10px; }

#player-bar-root:not(:empty) {
  position: fixed; z-index: 30; top: 0; left: 0; width: 100vw; height: 100vh;
  width: 100dvw; height: 100dvh; pointer-events: none;
}
.room-playerbar {
  position: absolute; left: max(18px, env(safe-area-inset-left)); right: max(18px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom)); min-height: 92px; display: grid;
  grid-template-columns: 64px minmax(180px, 1fr) auto auto; align-items: center; gap: 16px; padding: 13px 18px;
  border: 1px solid #4a4140; border-radius: 16px; background: rgba(25,26,28,.96); backdrop-filter: blur(18px);
  box-shadow: 0 18px 60px rgba(0,0,0,.58); pointer-events: auto;
}
.player-cover {
  width: 64px; height: 64px; display: grid; place-items: center; overflow: hidden; border-radius: 10px;
  color: #181818; background: linear-gradient(135deg, var(--red), var(--yellow)); font-size: 25px; font-weight: 900;
}
.player-cover .icon { width: 28px; height: 28px; }
.player-track { display: grid; gap: 5px; }
.player-track > strong { font-size: 15px; }
.player-meta { color: var(--muted); font-size: 11px; }
.player-meta .provider-pill { vertical-align: middle; }
.player-progress { width: 100%; height: 3px; overflow: hidden; border: 0; border-radius: 99px; appearance: none; background: #3a3b3e; }
.player-progress::-webkit-progress-bar { border-radius: inherit; background: #3a3b3e; }
.player-progress::-webkit-progress-value { border-radius: inherit; background: var(--red); transition: width .25s linear; }
.player-progress::-moz-progress-bar { border-radius: inherit; background: var(--red); transition: width .25s linear; }
.player-state { min-width: 120px; display: grid; justify-items: end; gap: 6px; }
.player-state small { color: var(--muted); font: 10px/1 monospace; }
.playback-state { color: var(--cyan); font-size: 12px; font-weight: 800; }
.playback-state.offline, .playback-state.error { color: var(--red); }
.playback-state.paused, .playback-state.buffering, .playback-state.loading { color: var(--yellow); }
.player-controls { display: flex; align-items: center; justify-content: end; gap: 8px; }
.player-icon {
  width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: #303135;
  cursor: pointer; font-weight: 900;
}
.player-icon:hover { filter: brightness(1.18); }
.player-icon.primary { width: 48px; height: 48px; color: #181818; border-color: transparent; background: var(--red); }
.player-icon .icon { width: 20px; height: 20px; }
.player-icon.primary .icon { width: 22px; height: 22px; }
.player-icon.is-favorite { color: var(--yellow); border-color: rgba(242,202,97,.42); }
.player-icon.is-favorite .icon { fill: currentColor; }
.player-icon:disabled { cursor: default; opacity: 1; }

.library-page-head { margin-bottom: 18px; }
.library-browser { max-width: 920px; margin: 0 auto; }
.library-toolbar { display: flex; align-items: start; gap: 10px; margin-bottom: 16px; }
.library-search { min-width: 0; flex: 1; display: grid; gap: 10px; }
.library-search-row { min-width: 0; display: flex; gap: 8px; }
.library-search-row input { min-width: 0; flex: 1; }
.library-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) auto; gap: 8px; }
.library-filters label { min-width: 0; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.library-filters select { min-width: 0; flex: 1; padding-block: 8px; }
.library-filters .button { padding-block: 8px; white-space: nowrap; }
.library-list { display: grid; gap: 7px; }
.library-row { min-width: 0; padding: 9px 11px; cursor: pointer; }
.library-row:hover { border-color: #4a4b4f; }
.library-cover {
  width: 72px; aspect-ratio: 16 / 9; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden;
  border-radius: 7px; color: #171717; background: linear-gradient(135deg, var(--red), var(--yellow));
}
.library-cover img { width: 100%; height: 100%; object-fit: cover; }
.library-cover .icon { width: 20px; height: 20px; }
.library-pager { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; }
.library-pager a, .pager-mobile {
  min-width: 35px; height: 35px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--panel-2); font-size: 12px;
}
.library-pager a.active { color: #171717; border-color: var(--red); background: var(--red); font-weight: 900; }
.library-pager a.disabled { opacity: .35; cursor: default; }
.pager-pages { display: flex; gap: 6px; }
.pager-mobile { display: none; }
.song-editor-head { max-width: 920px; margin: 0 auto 14px; display: flex; align-items: center; gap: 13px; }
.song-editor-head .room-back.visible { display: grid; }
.song-editor-head h1 { margin: 4px 0 0; overflow-wrap: anywhere; font-size: clamp(24px, 4vw, 38px); line-height: 1.08; }
.song-editor-tabs { max-width: 920px; margin: 0 auto 14px; }
.song-editor-tabs a {
  flex: 1; min-width: 0; padding: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 800;
}
.song-editor-tabs a.active { color: #171717; background: var(--red); }
.song-editor-tabs a span { padding: 2px 6px; border-radius: 99px; background: rgba(255,255,255,.18); font-size: 10px; }
.song-editor-content { width: 100%; max-width: 920px; min-width: 0; margin: 0 auto; }
.song-info-form { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.field label small { margin-left: 5px; color: #777; }
.has-library-actionbar { padding-bottom: 116px !important; }
.library-editor-actions {
  position: fixed; z-index: 28; left: max(18px, env(safe-area-inset-left)); right: max(18px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom)); max-width: 920px; min-height: 72px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px;
  border: 1px solid #4a4140; border-radius: 15px; background: rgba(25,26,28,.97); box-shadow: 0 18px 60px rgba(0,0,0,.58);
}
.source-manager { min-width: 0; display: grid; gap: 18px; }
.source-list { min-width: 0; display: grid; gap: 9px; }
.source-editor-card {
  min-width: 0; display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; grid-template-areas:
    "cover main actions" "cover url actions"; align-items: center; gap: 8px 13px; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
}
.source-editor-cover { grid-area: cover; width: 112px; aspect-ratio: 16 / 9; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: var(--panel-2); }
.source-editor-cover img { width: 100%; height: 100%; object-fit: cover; }
.source-editor-main { grid-area: main; min-width: 0; display: grid; gap: 9px; }
.source-editor-title { min-width: 0; }
.source-editor-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-editor-title span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.mapping-label-form { min-width: 0; display: flex; gap: 7px; }
.mapping-label-form input { min-width: 80px; padding-block: 8px; }
.mapping-label-form .button { min-width: 112px; flex: 0 0 auto; white-space: nowrap; }
.source-editor-actions { grid-area: actions; display: grid; gap: 5px; }
.source-editor-actions button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 7px; color: var(--muted); background: #303135; cursor: pointer; }
.source-editor-actions button.danger { color: #fff; background: var(--red-deep); }
.source-editor-actions button:disabled { opacity: .3; cursor: default; }
.source-editor-actions .icon { width: 16px; height: 16px; }
.source-editor-url { grid-area: url; width: max-content; max-width: 100%; color: var(--cyan); font-size: 11px; }
.source-editor-url .icon { width: 13px; height: 13px; vertical-align: middle; }
.source-import { display: grid; gap: 12px; }
.source-import h3 { margin: 0; }
.favorite-grid { width: 100%; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 10px; }
.favorite-card { min-width: 0; display: flex; align-items: center; gap: 13px; padding: 14px; border-radius: 10px; background: var(--panel-2); }
.favorite-card > .grow { min-width: 0; overflow: hidden; }
.favorite-card strong, .favorite-card .meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.favorite-icon { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: #181818; background: var(--yellow); }
.favorite-icon { overflow: hidden; }
.favorite-icon .icon { width: 20px; height: 20px; }
.mapping { border-left: 3px solid var(--red); padding: 12px 14px; background: #212225; margin-bottom: 9px; border-radius: 0 9px 9px 0; }
.mapping-head { display: flex; justify-content: space-between; gap: 12px; }
.timeline { display: grid; gap: 0; }
.timeline-row { min-width: 0; display: grid; grid-template-columns: 130px 16px 64px minmax(0, 1fr); align-items: start; gap: 12px; min-height: 76px; }
.timeline-row > :last-child { min-width: 0; overflow: hidden; }
.timeline-row strong, .timeline-row .meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-dot { position: relative; }
.timeline-dot::before { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--red); top: 5px; left: 4px; }
.timeline-dot::after { content: ""; position: absolute; width: 1px; background: var(--line); top: 16px; bottom: 0; left: 8px; }
.history-cover { width: 64px; aspect-ratio: 16 / 9; display: grid; place-items: center; overflow: hidden; border-radius: 7px; color: var(--yellow); background: var(--panel-2); }
.history-cover .icon { width: 19px; height: 19px; }

#toast-region { position: fixed; z-index: 1000; top: 92px; right: 18px; display: grid; gap: 8px; }
.toast { max-width: 360px; padding: 12px 15px; border-radius: 9px; background: #292a2d; border: 1px solid #45464a; box-shadow: 0 12px 35px #000; font-size: 13px; animation: toast-in .2s ease; }
.toast.error { border-color: var(--red); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.screen-root { position: fixed; inset: 0; z-index: 100; overflow: hidden; background: #050505; color: #fff; }
.player-slot, .player-slot iframe { width: 100%; height: 100%; border: 0; display: block; }
.transition-layer {
  position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 20px;
  background: radial-gradient(circle, #272022 0, #080808 68%); transition: opacity .4s ease; z-index: 2;
}
.transition-layer.ready { opacity: 0; pointer-events: none; }
.record-loader { width: 92px; height: 92px; border-radius: 50%; background: repeating-radial-gradient(circle, #333 0 3px, #101010 4px 8px); border: 3px solid #444; animation: spin 1.8s linear infinite; }
.record-loader::after { content: ""; display: block; margin: 32px; width: 22px; height: 22px; border-radius: 50%; background: var(--red); }
.transition-layer p { color: #bbb; letter-spacing: .18em; font-size: 12px; }
.screen-overlay { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.screen-toolbar {
  pointer-events: auto; position: absolute; top: 18px; left: 18px; right: 18px; display: flex; align-items: center; justify-content: space-between;
  opacity: .12; transition: opacity .2s;
}
.screen-toolbar:hover { opacity: 1; }
.screen-pair {
  pointer-events: auto; width: min(460px, calc(100% - 32px)); position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  padding: 28px; border-radius: 16px; background: rgba(25,26,28,.96); border: 1px solid #444; text-align: center;
}
.screen-pair input { text-align: center; font: 800 28px/1 monospace; letter-spacing: .25em; margin: 15px 0; }
.screen-error { background: rgba(96,22,18,.93); }

@media (max-width: 820px) {
  .room-mode .topbar { display: none; }
  .topbar { height: 65px; padding: 0 16px; gap: 12px; }
  .brand-text, .user-menu-trigger .user-name { display: none; }
  .brand { gap: 0; }
  .main-nav { overflow-x: auto; }
  .main-nav a { padding: 9px 10px; white-space: nowrap; }
  #app { padding: 28px 15px 55px; }
  #app.has-player-bar { padding-top: 16px !important; padding-bottom: 112px !important; }
  .hero, .dashboard-grid, .library-grid, .management-grid { grid-template-columns: 1fr; }
  .hero-art { order: -1; min-height: 220px; }
  .hero-art .vinyl { width: 210px; }
  .hero h1 { font-size: 53px; }
  .page-head { align-items: start; flex-direction: column; }
  .compact-page-head { align-items: center; flex-direction: row; }
  .library-toolbar { align-items: stretch; flex-direction: column; }
  .library-search { width: 100%; }
  .library-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-filters label { align-items: stretch; flex-direction: column; gap: 4px; }
  .library-filters .button { grid-column: 1 / -1; }
  .library-toolbar > .button { width: 100%; }
  .library-browser { padding: 14px; }
  .library-row { gap: 10px; padding: 9px 8px; }
  .library-cover { width: 64px; }
  .pager-pages { display: none; }
  .pager-mobile { display: inline-flex; }
  .library-pager { justify-content: space-between; }
  .pager-wide { flex: 1; }
  .song-editor-head { align-items: center; }
  .song-editor-head h1 { font-size: 24px; }
  .song-info-form { padding: 16px; }
  .has-library-actionbar { padding-bottom: 96px !important; }
  .library-editor-actions {
    left: 0; right: 0; bottom: 0; min-height: 72px; padding: 9px 13px max(9px, env(safe-area-inset-bottom));
    border-radius: 14px 14px 0 0; border-width: 1px 0 0;
  }
  .library-editor-actions .button { flex: 1; padding-inline: 10px; }
  .source-editor-card {
    grid-template-columns: 82px minmax(0, 1fr) auto; grid-template-areas:
      "cover main actions" "url url url"; gap: 9px; padding: 10px 9px;
  }
  .source-editor-cover { width: 82px; align-self: start; }
  .mapping-label-form { grid-column: 1 / -1; flex-wrap: wrap; }
  .mapping-label-form .button { flex: 1; }
  .source-editor-url { margin-top: 2px; }
  .source-import { padding: 15px; }
  .source-import .inline-form { align-items: stretch; flex-direction: column; }
  .room-page-head { align-items: center; margin-bottom: 10px; }
  .room-page-head h1 { font-size: 23px; }
  .room-back { display: grid; }
  .room-titlebar { gap: 8px; }
  .join-code { font-size: 11px; padding: 7px 8px; }
  .room-head-status { gap: 3px; }
  .room-view-tabs { position: sticky; top: 70px; z-index: 8; margin-bottom: 12px; }
  .room-mode .room-view-tabs { top: 0; }
  .room-tab-panel { min-height: 260px; padding: 16px; }
  .members-card { grid-column: auto; }
  .queue-row { align-items: center; gap: 9px; padding: 11px 9px; }
  .queue-panel-head { align-items: start; }
  .queue-global-actions { width: 100%; margin-left: 0; justify-content: start; }
  .queue-cover { width: 40px; height: 40px; }
  .source-tabs button { gap: 4px; padding-inline: 5px; font-size: 12px; }
  .source-tabs button .icon { width: 15px; height: 15px; }
  .quick-pick-row { gap: 9px; padding: 10px 9px; }
  .quick-pick-icon { display: none; }
  .search-result { grid-template-columns: 112px minmax(0, 1fr); gap: 11px; padding: 10px; }
  .search-result-cover { width: 112px; }
  .search-result-actions { padding-top: 13px; }
  .search-card-grid { grid-template-columns: minmax(0, 1fr); }
  .catalog-dialog {
    inset: 14dvh auto auto 0; width: 100dvw; max-width: 100dvw; height: 86dvh; max-height: 86dvh; margin: 0;
    border-radius: 16px 16px 0 0;
  }
  #catalog-detail-content { padding: 16px; }
  .catalog-hero { grid-template-columns: 1fr; gap: 12px; }
  .catalog-cover { width: 100%; }
  .catalog-variant { align-items: center; padding: 10px 9px; }
  .inline-form { flex-wrap: wrap; }
  .inline-form .button { flex: 1; }
  .timeline-row { grid-template-columns: 72px 12px 54px minmax(0, 1fr); gap: 7px; }
  .history-cover { width: 54px; }
  .room-playerbar {
    left: 0; right: 0; bottom: 0; min-height: 88px; grid-template-columns: 48px minmax(0, 1fr) auto;
    grid-template-rows: auto auto; gap: 4px 10px; padding: 7px 13px max(7px, env(safe-area-inset-bottom));
    border-radius: 14px 14px 0 0; border-width: 1px 0 0;
  }
  .player-cover { width: 48px; height: 48px; grid-row: 1 / 3; font-size: 20px; }
  .player-track { grid-column: 2; grid-row: 1; align-self: end; }
  .player-track > strong { font-size: 13px; }
  .player-meta { display: none; }
  .player-state { min-width: 0; grid-column: 2; grid-row: 2; justify-items: start; align-self: start; display: flex; gap: 8px; }
  .player-state small { font-size: 9px; }
  .player-controls { grid-column: 3; grid-row: 1 / 3; gap: 5px; }
  .player-icon { width: 36px; height: 36px; }
  .player-icon.primary { width: 42px; height: 42px; }
  #toast-region { top: 76px; right: auto; left: 10px; width: calc(100dvw - 20px); justify-items: end; }
  .toast { max-width: min(360px, 100%); }
}
