/* ==========================================================================
   Medvianta — "lamp-lit living room"
   A deep plum night palette with one warm accent: lamplight. Everything else stays
   quiet so the screen and the people on the couch carry the room.
   ========================================================================== */

:root {
  --bg: #17131f;
  --bg-2: #1c1726;
  --surface: #221c2e;
  --surface-2: #2b2439;
  --surface-3: #352d45;
  --line: #3a3249;
  --line-soft: #2e2740;
  --text: #f1ecf7;
  --muted: #aaa1ba;
  --faint: #7d7490;
  --lamp: #f2b65a;
  --lamp-strong: #ffc976;
  --lamp-ink: #2a1b05;
  --lamp-glow: rgb(242 182 90 / 0.35);
  --good: #6fd3b8;
  --warn: #f2b65a;
  --bad: #ff7f7f;
  --danger: #e5625e;
  --focus: #ffd38a;
  --stage: #07050b;
  --shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset, 0 12px 32px -18px rgb(0 0 0 / 0.7);

  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Type scale, ratio ~1.2 from 16px */
  --t-xs: 0.75rem;
  --t-sm: 0.8125rem;
  --t-base: 1rem;
  --t-md: 1.125rem;
  --t-lg: 1.375rem;
  --t-xl: 1.75rem;
  --t-2xl: 2.25rem;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 999px;
  --gap: 16px;
  --rail-w: 232px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f4fb;
  --bg-2: #f1ecf7;
  --surface: #ffffff;
  --surface-2: #f1ecf6;
  --surface-3: #e7e0ef;
  --line: #ddd5e8;
  --line-soft: #ebe5f2;
  --text: #221c30;
  --muted: #625a72;
  --faint: #8a8199;
  --lamp: #b8731a;
  --lamp-strong: #9a5f12;
  --lamp-ink: #ffffff;
  --lamp-glow: rgb(184 115 26 / 0.25);
  --good: #1f8a6c;
  --warn: #a8670f;
  --bad: #c33d3d;
  --danger: #c33d3d;
  --focus: #8a4fd6;
  --shadow: 0 10px 30px -18px rgb(60 30 90 / 0.35);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f7f4fb; --bg-2: #f1ecf7; --surface: #ffffff; --surface-2: #f1ecf6; --surface-3: #e7e0ef;
    --line: #ddd5e8; --line-soft: #ebe5f2; --text: #221c30; --muted: #625a72; --faint: #8a8199;
    --lamp: #b8731a; --lamp-strong: #9a5f12; --lamp-ink: #ffffff; --lamp-glow: rgb(184 115 26 / 0.25);
    --good: #1f8a6c; --warn: #a8670f; --bad: #c33d3d; --danger: #c33d3d; --focus: #8a4fd6;
    --shadow: 0 10px 30px -18px rgb(60 30 90 / 0.35);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--t-base)/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: var(--t-xl); }
h2 { font-size: var(--t-lg); }
h3 { font-size: var(--t-md); }
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-size: 0.9em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1:focus { outline: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--lamp); color: var(--lamp-ink); padding: 8px 14px; border-radius: var(--r-sm); }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }
.grow { flex: 1; min-width: 0; }
.clamp-1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row-end { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.icon { flex: none; }

/* ------------------------------------------------------------------ boot */
.boot { display: grid; place-items: center; min-height: 100dvh; }
.boot-lamp { width: 44px; height: 44px; border-radius: 50%; background: var(--lamp); box-shadow: 0 0 60px 20px var(--lamp-glow); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(0.85); opacity: 0.7; } }

/* ------------------------------------------------------------------ buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: var(--t-sm); text-decoration: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--lamp); border-color: var(--lamp); color: var(--lamp-ink); }
.btn-primary:hover { background: var(--lamp-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-small { min-height: 32px; padding: 0 12px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.link-quiet { color: var(--muted); font-size: var(--t-sm); text-decoration: none; }
.link-quiet:hover { color: var(--text); text-decoration: underline; }

input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lamp); box-shadow: 0 0 0 3px var(--lamp-glow); }
input[type=color] { width: 56px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--lamp); width: 18px; height: 18px; flex: none; margin: 3px 0 0; }
input[type=range] { accent-color: var(--lamp); width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 700; font-size: var(--t-sm); }
.hint { color: var(--muted); font-size: var(--t-sm); }
.form-error { color: var(--bad); font-size: var(--t-sm); min-height: 1em; }
.form-error:empty { display: none; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; cursor: pointer; }
.check > span { display: flex; flex-direction: column; font-weight: 700; font-size: var(--t-sm); }
.check small { font-weight: 400; color: var(--muted); font-size: var(--t-sm); }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-weight: 700; font-size: var(--t-sm); margin-bottom: 8px; padding: 0; }
details summary { cursor: pointer; font-weight: 700; font-size: var(--t-sm); color: var(--muted); padding: 8px 0; }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--muted); font-size: var(--t-xs); font-weight: 700; white-space: nowrap; }
.tag-mature { background: transparent; border: 1px solid var(--bad); color: var(--bad); }
.tag-live, .tag-connected, .tag-built_in { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.tag-upcoming, .tag-not_connected { background: color-mix(in srgb, var(--lamp) 16%, transparent); color: var(--lamp); }
.tag-needs_server_setup, .tag-not_available { background: var(--surface-3); color: var(--muted); }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--lamp); color: var(--lamp-ink); font-size: 11px; font-weight: 700; }
.icon-btn .badge, .bell .badge { position: absolute; top: 0; right: 0; }

.avatar { position: relative; display: inline-grid; place-items: center; border-radius: 50%; color: #1a1422; font-weight: 700; flex: none; overflow: hidden; font-family: var(--font-display); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.ghost { width: 32px; height: 32px; background: var(--surface-3); }

.segmented { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; margin-bottom: 20px; }
.segmented button { display: inline-flex; gap: 8px; align-items: center; padding: 8px 16px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; font-size: var(--t-sm); }
.segmented button.on { background: var(--surface-3); color: var(--text); }

.choice-group { display: grid; gap: 8px; }
.choice { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; background: var(--bg-2); }
.choice:has(input:checked) { border-color: var(--lamp); background: color-mix(in srgb, var(--lamp) 8%, var(--bg-2)); }
.choice input { margin: 0; }
.choice > span:last-child { display: flex; flex-direction: column; }
.choice small { color: var(--muted); font-size: var(--t-sm); }
.choice-icon { color: var(--lamp); display: grid; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: var(--t-sm); font-weight: 700; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--muted); flex: 1; min-width: 200px; }
.search:focus-within { border-color: var(--lamp); }
.search input { border: 0 !important; background: transparent !important; box-shadow: none !important; padding-left: 0 !important; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100dvh; }
.rail {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 4px;
  padding: 22px 14px; border-right: 1px solid var(--line-soft); background: var(--bg);
}
.brand-word { font-family: var(--font-display); font-weight: 700; font-size: var(--t-lg); text-decoration: none; padding: 0 10px 18px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
.brand-word::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--lamp); box-shadow: 0 0 18px 4px var(--lamp-glow); flex: none; }
.rail ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rail ul a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); color: var(--muted); text-decoration: none; font-weight: 700; font-size: var(--t-sm); }
.rail ul a:hover { color: var(--text); background: var(--surface); }
.rail ul a.on { color: var(--text); background: var(--surface); }
.rail ul a.on .icon { color: var(--lamp); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.rail-bell, .rail-me { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-md); color: var(--muted); text-decoration: none; font-weight: 700; font-size: var(--t-sm); background: transparent; border: 0; cursor: pointer; text-align: left; }
.rail-bell:hover, .rail-me:hover { background: var(--surface); color: var(--text); }
.rail-bell .badge { margin-left: auto; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.main { padding: 32px clamp(16px, 4vw, 48px) 64px; max-width: 1240px; width: 100%; outline: none; }
.conn-banner { background: color-mix(in srgb, var(--warn) 18%, var(--bg)); color: var(--warn); text-align: center; padding: 6px; font-size: var(--t-sm); font-weight: 700; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin-top: 6px; }
.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel > h2 { margin-bottom: 14px; font-size: var(--t-md); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.panel-head h2 { font-size: var(--t-md); }
.empty { text-align: center; padding: 28px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty h3 { font-size: var(--t-md); }
.empty p { max-width: 42ch; }
.empty-line { padding: 10px 0; }

.skeleton-group { display: flex; flex-direction: column; gap: 12px; padding: 8px 0; }
.skeleton { height: 18px; border-radius: 6px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ lists & cards */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-md); text-decoration: none; color: var(--text); }
.list-row:hover { background: var(--surface-2); }
.list-row[aria-disabled] { opacity: 0.55; cursor: default; }
.row-title { font-weight: 700; font-size: var(--t-sm); text-decoration: none; }
a.row-title:hover { text-decoration: underline; }
.people-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.people-list li { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--r-md); }
.people-list li:hover { background: var(--surface-2); }
.presence-wrap { position: relative; display: inline-flex; }
.presence-wrap.is-online::after { content: ""; position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--good); border: 2px solid var(--surface); }

.art { border-radius: var(--r-md); position: relative; overflow: hidden; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.art.fill { position: absolute; inset: 0; border-radius: 0; }
.art-sm { width: 44px; height: 44px; flex: none; border-radius: var(--r-sm); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 280px); gap: 16px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.card-row > * { scroll-snap-align: start; }
.party-card { display: flex; flex-direction: column; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden; transition: border-color 0.15s, transform 0.15s var(--ease); }
.party-card:hover { border-color: var(--line); transform: translateY(-2px); }
.party-card-art { position: relative; aspect-ratio: 16 / 9; background: var(--stage); }
.party-card-art > img { width: 100%; height: 100%; object-fit: cover; }
.live-pill { position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); background: rgb(10 7 15 / 0.75); color: #fff; font-size: var(--t-xs); font-weight: 700; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgb(111 211 184 / 0.25); }
.party-card-art .tag-mature { position: absolute; right: 10px; top: 10px; background: rgb(10 7 15 / 0.75); }
.party-card-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.party-card-body h3 { font-size: var(--t-base); }
.party-card .now { display: flex; gap: 6px; align-items: center; color: var(--lamp); font-size: var(--t-sm); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.party-card-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 6px; }
.host { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--muted); }

/* ------------------------------------------------------------------ home */
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.quick { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-soft); text-decoration: none; color: var(--text); }
.quick:hover { border-color: var(--line); background: var(--surface-2); }
.quick > span { display: flex; flex-direction: column; }
.quick small { color: var(--muted); font-size: var(--t-sm); }
.quick .icon { color: var(--lamp); }
.quick-primary { background: linear-gradient(135deg, color-mix(in srgb, var(--lamp) 22%, var(--surface)), var(--surface) 70%); border-color: color-mix(in srgb, var(--lamp) 40%, var(--line-soft)); }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.home-grid .panel { margin: 0; }
.span-2 { grid-column: span 2; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }

/* ------------------------------------------------------------------ auth */
.public { min-height: 100dvh; }
.auth-page { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100dvh; }
.auth-hero { position: relative; overflow: hidden; background: radial-gradient(80% 60% at 30% 25%, #3a2648 0%, var(--bg) 70%); display: flex; flex-direction: column; justify-content: flex-end; padding: 48px; }
:root[data-theme="light"] .auth-hero { background: radial-gradient(80% 60% at 30% 25%, #e9d9f3 0%, var(--bg) 70%); }
.auth-lamp { position: absolute; left: 22%; top: 18%; width: 120px; height: 120px; border-radius: 50%; background: var(--lamp); box-shadow: 0 0 160px 60px var(--lamp-glow); opacity: 0.9; }
.auth-couch { display: flex; gap: 14px; padding: 18px 26px; border-radius: 40px 40px 18px 18px; background: color-mix(in srgb, var(--text) 8%, transparent); align-self: flex-start; margin-bottom: 28px; }
.seat { display: block; }
.auth-couch .seat { width: 54px; height: 54px; border-radius: 50%; animation: talk 4.8s ease-in-out infinite; }
@keyframes talk { 0%, 80%, 100% { box-shadow: 0 0 0 0 transparent; } 88% { box-shadow: 0 0 0 4px var(--lamp), 0 0 24px 6px var(--lamp-glow); } }
.auth-tagline { font-family: var(--font-display); font-size: var(--t-2xl); line-height: 1.1; max-width: 16ch; font-weight: 700; letter-spacing: -0.02em; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 80px); }
.auth-form { max-width: 400px; width: 100%; display: flex; flex-direction: column; }
.auth-form h1 { margin-bottom: 6px; }
.auth-form > p.muted { margin-bottom: 24px; }
.auth-switch { margin-top: 18px; font-size: var(--t-sm); color: var(--muted); }

/* ------------------------------------------------------------------ create / forms */
.create-form { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 32px; align-items: start; }
.create-form.single { grid-template-columns: minmax(0, 680px); }
.create-main { max-width: 640px; }
.create-side { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.create-art { width: 100%; aspect-ratio: 16 / 10; border-radius: var(--r-lg); }
.advanced { border-top: 1px solid var(--line-soft); padding-top: 8px; margin-bottom: 16px; }
.add-item { display: grid; grid-template-columns: 2fr 1.4fr 90px auto; gap: 8px; margin-bottom: 10px; }
.programme { list-style: none; counter-reset: prog; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.programme li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg-2); border-radius: var(--r-sm); counter-increment: prog; }
.programme li:not(.empty-line):not(.total)::before { content: counter(prog); width: 22px; color: var(--faint); font-weight: 700; font-size: var(--t-sm); }
.programme li.total, .programme li.empty-line { background: transparent; }

/* ------------------------------------------------------------------ friends / profile / settings */
.add-friend { display: flex; gap: 10px; flex-wrap: wrap; }
.search-results { list-style: none; padding: 0; margin: 8px 0 0; }
.result { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer; text-align: left; }
.result:hover { background: var(--surface-2); }
.profile-head { margin-bottom: 24px; }
.profile-head .bio { margin-top: 8px; max-width: 60ch; }
.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 24px; }
.settings-nav a { padding: 9px 12px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-weight: 700; font-size: var(--t-sm); }
.settings-nav a:hover { color: var(--text); background: var(--surface); }
.settings-nav a.on { color: var(--text); background: var(--surface); box-shadow: inset 3px 0 0 var(--lamp); }
.settings-content { max-width: 680px; }
.settings-content > h2 { margin-bottom: 12px; }
.settings-content > p.muted { margin-bottom: 18px; }
.settings-content h3 { margin: 24px 0 8px; font-size: var(--t-base); }
.settings-form { display: flex; flex-direction: column; }
.avatar-preview { margin-bottom: 16px; }
.danger-zone { border-top: 1px solid var(--line-soft); margin-top: 28px; padding-top: 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.meter { flex: 1; height: 8px; background: var(--bg-2); border-radius: var(--r-pill); overflow: hidden; border: 1px solid var(--line); }
.meter-fill { height: 100%; width: 0; background: var(--good); transition: width 0.06s linear; }
.source-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.source { padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.source-head { display: flex; align-items: center; gap: 10px; }
.source-head .btn { margin-left: auto; }

/* uploads */
.library { display: flex; flex-direction: column; gap: 10px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; border: 1.5px dashed var(--line); border-radius: var(--r-lg); text-align: center; cursor: pointer; color: var(--muted); background: var(--bg-2); }
.dropzone strong { color: var(--text); }
.dropzone:hover, .dropzone.over { border-color: var(--lamp); color: var(--text); }
.upload-progress { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upload-progress .bar { height: 6px; flex: 1 1 100%; background: var(--lamp); border-radius: var(--r-pill); width: 0; transition: width 0.2s; }
.file-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--bg-2); }
.file-row.status-unsupported .small, .file-row.status-failed .small { color: var(--bad); }
.file-row.status-processing .icon { animation: breathe 1.6s ease-in-out infinite; }

/* join */
.join-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.join-card { width: min(520px, 100%); background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 28px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.join-art { aspect-ratio: 16 / 7; border-radius: var(--r-md); }
.join-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.art.pulse { width: 64px; height: 64px; border-radius: 50%; background: var(--lamp) !important; box-shadow: 0 0 60px 16px var(--lamp-glow); animation: breathe 2.4s ease-in-out infinite; align-self: center; }

/* ------------------------------------------------------------------ dialogs, toasts, popovers */
.dialog { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--text); padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 48px); box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.6); }
.dialog-wide { width: min(760px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgb(8 5 12 / 0.6); backdrop-filter: blur(2px); }
.dialog[open] { animation: rise 0.18s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px 22px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dialog-head h2 { font-size: var(--t-md); }
.dialog-body { padding: 4px 22px 22px; }
.dialog-body h3 { font-size: var(--t-base); margin: 16px 0 8px; }
.toasts { position: fixed; z-index: 1000; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(460px, calc(100vw - 24px)); }
.toast { pointer-events: auto; padding: 11px 16px; border-radius: var(--r-md); background: var(--surface-3); color: var(--text); font-size: var(--t-sm); font-weight: 700; box-shadow: 0 12px 30px -10px rgb(0 0 0 / 0.6); animation: rise 0.2s var(--ease); border-left: 3px solid var(--muted); }
.toast-success { border-left-color: var(--good); }
.toast-error { border-left-color: var(--bad); }
.toast.leaving { opacity: 0; transition: opacity 0.25s; }
.notif-pop { position: fixed; z-index: 500; left: calc(var(--rail-w) + 8px); bottom: 70px; width: 340px; max-height: 60dvh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: 0 30px 60px -20px rgb(0 0 0 / 0.6); }
.notif-pop ul { list-style: none; margin: 0; padding: 0; }
.notif-pop li a { display: flex; flex-direction: column; padding: 10px; border-radius: var(--r-sm); text-decoration: none; font-size: var(--t-sm); }
.notif-pop li a:hover { background: var(--surface-2); }
.notif-pop li.unread a span { font-weight: 700; }
.notif-pop li.unread a { box-shadow: inset 3px 0 0 var(--lamp); }
.notice { padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-2); border: 1px solid var(--line-soft); margin-bottom: 14px; display: flex; flex-direction: column; gap: 4px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; font-size: var(--t-sm); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.on { color: var(--text); border-bottom-color: var(--lamp); }
.add-panel { min-height: 220px; }
.add-panel .row input { flex: 1; }
.result-grid { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.result-card { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; font-size: var(--t-sm); }
.result-card img { aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-sm); width: 100%; }
.result-card:hover span:first-of-type { color: var(--lamp); }
.track-list { list-style: none; padding: 0; margin: 12px 0 0; }
.track { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 0; background: transparent; cursor: pointer; border-radius: var(--r-sm); text-align: left; }
.track:hover { background: var(--surface-2); }
.track img, .track-art { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; background: var(--surface-3); }
.track .grow { display: flex; flex-direction: column; }
.play-now { margin-top: 12px; border-top: 1px solid var(--line-soft); }
.member-menu { display: flex; flex-direction: column; gap: 12px; }
.mod-tools { border-top: 1px solid var(--line-soft); padding-top: 8px; display: flex; flex-direction: column; gap: 10px; }
.mod-tools select { width: auto; flex: 1; }
.invite-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.invite-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--bg-2); border-radius: var(--r-sm); }

/* ==========================================================================
   Party room
   ========================================================================== */
.bare { min-height: 100dvh; }
.party-loading { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 16px; }
.party {
  --party-hue: 38;
  --side-w: 360px;
  height: 100dvh; display: flex; flex-direction: column; overflow: hidden;
  background: radial-gradient(70% 50% at 35% 0%, hsl(var(--party-hue) 40% 16% / 0.55), transparent 70%), var(--bg);
}
:root[data-theme="light"] .party { background: radial-gradient(70% 50% at 35% 0%, hsl(var(--party-hue) 60% 88% / 0.7), transparent 70%), var(--bg); }
.party-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; min-height: 56px; }
.party-title { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.party-title h1 { font-size: var(--t-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.party-head-actions { display: flex; gap: 6px; align-items: center; }
.party-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--side-w); gap: 12px; padding: 0 12px 12px; }
.party.side-closed .party-grid { grid-template-columns: minmax(0, 1fr) 0; gap: 0; }
.party.side-closed .party-side { display: none; }
.party-main { min-height: 0; display: flex; flex-direction: column; gap: 10px; }

/* stage: the screen in the room */
.stage-wrap {
  position: relative; flex: 1; min-height: 220px; border-radius: var(--r-lg); overflow: hidden; background: var(--stage);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.04), 0 30px 90px -40px hsl(var(--party-hue) 70% 50% / 0.55);
  display: flex; flex-direction: column;
}
.stage-box { position: relative; flex: 1; min-height: 0; display: flex; }
.stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
.stage > * { grid-area: 1 / 1; }
.media-el { width: 100%; height: 100%; object-fit: contain; background: var(--stage); }
.media-el.audio-only { height: 0; }
.stage:has(.media-el.audio-only)::before { content: ""; width: min(40%, 220px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, hsl(var(--party-hue) 70% 70%), hsl(var(--party-hue) 50% 22%)); box-shadow: 0 0 80px 10px hsl(var(--party-hue) 70% 50% / 0.35); animation: spin 18s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.yt-host, .yt-host > div, .yt-host iframe { width: 100%; height: 100%; border: 0; }
.sp-host { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px; text-align: center; color: #fff; }
.sp-art { width: min(260px, 50vmin); aspect-ratio: 1; border-radius: var(--r-md); background: hsl(var(--party-hue) 30% 20%); overflow: hidden; box-shadow: 0 30px 60px -20px rgb(0 0 0 / 0.8); }
.sp-art img { width: 100%; height: 100%; object-fit: cover; }
.sp-meta { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.sp-meta strong { font-family: var(--font-display); font-size: var(--t-lg); }
.ext-host { width: 100%; height: 100%; display: grid; place-items: center; padding: 20px; color: #fff; }
.ext-card { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; max-width: 460px; }
.ext-card h2 { font-size: var(--t-xl); }
.ext-provider { color: var(--lamp); font-weight: 700; }
.ext-clock-wrap { display: flex; flex-direction: column; align-items: center; margin-top: 6px; }
.ext-clock { font-family: var(--font-display); font-size: clamp(2.5rem, 7vw, 4.5rem); font-variant-numeric: tabular-nums; line-height: 1; }
.ext-host.counting .ext-clock { color: var(--lamp); }
.ext-status { font-size: var(--t-base); min-height: 1.5em; color: #e9e2f2; }
.ext-why { color: #cfc6dc; max-width: 40ch; }
.ext-why summary { color: #cfc6dc; }

.stage-overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; padding: 16px; }
.stage-overlay > * { pointer-events: auto; }
.stage-overlay.active { background: rgb(7 5 11 / 0.55); }
.overlay-card { background: rgb(30 24 40 / 0.92); color: #f1ecf7; border: 1px solid rgb(255 255 255 / 0.08); border-radius: var(--r-lg); padding: 22px 26px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-width: 420px; }
.overlay-card strong { font-family: var(--font-display); font-size: var(--t-md); }
.overlay-card .muted { color: #b9b0c8; }
.overlay-cta { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 30px; border-radius: var(--r-lg); border: 0; background: var(--lamp); color: var(--lamp-ink); cursor: pointer; font-weight: 700; box-shadow: 0 0 60px 10px var(--lamp-glow); }
.overlay-cta small { font-weight: 400; }
.overlay-chip { position: absolute; top: 14px; padding: 6px 14px; border-radius: var(--r-pill); background: rgb(30 24 40 / 0.85); color: #fff; font-size: var(--t-sm); font-weight: 700; }
.big-count { font-family: var(--font-display); font-size: 3rem; line-height: 1; font-variant-numeric: tabular-nums; color: var(--lamp); }

.transport { position: relative; z-index: 2; padding: 6px 14px 10px; background: linear-gradient(transparent, rgb(7 5 11 / 0.9) 40%); color: #f1ecf7; }
.seek-row { display: flex; align-items: center; gap: 10px; }
.time { font-variant-numeric: tabular-nums; font-size: var(--t-xs); min-width: 42px; }
.time.muted { color: #b9b0c8; text-align: right; }
.seek { flex: 1; height: 18px; }
.transport-row { display: flex; align-items: center; gap: 12px; }
.transport-left, .transport-right { display: flex; align-items: center; gap: 4px; }
.transport .icon-btn { color: #d9d1e6; }
.transport .icon-btn:hover { background: rgb(255 255 255 / 0.08); color: #fff; }
.play-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--lamp); color: var(--lamp-ink); display: grid; place-items: center; cursor: pointer; }
.play-btn:hover { background: var(--lamp-strong); }
.play-btn.locked, .icon-btn.locked { opacity: 0.55; }
.now-title { flex: 1; min-width: 0; font-size: var(--t-sm); }
.now-title .muted { color: #b9b0c8; }
.sync-indicator { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: var(--r-pill); border: 0; background: rgb(255 255 255 / 0.06); color: #e9e2f2; cursor: help; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.good { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.stage-wrap:fullscreen { border-radius: 0; }
.stage-wrap:fullscreen .transport { position: absolute; left: 0; right: 0; bottom: 0; opacity: 0; transition: opacity 0.25s; }
.stage-wrap:fullscreen:hover .transport, .stage-wrap:fullscreen:focus-within .transport { opacity: 1; }

/* the couch: everyone in the room, seated under the screen */
.couch {
  display: flex; gap: 14px; align-items: flex-end; overflow-x: auto; padding: 10px 18px 12px; min-height: 94px;
  border-radius: 40px 40px var(--r-lg) var(--r-lg);
  background: linear-gradient(color-mix(in srgb, var(--text) 5%, transparent), color-mix(in srgb, var(--text) 2%, transparent));
  scrollbar-width: thin;
}
.couch .seat { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; width: 70px; }
.couch .seat .avatar { box-shadow: 0 0 0 3px var(--bg); transition: box-shadow 0.12s ease-out; }
.couch .seat.speaking .avatar { box-shadow: 0 0 0 3px var(--lamp), 0 0 26px 8px var(--lamp-glow); }
.couch .seat.video { width: 168px; }
.couch .seat video { width: 168px; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--r-md); background: #000; transition: box-shadow 0.12s; }
.couch .seat video.mirror { transform: scaleX(-1); }
.couch .seat.video.speaking video { box-shadow: 0 0 0 3px var(--lamp), 0 0 26px 6px var(--lamp-glow); }
.seat-name { display: flex; align-items: center; gap: 3px; font-size: var(--t-xs); color: var(--muted); max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.seat-crown { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); padding: 0 6px; border-radius: var(--r-pill); background: var(--lamp); color: var(--lamp-ink); font-size: 10px; font-weight: 700; }
.couch.has-video { min-height: 140px; }

.controlbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); flex-wrap: wrap; }
.cb-group { display: flex; align-items: center; gap: 6px; }
.cb-media { flex: 1; max-width: 420px; }
.ctl { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 700; font-size: var(--t-sm); }
.ctl:hover { background: var(--surface-3); }
.ctl.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.ctl:disabled { opacity: 0.45; cursor: not-allowed; }
.ctl-small { min-height: 32px; padding: 0 10px; font-size: var(--t-xs); white-space: nowrap; }
.ctl-small[aria-pressed="true"] { border-color: var(--lamp); color: var(--lamp); }
.ctl-sound { background: var(--lamp); color: var(--lamp-ink); border-color: var(--lamp); box-shadow: 0 0 18px 2px var(--lamp-glow); }
.ctl-sound span { display: inline !important; }
.ctl-leave { color: var(--bad); border-color: transparent; background: transparent; }
.ctl-leave:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); }
.vol { max-width: 150px; }
.duck-chip { padding: 3px 10px; border-radius: var(--r-pill); color: var(--lamp); background: color-mix(in srgb, var(--lamp) 14%, transparent); opacity: 0; transition: opacity 0.3s; white-space: nowrap; }
.duck-chip.on { opacity: 1; }
.mesh-note { max-width: 220px; }

/* side panel */
.party-side { min-height: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden; }
.side-tabs { display: flex; padding: 6px 6px 0; gap: 2px; border-bottom: 1px solid var(--line-soft); }
.side-tab { flex: 1; display: inline-flex; justify-content: center; align-items: center; gap: 6px; padding: 10px 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; font-size: var(--t-sm); border-bottom: 2px solid transparent; }
.side-tab.on { color: var(--text); border-bottom-color: var(--lamp); }
.side-panels { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side-panels > section { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* chat */
.chat-scroll { position: relative; flex: 1; min-height: 0; display: flex; }
.chat-list { list-style: none; margin: 0; padding: 12px 8px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.msg { position: relative; display: flex; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); }
.msg:hover { background: var(--surface-2); }
.msg.grouped { padding-top: 1px; }
.msg-gutter { width: 32px; flex: none; }
.msg-main { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-head strong { font-size: var(--t-sm); }
.msg-head time { font-size: var(--t-xs); color: var(--faint); }
.msg-body { font-size: var(--t-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-quote { border-left: 2px solid var(--line); padding-left: 8px; color: var(--muted); margin: 2px 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.msg-actions { position: absolute; right: 6px; top: -14px; display: none; align-items: center; gap: 2px; padding: 2px; border-radius: var(--r-pill); background: var(--surface-3); border: 1px solid var(--line); }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { display: flex; }
.msg-actions .icon-btn { width: 28px; height: 28px; }
.react-row { display: flex; }
.react-row button { border: 0; background: transparent; cursor: pointer; padding: 2px 4px; border-radius: 6px; font-size: 15px; }
.react-row button:hover { background: var(--surface-2); }
.reactions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.reaction { border: 1px solid var(--line); background: var(--bg-2); border-radius: var(--r-pill); padding: 0 8px; font-size: var(--t-xs); cursor: pointer; line-height: 22px; }
.reaction.mine { border-color: var(--lamp); background: color-mix(in srgb, var(--lamp) 14%, transparent); }
.msg-system { text-align: center; color: var(--faint); font-size: var(--t-xs); padding: 4px 8px; }
.msg-system:empty { display: none; }
.new-pill { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); border: 0; padding: 5px 12px; border-radius: var(--r-pill); background: var(--lamp); color: var(--lamp-ink); font-weight: 700; font-size: var(--t-xs); cursor: pointer; }
.chat-notice { padding: 8px 12px; color: var(--muted); border-top: 1px solid var(--line-soft); }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-top: 1px solid var(--line-soft); background: var(--bg-2); }
.chat-compose { position: relative; display: flex; align-items: flex-end; gap: 4px; padding: 10px; border-top: 1px solid var(--line-soft); }
.chat-compose textarea { min-height: 40px; max-height: 120px; resize: none; border-radius: 20px; padding: 9px 14px; }
.send-btn { color: var(--lamp); }
.emoji-pop { position: absolute; bottom: 58px; left: 8px; z-index: 5; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; border-radius: var(--r-md); background: var(--surface-3); border: 1px solid var(--line); box-shadow: 0 12px 30px -10px rgb(0 0 0 / 0.5); }
.emoji-pop button { border: 0; background: transparent; font-size: 20px; padding: 4px; border-radius: 6px; cursor: pointer; }
.emoji-pop button:hover { background: var(--surface-2); }

/* queue */
.queue-body, .people-body { overflow-y: auto; padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.q-section-head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; }
.q-section-head h3, .people-body h3 { font-size: var(--t-sm); color: var(--muted); margin-top: 6px; }
.q-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.q-item { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-sm); }
.q-item:hover { background: var(--surface-2); }
.q-item.current { background: color-mix(in srgb, var(--lamp) 10%, transparent); box-shadow: inset 3px 0 0 var(--lamp); }
.q-item[draggable="true"] { cursor: grab; }
.q-item.dragging { opacity: 0.4; }
.q-item.drop-target { box-shadow: inset 0 2px 0 var(--lamp); }
.q-thumb { width: 64px; height: 36px; border-radius: 4px; object-fit: cover; flex: none; background: var(--surface-3); }
.q-icon { display: grid; place-items: center; color: var(--muted); }
.q-bad { color: var(--bad); font-weight: 700; }
.q-actions { display: flex; opacity: 0.5; }
.q-item:hover .q-actions, .q-item:focus-within .q-actions { opacity: 1; }
.q-actions .icon-btn { width: 30px; height: 30px; }
.q-history { margin-top: 8px; }
.marathon-progress { padding: 12px; background: var(--bg-2); border-radius: var(--r-md); display: flex; flex-direction: column; gap: 8px; }
.mp-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.mp-bar { display: flex; gap: 3px; }
.mp-bar span { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); }
.mp-bar span.done { background: color-mix(in srgb, var(--lamp) 55%, var(--surface-3)); }
.mp-bar span.now { background: var(--lamp); box-shadow: 0 0 10px var(--lamp-glow); }

/* people */
.invite-box { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.waitlist { padding: 10px; border-radius: var(--r-md); background: color-mix(in srgb, var(--lamp) 8%, transparent); }
.member-list li.speaking .avatar { box-shadow: 0 0 0 2px var(--lamp); }
.member-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.role { color: var(--lamp); font-weight: 700; }
.sync-chip { font-variant-numeric: tabular-nums; }
.sync-chip.good { color: var(--good); }
.sync-chip.warn { color: var(--warn); }
.sync-chip.bad { color: var(--bad); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  :root { --rail-w: 76px; }
  .rail { padding: 18px 10px; align-items: center; }
  .rail .brand-word { font-size: 0; padding: 0 0 18px; }
  .rail .brand-word::before { width: 18px; height: 18px; }
  .rail ul a, .rail-bell, .rail-me { justify-content: center; padding: 10px; position: relative; }
  .rail ul a span, .rail-bell > span:not(.badge), .rail-me span { display: none; }
  .rail-bell .badge { position: absolute; top: 2px; right: 2px; }
  .party { --side-w: 320px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 50; bottom: 0; left: 0; right: 0; top: auto; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line-soft); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px); }
  .rail .brand-word, .rail-foot { display: none; }
  .rail ul { flex-direction: row; justify-content: space-around; width: 100%; }
  .rail ul li:nth-child(n+6) { display: none; }
  .rail ul a { position: relative; }
  .rail ul a .badge { position: absolute; top: 0; right: 4px; }
  .rail ul a { flex-direction: column; gap: 2px; padding: 6px 10px; font-size: 10px; }
  .rail ul a span { display: block; }
  .topbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
  .small-brand { font-size: var(--t-md); padding: 0; }
  .main { padding: 20px 16px 96px; }
  .notif-pop { left: 12px; right: 12px; width: auto; top: 56px; bottom: auto; }
  .quick-actions, .home-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { min-height: 220px; padding: 24px; }
  .auth-tagline { font-size: var(--t-xl); }
  .auth-lamp { width: 70px; height: 70px; left: auto; right: 14%; top: 18%; }
  .auth-panel { padding: 24px 16px 40px; }
  .create-form { grid-template-columns: 1fr; }
  .create-side { position: static; order: -1; }
  .create-art { aspect-ratio: 16 / 5; }
  .settings { grid-template-columns: 1fr; gap: 12px; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .settings-nav a { white-space: nowrap; }
  .settings-nav a.on { box-shadow: inset 0 -2px 0 var(--lamp); }
  .grid-2, .add-item { grid-template-columns: 1fr; }

  /* party: player on top, panel below, controls docked */
  .party { height: auto; min-height: 100dvh; overflow: visible; }
  .party-head { position: sticky; top: 0; z-index: 10; background: var(--bg); }
  .party-head .tag { display: none; }
  .party-grid, .party.side-closed .party-grid { display: flex; flex-direction: column; padding: 0 0 76px; gap: 0; }
  .party-main { gap: 0; }
  .stage-wrap { flex: none; min-height: 0; border-radius: 0; position: sticky; top: 56px; z-index: 5; }
  .stage-box { flex: none; aspect-ratio: 16 / 9; }
  .stage-wrap:has(.ext-host), .stage-wrap:has(.sp-host) { position: relative; top: 0; }
  .stage-box:has(.ext-host), .stage-box:has(.sp-host) { aspect-ratio: auto; min-height: 340px; }
  .overlay-card { padding: 14px 16px; gap: 8px; }
  .overlay-card p { font-size: var(--t-sm); }
  .transport { padding: 4px 10px 6px; }
  .now-title { display: none; }
  .sync-text { display: none; }
  .couch { border-radius: 0; min-height: 80px; padding: 10px 12px; }
  .controlbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; border-radius: 0; border-width: 1px 0 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); flex-wrap: nowrap; }
  .ctl span { display: none; }
  .ctl { padding: 0 12px; }
  .cb-media .vol, .duck-chip, .mesh-note, .ctl-small { display: none; }
  .party-side, .party.side-closed .party-side { display: flex; border-radius: 0; border-width: 1px 0 0; min-height: 60dvh; }
  .chat-list { max-height: none; }
}
@media (max-width: 420px) {
  .party-head-actions .btn { display: none; }
  .couch .seat.video, .couch .seat video { width: 132px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media (forced-colors: active) {
  .couch .seat.speaking .avatar, .couch .seat.speaking video { outline: 3px solid CanvasText; }
}

/* ---------------------------------------------------------------- Phase 2: party rules, profiles, screens, admin */
.host-away { padding: 10px 14px; border-radius: var(--r-md); background: color-mix(in srgb, var(--warn) 18%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); font-size: var(--t-sm); font-weight: 600; }
.screen-approved { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); font-size: var(--t-sm); }
.screen-approved span { flex: 1; }

.focus-wrap { display: none; }
.party.focusing .focus-wrap { display: flex; flex: 1; min-height: 0; }
.party.focusing .stage-wrap { flex: 0 0 32%; }
.focus-view { position: relative; flex: 1; min-height: 0; display: flex; border-radius: var(--r-lg); overflow: hidden; background: #000; }
.focus-view video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.focus-view video.mirror { transform: scaleX(-1); }
.focus-view:fullscreen { border-radius: 0; }
.focus-bar { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border-radius: var(--r-pill); background: rgb(12 9 18 / 0.72); color: #f1ecf7; font-size: var(--t-sm); }
.focus-bar .avatar { flex: none; }
.focus-bar > span:not(.avatar) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-bar .icon-btn { color: #e9e2f2; }

.couch .seat { cursor: pointer; }
.couch .seat:focus-visible { outline: 2px solid var(--lamp); outline-offset: 4px; border-radius: var(--r-md); }
.seat-screen { position: absolute; top: 4px; left: 4px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--lamp); color: var(--lamp-ink); }
.seat-focus, .seat-info { position: absolute; top: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgb(12 9 18 / 0.7); color: #fff; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.seat-focus { right: 4px; }
.seat-info { right: 32px; }
.couch .seat:not(.video) .seat-info { right: -4px; top: -4px; }
.couch .seat:hover .seat-focus, .couch .seat:hover .seat-info, .seat-focus:focus-visible, .seat-info:focus-visible { opacity: 1; }
@media (hover: none) { .seat-focus, .seat-info { opacity: 1; } }

/* Just Chatting: no player, the room is the stage */
.party.chat-mode .stage-wrap, .party.chat-mode .cb-media { display: none; }
.party.chat-mode .couch { flex: 1; min-height: 0; flex-wrap: wrap; align-content: center; justify-content: center; align-items: center; gap: 18px; border-radius: var(--r-lg); overflow-y: auto; }
.party.chat-mode .couch .seat { width: 120px; }
.party.chat-mode .couch .seat .avatar { width: 96px !important; height: 96px !important; font-size: 36px !important; }
.party.chat-mode .couch .seat.video { width: min(46%, 420px); }
.party.chat-mode .couch .seat.video video { width: 100%; }
.party.chat-mode.focusing .couch { flex: 0 0 auto; flex-wrap: nowrap; justify-content: flex-start; }

.member-open, .msg-avatar-btn { padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; }
.link-btn, .msg-name { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
.link-btn:hover, .msg-name:hover { text-decoration: underline; }
.tag-guest { margin-left: 6px; }
.profile-card-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.profile-card-head .big { font-size: var(--t-lg, 1.15rem); }
.profile-bio { white-space: pre-wrap; }
.guest-perms { padding-left: 28px; }
.guest-form { margin: 10px 0; }

.rail-community { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); color: var(--muted); font-size: var(--t-sm); }
.rail-community:hover { background: var(--surface-2); color: var(--text); }

.admin-tabs { margin-bottom: 16px; display: inline-flex; }
.admin-tabs a { padding: 7px 14px; border-radius: var(--r-pill); color: var(--muted); }
.admin-tabs a.on { background: var(--surface-3); color: var(--text); }
.admin-filters { margin-bottom: 12px; gap: 10px; }
.admin-filters input { flex: 1; }
.admin-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.admin-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-soft); }
.stat-value { font-family: var(--font-display); font-size: 1.6rem; }
.stat-label { color: var(--muted); font-size: var(--t-sm); }
.check-list { padding-left: 18px; line-height: 1.8; }
@media (max-width: 720px) {
  .admin-table thead { display: none; }
  .admin-table tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .admin-table td { display: block; border: 0; padding: 2px 0; }
  .party.focusing .stage-wrap { flex-basis: 28%; }
}

/* ---------------------------------------------------------------- TV receiver and casting */
html.tv-mode, html.tv-mode body { background: #07050b; overflow: hidden; }
.tv { position: fixed; inset: 0; display: grid; place-items: center; color: #f1ecf7; }
.tv-card { max-width: 900px; padding: 40px; text-align: center; display: grid; gap: 18px; justify-items: center; }
.tv-card h1 { font-size: clamp(2rem, 4vw, 3.4rem); margin: 0; }
.tv-card .muted { color: #b9b0c8; font-size: 1.15rem; }
.tv-steps { text-align: left; font-size: 1.4rem; line-height: 1.7; }
.tv-code { font-family: var(--font-display); font-size: clamp(3rem, 9vw, 7rem); letter-spacing: 0.08em; padding: 12px 34px; border-radius: 24px; background: rgb(255 255 255 / 0.06); color: var(--lamp); font-variant-numeric: tabular-nums; }
.tv-owner { display: flex; align-items: center; gap: 12px; font-size: 1.3rem; }
.tv-party { position: fixed; inset: 0; background: #000; }
.tv-stage { position: absolute; inset: 0; }
.tv-stage .media-el, .tv-stage iframe { width: 100%; height: 100%; }
.tv-head { position: absolute; top: 0; left: 0; right: 0; padding: 18px 28px; background: linear-gradient(rgb(0 0 0 / 0.7), transparent); font-size: 1.25rem; opacity: 0.9; pointer-events: none; }
.tv-head .muted { color: #b9b0c8; }
.tv-overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.tv-overlay:empty { display: none; }
.tv-chat { position: absolute; right: 28px; bottom: 28px; width: min(34vw, 520px); list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; pointer-events: none; }
.tv-chat li { padding: 10px 14px; border-radius: 14px; background: rgb(12 9 18 / 0.72); font-size: 1.15rem; transition: opacity 1.2s; }
.tv-chat li.fade { opacity: 0; }
.tv-start { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 1.5rem; }
.tv-chip { padding: 4px 10px; border-radius: var(--r-pill); background: rgb(255 255 255 / 0.08); color: #e9e2f2; }
.code-input { font-family: var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; }

/* TikTok is portrait: centre it on the stage */
.tiktok-frame { display: block; height: 100%; aspect-ratio: 9 / 16; max-width: 100%; margin: 0 auto; border: 0; background: #000; }
.stage:has(.tiktok-frame) { display: flex; justify-content: center; background: #000; }

/* chat pictures and videos */
.chat-attachment { margin-top: 4px; }
.chat-image { display: block; max-width: 100%; max-height: 260px; border-radius: var(--r-md); cursor: zoom-in; background: var(--surface-2); }
.chat-image-full { display: block; max-width: 100%; max-height: 80vh; margin: 0 auto; }
.chat-video { display: block; width: 100%; max-height: 300px; border-radius: var(--r-md); background: #000; }
.chat-uploads { display: grid; gap: 6px; padding: 0 10px; }
.chat-uploads .upload-progress { display: flex; align-items: center; gap: 8px; position: relative; padding: 6px 8px; border-radius: var(--r-md); background: var(--surface-2); overflow: hidden; }
.chat-uploads .upload-progress .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: color-mix(in srgb, var(--lamp) 22%, transparent); transition: width 0.2s; }
.chat-uploads .upload-progress span { position: relative; flex: 1; }
.chat.drop-over { outline: 2px dashed var(--lamp); outline-offset: -6px; }

/* apps page */
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 26px; }
.app-card { display: grid; gap: 6px; padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-soft); color: var(--text); text-decoration: none; }
.app-card:hover { border-color: var(--lamp); }
.app-card .icon { color: var(--lamp); }
.apps-notes { max-width: 720px; }
.apps-notes h2 { font-size: 1.1rem; margin-top: 22px; }

/* ---------------------------------------------------------------- chat polls */
.poll { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 10px; display: grid; gap: 8px; max-width: 360px; }
.poll-q { display: flex; gap: 6px; align-items: flex-start; }
.poll-q svg { flex: none; margin-top: 2px; color: var(--lamp); }
.poll-opts { display: grid; gap: 6px; }
.poll-opt { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.poll-opt:disabled { cursor: default; }
.poll-opt:not(:disabled):hover { border-color: var(--lamp); }
.poll-opt.picked { border-color: var(--lamp); }
.poll-opt.winner { font-weight: 700; }
.poll-fill { position: absolute; inset: 0 auto 0 0; background: var(--lamp-glow); transition: width .3s ease; pointer-events: none; }
.poll-label, .poll-count { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.poll-count { font-variant-numeric: tabular-nums; color: var(--muted); }
.poll-foot { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.poll-foot .link-btn { margin-left: auto; color: var(--lamp); }
.poll-edit-options { display: grid; gap: 6px; margin-bottom: 6px; }
.poll-edit-row { display: flex; gap: 6px; align-items: center; }
.poll-edit-row input { flex: 1; }
.poll-form { display: grid; gap: 12px; min-width: min(420px, 80vw); }
@media (prefers-reduced-motion: reduce) { .poll-fill { transition: none; } }

/* ---------------------------------------------------------------- scroll mode */
.scroll-gesture, .scroll-rail, .scroll-peek { display: none; }
.scroll-toggle.on { color: var(--lamp); }
.party.scroll-mode .stage-box { flex: 1 1 auto; align-self: center; aspect-ratio: 9 / 16; width: auto; max-width: 100%; background: #000; }
.party.scroll-mode .stage-wrap { background: radial-gradient(ellipse at center, hsl(var(--party-hue) 40% 14%), var(--stage) 70%); }
.party.scroll-mode .scroll-gesture { display: block; position: absolute; inset: 0; z-index: 1; cursor: pointer; touch-action: none; }
.party.scroll-mode .stage-overlay { z-index: 2; }
.party.scroll-mode .scroll-rail { display: flex; flex-direction: column; align-items: center; gap: 8px; position: absolute; right: -64px; top: 50%; transform: translateY(-50%); z-index: 3; }
.party.scroll-mode .scroll-peek { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 14px 0; color: #f1ecf7; min-height: 30px; }
.scroll-peek img { width: 22px; height: 30px; object-fit: cover; border-radius: 4px; }
.scroll-peek .link-btn { color: var(--lamp); margin-left: 6px; }
.rail-btn { width: 46px; height: 46px; border-radius: 50%; background: rgb(255 255 255 / 0.1); color: #fff; }
.rail-btn:not(:disabled):hover { background: rgb(255 255 255 / 0.2); }
.rail-btn:disabled { opacity: 0.35; }
.rail-up svg { transform: rotate(90deg); }
.rail-down svg { transform: rotate(90deg); }
.rail-count { color: rgb(255 255 255 / 0.75); font-variant-numeric: tabular-nums; }
.rail-browse { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 10px; padding: 8px 6px; border: 0; border-radius: 12px; background: rgb(255 255 255 / 0.1); color: #fff; font: inherit; font-size: 11px; cursor: pointer; width: 64px; }
.rail-browse:hover { background: rgb(255 255 255 / 0.2); }
.stage-box.swipe-up .stage { animation: swipe-up .35s ease-out; }
.stage-box.swipe-down .stage { animation: swipe-down .35s ease-out; }
@keyframes swipe-up { from { transform: translateY(14%); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes swipe-down { from { transform: translateY(-14%); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .stage-box.swipe-up .stage, .stage-box.swipe-down .stage { animation: none; } }
@media (max-width: 760px) {
  .party.scroll-mode .stage-box { aspect-ratio: 9 / 16; height: min(72dvh, 160vw); flex: none; }
  .party.scroll-mode .scroll-rail { right: 8px; top: auto; bottom: 12px; transform: none; }
  .party.scroll-mode .rail-count { display: none; }
}

/* browse dialog */
.browse { display: grid; gap: 12px; }
.browse-body { display: grid; gap: 10px; min-height: 200px; max-height: 60vh; overflow: auto; }
.browse-body textarea { width: 100%; }
.feed-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.feed-card { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 4px; border: 2px solid transparent; border-radius: 12px; background: transparent; color: inherit; text-align: left; cursor: pointer; font: inherit; font-size: var(--t-sm); }
.feed-card:hover { background: var(--surface-2); }
.feed-card.on { border-color: var(--lamp); background: var(--surface-2); }
.feed-thumb { position: relative; display: block; aspect-ratio: 9 / 12; border-radius: 8px; overflow: hidden; background: var(--surface-3); }
.feed-thumb img { width: 100%; height: 100%; object-fit: cover; }
.feed-dur { position: absolute; right: 6px; bottom: 6px; padding: 1px 5px; border-radius: 4px; background: rgb(0 0 0 / 0.75); color: #fff; font-size: 11px; }
.feed-check { position: absolute; left: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgb(0 0 0 / 0.5); color: transparent; border: 2px solid #fff; }
.feed-card.on .feed-check { background: var(--lamp); color: var(--lamp-ink); border-color: var(--lamp); }
.browse-foot { position: sticky; bottom: 0; }
.row-center { display: flex; justify-content: center; }

/* ---------------------------------------------------------------- VR */
.vr-btn.on { color: var(--lamp); }
.vr-canvas { position: fixed; inset: 0; z-index: 200; width: 100vw; height: 100vh; display: block; }
.vr-canvas:not(.vr-preview) { visibility: hidden; }
.vr-preview { cursor: grab; touch-action: none; }
.vr-close { position: fixed; top: 16px; right: 16px; z-index: 201; }

/* ---------------------------------------------------------------- watch together (live share) */
.live-view { position: absolute; inset: 0; z-index: 5; background: #000; display: flex; flex-direction: column; }
.live-view video { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #000; }
.live-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: rgb(7 5 11 / 0.92); color: #f1ecf7; font-size: var(--t-sm); }
.live-badge { display: inline-flex; align-items: center; gap: 6px; flex: none; font-weight: 800; letter-spacing: .06em; color: #ff6b6b; font-size: 12px; }
.live-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #ff4d4d; box-shadow: 0 0 0 3px rgb(255 77 77 / 0.25); animation: live-pulse 1.6s ease-in-out infinite; }
@keyframes live-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-badge::before { animation: none; } }
.live-wait { flex: 1; display: grid; place-content: center; text-align: center; gap: 6px; padding: 24px; color: #f1ecf7; }
.party.live-mode .transport, .party.live-mode .scroll-rail, .party.live-mode .scroll-peek, .party.live-mode .scroll-gesture { display: none; }
.party.live-mode .stage-box { aspect-ratio: auto; align-self: stretch; }
.live-view:fullscreen .live-bar { position: absolute; left: 0; right: 0; bottom: 0; opacity: 0; transition: opacity .25s; }
.live-view:fullscreen:hover .live-bar { opacity: 1; }

.watch { display: grid; gap: 14px; }
.watch-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; counter-reset: s; }
.watch-steps li { counter-increment: s; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.watch-steps li::before { content: counter(s) ". "; }
.watch-steps li.on { background: var(--lamp); color: var(--lamp-ink); font-weight: 700; }
.watch-steps li.done { color: var(--text); }
.watch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.watch-tile { position: relative; min-height: 72px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 4px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: linear-gradient(135deg, color-mix(in srgb, var(--tile) 55%, transparent), var(--surface-2)); color: #fff; font: inherit; cursor: pointer; text-align: left; }
.watch-tile:hover, .watch-tile:focus-visible { border-color: var(--lamp); }
.watch-tile.last { box-shadow: 0 0 0 2px var(--lamp); }
.watch-tile-name { font-weight: 800; text-shadow: 0 1px 2px rgb(0 0 0 / .5); }
.watch-tile-tag { position: absolute; top: 8px; right: 8px; font-size: 11px; padding: 1px 6px; border-radius: 999px; background: rgb(0 0 0 / .45); }
.watch-now { display: grid; gap: 6px; }
.notice-warn { border-color: color-mix(in srgb, var(--warn) 60%, var(--line)); }
.btn-big { min-height: 48px; font-size: var(--t-md); justify-self: start; }

/* ---------------------------------------------------------------- badges */
.badges { display: inline-flex; gap: 4px; vertical-align: middle; margin-left: 6px; }
.badge-chip { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .04em; line-height: 1.5; color: #fff; }
.badges-md .badge-chip { font-size: 13px; padding: 2px 10px; }
.badge-og { background: #2fbf71; color: #062612; box-shadow: 0 0 0 1px rgb(47 191 113 / .35), 0 0 12px -2px rgb(47 191 113 / .6); }
.badge-staff { background: var(--lamp); color: var(--lamp-ink); }
.badge-supporter { background: #b69cff; color: #1b1033; }

/* ---------------------------------------------------------------- rail badges */
.rail ul a { position: relative; }
.rail ul a .badge { margin-left: auto; }

/* ---------------------------------------------------------------- profile banner */
.profile-banner-wrap { border-radius: var(--r-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--line-soft); }
.profile-banner { aspect-ratio: 3 / 1; max-height: 260px; width: 100%; background-size: cover; background-position: center; }
.profile-banner-row { display: flex; gap: 16px; align-items: flex-end; padding: 0 20px 16px; flex-wrap: wrap; }
.profile-banner-avatar { margin-top: -44px; border-radius: 50%; padding: 4px; background: var(--surface); display: inline-flex; }
.profile-banner-row h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.profile-info { padding: 14px 4px 0; display: grid; gap: 10px; }
.profile-preview { max-width: 560px; }
.profile-preview h1 { font-size: var(--t-lg); }
.row.wrap { flex-wrap: wrap; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }

/* ---------------------------------------------------------------- messages */
.dm { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; height: calc(100dvh - 120px); min-height: 480px; }
.dm-side { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden; }
.dm-side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.dm-side-head h1 { font-size: var(--t-lg); }
.dm-threads { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.dm-thread { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-md); color: inherit; text-decoration: none; }
.dm-thread:hover, .dm-thread.on { background: var(--surface-2); }
.dm-thread.unread .row-title { font-weight: 800; }
.dm-thread-text { display: flex; flex-direction: column; min-width: 0; }
.dm-thread-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dm-empty { padding: 16px; }
.dm-pane { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden; }
.dm-pane > .empty { margin: auto; }
.dm-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.dm-who { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.dm-who > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.dm-back { display: none; }
.dm-list { list-style: none; margin: 0; padding: 16px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.dm-day { align-self: center; padding: 8px 0 4px; }
.dm-more { align-self: center; }
.dm-msg { display: flex; align-items: center; gap: 6px; max-width: min(78%, 560px); position: relative; }
.dm-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.dm-bubble { background: var(--surface-2); border-radius: 18px 18px 18px 6px; padding: 8px 12px; display: grid; gap: 2px; }
.dm-msg.mine .dm-bubble { background: color-mix(in srgb, var(--lamp) 22%, var(--surface-2)); border-radius: 18px 18px 6px 18px; }
.dm-bubble time { color: var(--muted); font-size: 11px; justify-self: end; }
.dm-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.dm-msg .msg-actions { opacity: 0; transition: opacity .15s; }
.dm-msg:hover .msg-actions, .dm-msg:focus-within .msg-actions { opacity: 1; }
.dm-seen { align-self: flex-end; }
.dm-card { display: flex; align-items: center; gap: 10px; min-width: 240px; }
.dm-call-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); }
.dm-call.call-missed .dm-call-icon, .dm-call.call-declined .dm-call-icon, .dm-call.call-cancelled .dm-call-icon { color: var(--bad); }
.dm-call.call-answered .dm-call-icon { color: var(--good); }
.dm-notice { padding: 0 16px; }
.dm-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line-soft); }
.dm-compose textarea { flex: 1; resize: none; min-height: 40px; }
@media (max-width: 900px) {
  .dm { grid-template-columns: 1fr; height: calc(100dvh - 160px); }
  .dm.has-thread .dm-side { display: none; }
  .dm:not(.has-thread) .dm-pane { display: none; }
  .dm-back { display: inline-flex; }
  .dm-msg { max-width: 90%; }
}

/* ---------------------------------------------------------------- calls */
.call-ring { position: fixed; z-index: 300; top: 16px; right: 16px; width: min(380px, calc(100vw - 32px)); display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 20px 60px -20px rgb(0 0 0 / .7); animation: ring-in .25s ease-out; }
.call-ring .row { gap: 8px; }
.call-ring-avatar { display: inline-flex; border-radius: 50%; box-shadow: 0 0 0 0 rgb(47 191 113 / .6); animation: ring-pulse 1.5s infinite; }
.call-ring-avatar.pulse { width: 72px; height: 72px; align-items: center; justify-content: center; background: var(--surface-2); color: var(--good); }
@keyframes ring-pulse { 0% { box-shadow: 0 0 0 0 rgb(47 191 113 / .55); } 70% { box-shadow: 0 0 0 16px rgb(47 191 113 / 0); } 100% { box-shadow: 0 0 0 0 rgb(47 191 113 / 0); } }
@keyframes ring-in { from { transform: translateY(-12px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .call-ring, .call-ring-avatar { animation: none; } }
.btn-call-accept { background: #2fbf71; border-color: #2fbf71; color: #062612; }
.btn-call-accept:hover { background: #3fd683; }
.btn-call-decline { background: var(--danger); border-color: var(--danger); color: #fff; }
.call-overlay { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 16px; text-align: center; }
.party.call-mode .ctl-leave { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ---------------------------------------------------------------- party apps */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.app-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface-2); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.app-tile:hover, .app-tile:focus-visible { border-color: var(--tile); }
.app-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--tile) 22%, transparent); color: var(--tile); }
.app-name { font-weight: 800; }
.yt-app { display: grid; gap: 12px; }
.yt-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; max-height: 58vh; overflow-y: auto; }
.yt-card { position: relative; }
.yt-watch { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.yt-thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--surface-3); }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.yt-play { position: absolute; inset: 0; display: grid; place-items: center; background: rgb(0 0 0 / .35); color: #fff; opacity: 0; transition: opacity .15s; }
.yt-watch:hover .yt-play, .yt-watch:focus-visible .yt-play { opacity: 1; }
.yt-title { font-weight: 700; font-size: var(--t-sm); }
.yt-add { position: absolute; top: 6px; right: 6px; background: rgb(0 0 0 / .6); color: #fff; }

/* ---------------------------------------------------------------- upcoming (scheduled parties) */
.upcoming { margin-bottom: 20px; }
.upcoming h2 { display: flex; align-items: center; gap: 6px; font-size: var(--t-md); margin-bottom: 10px; }
.upcoming-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 300px); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.upcoming-card { display: flex; flex-direction: column; border-radius: var(--r-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--line-soft); }
.upcoming-art { position: relative; display: block; aspect-ratio: 16 / 7; }
.upcoming-art .art { width: 100%; height: 100%; }
.upcoming-when { position: absolute; left: 10px; bottom: 10px; padding: 3px 10px; border-radius: 999px; background: rgb(0 0 0 / .65); color: #fff; font-size: 12px; font-weight: 700; }
.upcoming-body { padding: 12px 14px; display: grid; gap: 6px; }

/* ---------------------------------------------------------------- your media */
.media-list { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; }
.media-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); }
.media-row:hover { background: var(--surface-2); }
.media-row .row-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.media-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.media-icon.kind-movie { color: #7fc8f8; } .media-icon.kind-show { color: #b69cff; } .media-icon.kind-music { color: #7ddba3; }
.media-group h2 { display: flex; align-items: baseline; gap: 6px; }
.media-group h3 { margin: 10px 0 2px; }
.media-collections { margin-top: 8px; align-items: center; }
.chip-small { padding: 3px 10px; font-size: var(--t-xs); }
.tag-small { padding: 0 7px; font-size: 11px; }
.tag-guess { background: transparent; border: 1px dashed var(--line); }
.icon-btn.fav.on { color: var(--lamp); }
.icon-btn.fav.on svg path { fill: currentColor; }
.media-body { margin-top: 14px; }
.chips .chip { display: inline-flex; align-items: center; gap: 5px; }
@media (max-width: 600px) { .hide-sm { display: none; } }

/* ---------------------------------------------------------------- continue as guest */
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: var(--t-sm); margin: 4px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-guest-note { margin-top: -4px; text-align: center; }
.guest-card { display: grid; gap: 6px; padding: 12px; margin: 4px 0 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-soft); }
@media (max-width: 1180px) { .guest-card { display: none; } }

/* ---------------------------------------------------------------- controlling the shared tab */
.live-ctl { display: inline-flex; align-items: center; gap: 6px; }
.live-tools { display: inline-flex; align-items: center; gap: 2px; }
.live-tools .icon-btn { color: #f1ecf7; }
.live-zoom { min-width: 3.5em; text-align: center; font-variant-numeric: tabular-nums; color: #f1ecf7; }
.live-tools .link-btn { color: var(--lamp); margin-left: 4px; }
.live-ctl-note { display: inline-flex; align-items: center; gap: 4px; }
.live-hint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); padding: 4px 12px; border-radius: 999px; background: rgb(7 5 11 / .75); color: #f1ecf7; pointer-events: none; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.live-view { position: absolute; }
@media (max-width: 760px) { .live-ctl-note { display: none; } }
.live-hint { animation: hint-fade .6s ease 7s forwards; }
@keyframes hint-fade { to { opacity: 0; } }

/* ---------------------------------------------------------------- the viewer's local time in a party */
.party-clock { margin-left: 4px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-weight: 700; font-size: var(--t-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------------------------------------------------------- shared libraries */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.lib-card { display: flex; gap: 14px; align-items: flex-start; color: inherit; text-decoration: none; padding: 14px; transition: border-color .15s, transform .15s; }
.lib-card:hover { border-color: var(--lamp); transform: translateY(-1px); }
.lib-card h2 { font-size: 1.05rem; margin: 0 0 2px; }
.lib-art { width: 56px; height: 56px; flex: none; border-radius: var(--r-md); }
.avatar-stack { display: flex; margin: 8px 0; }
.avatar-stack > * { margin-right: -6px; box-shadow: 0 0 0 2px var(--surface); border-radius: 50%; }
.lib-usage { display: grid; gap: 4px; margin-top: 6px; }
.lib-usage .meter span { display: block; height: 100%; background: var(--lamp); border-radius: inherit; }
.lib-head { align-items: center; gap: 14px; }
.lib-head h1 { margin: 0; }
.lib-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.lib-main { display: grid; gap: 12px; min-width: 0; }
.lib-members { padding: 14px; display: grid; gap: 10px; position: sticky; top: 16px; }
.lib-members h2 { font-size: 1rem; margin: 0; }
.lib-member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lib-member-list a { color: inherit; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lib-upload { padding: 14px; display: grid; gap: 10px; }
.dropzone-small { padding: 18px 14px; }
.lib-uploads { display: grid; gap: 8px; }
.lib-uploads .upload-progress { padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-2); }
.lib-uploads .bar-wrap { flex: 1 1 100%; height: 6px; background: var(--bg-2); border-radius: var(--r-pill); overflow: hidden; }
.lib-uploads .bar-wrap .bar { flex: none; height: 100%; }
.lib-storage { display: inline-flex; align-items: center; gap: 5px; margin-top: 2px; color: var(--muted); }
.lib-storage-compressed { color: var(--good); }
.lib-storage-packing { color: var(--lamp); }
.pick-list { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.pick-row { display: flex; align-items: center; gap: 8px; }
.lib-picker { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 12px; }
.lib-picker select { max-width: 50%; }
@media (max-width: 900px) {
  .lib-layout { grid-template-columns: 1fr; }
  .lib-members { position: static; order: -1; }
  .lib-head { flex-wrap: wrap; }
}

/* The verified badge: a purple chip with a blue tick (only administrators can give it). */
.badge-verified { background: #7b3fe4; padding: 2px; width: 18px; height: 18px; justify-content: center; box-shadow: 0 0 0 1px rgb(123 63 228 / .4), 0 0 10px -2px rgb(123 63 228 / .7); }
.badge-verified .verified-tick { width: 14px; height: 14px; display: block; }
.badges-md .badge-verified { width: 24px; height: 24px; padding: 3px; }
.badges-md .badge-verified .verified-tick { width: 18px; height: 18px; }
