:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #7aa2ff;
  --border: #2a2f3a;
  --ok: #3dd68c;
  --danger: #f07178;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
/* Legacy header (non hub-top pages only — never fight compact hub chrome) */
header:not(.hub-top) {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 2;
}
header:not(.hub-top) .bar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
header:not(.hub-top) h1 { margin: 0; font-size: 1.15rem; font-weight: 650; }
header:not(.hub-top) p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.85rem; }
header:not(.hub-top) nav a,
.bar nav a {
  color: var(--accent); text-decoration: none; font-weight: 600; margin-left: 0.85rem; font-size: 0.9rem;
}
header:not(.hub-top) nav a:hover,
.bar nav a:hover { text-decoration: underline; }
header:not(.hub-top) nav a.active,
.bar nav a.active { color: var(--text); }
main { padding: 1rem 1.25rem 3rem; max-width: 1100px; margin: 0 auto; }
main.wide { max-width: 1280px; }
.row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem; align-items: center; }
input[type=search], input[type=text], textarea {
  flex: 1;
  min-width: 160px;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #12151b;
  color: var(--text);
  font: inherit;
}

/* Hide native number spinners (Chrome/Safari/Edge + Firefox) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

textarea { min-height: 2.4rem; resize: vertical; width: 100%; }
button, .btn, a.btn {
  padding: 0.65rem 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #243052;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}
button.primary, a.btn.primary, .primary { background: var(--accent); color: #0b1020; border-color: transparent; }
button.small, .small { padding: 0.35rem 0.6rem; font-size: 0.82rem; }
button:hover, .btn:hover { filter: brightness(1.08); }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  margin-top: 0.75rem;
}
.titles, .list { display: grid; gap: 0.4rem; }
.title-item, .list-item {
  display: flex; justify-content: space-between; gap: 0.75rem; align-items: center;
  padding: 0.55rem 0.7rem; border-radius: 8px; border: 1px solid transparent;
  background: #12151b; cursor: pointer; text-align: left; width: 100%;
  color: inherit; font: inherit; text-decoration: none;
}
.title-item:hover, .title-item.active, .list-item:hover { border-color: var(--accent); }
.title-item .meta, .list-item .meta { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.crumb { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.5rem; }
.crumb a { color: var(--accent); text-decoration: none; }
.season-h { margin: 1rem 0 0.4rem; font-size: 0.95rem; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; text-align: left; }
code { background: #0b0d12; padding: 0.1rem 0.35rem; border-radius: 4px; }
.toast {
  position: fixed; bottom: 1rem; right: 1rem; background: var(--ok); color: #062016;
  padding: 0.6rem 0.9rem; border-radius: 8px; font-weight: 700; display: none; z-index: 5;
}
.toast.err { background: var(--danger); color: #1a0608; }
.muted { color: var(--muted); }
.muted a { color: var(--accent); }
.ts-in { width: 7.8rem; min-width: 7rem; flex: 0; font-variant-numeric: tabular-nums; font-size: 0.85rem; padding: 0.4rem 0.5rem; }
.cue-text { min-width: 200px; }
.ts-label { display: block; }
.ts-caption { display: none; }
.cue-scroll { max-height: 70vh; overflow: auto; -webkit-overflow-scrolling: touch; }
.sticky-actions {
  position: sticky; bottom: 0; background: rgba(26,29,36,0.95); border-top: 1px solid var(--border);
  padding: 0.65rem 0.75rem; margin: 0.75rem -0.75rem -0.75rem; display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center;
  z-index: 3;
}
@media (max-width: 800px) {
  /* Other pages may still use hide-sm; file-page times no longer use it. */
  .hide-sm { display: none !important; }

  main { padding: 0.75rem 0.75rem 4.5rem; }
  .cue-scroll { max-height: none; overflow: visible; }
  .cue-table { font-size: 1rem; }
  .cue-table thead { display: none; }
  .cue-table tbody { display: block; width: 100%; }
  .cue-table tr.cue-row {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    grid-template-areas:
      "num start end"
      "text text text"
      "actions actions actions";
    gap: 0.45rem 0.5rem;
    align-items: center;
    width: 100%;
    margin: 0 0 0.7rem;
    padding: 0.65rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #12151b;
  }
  .cue-table tr.cue-row td {
    display: block;
    width: auto;
    padding: 0;
    border-bottom: none;
    vertical-align: middle;
  }
  .cue-table tr.cue-empty { display: block; padding: 0.75rem; }
  .cue-num { grid-area: num; }
  .cue-start { grid-area: start; }
  .cue-end { grid-area: end; }
  .cue-body { grid-area: text; }
  .cue-actions {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
  }
  .ts-caption {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
  }
  .ts-in {
    width: 100%;
    min-width: 0;
    max-width: none;
    font-size: 16px; /* avoid iOS input zoom */
    padding: 0.55rem 0.6rem;
  }
  .cue-text {
    min-width: 0;
    width: 100%;
    font-size: 16px;
    min-height: 3.2rem;
  }
  .sticky-actions {
    position: sticky;
    bottom: 0;
    padding: 0.7rem 0.75rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
    gap: 0.5rem;
  }
  .sticky-actions button {
    flex: 1 1 auto;
    min-height: 2.6rem;
  }
}

.shift-row {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  padding: 0.55rem 0.75rem; margin: 0.5rem -0.75rem 0;
  border-top: 1px solid var(--border);
  background: #141820;
}
.shift-label { color: var(--muted); font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
#shiftOffset {
  flex: 0 1 9rem; min-width: 7rem; max-width: 12rem;
  font-size: 16px; /* avoid iOS zoom */
  font-variant-numeric: tabular-nums;
}
.shift-presets { display: flex; flex-wrap: wrap; gap: 0.3rem; }
#shiftPreview { font-size: 0.8rem; flex: 1 1 12rem; }
@media (max-width: 800px) {
  .shift-row { padding: 0.65rem 0.75rem; gap: 0.45rem; }
  #shiftOffset { flex: 1 1 100%; max-width: none; width: 100%; font-size: 16px; }
  #btnShift { flex: 1 1 auto; min-height: 2.6rem; }
}


/* Commands docs page */
.docs h2 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 650;
}
.docs h3 {
  margin: 0.85rem 0 0.4rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 650;
}
.docs section { scroll-margin-top: 4.5rem; }
.docs .cmd-list {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.35rem;
}
.docs .cmd-list li { line-height: 1.4; }
.docs .toc { margin: 0.5rem 0 0; font-size: 0.9rem; }
.docs .toc a { color: var(--accent); text-decoration: none; font-weight: 600; }
.docs .toc a:hover { text-decoration: underline; }
.docs .footnote { margin-top: 1.25rem; font-size: 0.85rem; }

/* Multi-select + command builder */
.cue-check-col { width: 2.75rem; text-align: center; }
.cue-check {
  width: 1.25rem; height: 1.25rem; margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.cue-check-hit {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; margin: -0.5rem;
  cursor: pointer;
}
.cue-num-btn {
  background: none; border: none; color: inherit; font: inherit;
  padding: 0.35rem 0.45rem; min-width: 44px; min-height: 44px;
  cursor: pointer; border-radius: 8px;
}
.cue-num-btn:hover { background: #243052; }
.cue-num-btn code { pointer-events: none; }
tr.cue-row.selected, tr.cue-row.selected td {
  background: rgba(122, 162, 255, 0.12);
}
tr.cue-row.selected {
  outline: 1px solid rgba(122, 162, 255, 0.35);
  outline-offset: -1px;
}

.sticky-stack {
  position: sticky; bottom: 0; z-index: 3;
  margin: 0.75rem -0.75rem -0.75rem;
  background: rgba(26, 29, 36, 0.97);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(6px);
}
.sticky-stack .sticky-actions {
  position: static; margin: 0; border-top: 1px solid var(--border);
  background: transparent; backdrop-filter: none;
}
.cmd-builder {
  display: none;
  padding: 0.65rem 0.75rem;
  gap: 0.55rem;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  background: #141820;
}
.cmd-builder.visible { display: flex; }
.cmd-builder-top {
  display: flex; flex-wrap: wrap; gap: 0.5rem 0.85rem; align-items: center;
}
.cmd-sel-count { font-weight: 700; font-size: 0.9rem; }
.cmd-sel-ids {
  font-size: 0.8rem; font-variant-numeric: tabular-nums;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cmd-builder-modes { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.cmd-builder-modes button.mode.active {
  background: var(--accent); color: #0b1020; border-color: transparent;
}
.cmd-builder-modes button.mode:disabled {
  opacity: 0.4; cursor: not-allowed; filter: none;
}
.cmd-preview {
  margin: 0; padding: 0.5rem 0.65rem; border-radius: 8px;
  background: #0b0d12; border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem; white-space: pre-wrap; word-break: break-word;
  max-height: 5.5rem; overflow: auto; color: var(--text);
}
.cmd-builder-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.cmd-builder-hint { font-size: 0.78rem; }

@media (max-width: 800px) {
  .cue-table tr.cue-row {
    grid-template-columns: auto auto 1fr 1fr;
    grid-template-areas:
      "check num start end"
      "text text text text"
      "actions actions actions actions";
  }
  .cue-check-cell { grid-area: check; }
  .cue-num { grid-area: num; }
  .cue-check-hit, .cue-num-btn { min-width: 44px; min-height: 44px; }
  .sticky-stack {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .cmd-builder-actions button {
    flex: 1 1 auto; min-height: 2.6rem;
  }
  .cmd-sel-ids { white-space: normal; }
}

/* Search page sticky builder (no save bar) */
.panel > .cmd-builder.search-cmd {
  margin: 0.5rem -0.75rem -0.75rem;
  border-radius: 0 0 12px 12px;
  position: sticky; bottom: 0; z-index: 3;
  border-top: 1px solid var(--border);
  border-bottom: none;
}


/* Music library page */
.music-filters label {
  display: flex; flex-direction: column; gap: 0.25rem;
  font-size: 0.8rem; flex: 1 1 12rem; min-width: 10rem;
}
.music-filters select {
  padding: 0.55rem 0.7rem; border-radius: 10px;
  border: 1px solid var(--border); background: #12151b; color: var(--text);
  font: inherit; max-width: 100%;
}
.music-scroll { max-height: 70vh; overflow: auto; -webkit-overflow-scrolling: touch; margin-top: 0.5rem; }
.music-table { font-size: 0.9rem; }
.music-table a { color: var(--accent); text-decoration: none; font-weight: 600; }
.music-table a:hover { text-decoration: underline; }
.music-table .path-cell {
  font-size: 0.75rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 800px) {
  .music-scroll { max-height: none; overflow: visible; }
  .music-table thead { display: none; }
  .music-table tbody { display: block; }
  .music-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.2rem 0.5rem;
    padding: 0.65rem 0.35rem;
    border-bottom: 1px solid var(--border);
  }
  .music-table td { border: none; padding: 0; }
  .music-table td:nth-child(2) { grid-column: 1; font-weight: 650; }
  .music-table td:nth-child(3) { grid-column: 1 / -1; font-size: 1.02rem; }
  .music-table td:nth-child(4) { grid-column: 1; color: var(--muted); font-size: 0.85rem; }
  .music-table td:nth-child(5) { grid-column: 2; grid-row: 1; color: var(--muted); text-align: right; }
  .music-table td:nth-child(6) { grid-column: 2; color: var(--muted); text-align: right; font-size: 0.8rem; }
}

/* Manual copy fallback (non-secure HTTP / blocked clipboard) */
.copy-modal {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.copy-modal-card {
  background: var(--panel, #1a1d24); color: var(--text, #e8eaed);
  border: 1px solid var(--border, #333); border-radius: 12px;
  padding: 1rem 1.1rem; width: min(520px, 100%);
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}
.copy-modal-card h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.copy-modal-card textarea {
  width: 100%; min-height: 5.5rem; margin: 0.5rem 0 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem; padding: 0.55rem 0.65rem; border-radius: 8px;
  border: 1px solid var(--border, #333); background: #0f1115; color: inherit;
  resize: vertical;
}
.copy-modal-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }


/* Missing-subs visibility (indexed media without ok sidecar yet) */
.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  vertical-align: middle;
}
.badge-warn {
  background: #5c3b12;
  color: #ffcc80;
  border: 1px solid #a66b2b;
}
.title-item.missing-subs,
.list-item.missing-subs {
  opacity: 0.92;
  border-style: dashed;
}


/* ===== Full-file compact view / edit mode ===== */
body.file-page.view-mode .edit-only { display: none !important; }
body.file-page.view-mode .tools-drawer { display: none; }
body.file-page .file-head h1 {
  font-size: 1.05rem;
  line-height: 1.25;
  max-width: 52rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.file-page .file-meta {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
  max-width: 56rem;
}
body.file-page .file-toolbar { margin-bottom: 0.5rem; gap: 0.5rem; }
body.file-page .status-line { font-size: 0.82rem; margin-bottom: 0.35rem; }

/* Compact cue rows (default view) */
body.file-page.view-mode .cue-table {
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
body.file-page.view-mode .cue-table th,
body.file-page.view-mode .cue-table td {
  padding: 0.18rem 0.4rem;
  vertical-align: middle;
}
body.file-page.view-mode .cue-text-view {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.3;
  max-height: 2.6em; /* ~2 lines */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
body.file-page.view-mode tr.cue-row:hover .cue-text-view,
body.file-page.view-mode tr.cue-row.selected .cue-text-view {
  max-height: none;
  -webkit-line-clamp: unset;
  display: block;
}
body.file-page.view-mode .cue-ts {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 0.78rem;
}
body.file-page.view-mode .cue-actions {
  white-space: nowrap;
}
body.file-page.view-mode .cue-actions .small {
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
body.file-page.view-mode .cue-check-hit,
body.file-page.view-mode .cue-num-btn {
  min-width: 32px;
  min-height: 32px;
  margin: 0;
  padding: 0.15rem 0.25rem;
}
body.file-page.view-mode .cue-scroll {
  max-height: calc(100vh - 11rem);
}

/* Edit mode keeps prior denser but editable layout */
body.file-page.edit-mode .cue-scroll {
  max-height: calc(100vh - 16rem);
}
body.file-page.edit-mode .cue-text {
  min-height: 2.2rem;
  font-size: 0.9rem;
  padding: 0.4rem 0.55rem;
}

.tools-drawer {
  margin: 0.5rem -0.75rem 0;
  border-top: 1px solid var(--border);
  background: #141820;
  padding: 0.35rem 0.75rem 0.55rem;
}
.tools-drawer > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
  padding: 0.35rem 0;
  list-style: none;
}
.tools-drawer > summary::-webkit-details-marker { display: none; }
.tools-drawer > summary::before {
  content: "▸ ";
  color: var(--accent);
}
.tools-drawer[open] > summary::before { content: "▾ "; }
.tools-drawer .shift-row {
  margin: 0.25rem -0.75rem 0;
  border-top: none;
  background: transparent;
}
.tools-extra {
  display: flex; flex-wrap: wrap; gap: 0.45rem;
  padding: 0.25rem 0 0.15rem;
}

@media (max-width: 800px) {
  body.file-page .file-head h1 {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  body.file-page.view-mode .cue-table tr.cue-row {
    grid-template-columns: auto auto 1fr 1fr;
    grid-template-areas:
      "check num start end"
      "text text text text"
      "actions actions actions actions";
    gap: 0.25rem 0.4rem;
    margin: 0 0 0.4rem;
    padding: 0.45rem 0.55rem;
  }
  body.file-page.view-mode .cue-text-view {
    font-size: 0.9rem;
    font-family: ui-sans-serif, system-ui, sans-serif;
    max-height: none;
    -webkit-line-clamp: unset;
  }
  body.file-page.view-mode .cue-scroll {
    max-height: none;
  }
}

/* --- media detail overlay + purple user ratings (embystats #5B2C86) --- */
:root {
  --rating-purple: #5B2C86;
  --rating-purple-glow: rgba(91, 44, 134, 0.55);
}
.stars {
  display: inline-flex;
  align-items: center;
  gap: 0.08rem;
  color: var(--rating-purple);
  letter-spacing: 0.02em;
  font-size: 1.15rem;
  line-height: 1;
  text-shadow: 0 0 10px var(--rating-purple-glow);
}
.stars .star { opacity: 0.28; }
.stars .star.on { opacity: 1; }
.stars .star.half {
  opacity: 1;
  background: linear-gradient(90deg, var(--rating-purple) 50%, rgba(91,44,134,0.25) 50%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stars .avg-num {
  margin-left: 0.4rem;
  font-size: 0.85rem;
  color: #e9d5ff;
  opacity: 0.95;
}
.rating-users {
  margin-top: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
}
.rating-users .ru {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: #cbd5e1;
}
.detail-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: none;
  align-items: stretch;
  justify-content: center;
}
.detail-overlay.open { display: flex; }
.detail-bg {
  position: absolute; inset: 0;
  background: #070b14 center / cover no-repeat;
  filter: brightness(0.38) saturate(1.05);
  transform: scale(1.04);
}
.detail-veil {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(4,7,14,0.92) 0%, rgba(4,7,14,0.72) 42%, rgba(4,7,14,0.55) 100%),
    radial-gradient(ellipse at 70% 40%, rgba(91,44,134,0.22), transparent 55%);
}
.detail-panel {
  position: relative; z-index: 2;
  width: min(920px, 96vw);
  margin: auto;
  max-height: 92vh;
  overflow: auto;
  padding: 1.25rem 1.4rem 1.5rem;
  border-radius: 16px;
  border: 1px solid rgba(91, 44, 134, 0.55);
  background: rgba(10, 14, 24, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 18px 50px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04) inset;
  color: #e8eaed;
}
.detail-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  line-height: 1.2;
}
.detail-meta {
  color: #c4b5fd;
  font-size: 0.92rem;
  margin-bottom: 0.75rem;
}
.detail-overview {
  color: #dbe3f0;
  line-height: 1.45;
  font-size: 0.95rem;
  white-space: pre-wrap;
  margin: 0.6rem 0 0.9rem;
}
.detail-actions {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-top: 1rem;
}
.detail-close {
  position: absolute; top: 0.65rem; right: 0.75rem;
  background: rgba(15,23,42,0.7);
  border: 1px solid #475569;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
}
.poster-card { cursor: pointer; }
.poster-card .cap .stars { font-size: 0.85rem; margin-top: 0.2rem; }
.row.people-filters { flex-wrap: wrap; gap: 0.45rem; }
.row.people-filters input[type="search"] { min-width: 140px; flex: 1; }


/* Discord session chip (OAuth) — avatar opens account dropdown */
.hub-user-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  max-width: none;
}
.hub-user-chip-btn {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0.18rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 6px 22px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.14);
  backdrop-filter: blur(12px) saturate(1.25);
  -webkit-backdrop-filter: blur(12px) saturate(1.25);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  touch-action: manipulation;
}
.hub-user-chip-btn:hover,
.hub-user-chip-btn:focus-visible,
.hub-user-chip.is-open .hub-user-chip-btn {
  border-color: rgba(165,180,252,0.65);
  background: rgba(88,101,242,0.28);
  outline: none;
}
.hub-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover; background: #1e293b;
  border: 1px solid rgba(255,255,255,0.18);
  flex-shrink: 0;
  display: block;
}
.hub-user-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 11.5rem;
  max-width: min(240px, 78vw);
  padding: 0.55rem 0.6rem 0.6rem;
  border-radius: 12px;
  background: rgba(15,23,42,0.96);
  border: 1px solid rgba(148,163,184,0.28);
  box-shadow: 0 14px 40px rgba(0,0,0,0.45);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.hub-user-menu[hidden] { display: none !important; }
.hub-user-menu-name {
  font-weight: 700;
  font-size: 0.82rem;
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hub-user-menu-user {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-bottom: 0.35rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hub-user-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.15rem;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  text-decoration: none;
  color: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 650;
  background: rgba(51,65,85,0.7);
  border: 1px solid rgba(148,163,184,0.35);
}
.hub-user-logout:hover, .hub-user-logout:focus-visible {
  color: #fff;
  background: rgba(88,101,242,0.5);
  border-color: rgba(165,180,252,0.55);
  outline: none;
}
header .bar .hub-user-chip { margin-left: 0.35rem; }
.hub-top .hub-user-chip { margin-left: 0.5rem; }


/* === FORCE compact single-row hub chrome (beats page-inline mosaic rules) === */
header.hub-top {
  position: sticky !important;
  top: 0 !important;
  z-index: 50 !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 0.65rem 0.85rem;
  padding: 0.55rem 1.1rem 0.6rem;
  box-sizing: border-box;
  pointer-events: auto !important;
  overflow: visible !important; /* never clip title/nav glyphs */
}
body.hub header.hub-top {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
}
header.hub-top .hub-brand {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  flex: 0 0 auto !important; /* size to title; do not ellipsis Home */
  min-width: 0 !important;
  max-width: none !important;
}
header.hub-top .hub-server-link,
header.hub-top .hub-server-icon {
  flex-shrink: 0 !important; /* left icon stays put */
}
header.hub-top nav,
header.hub-top .hub-nav {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important; /* sit next to brand, not far-right */
  flex: 0 1 auto !important;
  min-width: 0 !important;
  margin-left: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
header.hub-top nav a,
header.hub-top .hub-nav a {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
}
header.hub-top .hub-user-chip {
  flex: 0 0 auto !important;
  margin-left: auto !important; /* pfp far right */
}
@media (max-width: 768px) {
  header.hub-top,
  body.hub-detail > header.hub-top {
    flex-wrap: wrap !important; /* brand+pfp row, nav under */
  }
  header.hub-top .hub-brand {
    flex: 1 1 auto !important; /* fill between icons; title may ellipsis */
    max-width: none !important;
    order: 1 !important;
  }
  header.hub-top .hub-user-chip {
    order: 2 !important;
    margin-left: auto !important; /* pin pfp FAR RIGHT */
  }
  header.hub-top nav,
  header.hub-top .hub-nav {
    flex: 1 1 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    order: 3 !important;
    justify-content: flex-start !important;
    padding-inline: 0.05rem;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    gap: 0.35rem 0.4rem !important;
  }
  header.hub-top nav a,
  header.hub-top .hub-nav a {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0.32rem 0.65rem !important;
    min-height: 2rem !important;
    display: inline-flex !important;
    align-items: center !important;
    border-radius: 999px !important;
    background: rgba(255,255,255,0.06) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    box-sizing: border-box !important;
  }
}

/* === shared hub chrome (hub-top) — compact single-row Home bar on EVERY page === */
.hub-top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.65rem 0.85rem;
  flex-wrap: nowrap; /* single compact row: icon | brand | nav… | pfp */
  padding: 0.55rem 1.1rem 0.6rem;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(6,10,20,0.94) 0%, rgba(6,10,20,0.78) 72%, rgba(6,10,20,0.55) 100%);
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  border-bottom: 1px solid rgba(167,139,250,0.12);
  pointer-events: auto;
}
body.hub .hub-top {
  position: fixed;
  left: 0; right: 0;
  background: linear-gradient(180deg, rgba(6,10,20,0.94) 0%, rgba(6,10,20,0.78) 72%, rgba(6,10,20,0) 100%);
  border-bottom: 0;
}
.hub-top a, .hub-top button, .hub-top .hub-user-chip {
  position: relative;
  z-index: 51;
}
.hub-back {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
  text-decoration: none;
  font-weight: 650;
  font-size: 0.78rem;
  white-space: nowrap;
}
.hub-back:hover { background: rgba(255,255,255,0.14); color: #fff; text-decoration: none; }
.hub-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 0 0 auto; /* brand+page title size to content; nav follows immediately */
  min-width: 0;
  max-width: none;
}
.hub-server-link {
  display: inline-flex;
  flex-shrink: 0;
  line-height: 0;
  border-radius: 999px;
  border: 1px solid rgba(167,139,250,0.45);
  box-shadow: 0 6px 22px rgba(0,0,0,0.35), 0 0 0 2px rgba(91,44,134,0.25);
  overflow: hidden;
  text-decoration: none;
}
.hub-server-icon {
  width: 40px;
  height: 40px;
  object-fit: cover;
  display: block;
  background: #17132b;
}
.hub-brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.05rem;
  min-width: 0;
  flex: 1 1 auto;
}
.hub-top h1 {
  margin: 0;
  font-size: clamp(1.05rem, 1.9vw, 1.65rem);
  font-weight: 750;
  letter-spacing: 0.01em;
  line-height: 1.12;
  color: #f1f5f9;
  text-shadow: 0 1px 10px rgba(0,0,0,0.55);
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
.hub-top h1 .hub-title-page {
  overflow: visible;
  text-overflow: clip;
}
.hub-top h1 .hub-title-accent {
  color: #c4b5fd;
  background: linear-gradient(120deg, #a78bfa 0%, #c4b5fd 45%, #ddd6fe 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 1px 8px rgba(91,44,134,0.45));
}
.hub-top h1 .hub-title-sep {
  color: #a78bfa;
  background: none;
  -webkit-text-fill-color: #a78bfa;
  margin: 0 0.28em;
  font-weight: 650;
  opacity: 0.85;
  filter: none;
}
.hub-quote, .hub-top .hub-sub {
  margin: 0;
  font-size: clamp(0.68rem, 0.95vw, 0.82rem);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #a78bfa;
  opacity: 0.92;
  text-shadow: 0 1px 6px rgba(0,0,0,0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.hub-top .hub-sub { font-style: normal; opacity: 0.8; color: #c4b5fd; }
.hub-top .hub-sub.is-empty,
.hub-top .hub-sub:empty {
  display: none;
}
.hub-top nav,
.hub-top .hub-nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  /* flow LTR after brand; do not orphan links on the far right */
  justify-content: flex-start;
  gap: 0;
  flex: 0 1 auto;
  min-width: 0;
  margin-left: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.hub-top nav::-webkit-scrollbar,
.hub-top .hub-nav::-webkit-scrollbar { display: none; }
.hub-top nav a,
.hub-top .hub-nav a {
  color: #cbd5e1 !important; /* beat any leftover accent/blue nav rules */
  text-decoration: none !important;
  margin-left: 0.7rem;
  font-size: 0.84rem;
  opacity: 0.88;
  font-weight: 600;
  white-space: nowrap;
  flex: 0 0 auto;
  overflow: visible;
  text-overflow: clip;
}
.hub-top nav a:hover,
.hub-top .hub-nav a:hover,
.hub-top nav a.active,
.hub-top .hub-nav a.active {
  color: #fff !important;
  opacity: 1;
  text-decoration: none !important;
}
.hub-top nav a.hub-nav-slsk,
.hub-top .hub-nav a.hub-nav-slsk {
  color: #fcd34d !important;
  opacity: 0.92;
}
.hub-top nav a.hub-nav-slsk:hover,
.hub-top .hub-nav a.hub-nav-slsk:hover {
  color: #fde68a !important;
}
.hub-top .hub-user-chip {
  margin-left: auto; /* pin avatar far right; brand+nav stay grouped left */
  flex: 0 0 auto;
}

/* Non-home sticky chrome */
body.browse-mosaic > .hub-top,
body.hub-detail > .hub-top,
body.dl-page > .hub-top,
body.st-page > .hub-top,
body.login > .hub-top {
  position: sticky;
}
body.dl-page .dl-wrap,
body.st-page .st-wrap {
  padding-top: 0.35rem;
}

@media (max-width: 768px) {
  .hub-top {
    padding: 0.4rem 0.65rem 0.45rem;
    gap: 0.4rem 0.5rem;
    flex-wrap: wrap; /* icon+brand+pfp row, nav scrolls underneath on narrow phones */
    align-items: center;
    overflow: visible;
  }
  .hub-back { order: 0; padding: 0.28rem 0.55rem; font-size: 0.72rem; flex: 0 0 auto; }
  .hub-brand {
    flex: 1 1 auto; /* shrink/grow between fixed icons */
    gap: 0.5rem;
    min-width: 0;
    max-width: none;
    order: 1;
  }
  .hub-server-link, .hub-server-icon { flex-shrink: 0; }
  .hub-server-icon { width: 32px; height: 32px; }
  .hub-brand-text { gap: 0.02rem; min-width: 0; }
  .hub-top h1 {
    font-size: 0.84rem;
    font-weight: 700;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .hub-quote, .hub-top .hub-sub {
    font-size: 0.62rem;
    opacity: 0.88;
  }
  .hub-top .hub-user-chip {
    order: 2;
    margin-left: auto; /* FAR RIGHT of top bar */
    flex: 0 0 auto;
  }
  .hub-top nav,
  .hub-top .hub-nav {
    display: flex;
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    flex-wrap: wrap;
    overflow-x: visible;
    overflow-y: visible;
    justify-content: flex-start;
    align-content: flex-start;
    gap: 0.35rem 0.4rem;
    min-width: 0;
    padding: 0.2rem 0.05rem 0.05rem;
    margin-left: 0;
  }
  .hub-top nav a,
  .hub-top .hub-nav a {
    margin-left: 0;
    margin-right: 0;
    padding: 0.32rem 0.65rem;
    font-size: 0.78rem;
    white-space: nowrap;
    flex: 0 0 auto;
    overflow: visible;
    text-overflow: clip;
    min-height: 2rem;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    box-sizing: border-box;
  }
  .hub-top nav a:hover,
  .hub-top .hub-nav a:hover,
  .hub-top nav a.active,
  .hub-top .hub-nav a.active {
    background: rgba(167,139,250,0.18);
    border-color: rgba(167,139,250,0.35);
  }
}

/* === hub music SSO + floating mini-player === */
.hub-music-sso-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  align-items: center;
  margin: 0.85rem auto 0.15rem;
  max-width: 980px;
  padding: 0 0.75rem;
}
a.hub-music-sso,
button.hub-music-sso {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  border: 1px solid rgba(167, 139, 250, 0.55);
  color: #f5f3ff;
  text-decoration: none;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  background:
    linear-gradient(135deg, rgba(91, 44, 134, 0.72), rgba(76, 29, 149, 0.55) 55%, rgba(30, 20, 50, 0.45));
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.35),
    0 0 22px rgba(167, 139, 250, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px) saturate(1.25);
  -webkit-backdrop-filter: blur(12px) saturate(1.25);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  appearance: none;
}
a.hub-music-sso:hover,
button.hub-music-sso:hover {
  border-color: rgba(196, 181, 253, 0.85);
  background:
    linear-gradient(135deg, rgba(109, 40, 160, 0.85), rgba(91, 33, 182, 0.65) 55%, rgba(40, 25, 70, 0.55));
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.42),
    0 0 30px rgba(167, 139, 250, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  filter: brightness(1.05);
}
a.hub-music-sso:focus-visible,
button.hub-music-sso:focus-visible {
  outline: 2px solid #c4b5fd;
  outline-offset: 3px;
}
.hub-music-sso .hub-music-sso-ico {
  font-size: 1.05rem;
  line-height: 1;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.45));
}
.hub-music-sso .hub-music-sso-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: #ddd6fe;
  opacity: 0.9;
}
body.hub-detail .hub-music-sso-row {
  justify-content: flex-start;
  margin: 0 0 0.75rem;
  padding: 0;
  max-width: none;
}
body.hub-detail a.hub-music-sso {
  font-size: 0.88rem;
  padding: 0.42rem 0.9rem;
}

a.hub-music-sso.hub-music-sso-out {
  border-color: rgba(248, 113, 113, 0.45);
  background:
    linear-gradient(135deg, rgba(127, 29, 29, 0.55), rgba(69, 10, 10, 0.40) 55%, rgba(30, 12, 20, 0.45));
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.35),
    0 0 18px rgba(248, 113, 113, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
a.hub-music-sso.hub-music-sso-out:hover {
  border-color: rgba(252, 165, 165, 0.75);
  background:
    linear-gradient(135deg, rgba(153, 27, 27, 0.72), rgba(127, 29, 29, 0.55) 55%, rgba(40, 15, 25, 0.55));
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.42),
    0 0 26px rgba(248, 113, 113, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* Floating mini-player (sticky across hub nav via sessionStorage) */
.hub-music-player {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 120;
  max-width: 720px;
  margin: 0 auto;
  border-radius: 16px;
  border: 1px solid rgba(167, 139, 250, 0.45);
  background: rgba(18, 10, 32, 0.92);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.55),
    0 0 28px rgba(91, 44, 134, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  color: #f5f3ff;
  overflow: hidden;
}
.hub-music-player[hidden] { display: none !important; }
.hub-music-player-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  min-height: 48px;
}
.hub-music-player-bar .title {
  flex: 1;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hub-music-player-bar .title span {
  display: block;
  font-size: 0.72rem;
  font-weight: 550;
  color: #c4b5fd;
  opacity: 0.9;
}
.hub-music-player-bar a,
.hub-music-player-bar button {
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(91, 44, 134, 0.45);
  color: #f5f3ff;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.hub-music-player-bar a:hover,
.hub-music-player-bar button:hover {
  border-color: rgba(196, 181, 253, 0.7);
  background: rgba(109, 40, 160, 0.65);
}
.hub-music-player-bar button.icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}
.hub-music-player-frame-wrap {
  height: min(52vh, 420px);
  border-top: 1px solid rgba(167, 139, 250, 0.28);
  background: #0b0712;
}
.hub-music-player:not(.is-expanded) .hub-music-player-frame-wrap {
  display: none;
}
.hub-music-player-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0b0712;
}
body.has-hub-music-player {
  padding-bottom: 4.5rem;
}
@media (max-width: 640px) {
  .hub-music-player {
    left: 0.4rem;
    right: 0.4rem;
    bottom: 0.4rem;
    border-radius: 14px;
  }
  .hub-music-player-bar .title { font-size: 0.82rem; }
  .hub-music-sso .hub-music-sso-sub { display: none; }
}

/* hub music dock: iframe expand removed (Authentik/ND XFO DENY) — popup only */
.hub-music-player-frame-wrap { display: none !important; }
.hub-music-player.is-expanded .hub-music-player-frame-wrap { display: none !important; }


/* mobile scroll comfort */
@media (max-width: 768px) {
  html {
    overscroll-behavior-y: none;
  }
  body.hub,
  body.hub-detail {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
  }
  body.hub main,
  body.hub-detail main,
  .hub-main,
  .browse-grid,
  .hub-mosaic-page {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  a, button, input, select, textarea {
    touch-action: pan-y;
  }
}
