/* ==========================================================================
   PaxBus+ — VANTA interface layer (Phases 1–2: shell, home + destinations)
   Ported from ui/styles.css. Every selector is namespaced with `pb-` so any
   not-yet-ported view keeps its existing markup untouched.
   Legacy token names are mapped here so the older views adopt the new palette.
   ========================================================================== */

/* ── Fonts ─────────────────────────────────────────────────────────────── */
@font-face {
  font-family: "Manrope";
  src: url("../assets/fonts/manrope.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("../assets/fonts/space-grotesk.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens ────────────────────────────────────────────────────────────── */
:root {
  /* New palette */
  --bg: #07080b;
  --bg-elevated: #0b0d12;
  --surface: #101319;
  --surface-2: #151922;
  --surface-3: #1b202a;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --chrome-line: rgba(255, 255, 255, 0.14);
  --text: #f3f5fa;
  --text-soft: #c3c8d4;
  --muted: #98a0b0;
  --faint: #6e7788;
  --violet: #6fa8ff;
  --violet-bright: #9cc4ff;
  --violet-tint: rgba(111, 168, 255, 0.12);
  --cyan: #5ce1d0;
  --cyan-tint: rgba(92, 225, 208, 0.12);
  --danger: #ff9a9a;
  /* Both logo exports carry the same 82 paths; only the wordmark ink differs,
     so the file itself is a palette token like any colour. */
  --brand-mark: url("../assets/icons/entertainment-darkmode.svg");
  --radius: clamp(10px, 0.55rem + 0.25vw, 14px);
  --radius-lg: clamp(14px, 0.8rem + 0.35vw, 20px);
  --sidebar-w: clamp(232px, 13rem + 1.5vw, 264px);
  --sidebar-collapsed-w: clamp(68px, 4.2rem + 0.3vw, 80px);
  --topbar-h: clamp(60px, 3.4rem + 0.8vw, 72px);
  --player-h: clamp(68px, 4rem + 0.5vw, 80px);
  --mobilenav-h: clamp(56px, 3.5rem + 0.45vw, 68px);
  --pad-x: clamp(16px, 3.2vw, 40px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Legacy aliases used by the still-unported views */
  --bg-2: var(--surface);
  --line-2: var(--line-strong);
  --ink: var(--text);
  --ink-2: var(--text-soft);
  --ink-3: var(--muted);
  --accent: var(--violet);
  --accent-2: var(--cyan);
  --accent-ink: #080a0f;
  --green: var(--cyan);
  --red: var(--danger);
  --accent-grad: linear-gradient(135deg, var(--violet), var(--cyan));
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --glow-acc: 0 0 24px rgba(111, 168, 255, 0.3);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --font-display: "Space Grotesk", "Sora", system-ui, sans-serif;
  --font-body: "Manrope", "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --bnav-h: var(--mobilenav-h);
  --page-px: var(--pad-x);
  --max-w: min(1480px, 100%);
}

/* paxplay-ui.css pins html/body font and background with !important through
   these variables, so they must point at the design tokens. */
:root,
:root[data-theme] {
  --font-family: "Manrope", "Segoe UI", sans-serif;
  --bg-app: var(--bg);
}

/* :root raises specificity to match the legacy light blocks in app.css and
   paxbus-brand.css, which would otherwise win over this later file. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --surface-3: #e5e9f2;
  --line: rgba(25, 34, 55, 0.1);
  --line-strong: rgba(25, 34, 55, 0.2);
  --chrome-line: rgba(25, 34, 55, 0.26);
  --text: #172033;
  --text-soft: #44506a;
  --muted: #64708a;
  --faint: #7d879b;
  --violet: #0d6efd;
  --violet-bright: #0d6efd;
  --violet-tint: rgba(13, 110, 253, 0.1);
  --cyan: #159d91;
  --cyan-tint: rgba(21, 157, 145, 0.1);
  --danger: #c34d5d;
  --brand-mark: url("../assets/icons/entertainment.svg");
  --bg-2: var(--surface);
  --line-2: var(--line-strong);
  --ink: var(--text);
  --ink-2: var(--text-soft);
  --ink-3: var(--muted);
  --accent: var(--violet);
  --accent-2: var(--cyan);
  --accent-ink: #ffffff;
  --green: var(--cyan);
  --red: var(--danger);
  --accent-grad: linear-gradient(135deg, var(--violet), var(--cyan));
  --shadow-sm: 0 2px 10px rgba(20, 25, 40, 0.08);
  --shadow-md: 0 10px 28px rgba(20, 25, 40, 0.12);
  --shadow-lg: 0 24px 60px rgba(20, 25, 40, 0.16);
  --glow-acc: 0 8px 22px rgba(13, 110, 253, 0.18);
}

/* ── Base ──────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden]:not([hidden="until-found" i]) {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 clamp(0.9rem, 0.84rem + 0.28vw, 1.05rem) / 1.6 "Manrope", "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
}

img {
  max-width: 100%;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
}
::selection {
  background: rgba(111, 168, 255, 0.35);
  color: #fff;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

:focus-visible {
  outline: 2px solid var(--violet-bright);
  outline-offset: 2px;
}

h1,
h2,
h3,
h4,
.pb-h1,
.pb-h2,
.pb-h3,
.pb-h4 {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 0;
}

.pb-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: none;
  color: currentColor;
}
.pb-icon--sm {
  width: 16px;
  height: 16px;
}
.pb-icon--lg {
  width: 22px;
  height: 22px;
}
.pb-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.pb-truncate {
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pb-clamp-2,
.pb-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.pb-clamp-3 {
  -webkit-line-clamp: 3;
}

/* ── App shell ─────────────────────────────────────────────────────────── */
.pb-app {
  display: flex;
  min-height: 100dvh;
}
.pb-shell {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  transition: margin-left 0.3s var(--ease);
}

/* Sidebar */
.pb-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 26px 16px 18px;
  background: #080a0f;
  border-right: 1px solid var(--chrome-line);
  overflow-y: auto;
  transition: width 0.3s var(--ease), padding 0.3s var(--ease);
}
/* No rail animation on first paint, before the app restores the saved state. */
html:not([data-app-ready]) .pb-sidebar,
html:not([data-app-ready]) .pb-shell {
  transition: none;
}
.pb-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 0 10px 22px;
  text-decoration: none;
}
.pb-brand__mark {
  width: auto;
  height: 32px;
  max-width: 100%;
  flex: none;
  object-fit: contain;
}
/* `content` swaps the file on the <img> itself, so the wordmark follows the
   theme with no extra markup, no repaint and no flash of the wrong ink before
   theme.js runs. */
.pb-brand__mark,
.pb-topbar__brand img {
  content: var(--brand-mark);
}
.pb-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pb-nav__label {
  margin: 18px 12px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}
.pb-nav__label:first-child {
  margin-top: 2px;
}
.pb-nav__item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  transition: background 0.16s, color 0.16s;
}
.pb-nav__item .pb-icon {
  color: var(--faint);
  transition: color 0.16s;
}
.pb-nav__item:hover {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}
.pb-nav__item:hover .pb-icon {
  color: var(--text-soft);
}
.pb-nav__item[aria-current="true"],
.pb-nav__item.active {
  background: var(--violet-tint);
  color: #e3edff;
}
.pb-nav__item[aria-current="true"] .pb-icon,
.pb-nav__item.active .pb-icon {
  color: var(--violet);
}
.pb-sidebar__foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.pb-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 4px 6px;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
}
.pb-profile__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.pb-profile__text strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pb-profile__text span {
  font-size: 10.5px;
  color: var(--muted);
}
.pb-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: rgba(111, 168, 255, 0.18);
  border: 1px solid rgba(111, 168, 255, 0.3);
  color: #cfe1ff;
  font: 700 12px "Space Grotesk", sans-serif;
}
.pb-avatar--sm {
  width: 34px;
  height: 34px;
  font-size: 11.5px;
}

/* Topbar */
.pb-topbar {
  position: sticky;
  top: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--topbar-h);
  padding: 0 var(--pad-x);
  background: rgba(7, 8, 11, 0.95);
  border-bottom: 1px solid var(--chrome-line);
  backdrop-filter: blur(14px);
}
.pb-topbar__brand {
  display: none;
  font-family: "Space Grotesk", sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
}
.pb-topbar__brand img {
  width: auto;
  height: 22px;
  max-width: 130px;
  object-fit: contain;
}
.pb-search-trigger {
  flex: 1;
  max-width: 520px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--faint);
  font-size: 13px;
  text-align: left;
  transition: border-color 0.18s, color 0.18s;
}
.pb-search-trigger:hover {
  border-color: var(--line-strong);
  color: var(--muted);
}
.pb-search-trigger .pb-icon {
  width: 17px;
  height: 17px;
}
.pb-search-trigger span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pb-search-trigger kbd {
  font: 600 10px "Manrope", sans-serif;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  color: var(--muted);
}
.pb-topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pb-icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--text-soft);
  transition: background 0.16s, color 0.16s;
}
.pb-icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.pb-topbar__menu {
  display: inline-flex;
}
.pb-theme-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: none;
  color: var(--text-soft);
}
.pb-theme-toggle img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(82%) sepia(10%) saturate(420%) hue-rotate(188deg) brightness(92%);
}
.pb-theme-toggle__moon {
  display: none;
}
[data-theme="light"] .pb-theme-toggle__sun {
  display: none;
}
[data-theme="light"] .pb-theme-toggle__moon {
  display: block;
  filter: brightness(0) saturate(100%) invert(24%) sepia(17%) saturate(1200%) hue-rotate(190deg) brightness(86%);
}
.pb-notify {
  position: relative;
}
.pb-notify__dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  border: 1.5px solid #080a0f;
}
.pb-popover {
  position: absolute;
  right: 0;
  top: 48px;
  z-index: 70;
  width: min(330px, calc(100vw - 24px));
  padding: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
  transform-origin: top right;
}
.pb-popover__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.pb-popover__head strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
}
.pb-notify__item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text);
  text-align: left;
}
.pb-notify__item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.pb-notify__ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--violet-bright);
}
.pb-notify__item strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
}
.pb-notify__item span {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--muted);
}

/* Collapsed sidebar (desktop) */
.pb-app.sidebar-collapsed .pb-sidebar {
  width: var(--sidebar-collapsed-w);
  padding-inline: 12px;
}
.pb-app.sidebar-collapsed .pb-shell {
  margin-left: var(--sidebar-collapsed-w);
}
.pb-app.sidebar-collapsed .pb-brand {
  padding-inline: 0;
}
.pb-app.sidebar-collapsed .pb-brand__mark {
  width: 48px;
  height: auto;
  max-height: 24px;
}
.pb-app.sidebar-collapsed .pb-nav__label,
.pb-app.sidebar-collapsed .pb-nav__item span,
.pb-app.sidebar-collapsed .pb-profile__text {
  display: none;
}
.pb-app.sidebar-collapsed .pb-nav__item {
  justify-content: center;
  padding-inline: 0;
}
/* Labels pop back in when the rail expands (restarts because display flips). */
.pb-app:not(.sidebar-collapsed) .pb-nav__label,
.pb-app:not(.sidebar-collapsed) .pb-nav__item span,
.pb-app:not(.sidebar-collapsed) .pb-profile__text {
  animation: pb-label-in 0.26s var(--ease) both;
}
@keyframes pb-label-in {
  from {
    opacity: 0;
    transform: translateX(-5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.pb-app.sidebar-collapsed .pb-profile {
  justify-content: center;
  padding-inline: 0;
}

/* Main view */
.pb-view {
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: clamp(24px, 2rem + 1vw, 36px) var(--pad-x)
    calc(var(--player-h) + clamp(40px, 4vw, 64px));
  animation: pb-rise 0.34s var(--ease) both;
}
.pb-view:focus {
  outline: none;
}

@keyframes pb-rise {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes pb-toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes pb-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ── Shared small type ─────────────────────────────────────────────────── */
.pb-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.pb-eyebrow .pb-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
}
.pb-lede {
  max-width: 56ch;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.65;
}

/* ── Buttons / chips / pills ───────────────────────────────────────────── */
.pb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: 600 14.5px/1 "Manrope", sans-serif;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s;
}
.pb-btn:active {
  transform: translateY(1px);
}
.pb-btn--primary {
  background: #f2f4f9;
  color: #080a0f;
}
.pb-btn--primary:hover {
  background: #fff;
}
.pb-btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}
.pb-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.28);
}
.pb-btn--soft {
  background: var(--violet-tint);
  border-color: rgba(111, 168, 255, 0.22);
  color: #c7dcff;
}
.pb-btn--soft:hover {
  background: rgba(111, 168, 255, 0.2);
}
.pb-btn--sm {
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 13px;
}
.pb-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.pb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pb-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
}
.pb-chip:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--line-strong);
  color: var(--text);
}
.pb-chip[aria-pressed="true"] {
  background: #edeff5;
  border-color: #edeff5;
  color: #080a0f;
  font-weight: 600;
}

.pb-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
}
.pb-pill--soft {
  background: var(--violet-tint);
  border-color: rgba(111, 168, 255, 0.24);
  color: #c3daff;
}
.pb-pill--cyan {
  background: var(--cyan-tint);
  border-color: rgba(92, 225, 208, 0.24);
  color: #9ceee4;
}

/* ── Sections / rails ──────────────────────────────────────────────────── */
.pb-section {
  margin-top: clamp(2rem, 1.5rem + 1.8vw, 3.25rem);
}
.pb-section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(0.75rem, 0.6rem + 0.5vw, 1rem);
  margin-bottom: clamp(0.85rem, 0.7rem + 0.5vw, 1.15rem);
}
.pb-section__title {
  font-size: clamp(1.1rem, 1rem + 0.55vw, 1.35rem);
  letter-spacing: -0.01em;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  margin: 0;
}
.pb-section__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.pb-section__link:hover {
  color: var(--text);
}
.pb-section__link .pb-icon {
  width: 16px;
  height: 16px;
}

.pb-rail {
  display: flex;
  gap: clamp(0.75rem, 0.55rem + 0.7vw, 1.1rem);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 10px;
  margin: -2px -2px 0;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
}
.pb-rail::-webkit-scrollbar {
  display: none;
}
.pb-rail > * {
  flex: none;
  scroll-snap-align: start;
}
.pb-rail--poster > * {
  width: clamp(8.5rem, 7rem + 5vw, 10.5rem);
}
.pb-rail--album > * {
  width: clamp(9rem, 7.5rem + 5vw, 11.25rem);
}
.pb-rail--continue > * {
  width: clamp(15rem, 12rem + 8vw, 18.75rem);
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.pb-card {
  position: relative;
}
.pb-card__open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  border-radius: 12px;
}
.pb-media {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  transition: border-color 0.2s, transform 0.2s;
}
.pb-media img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.45s var(--ease);
}
.pb-media--poster img {
  aspect-ratio: 2 / 3;
  object-fit: cover;
}
.pb-media--square img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
.pb-media--wide img {
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
.pb-media--contain img {
  aspect-ratio: 2 / 3;
  object-fit: contain;
  background: #0b0d12;
}
.pb-card__open:hover .pb-media,
.pb-card__open:focus-visible .pb-media {
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-3px);
}
.pb-card__open:hover .pb-media img {
  transform: scale(1.025);
}
.pb-media__veil {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  background: linear-gradient(to top, rgba(4, 5, 8, 0.86), rgba(4, 5, 8, 0.06) 55%, transparent);
  opacity: 0;
  transition: opacity 0.24s;
}
.pb-card__open:hover .pb-media__veil,
.pb-card__open:focus-visible .pb-media__veil {
  opacity: 1;
}
.pb-media__veil span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(8, 9, 12, 0.68);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
}
.pb-media__type {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(8, 9, 12, 0.8);
  color: #dfe3ec;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.pb-save-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background: rgba(8, 9, 12, 0.74);
  color: #e8eaf2;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
}
.pb-save-btn:hover {
  background: #151922;
  border-color: rgba(255, 255, 255, 0.3);
}
/* Already in the library: the card stays the same and the bookmark keeps its
   shape but is shaded in. The glyph reads its fill from --pb-bookmark-fill
   (see #i-bookmark in index.html), the only hook that reaches inside a <use>
   shadow tree. */
.pb-save-btn[aria-pressed="true"] {
  --pb-bookmark-fill: currentColor;
}
.pb-card__body {
  display: block;
  margin-top: 10px;
}
.pb-card__title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.005em;
}
.pb-card__sub {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
}
.pb-score {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(8, 9, 12, 0.78);
  color: #fff;
  font: 700 11.5px "Space Grotesk", sans-serif;
}
.pb-score .pb-icon {
  width: 11px;
  height: 11px;
  color: var(--cyan);
}

.pb-progress {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.pb-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--violet);
  transition: width 0.3s var(--ease);
}
.pb-progress--cyan > span {
  background: var(--cyan);
}

/* ── Home ──────────────────────────────────────────────────────────────── */
.pb-greet {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.pb-greet h1 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0;
}
.pb-greet p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}
.pb-greet__stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.pb-stat-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
}
.pb-stat-chip b {
  font: 700 15px "Space Grotesk", sans-serif;
  color: var(--text);
}

.pb-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(240px, 0.5fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  padding: clamp(24px, 3.4vw, 44px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #0c0f15;
}
.pb-hero::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--violet), var(--cyan) 42%, transparent 78%);
  opacity: 0.7;
}
.pb-hero__title {
  margin: 14px 0 12px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: clamp(2rem, 3.6vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}
.pb-hero__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--text-soft);
  font-size: 13.5px;
}
.pb-hero__meta .pb-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
}
.pb-hero__desc {
  max-width: 56ch;
  margin: 14px 0 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}
.pb-hero__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.pb-hero__art {
  justify-self: end;
  width: 100%;
  max-width: 280px;
  margin: 0;
}
.pb-hero__art img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.55);
}

.pb-continue-card {
  position: relative;
  display: block;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.pb-continue-card:hover {
  background: var(--surface-2);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}
.pb-continue-card__open {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 13px;
  align-items: start;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
}
.pb-continue-card__open > span:last-child {
  display: block;
  min-width: 0;
}
.pb-continue-card .pb-media {
  width: 76px;
  border-radius: 9px;
}
.pb-continue-card .pb-card__title {
  overflow-wrap: normal;
  word-break: normal;
}
.pb-continue-card h3 {
  font: 600 13.5px/1.35 "Manrope", sans-serif;
  margin: 0;
}
.pb-continue-card p {
  margin: 4px 0 9px;
  font-size: 11.5px;
  color: var(--muted);
}
.pb-continue__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
}
.pb-continue__bar .pb-progress {
  flex: 1;
}
.pb-continue__bar span {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.pb-pick-grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(100%, clamp(11rem, 9rem + 4vw, 14rem)), 1fr)
  );
  gap: clamp(0.85rem, 0.65rem + 0.7vw, 1.15rem);
}

/* ── Games page ────────────────────────────────────────────────────────── */
.pb-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.pb-page-title {
  margin: 10px 0 0;
  /* Mockup-sized; avoid aggressive vw so 175% DPI doesn't explode the H1 */
  font-size: clamp(2rem, 1.7rem + 1.1vw, 2.65rem);
  line-height: 1.02;
}
.pb-page-head .pb-lede {
  margin-top: 10px;
}
.pb-page-head__aside {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.pb-head-stat {
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.pb-head-stat b {
  display: block;
  font: 700 20px/1.1 "Space Grotesk", sans-serif;
}
.pb-head-stat span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}

.pb-stats-strip {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(min(100%, 10rem), 1fr)
  );
  gap: clamp(0.65rem, 0.5rem + 0.5vw, 0.85rem);
  margin-bottom: clamp(1.1rem, 0.9rem + 0.8vw, 1.75rem);
}
.pb-stat-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.pb-stat-card b {
  display: block;
  font: 700 26px/1.1 "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
}
.pb-stat-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
}

.pb-spotlight {
  display: grid;
  grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
  gap: clamp(1rem, 0.8rem + 1vw, 2rem);
  align-items: center;
  padding: clamp(1rem, 0.85rem + 0.8vw, 1.6rem);
  margin-bottom: clamp(1.25rem, 1rem + 1vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #0c0f15;
}
.pb-spotlight__art {
  width: 100%;
  max-width: min(200px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.pb-spotlight__art img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}
.pb-spotlight__fallback {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 2 / 3;
  font-size: 52px;
}
.pb-spotlight__copy h2 {
  margin: 10px 0;
  font-size: clamp(1.8rem, 2.6vw, 2.6rem);
}
.pb-spotlight__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.pb-spotlight__desc {
  max-width: 64ch;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}
.pb-spotlight__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pb-filterbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 6px 0 24px;
}
.pb-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.pb-select {
  appearance: none;
  height: 38px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2398a0b0' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 13px center;
  color: var(--text-soft);
  font: 500 13px "Manrope", sans-serif;
}
.pb-game-grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(100%, clamp(11rem, 9rem + 4vw, 14rem)), 1fr)
  );
  gap: clamp(0.9rem, 0.7rem + 0.7vw, 1.25rem);
}
.pb-chart-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
}
.pb-chart-row {
  display: grid;
  grid-template-columns: 40px 44px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  background: var(--surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.pb-chart-row:hover,
.pb-chart-row:focus-visible {
  background: var(--surface-2);
}
.pb-chart-row__rank {
  color: var(--faint);
  font: 600 16px "Space Grotesk", sans-serif;
}
.pb-chart-row img,
.pb-chart-row__fallback {
  width: 44px;
  height: 62px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
}
.pb-chart-row__fallback {
  display: grid;
  place-items: center;
  background: var(--surface-2);
  font-size: 20px;
}
.pb-chart-row__title {
  display: block;
  font: 600 14px "Manrope", sans-serif;
  color: var(--text);
}
.pb-chart-row__sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.pb-chart-row__score {
  color: var(--cyan);
  font: 700 15px "Space Grotesk", sans-serif;
  white-space: nowrap;
}

/* ── Collection pages (Movies, Music, Books) ───────────────────────────── */
.pb-filterbar__count {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.pb-media-grid {
  display: grid;
  gap: clamp(0.9rem, 0.7rem + 0.7vw, 1.25rem);
}
.pb-media-grid--wide {
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(100%, clamp(13rem, 11rem + 4vw, 16rem)), 1fr)
  );
}
.pb-media-grid--poster {
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(100%, clamp(9rem, 7.5rem + 3vw, 11rem)), 1fr)
  );
  gap: clamp(0.9rem, 0.7rem + 0.6vw, 1.35rem)
    clamp(0.75rem, 0.6rem + 0.5vw, 1.15rem);
}
.pb-media-grid--square {
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(100%, clamp(10rem, 8rem + 3.5vw, 12rem)), 1fr)
  );
  gap: clamp(0.85rem, 0.65rem + 0.6vw, 1.15rem);
}
.pb-media-grid--contain {
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(100%, clamp(9rem, 7.5rem + 3vw, 11rem)), 1fr)
  );
  gap: clamp(0.85rem, 0.65rem + 0.6vw, 1.15rem);
}
.pb-media-grid--library {
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(100%, clamp(10.5rem, 8.5rem + 3.5vw, 13rem)), 1fr)
  );
}
.pb-media__badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(7, 8, 11, 0.8);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}
.pb-spotlight--wide {
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
}
.pb-spotlight--wide .pb-spotlight__art {
  max-width: 340px;
}
.pb-spotlight--wide .pb-spotlight__art img,
.pb-spotlight--wide .pb-spotlight__fallback {
  aspect-ratio: 3 / 2;
}
.pb-spotlight--square {
  grid-template-columns: 220px minmax(0, 1fr);
}
.pb-spotlight--square .pb-spotlight__art {
  max-width: 220px;
}
.pb-spotlight--square .pb-spotlight__art img,
.pb-spotlight--square .pb-spotlight__fallback {
  aspect-ratio: 1 / 1;
}
.pb-spotlight--poster .pb-spotlight__art img,
.pb-spotlight--poster .pb-spotlight__fallback {
  aspect-ratio: 2 / 3;
}
.pb-spotlight--contain .pb-spotlight__art img {
  object-fit: contain;
  background: #0b0d12;
}
.pb-spotlight__fallback {
  background: linear-gradient(150deg, var(--surface-2), var(--surface));
}

.pb-rail--wide > * {
  width: 260px;
}
.pb-rail--rank > * {
  width: 150px;
}
.pb-rail--artist > * {
  width: 160px;
}
.pb-rank-card {
  position: relative;
}
.pb-rank-card__num {
  display: block;
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.22);
  font: 700 34px/1 "Space Grotesk", sans-serif;
  pointer-events: none;
}
[data-theme="light"] .pb-rank-card__num {
  color: rgba(25, 34, 55, 0.3);
}
.pb-rank-card .pb-save-btn {
  top: 46px;
}
.pb-artist-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.2s,
    transform 0.2s;
}
.pb-artist-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}
[data-theme="light"] .pb-artist-card:hover {
  border-color: var(--line-strong);
}
.pb-avatar--lg {
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  font-size: 17px;
}
.pb-artist-card h3 {
  margin: 0;
  font: 600 14px "Manrope", sans-serif;
  letter-spacing: 0;
}
.pb-artist-card p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* ── Music hero (port of ui .music-hero) ──────────────────────────────── */
.pb-music-hero {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 32px;
  padding: 26px;
  margin-bottom: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #0c0f15;
}
.pb-music-hero__art {
  width: 100%;
  overflow: hidden;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.pb-music-hero__art img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
.pb-music-hero__fallback {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  font-size: 52px;
}
.pb-music-hero__copy h2 {
  margin: 8px 0 4px;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
}
.pb-music-hero__artist {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
}
.pb-music-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.pb-music-hero__desc {
  max-width: 64ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}
.pb-waveform {
  display: block;
  width: 100%;
  max-width: 440px;
  height: 56px;
  margin: 18px 0 10px;
  color: var(--violet);
}
.pb-music-hero__controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}
.pb-round-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s;
}
.pb-round-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.3);
}
.pb-round-btn--primary {
  width: 54px;
  height: 54px;
  background: #f2f4f9;
  border-color: #f2f4f9;
  color: #080a0f;
}
.pb-round-btn--primary:hover {
  background: #fff;
  border-color: #fff;
}
.pb-round-btn[aria-pressed="true"] {
  --pb-bookmark-fill: currentColor;
}
[data-theme="light"] .pb-round-btn:hover {
  background: rgba(25, 34, 55, 0.06);
  border-color: var(--line-strong);
}

/* ── Books continue-reading banner (port of ui .continue-read) ────────── */
.pb-continue-read {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 26px;
  align-items: center;
  padding: 24px;
  margin-bottom: 36px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0c0f15;
}
.pb-continue-read__art {
  width: 100%;
  max-width: 150px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}
.pb-continue-read__art img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}
.pb-continue-read__fallback {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 2 / 3;
  font-size: 34px;
}
.pb-continue-read__copy h2 {
  margin: 8px 0 4px;
  font-size: clamp(1.5rem, 2.2vw, 2rem);
}
.pb-continue-read__meta {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}
.pb-continue-read__desc {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}
.pb-book-progress-label {
  display: flex;
  justify-content: space-between;
  max-width: 420px;
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 11.5px;
}
.pb-continue-read__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* ── Library type badge (port of ui .lib-type) ─────────────────────────── */
.pb-lib-type {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(8, 9, 12, 0.8);
  color: #e6e9f2;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}
[data-theme="light"] .pb-lib-type {
  border-color: rgba(25, 34, 55, 0.16);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

.pb-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.pb-tab {
  padding: 12px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: 600 13.5px "Manrope", sans-serif;
  white-space: nowrap;
  cursor: pointer;
}
.pb-tab:hover {
  color: var(--text);
}
.pb-tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--violet);
}
.pb-empty-state {
  padding: 56px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.015);
  text-align: center;
}
.pb-empty-state__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--violet);
}
.pb-empty-state h2 {
  margin: 0 0 8px;
  font-size: 20px;
}
.pb-empty-state p {
  max-width: 40ch;
  margin: 0 auto 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ── News page ─────────────────────────────────────────────────────────── */
.pb-news-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pb-news-status {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}
.pb-news-lead {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  margin-bottom: 32px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #0c0f15;
}
.pb-news-lead .pb-media {
  height: 100%;
  border: 0;
  border-radius: 0;
}
.pb-news-lead .pb-media img {
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
.pb-news-lead__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: clamp(22px, 3vw, 40px);
}
.pb-news-lead__body h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2.6vw, 2.5rem);
}
.pb-news-lead__body h2 a {
  color: inherit;
  text-decoration: none;
}
.pb-news-lead__body p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}
.pb-news-lead__actions {
  display: flex;
  margin-top: 6px;
}

.pb-news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.pb-news-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  transition: border-color 0.2s, transform 0.2s;
}
.pb-news-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}
.pb-news-card__open {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  text-decoration: none;
}
.pb-news-card .pb-media {
  border: 0;
  border-radius: 0;
}
.pb-news-card .pb-media img {
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
.pb-news-card__body {
  display: block;
  padding: 16px;
}
.pb-news-card__cat {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
}
.pb-news-card h3 {
  margin: 8px 0 6px;
  font-family: "Manrope", sans-serif;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
}
.pb-news-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.pb-news-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--faint);
  font-size: 11.5px;
}

.pb-empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
}

/* ── Mobile "more" sheet ───────────────────────────────────────────────── */
.pb-sheet {
  width: min(430px, calc(100vw - 24px));
  margin: auto auto 10px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--bg-elevated);
  color: var(--text);
}
.pb-sheet::backdrop {
  background: rgba(3, 4, 7, 0.72);
}
.pb-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.pb-sheet__head strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
}
.pb-sheet__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px;
}
.pb-sheet__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.pb-sheet__item:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ── Search dialog ─────────────────────────────────────────────────────── */
.pb-search-dialog {
  width: min(680px, calc(100vw - 28px));
  max-width: none;
  margin: 9vh auto auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
}
.pb-search-dialog::backdrop {
  background: rgba(3, 4, 7, 0.72);
}
.pb-search-dialog__field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.pb-search-dialog__field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 15.5px;
  outline: none;
}
.pb-key-cap {
  padding: 4px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font: 600 10.5px "Manrope", sans-serif;
}
.pb-search-results {
  max-height: min(56vh, 460px);
  overflow-y: auto;
  padding: 8px;
}
.pb-search-group-label {
  margin: 0;
  padding: 12px 10px 6px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.pb-search-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text);
  text-align: left;
}
.pb-search-row:hover,
.pb-search-row:focus-visible,
.pb-search-row.is-active {
  background: rgba(255, 255, 255, 0.06);
}
.pb-search-row img {
  width: 34px;
  height: 48px;
  object-fit: cover;
  border-radius: 5px;
  background: var(--surface-2);
}
.pb-search-row--square img {
  height: 34px;
  object-fit: cover;
}
.pb-search-row__mono {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--violet-bright);
  font: 700 11px "Space Grotesk", sans-serif;
}
.pb-search-row strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.pb-search-row span span {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--muted);
}
.pb-search-row__type {
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.pb-search-empty {
  margin: 0;
  padding: 38px 20px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}
.pb-search-dialog__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10.5px;
}
.pb-search-dialog__foot kbd {
  margin: 0 1px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: inherit;
  font: 9.5px "Manrope", sans-serif;
}

/* ── Persistent player bar (port of ui .player) ─────────────────────────── */
.pb-player {
  position: fixed;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  height: var(--player-h);
  padding: 0 24px;
  border-top: 1px solid var(--line);
  background: #0a0c11;
}
.pb-player[hidden] {
  display: none;
}
.pb-app.sidebar-collapsed .pb-player {
  left: var(--sidebar-collapsed-w);
}
[data-theme="light"] .pb-player {
  background: var(--bg-elevated);
}
.pb-player__progress {
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  z-index: 2;
  width: 100%;
  height: 3px;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}
.pb-player__progress::-webkit-slider-runnable-track {
  height: 3px;
  background: linear-gradient(
    to right,
    var(--violet) var(--seek, 0%),
    rgba(255, 255, 255, 0.12) var(--seek, 0%)
  );
}
.pb-player__progress:hover::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    var(--violet-bright) var(--seek, 0%),
    rgba(255, 255, 255, 0.2) var(--seek, 0%)
  );
}
.pb-player__progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  background: var(--violet);
  opacity: 0;
  transition: opacity 0.15s;
}
.pb-player__progress:hover::-webkit-slider-thumb,
.pb-player__progress:focus-visible::-webkit-slider-thumb {
  opacity: 1;
}
.pb-player__progress::-moz-range-track {
  height: 3px;
  background: rgba(255, 255, 255, 0.14);
}
.pb-player__progress::-moz-range-progress {
  height: 3px;
  background: var(--violet);
}
[data-theme="light"] .pb-player__progress::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    var(--violet) var(--seek, 0%),
    var(--line) var(--seek, 0%)
  );
}
[data-theme="light"] .pb-player__progress::-moz-range-track {
  background: var(--line);
}
.pb-player__progress:disabled {
  cursor: default;
}
.pb-player__track {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.pb-player__art,
.pb-player__fallback {
  width: 44px;
  height: 44px;
  flex: none;
}
.pb-player__art {
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.pb-player__art[hidden],
.pb-player__fallback[hidden] {
  display: none;
}
.pb-player__fallback {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--faint);
}
.pb-player__fallback .pb-icon {
  width: 20px;
  height: 20px;
}
.pb-player__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.pb-player__meta > span:first-child {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pb-player__meta > span:last-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pb-player__tag {
  margin-left: 6px;
  padding: 3px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pb-player__controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pb-player__ctrl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-soft);
  cursor: pointer;
}
.pb-player__ctrl:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.pb-player__ctrl:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.pb-player__play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f2f4f9;
  color: #080a0f;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.pb-player__play:hover {
  background: #fff;
  transform: scale(1.04);
}
.pb-player__side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}
.pb-player__time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
[data-theme="light"] .pb-player__ctrl:hover:not(:disabled) {
  background: rgba(25, 34, 55, 0.06);
  color: var(--text);
}
[data-theme="light"] .pb-player__play {
  background: #172033;
  color: #fff;
}
[data-theme="light"] .pb-player__play:hover {
  background: #0b1220;
}

/* ── Toasts ────────────────────────────────────────────────────────────── */
.pb-toasts {
  position: fixed;
  right: 24px;
  bottom: calc(var(--player-h) + 18px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.pb-toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 320px;
  padding: 11px 15px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: #1a1f2a;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  animation: pb-toast-in 0.28s var(--ease) both;
}
.pb-toast .pb-icon {
  width: 16px;
  height: 16px;
  color: var(--cyan);
}

/* ── Mobile bottom nav ─────────────────────────────────────────────────── */
.pb-mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--mobilenav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: #0a0c11;
}
.pb-mobile-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.pb-mobile-nav__item .pb-icon {
  width: 21px;
  height: 21px;
}
.pb-mobile-nav__item[aria-current="true"],
.pb-mobile-nav__item.active {
  color: var(--violet-bright);
}

/* ── Light theme overrides ─────────────────────────────────────────────── */
/* Cross-fade the palette while the theme toggle swaps variables. The class
   is added for ~340ms by js/theme.js, then removed. */
html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease,
    fill 0.3s ease, stroke 0.3s ease, box-shadow 0.3s ease !important;
}
[data-theme="light"] body {
  background: var(--bg);
}
[data-theme="light"] .pb-sidebar {
  background: #edf0f7;
}
[data-theme="light"] .pb-topbar {
  background: rgba(245, 247, 251, 0.95);
}
[data-theme="light"] .pb-icon-btn:hover,
[data-theme="light"] .pb-search-trigger:hover,
[data-theme="light"] .pb-nav__item:hover,
[data-theme="light"] .pb-mobile-nav__item:hover {
  background: rgba(25, 34, 55, 0.06);
  color: var(--text);
}
[data-theme="light"] .pb-popover,
[data-theme="light"] .pb-mobile-nav {
  background: var(--bg-elevated);
}
[data-theme="light"] .pb-notify__dot {
  border-color: #edf0f7;
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(25, 34, 55, 0.18);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(25, 34, 55, 0.28);
}
[data-theme="light"] .pb-avatar {
  background: rgba(13, 110, 253, 0.12);
  border-color: rgba(13, 110, 253, 0.26);
  color: #17509f;
}
[data-theme="light"] .pb-hero,
[data-theme="light"] .pb-spotlight,
[data-theme="light"] .pb-music-hero,
[data-theme="light"] .pb-continue-read,
[data-theme="light"] .pb-news-lead {
  background: var(--surface);
  color: var(--text);
}
[data-theme="light"] .pb-media--contain img {
  background: var(--surface-2);
}
[data-theme="light"] .pb-btn--primary {
  background: var(--text);
  color: var(--bg);
}
[data-theme="light"] .pb-btn--primary:hover {
  background: #2b3853;
}
[data-theme="light"] .pb-nav__item[aria-current="true"],
[data-theme="light"] .pb-nav__item.active {
  color: #14356e;
}
[data-theme="light"] .pb-nav__item[aria-current="true"] .pb-icon,
[data-theme="light"] .pb-nav__item.active .pb-icon {
  color: #0d6efd;
}
[data-theme="light"] .pb-pill--soft {
  border-color: rgba(13, 110, 253, 0.24);
  color: #1a4fae;
}
[data-theme="light"] .pb-pill--cyan {
  border-color: rgba(21, 157, 145, 0.24);
  color: #08766d;
}
[data-theme="light"] .pb-chip:hover,
[data-theme="light"] .pb-btn--ghost:hover,
[data-theme="light"] .pb-continue-card:hover,
[data-theme="light"] .pb-news-card:hover,
[data-theme="light"] .pb-chart-row:hover,
[data-theme="light"] .pb-chart-row:focus-visible,
[data-theme="light"] .pb-search-row:hover,
[data-theme="light"] .pb-search-row.is-active {
  background: rgba(25, 34, 55, 0.06);
  border-color: var(--line-strong);
}
[data-theme="light"] .pb-chip[aria-pressed="true"] {
  background: #2b3853;
  border-color: #2b3853;
  color: #fff;
}
[data-theme="light"] .pb-hero__art img {
  border-color: var(--line);
  box-shadow: 0 26px 60px rgba(25, 34, 55, 0.16);
}
[data-theme="light"] .pb-card__open:hover .pb-media,
[data-theme="light"] .pb-card__open:focus-visible .pb-media {
  border-color: var(--line-strong);
}
[data-theme="light"] .pb-save-btn,
[data-theme="light"] .pb-score,
[data-theme="light"] .pb-media__type {
  border-color: rgba(25, 34, 55, 0.16);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}
[data-theme="light"] .pb-save-btn:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}
[data-theme="light"] .pb-progress {
  background: rgba(25, 34, 55, 0.12);
}
[data-theme="light"] .pb-toast {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 14px 40px rgba(25, 34, 55, 0.18);
}
[data-theme="light"] .pb-search-dialog::backdrop,
[data-theme="light"] .pb-sheet::backdrop {
  background: rgba(25, 34, 55, 0.32);
}
[data-theme="light"] .pb-empty-state {
  background: rgba(25, 34, 55, 0.025);
}

/* ── Elia Chat ─────────────────────────────────────────────────────────── */
/* Pull Elia edge-to-edge inside the main pane without changing other views. */
.pb-view:has([data-dest="settings"]:not([hidden])) {
  max-width: none;
  padding-left: clamp(8px, 1vw, 14px);
  padding-right: clamp(8px, 1vw, 14px);
}
.elia {
  color: var(--text);
  width: 100%;
}
/* Page-head is shared elsewhere — keep denser spacing Elia-only. */
.elia > .pb-page-head {
  gap: 14px;
  margin-bottom: 12px;
  align-items: flex-end;
}
.elia > .pb-page-head .pb-page-title {
  margin-top: 4px;
  font-size: clamp(1.55rem, 2.8vw, 2.15rem);
  line-height: 1.08;
}
.elia > .pb-page-head .pb-lede {
  margin-top: 4px;
  max-width: 42rem;
}
.elia > .pb-page-head .pb-eyebrow {
  font-size: 10.5px;
}
.pb-chat {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  width: 100%;
  height: min(780px, calc(100dvh - 210px));
  min-height: 440px;
}
.pb-chat__rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.pb-chat__rail > * {
  flex: none;
}
.pb-chat__rail .elia-section-label {
  display: block;
  margin: 0;
}
.pb-chat__rail .elia-section-label > h2 {
  margin: 0;
  font: 700 15px/1.2 "Space Grotesk", sans-serif;
  letter-spacing: -0.01em;
  color: var(--text);
}
.pb-chat__rail .elia-section-label > span {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}
.pb-chat__rail .elia-local-place {
  gap: 8px;
  margin: 8px 0 6px;
}
.pb-chat__rail .elia-local-place > div {
  min-width: 0;
}
.pb-chat__rail .elia-local-place strong {
  font-size: 16px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.pb-chat__rail .elia-local-place span {
  display: block;
  margin-top: 2px;
  line-height: 1.3;
  font-size: 11px;
}
.elia-local-card {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.elia-local-card .elia-local-date {
  gap: 2px;
  padding: 8px 0;
}
.elia-local-card .elia-local-date > strong {
  font-size: 22px;
  line-height: 1.05;
}
.elia-local-card .elia-local-date > span,
.elia-local-card .elia-local-date > small {
  font-size: 10px;
}
.elia-local-card .elia-weather-live {
  margin: 8px 0 0;
  gap: 8px;
}
.elia-local-card .elia-weather-live > span {
  font-size: 22px;
}
.elia-local-card .elia-weather-live b {
  font-size: 18px;
}
.elia-local-card .elia-location-map {
  width: 84px;
  height: 68px;
}
.elia-actions {
  gap: 6px;
}
.elia-actions > button {
  min-height: 48px;
  padding: 8px 10px;
  border-color: var(--line);
  border-radius: 11px;
  background: var(--surface);
}
.elia-actions > button:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}
.elia-action-icon {
  width: 32px;
  height: 32px;
  font-size: 16px;
  background: var(--surface-2);
}
.elia-actions i {
  color: var(--violet);
}
.elia-actions b {
  font-size: 12.5px;
}
.elia-actions small {
  font-size: 10.5px;
}

.pb-chat__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.pb-chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: none;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.pb-chat__id {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.pb-chat__id .pb-msg__avatar {
  width: 28px;
  height: 28px;
}
.pb-chat__id > div {
  min-width: 0;
}
.pb-chat__id strong {
  display: block;
  font: 600 13.5px/1.2 "Space Grotesk", sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pb-chat__id span {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pb-chat__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.elia-chat-status {
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
}
.elia-chat-status.is-busy {
  color: var(--violet);
}
.elia-new-chat {
  white-space: nowrap;
}

.pb-chat__messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  padding: 14px 16px 6px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
/* Pin sparse threads to the composer so the middle doesn't feel empty. */
.pb-chat__messages::before {
  content: "";
  flex: 1 0 0;
  min-height: 0;
}
.pb-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: min(620px, 92%);
}
.pb-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.pb-msg__avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
}
.pb-msg__avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pb-msg__body {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.5;
}
.pb-msg__body > p {
  margin: 0;
}
.pb-msg--user .pb-msg__body {
  background: rgba(111, 168, 255, 0.14);
  border-color: rgba(111, 168, 255, 0.28);
  color: #e3edff;
}
.pb-msg--user .pb-msg__body > p {
  white-space: pre-wrap;
}
/* Typing indicator: three staggered dots rendered without extra markup —
 * the middle dot is the paragraph's own background, the side dots are pseudos.
 * elia.js puts .elia-thinking on the .pb-msg__body itself. */
.pb-msg__body.elia-thinking {
  opacity: 0.9;
}
.pb-msg__body.elia-thinking p {
  position: relative;
  width: 28px;
  height: 5px;
  margin: 5px 2px;
  font-size: 0;
  background: radial-gradient(circle, var(--muted) 2.5px, transparent 2.7px) center / 5px 5px no-repeat;
  animation: pb-dot-bounce 1.1s ease-in-out infinite;
  animation-delay: 0.15s;
}
.pb-msg__body.elia-thinking p::before,
.pb-msg__body.elia-thinking p::after {
  content: "";
  position: absolute;
  top: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: pb-dot-bounce 1.1s ease-in-out infinite;
}
.pb-msg__body.elia-thinking p::before {
  left: 0;
}
.pb-msg__body.elia-thinking p::after {
  right: 0;
  animation-delay: 0.3s;
}
@keyframes pb-dot-bounce {
  0%, 70%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
.pb-msg__body.elia-error {
  border-color: var(--red) !important;
}

.pb-chat__composer {
  flex: none;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
}
.elia-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 8px;
  border-top: 0;
  overflow: visible;
}
.elia-suggestions button {
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-soft);
  font: 500 12px "Manrope", sans-serif;
  white-space: nowrap;
}
.elia-suggestions button:hover {
  border-color: var(--line-strong);
  color: var(--text);
}
.pb-composer,
.elia-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 0;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface-2);
}
.pb-composer:focus-within,
.elia-composer:focus-within {
  border-color: rgba(111, 168, 255, 0.55);
}
.pb-composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 120px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 400 13.5px/1.45 "Manrope", sans-serif;
  resize: none;
  outline: none;
}
.pb-composer textarea::placeholder {
  color: var(--faint);
}
.pb-composer button,
.elia-composer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 0;
  border-radius: 8px;
  background: #f2f4f9;
  color: #080a0f;
  font-size: 15px;
  cursor: pointer;
}
.pb-composer button:hover:not(:disabled),
.elia-composer button:hover:not(:disabled) {
  background: #fff;
}
.pb-composer button:disabled,
.elia-composer button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pb-chat__note {
  margin: 5px 2px 0;
  color: var(--faint);
  font-size: 10px;
}
[data-theme="light"] .pb-msg--user .pb-msg__body {
  background: rgba(13, 110, 253, 0.1);
  border-color: rgba(13, 110, 253, 0.26);
  color: #14356e;
}
[data-theme="light"] .pb-chat__main,
[data-theme="light"] .elia-local-card,
[data-theme="light"] .elia-actions > button {
  background: var(--surface);
}
[data-theme="light"] .pb-composer,
[data-theme="light"] .elia-composer {
  background: var(--surface-2);
}
[data-theme="light"] .pb-composer button,
[data-theme="light"] .elia-composer button {
  background: var(--text);
  color: #fff;
}
[data-theme="light"] .pb-composer button:hover:not(:disabled),
[data-theme="light"] .elia-composer button:hover:not(:disabled) {
  background: #2b3853;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1240px) {
  :root {
    --sidebar-w: 236px;
  }
  .pb-hero {
    grid-template-columns: 1.3fr 0.52fr;
  }
}

/* Mobile shell: narrow viewports OR phone landscape (e.g. iPhone 956×440).
   Keep desktop sidebar for Windows 175% laptops (~1097×617). */
@media (max-width: 800px),
  (max-width: 1200px) and (max-height: 500px) and (orientation: landscape) {
  :root {
    --sidebar-w: 0px;
  }
  .pb-sidebar {
    display: none;
  }
  .pb-topbar__brand {
    display: flex;
    align-items: center;
  }
  .pb-mobile-nav {
    display: grid;
  }
  .pb-app.sidebar-collapsed .pb-shell {
    margin-left: 0;
  }
  .pb-player,
  .pb-app.sidebar-collapsed .pb-player {
    left: 0;
    bottom: calc(var(--mobilenav-h) + env(safe-area-inset-bottom));
  }
  .pb-view {
    padding-bottom: calc(var(--player-h) + var(--mobilenav-h) + 56px);
  }
  .pb-toasts {
    bottom: calc(var(--player-h) + var(--mobilenav-h) + 24px);
  }
  .pb-chat {
    grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
    gap: 10px;
  }
}

@media (max-width: 700px) {
  .pb-hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .pb-hero__art {
    order: -1;
    justify-self: start;
    max-width: 180px;
  }
  .pb-pick-grid {
    grid-template-columns: repeat(
      auto-fill,
      minmax(min(100%, 11rem), 1fr)
    );
  }
  .pb-news-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  }
  .pb-spotlight {
    grid-template-columns: minmax(7.5rem, 9rem) minmax(0, 1fr);
    gap: 1rem;
  }
  .pb-spotlight__art,
  .pb-spotlight--wide .pb-spotlight__art,
  .pb-spotlight--square .pb-spotlight__art {
    max-width: 144px;
  }
  .pb-music-hero {
    grid-template-columns: 160px minmax(0, 1fr);
  }
  .pb-news-lead {
    grid-template-columns: 1fr;
  }
  .pb-news-lead .pb-media img {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 640px) {
  :root {
    --pad-x: clamp(14px, 4vw, 18px);
  }
  .pb-view {
    padding-top: clamp(18px, 3vw, 24px);
  }
  .pb-section {
    margin-top: clamp(28px, 5vw, 40px);
  }
  .pb-hero {
    padding: 20px;
  }
  .pb-hero__title {
    font-size: clamp(1.7rem, 6vw, 2.25rem);
  }
  .pb-pick-grid {
    grid-template-columns: repeat(
      auto-fill,
      minmax(min(100%, 9.5rem), 1fr)
    );
    gap: clamp(0.75rem, 2.5vw, 1rem);
  }
  .pb-news-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .pb-rail--continue > * {
    width: clamp(14rem, 70vw, 17rem);
  }
  .pb-rail--poster > * {
    width: clamp(8rem, 28vw, 9.5rem);
  }
  .pb-rail--rank > * {
    width: clamp(7rem, 26vw, 8.25rem);
  }
  .pb-rail--album > * {
    width: clamp(8.5rem, 30vw, 10rem);
  }
  .pb-page-head {
    margin-bottom: 22px;
  }
  .pb-spotlight {
    grid-template-columns: 1fr;
    padding: 18px;
  }
  .pb-spotlight__art,
  .pb-spotlight--wide .pb-spotlight__art,
  .pb-spotlight--square .pb-spotlight__art {
    max-width: 140px;
  }
  .pb-music-hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .pb-music-hero__art {
    max-width: 220px;
  }
  .pb-continue-read {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 18px;
    padding: 18px;
  }
  .pb-continue-read__art {
    max-width: 100px;
  }
  .pb-chat {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    gap: 12px;
  }
  .pb-chat__main {
    order: -1;
    height: min(62dvh, 520px);
    min-height: 360px;
  }
  .pb-chat__rail {
    overflow: visible;
    gap: 8px;
  }
  .elia > .pb-page-head {
    margin-bottom: 10px;
  }
  .pb-game-grid {
    grid-template-columns: repeat(
      auto-fill,
      minmax(min(100%, 9.5rem), 1fr)
    );
    gap: clamp(0.75rem, 2.5vw, 1rem);
  }
  .pb-media-grid--wide,
  .pb-media-grid--poster,
  .pb-media-grid--square,
  .pb-media-grid--contain,
  .pb-media-grid--library {
    grid-template-columns: repeat(
      auto-fill,
      minmax(min(100%, 9rem), 1fr)
    );
    gap: clamp(0.75rem, 2.5vw, 1.1rem) clamp(0.65rem, 2vw, 0.9rem);
  }
  .pb-stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  /* Collapsed to an icon, the search field is a topbar action like the theme
     and notification buttons: same box, same colour, no bordered input frame,
     and it joins that cluster instead of floating beside the logo. */
  .pb-search-trigger {
    flex: none;
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    margin-left: auto;
    /* The topbar gap is 10px; the action cluster spaces its icons at 4px. */
    margin-right: -6px;
    border-color: transparent;
    border-radius: 10px;
    background: none;
    color: var(--text-soft);
  }
  .pb-search-trigger:hover {
    border-color: transparent;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
  }
  .pb-search-trigger .pb-icon {
    width: 18px;
    height: 18px;
  }
  .pb-search-trigger span,
  .pb-search-trigger kbd {
    display: none;
  }
  .pb-topbar {
    gap: 10px;
  }
  .pb-topbar__brand {
    font-size: 14px;
  }
  .pb-topbar__actions {
    margin-left: 0;
    gap: 4px;
  }
  .pb-greet p {
    font-size: 14px;
  }
  .pb-greet__stats {
    width: 100%;
  }
  .pb-stat-chip {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
  }
  .pb-toasts {
    left: 12px;
    right: 12px;
    align-items: stretch;
  }
  .pb-toast {
    max-width: none;
  }
  .pb-hero__actions .pb-btn {
    flex: 1 1 auto;
  }
  .pb-player {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 0 14px;
  }
  .pb-player__time,
  .pb-player__tag {
    display: none;
  }
  .pb-player__side .pb-player__ctrl {
    display: none;
  }
  .pb-player__track {
    gap: 9px;
  }
  .pb-player__art,
  .pb-player__fallback {
    width: 38px;
    height: 38px;
  }
  .pb-stats-strip {
    gap: 8px;
  }
  .pb-stat-card {
    padding: 13px;
  }
  .pb-stat-card b {
    font-size: 22px;
  }
  .pb-news-lead__body {
    padding: 20px;
  }
  .pb-chart-row {
    grid-template-columns: 26px 40px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 12px;
  }
  .pb-chart-row img,
  .pb-chart-row__fallback {
    width: 40px;
    height: 56px;
  }
  /* Game charts show duration text rather than a two-digit score. */
  .pb-chart-row__score {
    font-size: 12px;
  }
  .pb-media-grid--wide {
    grid-template-columns: 1fr;
  }
  .pb-page-head__aside {
    width: 100%;
  }
  .pb-head-stat {
    flex: 1;
  }
  .pb-news-tools {
    width: 100%;
    justify-content: space-between;
  }
  .pb-chat__main {
    height: min(64dvh, 480px);
    min-height: 340px;
  }
  .pb-chat__head {
    padding: 9px 12px;
  }
  .pb-chat__controls {
    gap: 8px;
  }
  .elia-chat-status {
    display: none;
  }
  .pb-chat__messages {
    gap: 10px;
    padding: 12px 12px 4px;
  }
  .pb-msg {
    max-width: 96%;
  }
  .pb-chat__composer {
    padding: 8px 10px 10px;
  }
  .elia-suggestions {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .elia-local-card {
    padding: 10px 12px;
  }
  .elia-actions > button {
    min-height: 44px;
    padding: 7px 9px;
  }
  .pb-search-dialog {
    margin-top: 6vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .pb-card__open:hover .pb-media,
  .pb-continue-card:hover,
  .pb-news-card:hover {
    transform: none;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Legacy coexistence
   paxplay-ui.css ships `.side-link`, `.sidebar-backdrop`, `body` padding and
   `.app`/`.app-main` rules with !important. The new shell reuses a few hook
   names for the test suite and JS, so neutralise those declarations here.
   ══════════════════════════════════════════════════════════════════════════ */
body {
  padding-bottom: 0 !important;
}

#app-header .side-link {
  all: unset !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  gap: 11px !important;
  width: 100% !important;
  height: 42px !important;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: none !important;
  color: var(--muted) !important;
  font-family: "Manrope", system-ui, sans-serif !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  line-height: 1.2 !important;
  text-align: left !important;
  cursor: pointer !important;
  transform: none !important;
  transition: background 0.16s, color 0.16s !important;
  outline: none !important;
}
#app-header .side-link:focus-visible {
  outline: 2px solid var(--violet-bright) !important;
  outline-offset: 2px !important;
}
.pb-app.sidebar-collapsed #app-header .side-link {
  justify-content: center !important;
  padding-inline: 0 !important;
}
#app-header .side-link .pb-icon {
  width: 18px !important;
  height: 18px !important;
  color: var(--faint) !important;
  transform: none !important;
  transition: color 0.16s !important;
}
#app-header .side-link:hover {
  background: rgba(255, 255, 255, 0.045) !important;
  color: var(--text) !important;
}
#app-header .side-link:hover .pb-icon {
  color: var(--text-soft) !important;
}
#app-header .side-link.active,
#app-header .side-link[aria-current="page"] {
  background: var(--violet-tint) !important;
  color: #e3edff !important;
  border-color: transparent !important;
  font-weight: 500 !important;
}
#app-header .side-link.active .pb-icon,
#app-header .side-link[aria-current="page"] .pb-icon {
  color: var(--violet) !important;
}
[data-theme="light"] #app-header .side-link:hover {
  background: rgba(25, 34, 55, 0.06) !important;
  color: var(--text) !important;
}
[data-theme="light"] #app-header .side-link.active,
[data-theme="light"] #app-header .side-link[aria-current="page"] {
  background: rgba(13, 110, 253, 0.12) !important;
  color: #14356e !important;
}
[data-theme="light"] #app-header .side-link.active .pb-icon,
[data-theme="light"] #app-header .side-link[aria-current="page"] .pb-icon {
  color: #0d6efd !important;
}

/* Drawer on small screens / phone landscape */
@media (max-width: 800px),
  (max-width: 1200px) and (max-height: 500px) and (orientation: landscape) {
  .pb-sidebar {
    display: flex;
    width: min(304px, 84vw);
    transform: translateX(-104%);
    transition: transform 0.3s var(--ease);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
  }
  body.sidebar-open .pb-sidebar {
    transform: none;
  }
  #sidebar-backdrop:not([hidden]) {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 39 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: rgba(3, 4, 7, 0.62) !important;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: pb-fade-in 0.24s var(--ease);
  }
  [data-theme="light"] #sidebar-backdrop:not([hidden]) {
    background: rgba(25, 34, 55, 0.34) !important;
  }
}

/* The production search overlay is a flex container. Seat the ui dialog at
   the top of the viewport like ui/styles.css does with its <dialog>. */
.search-overlay {
  align-items: flex-start !important;
  justify-content: center !important;
  padding: 9vh 14px 14px !important;
  background: rgba(3, 4, 7, 0.72) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
[data-theme="light"] .search-overlay {
  background: rgba(25, 34, 55, 0.32) !important;
}
.search-overlay .pb-search-dialog {
  display: flex;
  flex-direction: column;
  width: min(680px, 100%);
  max-height: calc(100dvh - 9vh - 14px);
  margin: 0;
}
.search-overlay .pb-search-results {
  display: block;
  flex: 1;
  min-height: 0;
  gap: 0;
  padding: 8px;
}

/* paxplay-ui.css pads and spaces the games wrapper as a legacy page; the
   design gives every view the same .pb-view padding. */
.pb-view .games-view-container {
  display: block;
  gap: 0 !important;
  padding: 0 !important;
}
@media (max-width: 520px) {
  .search-overlay {
    padding: 6vh 10px 10px !important;
  }
  .search-overlay .pb-search-dialog {
    max-height: calc(100dvh - 6vh - 10px);
  }
}

/* Legacy `header-btn` siblings stay out of the new toolbar */
.pb-topbar .header-btn,
.pb-topbar .volume-control {
  display: none !important;
}

/* paxplay-ui.css hides #search-toggle as a legacy topbar button. The new
   topbar owns that id, so restore the ui search field. */
.pb-topbar #search-toggle {
  display: flex !important;
}

/* Notification list rows rendered by js/paxplay-ui.js */
.pb-notif-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(50vh, 360px);
  overflow-y: auto;
}
.pb-notif-empty {
  margin: 0;
  padding: 14px 12px 16px;
  color: var(--muted);
  font-size: 12.5px;
}

/* Give topbar action icons a consistent box */
.pb-icon-btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

/* Media fallbacks used by the home feed when a catalog item has no artwork */
.pb-media__glyph {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: linear-gradient(150deg, var(--surface-2), var(--surface));
  color: var(--faint);
  font-family: "Space Grotesk", sans-serif;
  font-size: 40px;
  line-height: 1;
}
.pb-media--square .pb-media__glyph {
  aspect-ratio: 1 / 1;
}
.pb-media--wide .pb-media__glyph,
.pb-news-card .pb-media__glyph {
  aspect-ratio: 3 / 2;
}
.pb-news-card .pb-media:empty {
  display: block;
  min-height: 132px;
  background: var(--surface-2);
}
.pb-hero__fallback {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  font-size: 64px;
  line-height: 1;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.55);
}
[data-theme="light"] .pb-hero__fallback {
  border-color: var(--line);
  box-shadow: 0 26px 60px rgba(25, 34, 55, 0.16);
}

@media (max-width: 520px) {
  .pb-popover {
    position: fixed;
    top: calc(var(--topbar-h) + 6px);
    left: 12px;
    right: 12px;
    width: auto;
  }
}
