/* ============================================================================
   CHIDEOUT — design system (spy light gray + bright teal; dark mode = night ops)
   A Reddit / YikYak-style social layout: sticky top bar, left navigation,
   center feed of cards, right community sidebar, bottom tab bar on mobile.
   ============================================================================ */

:root {
  color-scheme: dark;

  /* "night ops": deep slate; accents are an off-white tinted with the brand ink (#201f2c itself is too dark to see here) */
  --bg: #0a1013;
  --surface: #111a1e;
  --surface-2: #172227;
  --surface-3: #1f2c32;
  --hover: rgba(190, 186, 230, 0.05);
  --border: #22313a;
  --border-strong: #31444e;

  --text: #e4eef0;
  --text-2: #a9bbc0;
  --muted: #7d9198;

  --brand: #dcdbe6;
  --up: #10b981;
  /* The logo's own colours (tile gradient, ink on it, and the wordmark's "hide"). logo-mark.js swaps them for a person's chosen logo colour. */
  --logo-a: #343249; --logo-b: #16151f; --logo-ink: #ffffff;
  --brand-2: #b6b4c6;
  --brand-ink: #15141d;
  --brand-text: #e8e7f0;
  --brand-soft: rgba(220, 219, 230, 0.10);

  /* Downvotes are orange (they push posts toward the Graveyard) so they never look like an upvote */
  --down: #ff8f5a;
  --down-soft: rgba(255, 143, 90, 0.16);
  --alias: #b98cff;
  --alias-soft: rgba(185, 140, 255, 0.15);
  --ok: #3ddc97;
  --ok-soft: rgba(61, 220, 151, 0.13);
  --warn: #ffb547;
  --warn-soft: rgba(255, 181, 71, 0.14);
  --danger: #ff5470;
  --danger-soft: rgba(255, 84, 112, 0.14);
  --pub: #b98cff;
  --priv: #52b4ff;
  --grave: #93a4ab;
  --quick: #ff9d4d;
  --truce: #2fd08a;
  --victory: #f2b84b;
  --victory-soft: rgba(242, 184, 75, 0.14);
  --burn: #ff7a3d;
  --burn-soft: rgba(255, 122, 61, 0.15);

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --r-pill: 999px;

  --topbar-h: 56px;
  --tabbar-h: 62px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Light is the default theme. Dark is opt-in: <html data-theme="dark"> (set by /theme.js from the menu toggle). */
:root:not([data-theme="dark"]) {
  color-scheme: light;

  /* "spy" light gray with deep ink-navy (#201f2c) */
  --bg: #e7ecee;
  --surface: #ffffff;
  --surface-2: #f0f3f5;
  --surface-3: #e2e8eb;
  --hover: rgba(10, 30, 36, 0.05);
  --border: #d5dde1;
  --border-strong: #bfcad0;

  --text: #0e1a1e;
  --text-2: #33454c;
  --muted: #627379;

  --brand: #201f2c;
  --brand-2: #12111a;
  --brand-ink: #ffffff;
  --up: #10b981;
  --brand-text: #201f2c;
  --brand-soft: rgba(32, 31, 44, 0.08);

  --down: #d4561c;
  --down-soft: rgba(212, 86, 28, 0.11);
  --alias: #7646d6;
  --alias-soft: rgba(118, 70, 214, 0.10);
  --ok: #0f9a62;
  --ok-soft: rgba(15, 154, 98, 0.10);
  --warn: #a96700;
  --warn-soft: rgba(230, 150, 20, 0.14);
  --danger: #d5243f;
  --danger-soft: rgba(213, 36, 63, 0.09);
  --pub: #7646d6;
  --priv: #1673c4;
  --grave: #5d6e75;
  --quick: #c4570c;
  --truce: #0f9a62;
  --victory: #a86b00;
  --victory-soft: rgba(201, 138, 18, 0.13);
  --burn: #c4470c;
  --burn-soft: rgba(230, 100, 30, 0.11);

  --shadow: 0 10px 30px rgba(10, 30, 36, 0.12);
}

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

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body.modal-open { overflow: hidden; }

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
code { font-family: var(--mono); font-size: 0.86em; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
a { color: inherit; }

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

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.ic { width: 18px; height: 18px; flex-shrink: 0; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 300;
  background: var(--brand); color: var(--brand-ink); padding: 8px 14px; border-radius: var(--r-sm);
  text-decoration: none; font-weight: 700;
}
.skip-link:focus { top: 10px; }

.noscript { padding: 24px; text-align: center; color: var(--warn); }

/* ============================================================================
   BUTTONS & SMALL CONTROLS
   ============================================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: var(--surface-3); color: var(--text);
  font-weight: 700; font-size: 0.9rem; white-space: nowrap;
  box-sizing: border-box; overflow: hidden;
  transition: background 0.15s, border-color 0.15s, filter 0.15s, transform 0.1s;
}
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 0.84rem; }
.btn-xs { height: 26px; padding: 0 10px; font-size: 0.76rem; }
.btn-block { width: 100%; }
.btn-brand {
  background: var(--brand);
  color: var(--brand-ink);
  border: 0 !important;
  border-width: 0 !important;
  border-style: none !important;
  border-color: transparent !important;
  outline: none;
  box-sizing: border-box !important;
  overflow: hidden !important;
  background-clip: border-box !important;
  background-origin: border-box !important;
}
.btn-brand:hover, .btn-brand:active, .btn-brand:focus {
  border: 0 !important;
  border-width: 0 !important;
  border-style: none !important;
  border-color: transparent !important;
  outline: none;
  box-sizing: border-box !important;
  overflow: hidden !important;
  background-clip: border-box !important;
  background-origin: border-box !important;
}
.btn-outline { background: transparent; border-color: var(--border-strong); }
.btn-outline:hover { background: var(--hover); }
/* Snapchat's brand button: Snap yellow with black text (Snap Kit brand guidelines) */
.btn-snap { background: #fffc00; color: #111; border-color: #e8e500; gap: 8px; }
.btn-snap:hover { background: #f2ef00; }
.btn-snap img { width: 20px; height: 20px; border-radius: 5px; }
.btn-reddit { background: #ff4500; color: #fff; border-color: #e03d00; gap: 8px; }
.btn-reddit:hover { background: #e83e00; }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); filter: none; }
.btn-ghost.is-disabled { opacity: 0.5; text-decoration: line-through; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-truce { background: linear-gradient(135deg, var(--brand, #ff3cac), var(--brand-2, #784ba0)); color: var(--brand-ink, #fff); border: 0; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-pill); border: 0;
  background: transparent; color: var(--text-2); font-size: 1.1rem; line-height: 1;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

.link-btn {
  background: none; border: 0; padding: 0; color: var(--brand-text);
  font-weight: 600; font-size: inherit; text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: var(--brand-text); }

.chip-btn {
  height: 28px; padding: 0 11px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text-2); font-size: 0.8rem; font-weight: 700;
}
.chip-btn:hover:not(:disabled) { color: var(--text); border-color: var(--quick); }
.chip-btn:disabled { opacity: 0.4; }
.chip-btn.accent { border-color: rgba(255, 181, 71, 0.5); color: var(--quick); }

.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--r-pill); }
.seg-btn {
  flex: 1; height: 30px; border: 0; border-radius: var(--r-pill); background: transparent;
  color: var(--text-2); font-weight: 700; font-size: 0.82rem; white-space: nowrap;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset; }
.seg-lg .seg-btn { height: 38px; font-size: 0.88rem; }

.avatar {
  --av: #666;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--av); color: #0b0c0f; font-weight: 800; font-size: 0.8rem;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25) inset;
}
.avatar.sm { width: 30px; height: 30px; font-size: 0.72rem; }
.avatar.xs { width: 24px; height: 24px; font-size: 0.66rem; }
.avatar.anon { --av: #3a2a26; color: #fff; font-size: 0.9rem; }
.avatar-spacer { width: 30px; flex-shrink: 0; }

.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.6);
  animation: live 2s infinite;
}
@keyframes live {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(61, 220, 151, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); }
}

/* ============================================================================
   TOP BAR
   ============================================================================ */

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  background: rgba(11, 12, 15, 0.92);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; min-width: 0; }
.brand {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 6px;
  border-radius: var(--r-sm);
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--logo-fill, linear-gradient(135deg, var(--logo-a), var(--logo-b)));
  font-size: 1.15rem;
}
.brand-word { font-size: 1.35rem; font-weight: 900; letter-spacing: -0.04em; color: var(--text); }

.topbar-search {
  flex: 1; min-width: 0; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-pill);
  color: var(--muted);
}
.topbar-search:focus-within { border-color: var(--border-strong); background: var(--surface); }
.topbar-search input { flex: 1; min-width: 0; width: 100%; border: 0; outline: none; background: transparent; color: var(--text); font-size: 0.92rem; }
.topbar-search input::placeholder { color: var(--muted); }
.topbar-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
/* our own clear (x) button: shows only while there is text in the box */
.search-clear {
  display: none; align-items: center; justify-content: center; flex-shrink: 0;
  width: 26px; height: 26px; margin-right: -6px; padding: 0; border: 0; border-radius: 50%;
  background: var(--surface-3); color: var(--text-2); cursor: pointer;
}
.search-clear .ic { width: 14px; height: 14px; display: block !important; }
.search-clear:hover { background: var(--border-strong); color: var(--text); }
.topbar-search.has-text .search-clear { display: inline-flex; }

.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.online-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface);
  font-weight: 700; font-size: 0.84rem; color: var(--text);
}
.online-pill:hover { border-color: var(--ok); }
.online-label { color: var(--muted); font-weight: 600; }

.persona-menu { position: relative; }
.persona-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 8px 0 4px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: transparent;
}
.persona-btn:hover, .persona-btn[aria-expanded="true"] { border-color: var(--border-strong); background: var(--surface); }
.persona-btn-text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.persona-btn-name { font-weight: 700; font-size: 0.84rem; }
.persona-btn-sub { font-size: 0.72rem; color: var(--muted); }
.persona-btn .chev { width: 16px; height: 16px; color: var(--muted); }

.dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
  width: 300px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r);
  box-shadow: var(--shadow);
}
.dropdown-head { padding: 8px 10px 10px; font-weight: 800; font-size: 0.86rem; }
.dropdown-head span { display: block; font-weight: 500; font-size: 0.76rem; color: var(--muted); }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: left;
}
.dropdown-item:hover { background: var(--hover); }
.dropdown-item.is-active { background: var(--brand-soft); }
.dd-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dd-text strong { font-size: 0.88rem; }
.dd-text small { font-size: 0.74rem; color: var(--muted); }
.dd-check { color: var(--brand-text); font-weight: 900; }

/* ============================================================================
   LAYOUT
   ============================================================================ */

.layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 56px;
  gap: 24px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
}
html.rightbar-pinned .layout,
body.rightbar-pinned .layout {
  grid-template-columns: 248px minmax(0, 1fr) 316px;
}

.leftnav {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 16px 0 20px;
  border-right: 1px solid var(--border);
  padding-right: 14px;
  display: flex; flex-direction: column;
}
.nav-section-label {
  padding: 14px 12px 6px; font-size: 0.72rem; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.nav-section-label:first-child { padding-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 42px; padding: 6px 12px; border: 0; border-radius: var(--r);
  background: transparent; color: var(--text-2); text-align: left; font-weight: 600;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.is-active { background: var(--surface-2); color: var(--text); box-shadow: inset 3px 0 0 var(--brand); }
.nav-item .ic { width: 20px; height: 20px; }
.nav-label { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.nav-sub { font-size: 0.7rem; color: var(--muted); font-weight: 600; }
.nav-count {
  min-width: 24px; padding: 1px 8px; border-radius: var(--r-pill);
  background: var(--surface-3); font-size: 0.74rem; font-weight: 700; text-align: center; color: var(--text-2);
}
.nav-divider { height: 1px; background: var(--border); margin: 14px 4px 4px; }
.nav-hint { padding: 0 12px 8px; font-size: 0.8rem; color: var(--muted); }
.platform-badge {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.95rem;
}
.platform-badge.imessage, .chat-icon.imessage { background: linear-gradient(160deg, #5df27c, #28c840); }
.platform-badge.snapchat, .chat-icon.snapchat { background: #fffc00; }
.platform-badge.reddit, .chat-icon.reddit { background: #ff4500; }
.platform-badge.xcom, .chat-icon.xcom { background: #0f1419; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); }
.platform-badge.instagram, .chat-icon.instagram { background: linear-gradient(45deg, #feda75, #fa7e1e 30%, #d62976 60%, #962fbf 85%, #4f5bd5); }
.leftnav-footer {
  margin-top: auto; padding: 18px 12px 0;
  display: flex; flex-direction: column; gap: 6px; font-size: 0.74rem; color: var(--muted);
}

.center { min-width: 0; padding: 20px 0 48px; outline: none; }
.rightbar > *, .chat-scroll > *, .chat-list > *, .post-list > * { flex-shrink: 0; }

.rightbar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  width: 56px;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  box-sizing: border-box;
  z-index: 25;
  transition: width .3s cubic-bezier(.4, 0, .2, 1);
}

.rightbar-rail {
  width: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 0 28px;
  box-sizing: border-box;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.rightbar-rail::-webkit-scrollbar { display: none; }

.rb-rail-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--r-full, 9999px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .15s ease, box-shadow .18s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.rb-rail-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: rgba(255, 60, 172, 0.45);
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.rb-rail-btn.is-active {
  background: var(--surface-3);
  color: var(--brand, #ff3cac);
  border-color: var(--brand, #ff3cac);
}

.rb-rail-btn .ic {
  width: 20px;
  height: 20px;
}

.rb-rail-divider {
  width: 26px;
  height: 1px;
  background: var(--border);
  margin: 2px 0;
  flex-shrink: 0;
}

/* Floating overlay drawer when collapsed */
.rightbar-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 56px;
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-radius: var(--r-lg) 0 0 var(--r-lg);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: width .38s cubic-bezier(.4, 0, .2, 1), opacity .22s ease, box-shadow .38s ease;
}

.rightbar.snap-shut .rightbar-drawer {
  transition: none !important;
}

.rightbar.is-open .rightbar-drawer,
.rightbar:focus-within .rightbar-drawer {
  width: 320px;
  opacity: 1;
  pointer-events: auto;
  box-shadow: -14px 0 34px rgba(0, 0, 0, 0.28);
}

.rightbar-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
  min-width: 320px;
  box-sizing: border-box;
}

.rightbar-drawer-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.rightbar-drawer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rightbar-drawer-actions .icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s ease;
}

.rightbar-drawer-actions .icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.rightbar-drawer-actions .icon-btn.is-pinned,
.rightbar-drawer-actions .icon-btn.is-active {
  background: var(--surface-3);
  color: var(--brand, #ff3cac);
  border-color: var(--brand, #ff3cac);
}

.rightbar-drawer-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 320px;
  box-sizing: border-box;
}

.rightbar-drawer-scroll > * {
  flex-shrink: 0;
}

/* When pinned: drawer replaces rail in-flow and layout column expands */
html.rightbar-pinned .rightbar,
body.rightbar-pinned .rightbar {
  width: 100%;
}

html.rightbar-pinned .rightbar-rail,
body.rightbar-pinned .rightbar-rail {
  display: none;
}

html.rightbar-pinned .rightbar-drawer,
body.rightbar-pinned .rightbar-drawer {
  position: relative;
  width: 100%;
  opacity: 1;
  pointer-events: auto;
  box-shadow: none;
  border-left: 0;
  border-radius: 0;
  transition: none;
}

/* Chats: the left nav hides instantly so the chats get the full width.
   The menu button in the top bar brings it back as a drawer over the chats.
   Minimize empty space surrounding the chat section across desktop and mobile. */
.nav-toggle { display: none; margin-right: 2px; }
.nav-toggle .ic { width: 22px; height: 22px; }
body.view-chats {
  overflow-y: hidden;
}
body.view-chats .layout {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1680px;
  width: 100%;
  padding: 0 10px;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  box-sizing: border-box;
}
body.view-chats .leftnav { display: none; }
@media (min-width: 901px) {
  body.view-chats .nav-toggle { display: inline-flex; }
  body.view-chats.nav-peek .nav-toggle { background: var(--surface-2); color: var(--text); }
  body.view-chats.nav-peek .leftnav {
    display: flex; position: fixed; left: 0; top: var(--topbar-h); bottom: 0; z-index: 40;
    width: 268px; height: auto; padding-left: 14px;
    background: var(--bg); box-shadow: 14px 0 34px rgba(0, 0, 0, .28);
  }
}
body.view-chats .rightbar { display: none; }
body.view-chats .center {
  padding: 6px 0 8px;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
}
body.view-chats #view-chats {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
body.view-chats .chats {
  flex: 1;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  margin-bottom: 0;
}

/* ============================================================================
   WELCOME HERO (Landing Explanation Banner for Visitors)
   ============================================================================ */
.welcome-hero {
  position: relative;
  margin: 0 0 16px;
  padding: 24px 26px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px -16px rgba(0, 0, 0, 0.18);
}
.welcome-hero-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s ease;
}
.welcome-hero-close:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-strong);
}
.welcome-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--surface);
  padding: 4px 11px;
  border-radius: var(--r-pill);
  background: var(--brand);
  margin-bottom: 12px;
}
.welcome-hero-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}
.welcome-hero-title {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  margin: 0 0 10px;
  letter-spacing: -0.02em;
  padding-right: 28px;
}
.welcome-hero-sub {
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--text-2);
  margin: 0 0 18px;
  max-width: 660px;
}
.welcome-hero-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}
.welcome-hero-feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid transparent;
}
.welcome-hero-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--brand);
  color: var(--surface);
}
.welcome-hero-feat-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.welcome-hero-feat-text strong {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}
.welcome-hero-feat-text span {
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--text-2);
}
.welcome-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.welcome-hero-forever {
  margin-top: 12px;
  font-size: 0.8rem;
}
.welcome-hero-forever .link-btn {
  color: var(--text-2);
  font-weight: 500;
}
.welcome-hero-forever .link-btn:hover { color: var(--text); }
.welcome-hero-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--r-pill);
}

@media (max-width: 640px) {
  .welcome-hero {
    padding: 16px 16px 18px;
    margin-bottom: 12px;
  }
  .welcome-hero-title {
    font-size: 1.2rem;
  }
  .welcome-hero-features {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .welcome-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .welcome-hero-actions .btn {
    justify-content: center;
  }
}

/* ============================================================================
   FEED HEADER, CREATE BAR, INFO STRIP, SORT
   ============================================================================ */

.feed-header {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; margin-bottom: 14px;
}
.feed-banner { height: 72px; background: linear-gradient(120deg, var(--brand), var(--brand-2)); }
.feed-graveyard .feed-banner { background: linear-gradient(120deg, #2b2f3a, #4a4f63 50%, #6b5b7a); }
.feed-quick .feed-banner { background: linear-gradient(120deg, #ffb547, #ff7a18 50%, #ff4d6a); }
.feed-header-body { display: flex; align-items: flex-end; gap: 14px; padding: 0 18px; margin-top: -26px; }
.feed-icon {
  width: 68px; height: 68px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 2rem;
  background: var(--surface-2); border: 4px solid var(--surface);
}
.feed-titles { flex: 1; min-width: 0; padding-bottom: 4px; }
.feed-titles h1 { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.02em; line-height: 1.15; }
.feed-handle { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.feed-cta { margin-bottom: 6px; }
.feed-desc { padding: 10px 18px 16px; color: var(--text-2); font-size: 0.9rem; }

.create-bar {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); text-align: left;
}
.create-bar:hover { border-color: var(--border-strong); }
.create-bar-input {
  flex: 1; height: 38px; padding: 0 14px; display: flex; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-pill);
  color: var(--muted); font-size: 0.9rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.create-bar-icon { font-size: 1.1rem; padding: 0 6px; }

.info-strip {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px;
  padding: 10px 14px; margin-bottom: 12px;
  background: var(--down-soft); border: 1px solid rgba(124, 140, 255, 0.3); border-radius: var(--r);
  font-size: 0.86rem; color: var(--text-2);
}
.info-strip strong { color: var(--text); }
.info-strip > span:nth-child(2) { flex: 1; min-width: 200px; }
.info-strip.grave { background: rgba(154, 163, 181, 0.1); border-color: rgba(154, 163, 181, 0.28); }
.info-strip.quick { background: var(--warn-soft); border-color: rgba(255, 181, 71, 0.3); }
.info-strip.quick .warp-label { flex: 0 0 auto; min-width: 0; }
.warp-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }

.sort-bar { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.sort-bar::-webkit-scrollbar { display: none; }
.sort-tab {
  height: 34px; padding: 0 14px; border-radius: var(--r-pill);
  border: 0; background: transparent; color: var(--text-2); font-weight: 700; font-size: 0.86rem; white-space: nowrap;
}
.sort-tab:hover { background: var(--hover); color: var(--text); }
.sort-tab.is-active { background: var(--surface-3); color: var(--text); }

.empty {
  text-align: center; padding: 48px 24px;
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--r-lg);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty-icon { font-size: 2.4rem; }
.empty h3 { font-size: 1.1rem; }
.empty p { color: var(--muted); max-width: 420px; margin-bottom: 6px; }

/* ============================================================================
   POST CARDS
   ============================================================================ */

.post-list { display: flex; flex-direction: column; gap: 12px; }

.post {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 12px 16px 10px;
  transition: border-color 0.15s;
}
.post:hover { border-color: var(--border-strong); }
.post.is-buried { background: linear-gradient(180deg, #16171c, #131418); }
.post.is-buried .post-title, .post.is-buried .post-body { color: var(--text-2); }

.post-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px;
  font-size: 0.8rem; color: var(--muted); min-height: 30px;
}
.community-dot {
  width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3);
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem;
}
.community { color: var(--text); font-weight: 700; }
.dot { color: var(--border-strong); }
.you-badge {
  font-size: 0.68rem; font-weight: 800; color: var(--brand-text); background: var(--brand-soft);
  padding: 0 6px; border-radius: var(--r-pill); margin-left: 2px;
}
.flair {
  --flair: #888;
  margin-left: 4px; padding: 1px 9px; border-radius: var(--r-pill);
  font-size: 0.72rem; font-weight: 700; color: var(--flair);
  background: color-mix(in srgb, var(--flair) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--flair) 35%, transparent);
}

.menu-wrap { position: relative; margin-left: auto; }
.menu {
  display: none;
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  min-width: 240px; padding: 6px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r);
  box-shadow: var(--shadow);
}
.menu-wrap.is-open .menu { display: block; }
.menu button {
  display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--r-sm);
  background: transparent; text-align: left; font-size: 0.88rem; font-weight: 600; color: var(--text);
}
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--danger); }

.post-title { font-size: 1.12rem; font-weight: 800; line-height: 1.35; margin: 4px 0 6px; letter-spacing: -0.01em; }
.post-body { font-size: 0.95rem; color: var(--text-2); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-title + .post-body { margin-top: 2px; }

/* Swapped names render as plain text. This rule neutralizes any older saved posts that still carry the span. */
.narrative-alias-chip { color: inherit; font-weight: inherit; text-decoration: none; cursor: inherit; }

/* Graveyard meter (Main) */
.grave-meter { display: flex; align-items: center; gap: 10px; margin: 12px 0 2px; }
.meter-track { flex: 1; height: 6px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.meter-track span { display: block; height: 100%; border-radius: inherit; background: var(--down); transition: width 0.4s ease; }
.meter-label { font-size: 0.76rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.grave-meter.is-near .meter-track span { background: linear-gradient(90deg, var(--down), var(--danger)); }
.grave-meter.is-near .meter-label { color: var(--danger); }

/* Quick decay */
.decay { display: flex; align-items: center; gap: 10px; margin: 12px 0 2px; }
.decay .decay-fill { background: linear-gradient(90deg, var(--danger), var(--quick)); transition: width 0.9s linear; }
.countdown { font-size: 0.78rem; color: var(--text-2); white-space: nowrap; }
.countdown-digits { font-family: var(--mono); color: var(--quick); font-weight: 800; font-variant-numeric: tabular-nums; }
.decay.is-critical .countdown-digits { color: var(--danger); animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { opacity: 0.45; } }

/* Burial (Graveyard) */
.burial {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin-top: 12px; padding: 8px 12px; border-radius: var(--r);
  background: rgba(154, 163, 181, 0.08); border: 1px solid rgba(154, 163, 181, 0.2);
  font-size: 0.8rem; color: var(--text-2);
}
.burial-stamp { font-weight: 800; color: var(--text); }
.burial-note { width: 100%; color: var(--muted); font-size: 0.76rem; }

/* Actions row */
.post-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.vote-pill, .action-pill, .react {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r-pill);
  border: 0; background: var(--surface-2); color: var(--text-2);
  font-size: 0.82rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.vote-pill:hover, .action-pill:hover, .react:hover { background: var(--surface-3); color: var(--text); }
.vote-pill .ic { width: 17px; height: 17px; }
.vote-pill.is-on { background: var(--down); color: #0b0c1f; }
.vote-pill.is-final { background: var(--surface-2); color: var(--grave); cursor: default; }
.reacts { display: flex; gap: 6px; flex-wrap: wrap; }
.react { padding: 0 10px; }
.react.is-on { background: var(--brand-soft); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 55%, transparent); }
.react.is-static { cursor: default; opacity: 0.75; }
.react.is-static:hover { background: var(--surface-2); color: var(--text-2); }
.alias-note { font-size: 0.74rem; color: var(--alias); font-weight: 600; }
.post-actions > .alias-note { margin-left: auto; }

/* Comments */
.comments { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.comment-compose { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.comment-input {
  flex: 1; min-width: 0; height: 38px; padding: 0 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-pill);
  outline: none; font-size: 0.88rem;
}
.comment-input:focus { border-color: var(--border-strong); background: var(--bg); }
.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment { display: flex; gap: 10px; }
.comment-main { flex: 1; min-width: 0; padding-left: 10px; border-left: 2px solid var(--border); }
.comment-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; font-size: 0.76rem; color: var(--muted); }
.comment-meta strong { color: var(--text); font-size: 0.8rem; }
.comment-meta strong.op { color: var(--brand-text); }
.op-badge { font-size: 0.64rem; font-weight: 900; padding: 0 5px; border-radius: 4px; background: var(--brand); color: var(--brand-ink); }
.comment-body { font-size: 0.9rem; color: var(--text-2); margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comments-locked, .comments-empty { font-size: 0.84rem; color: var(--muted); padding: 2px 0 6px; }

/* ============================================================================
   RIGHT SIDEBAR
   ============================================================================ */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; }
.card-title { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

.about-card { padding: 0; overflow: hidden; }
.about-banner { height: 40px; background: linear-gradient(120deg, var(--brand), var(--brand-2)); }
.about-graveyard .about-banner { background: linear-gradient(120deg, #2b2f3a, #4a4f63 50%, #6b5b7a); }
.about-quick .about-banner { background: linear-gradient(120deg, #ffb547, #ff7a18 50%, #ff4d6a); }
.about-body { padding: 14px 16px 16px; }
.about-body .card-title { text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--text); }
.about-body p { font-size: 0.88rem; color: var(--text-2); }
.about-stats { display: flex; gap: 24px; margin: 14px 0; padding-top: 12px; border-top: 1px solid var(--border); }
.about-stats div { display: flex; flex-direction: column; }
.about-stats strong { font-size: 1.05rem; }
.about-stats span { font-size: 0.76rem; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }

.threshold-big { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.threshold-big strong { font-size: 2rem; font-weight: 900; color: var(--down); letter-spacing: -0.03em; }
.threshold-big span { color: var(--text-2); font-size: 0.86rem; }

.curve { width: 100%; height: auto; display: block; margin: 4px 0 8px; }
.curve-area { fill: var(--down-soft); stroke: none; }
.curve-line { fill: none; stroke: var(--down); stroke-width: 2; stroke-linejoin: round; }
.curve-guide { stroke: var(--border-strong); stroke-dasharray: 3 3; }
.curve-dot { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
.curve-tick { fill: var(--muted); font-size: 9px; font-family: var(--font); }
.card .muted.small { margin-bottom: 12px; }

.rules { counter-reset: rule; display: flex; flex-direction: column; gap: 10px; }
.rules li { counter-increment: rule; position: relative; padding-left: 28px; font-size: 0.84rem; color: var(--text-2); }
.rules li::before {
  content: counter(rule); position: absolute; left: 0; top: 1px;
  width: 19px; height: 19px; border-radius: 50%; background: var(--surface-3);
  font-size: 0.7rem; font-weight: 800; display: flex; align-items: center; justify-content: center; color: var(--text);
}
.rules strong { color: var(--text); }

.take-outside-card p { font-size: 0.86rem; margin-bottom: 12px; }
.platform-row { display: flex; flex-wrap: wrap; gap: 6px; }
.platform-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--surface-2); font-weight: 700; font-size: 0.82rem;
}
.platform-btn:hover { background: var(--surface-3); }
.platform-btn.imessage:hover, .platform-btn.imessage.is-active { border-color: #34c759; }
.platform-btn.snapchat:hover, .platform-btn.snapchat.is-active { border-color: #fffc00; }
.platform-btn.instagram:hover, .platform-btn.instagram.is-active { border-color: #d62976; }
.platform-btn.reddit:hover, .platform-btn.reddit.is-active { border-color: #ff4500; }
.platform-btn.xcom:hover, .platform-btn.xcom.is-active { border-color: var(--text); }

.log { display: flex; flex-direction: column; gap: 10px; }
.log-item { display: flex; gap: 10px; font-size: 0.8rem; color: var(--text-2); }
.log-icon { width: 22px; flex-shrink: 0; text-align: center; }
.log-text { flex: 1; min-width: 0; }
.log-time { display: block; font-size: 0.72rem; color: var(--muted); }
.log-block .log-text { color: #ffb2bf; }

.rb-footer { font-size: 0.74rem; color: var(--muted); padding: 0 6px; }

/* ============================================================================
   FIGHT CHATS
   ============================================================================ */

.chats {
  display: grid; grid-template-columns: 320px minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h) - 40px);
  min-height: 520px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden;
}

.chat-list-pane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.chat-list-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px; }
.chat-list-head h1 { font-size: 1.2rem; font-weight: 900; letter-spacing: -0.02em; }
.chat-list-actions { display: flex; align-items: center; gap: 4px; }
.chat-list-pane .seg { margin: 0 14px 10px; }
.chat-list { flex: 1; overflow-y: auto; padding: 0 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.chat-list > li { list-style: none; margin: 0; }
.chat-list-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 0.86rem; }

.chat-row {
  display: flex; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: var(--r);
  background: transparent; text-align: left;
}
.chat-row:hover { background: var(--hover); }
.chat-row.is-active { background: var(--surface-3); }
.chat-icon {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem;
  background: var(--surface-3);
}
.chat-icon.pub { background: var(--alias-soft); }
.chat-icon.priv { background: rgba(54, 197, 240, 0.15); }
.chat-icon.fork { background: var(--alias-soft); }
.chat-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-row-top { display: flex; align-items: baseline; gap: 6px; }
.chat-row-name { flex: 1; min-width: 0; font-weight: 700; font-size: 0.9rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-row-time { font-size: 0.7rem; color: var(--muted); flex-shrink: 0; }
.chat-row-preview { font-size: 0.8rem; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-row-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }

.vis-badge {
  white-space: nowrap;
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: 0.68rem; font-weight: 800;
}
.vis-badge.pub { background: var(--alias-soft); color: var(--pub); }
.vis-badge.priv { background: rgba(54, 197, 240, 0.14); color: var(--priv); }
.vis-badge.out { background: var(--warn-soft); color: var(--warn); }

.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-pane > .empty { margin: 24px; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.chat-back { display: none; }
.chat-head-info { flex: 1; min-width: 0; }
.chat-title { font-size: 1rem; font-weight: 800; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 0.78rem; color: var(--muted); }
.origin-tag { color: var(--text-2); }
.chat-head-actions { display: flex; align-items: center; gap: 6px; }
.chat-head-actions .menu-wrap { margin-left: 0; }

.chat-topic { padding: 8px 16px 0; font-size: 0.84rem; color: var(--text-2); }
.chat-rules {
  display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 16px 10px;
  font-size: 0.74rem; color: var(--muted); border-bottom: 1px solid var(--border);
}
.fork-banner {
  margin: 10px 16px 0; padding: 8px 12px; border-radius: var(--r);
  background: var(--alias-soft); border: 1px solid rgba(185, 140, 255, 0.3); font-size: 0.8rem; color: var(--text-2);
}

.chat-scroll { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 4px; min-height: 0; }

.sys-msg {
  align-self: center; max-width: 90%; margin: 10px 0; padding: 5px 12px;
  border-radius: var(--r-pill); background: var(--surface-2);
  font-size: 0.76rem; color: var(--muted); text-align: center;
}
.sys-time { opacity: 0.7; }

.msg { display: flex; align-items: flex-end; gap: 8px; position: relative; margin-top: 8px; transition: opacity 0.2s, transform 0.2s; }
.msg.grouped { margin-top: 2px; }
.msg.mine { flex-direction: row-reverse; }
.msg-col { display: flex; flex-direction: column; max-width: min(72%, 560px); min-width: 0; }
.msg.mine .msg-col { align-items: flex-end; }
.msg-meta { display: flex; align-items: baseline; gap: 6px; margin: 0 4px 3px; font-size: 0.74rem; color: var(--muted); }
.msg-name { font-weight: 700; color: var(--text-2); }
.bubble {
  padding: 8px 12px; border-radius: 18px; background: var(--surface-3);
  font-size: 0.92rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg:not(.mine) .bubble { border-bottom-left-radius: 6px; }
.msg.mine .bubble {
  --bubble: var(--brand);
  background: color-mix(in srgb, var(--bubble) 82%, #000);
  color: #fff; border-bottom-right-radius: 6px;
}
.msg-note { font-size: 0.7rem; color: var(--alias); margin: 3px 6px 0; }

/* Message buttons stay hidden until you hover over the message (or just did), or tap/click it once. */
.msg-actions {
  display: flex; align-items: center; gap: 4px; align-self: center;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
@media (hover: hover) { .msg:hover .msg-actions { opacity: 1; pointer-events: auto; } }
.msg.recent .msg-actions, .msg.is-active .msg-actions, .msg:focus-within .msg-actions { opacity: 1; pointer-events: auto; }
/* The tapped message is highlighted: 15% bigger with a barely-there gray glow. */
.msg .bubble { transition: transform 0.18s ease, box-shadow 0.18s ease; }
.msg:not(.mine) .bubble { transform-origin: left center; }
.msg.mine .bubble { transform-origin: right center; }
.msg.is-active { z-index: 2; margin-top: 14px; margin-bottom: 8px; }
.msg.is-active:not(.mine) .msg-actions { margin-left: var(--grow, 0px); }
.msg.is-active.mine .msg-actions { margin-right: var(--grow, 0px); }
.msg.is-active .bubble { transform: scale(1.15); box-shadow: 0 0 0 1px rgba(140, 140, 140, 0.16), 0 0 14px 2px rgba(140, 140, 140, 0.16); position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .msg .bubble { transition: none; } }
.msg-act {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px;
  border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 0.72rem; font-weight: 700; color: var(--muted);
}
.msg-act .ic { width: 14px; height: 14px; }
.msg-act:hover { color: var(--text); }
.msg-act.danger { color: var(--danger); border-color: rgba(255, 77, 106, 0.4); }
.msg-act.danger:hover { background: var(--danger); color: #fff; }

.msg.vaporizing, .truce.vaporizing { opacity: 0; transform: scale(0.94); }

.chat-compose { padding: 10px 14px 12px; border-top: 1px solid var(--border); }
.chat-compose-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.chat-compose-btn {
  height: 28px;
  padding: 0 11px;
  font-size: 0.8rem;
  font-weight: 700;
  gap: 5px;
}
.chat-compose-btn .ic {
  width: 14px;
  height: 14px;
}
.chat-compose-row { display: flex; align-items: flex-end; gap: 8px; }
#chat-input {
  flex: 1; min-width: 0; min-height: 42px; max-height: 160px; resize: none;
  padding: 10px 16px; border-radius: 21px; border: 1px solid var(--border);
  background: var(--surface-2); outline: none; font-size: 0.92rem; line-height: 1.4;
}
#chat-input:focus { border-color: var(--border-strong); }
.send-btn { width: 42px; height: 42px; padding: 0; flex-shrink: 0; }
.send-btn .ic { width: 18px; height: 18px; }
.chat-gate {
  display: flex; align-items: flex-start; gap: 6px; margin-top: 8px; padding: 6px 10px;
  border-radius: var(--r); background: var(--surface-2); font-size: 0.78rem; color: var(--text-2);
}
.chat-gate.is-ok { background: var(--ok-soft); }
.chat-gate.is-blocked { background: var(--danger-soft); color: #ffc2cc; }
.chat-gate s { color: var(--muted); }
.chat-gate strong { color: var(--text); }
.chat-try { margin-top: 6px; font-size: 0.76rem; color: var(--muted); }
.chat-compose.is-locked { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 0.86rem; color: var(--text-2); }

/* ============================================================================
   TRUCE BOX
   ============================================================================ */

.truce {
  position: relative; overflow: hidden;
  margin: 14px 0; padding: 16px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border));
  box-shadow: var(--shadow);
  transition: opacity 0.2s, transform 0.2s;
}
.chat-scroll.has-bg .truce {
  background: var(--surface) !important;
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border)) !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5) !important;
}
.truce.is-sealed, .truce.is-celebrating {
  overflow: visible;
}
.truce.is-pending {
  background: color-mix(in srgb, var(--warn) 7%, var(--surface));
  border: 1px dashed color-mix(in srgb, var(--warn) 60%, var(--border));
}
.truce-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.truce-badge {
  font-size: 0.74rem; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 10px; border-radius: var(--r-pill); background: var(--brand-soft); color: var(--brand-text);
}
.truce.is-pending .truce-badge { background: var(--warn-soft); color: var(--warn); }
.truce-state { flex: 1; font-size: 0.82rem; font-weight: 700; color: var(--text-2); text-align: center; }
.truce-head .msg-time { font-size: 0.74rem; color: var(--muted); }

.truce-grid { display: grid; grid-template-columns: 1fr 76px 1fr; gap: 10px; align-items: stretch; }
.truce-side {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px; border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.truce-side.side-a { border-left: 3px solid var(--priv); }
.truce-side.side-b { border-right: 3px solid var(--warn); }
.truce.is-sealed .truce-side.side-a, .truce.is-sealed .truce-side.side-b { border-color: color-mix(in srgb, var(--brand, #ff3cac) 40%, var(--border)); }
.truce-party { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; }
.truce-party span { display: flex; flex-direction: column; line-height: 1.2; }
.truce-party small { font-size: 0.68rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.truce-terms { flex: 1; font-size: 0.9rem; line-height: 1.5; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.truce-sign { font-size: 0.72rem; color: var(--brand-text, #ff3cac); font-weight: 700; }
.truce-waiting { font-size: 0.84rem; color: var(--muted); }
.truce-input {
  width: 100%; resize: none; min-height: 70px; padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--bg); outline: none; font-size: 0.88rem;
}
.truce-input:focus { border-color: var(--warn); }
.truce-side .btn { align-self: flex-start; }

.truce-clasp { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.truce-orb {
  position: relative; z-index: 2;
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand, #ff3cac) 42%, transparent), color-mix(in srgb, var(--brand-2, #784ba0) 80%, #000));
  border: 2px solid var(--brand, #ff3cac); box-shadow: 0 0 24px color-mix(in srgb, var(--brand, #ff3cac) 45%, transparent);
}
.truce.is-pending .truce-orb { background: var(--surface-2); border-color: var(--warn); box-shadow: none; filter: grayscale(0.5); }
.truce-ring {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; box-sizing: border-box;
  margin: 0;
  border-radius: 50%; border: 2px solid var(--brand, #ff3cac); opacity: 0; pointer-events: none;
  transform-origin: center center;
}
.truce-stamp {
  font-size: 0.64rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 2px 8px; border-radius: 4px; background: var(--brand, #ff3cac); color: var(--brand-ink, #fff);
  display: inline-flex; align-items: center; justify-content: center;
}
.truce.is-pending .truce-stamp { background: var(--warn-soft); color: var(--warn); }

.truce-banner {
  margin-top: 12px; padding: 8px 12px; border-radius: var(--r);
  text-align: center; font-size: 0.82rem; font-weight: 800; color: var(--brand-text, #ff70c2);
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand, #ff3cac) 8%, transparent), color-mix(in srgb, var(--brand, #ff3cac) 24%, transparent), color-mix(in srgb, var(--brand, #ff3cac) 8%, transparent));
}
.truce-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 10px; font-size: 0.78rem; }
.truce-foot .link-btn { margin-right: auto; color: var(--brand-text, #ff3cac); }

.truce-confetti { position: absolute; inset: -40px; pointer-events: none; overflow: visible; }
.truce-confetti i {
  position: absolute; top: 46%; left: 50%; width: 8px; height: 12px; border-radius: 2px; opacity: 0;
  background: hsl(calc(var(--i) * 27deg) 85% 62%);
}

/* Agreement animation — both halves lock together, handshake bursts, confetti flies */
.truce.is-celebrating { animation: truceGlow 3.8s ease-out; }
.truce.is-celebrating .side-a { animation: lockLeft 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.truce.is-celebrating .side-b { animation: lockRight 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.truce.is-celebrating .truce-orb { animation: handshake 2.2s cubic-bezier(0.34, 1.56, 0.64, 1); }
.truce.is-celebrating .truce-ring { animation: shockwave 2.0s ease-out 0.35s; }
.truce.is-celebrating .truce-banner { animation: stamp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.45s both; }
.truce.is-celebrating .truce-confetti i { animation: confetti 3.0s cubic-bezier(0.2, 0.7, 0.3, 1) 0.35s forwards; }

@keyframes lockLeft { 0% { transform: translateX(-40px); opacity: 0.4; } 65% { transform: translateX(8px); opacity: 1; } 100% { transform: none; } }
@keyframes lockRight { 0% { transform: translateX(40px); opacity: 0.4; } 65% { transform: translateX(-8px); opacity: 1; } 100% { transform: none; } }
@keyframes handshake {
  0% { transform: scale(0.3) rotate(-30deg); }
  32% { transform: scale(1.48) rotate(14deg); box-shadow: 0 0 52px color-mix(in srgb, var(--brand, #ff3cac) 85%, transparent); }
  52% { transform: scale(0.92) rotate(-5deg); }
  70% { transform: scale(1.16) rotate(5deg); }
  85% { transform: scale(0.97) rotate(-2deg); }
  100% { transform: none; }
}
@keyframes shockwave { 0% { transform: scale(0.8); opacity: 1; } 100% { transform: scale(4.4); opacity: 0; } }
@keyframes stamp { 0% { transform: scale(1.3); opacity: 0; } 60% { transform: scale(0.97); opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes truceGlow {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand, #ff3cac) 80%, transparent); }
  25% { box-shadow: 0 0 54px 8px color-mix(in srgb, var(--brand, #ff3cac) 55%, transparent); }
  60% { box-shadow: 0 0 38px 4px color-mix(in srgb, var(--brand, #ff3cac) 35%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand, #ff3cac) 0%, transparent); }
}
@keyframes confetti {
  0% { opacity: 1; transform: translate(-50%, 0) rotate(0) scale(1); }
  40% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(calc((var(--i) - 6.5) * 44px), calc(-130px + (var(--i) * 10px))) rotate(calc(var(--i) * 120deg)) scale(0.85);
  }
}

/* ============================================================================
   MODALS
   ============================================================================ */

.modal-root { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.66); backdrop-filter: blur(3px); animation: fade 0.15s ease-out; }
.modal {
  position: relative; z-index: 1;
  width: 100%; max-width: 520px; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow); animation: pop 0.18s ease-out;
}
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 680px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px 20px; }
.modal-head h2 { font-size: 1.1rem; font-weight: 800; }
.modal-body { padding: 4px 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-body form { display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
.foot-note { margin-right: auto; font-size: 0.78rem; color: var(--muted); }
.confirm-text { color: var(--text-2); }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0; border: 0; padding: 0; min-width: 0; }
.field-label { display: flex; align-items: baseline; gap: 6px; font-size: 0.8rem; font-weight: 700; color: var(--text-2); }
.field-label em { font-style: normal; font-weight: 500; color: var(--muted); }
.counter { margin-left: auto; font-weight: 500; color: var(--muted); }
.field input[type="text"], .field input[type="url"], .field select, .field textarea, .modal-body textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--border-strong); background: var(--bg); outline: none; font-size: 0.92rem;
}
.field textarea, .modal-body textarea { resize: none; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .modal-body textarea:focus { border-color: var(--brand-text); }
.note { font-size: 0.8rem; color: var(--muted); }
.dest-note { font-size: 0.84rem; color: var(--text-2); margin-top: -4px; }

.tag-input {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 6px 8px; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--bg);
}
.tag-input:focus-within { border-color: var(--brand-text); }
.tag-input input { flex: 1; min-width: 160px; border: 0; outline: none; background: transparent; padding: 4px; font-size: 0.9rem; }
.tags { display: contents; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: var(--r-pill);
  background: var(--alias-soft); color: var(--alias); font-size: 0.8rem; font-weight: 700;
}
.tag button { border: 0; background: none; color: inherit; width: 20px; height: 20px; border-radius: 50%; }
.tag button:hover { background: rgba(255, 255, 255, 0.1); }
.try-row { font-size: 0.8rem; color: var(--muted); }

.gate-preview { border-radius: var(--r); padding: 12px 14px; border: 1px solid var(--border); background: var(--surface-2); font-size: 0.86rem; }
.gate-preview p { color: var(--text-2); }
.gate-preview.is-ok { border-color: rgba(61, 220, 151, 0.35); }
.gate-preview.is-blocked { border-color: var(--danger); background: var(--danger-soft); animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.gate-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.gate-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--priv); box-shadow: 0 0 8px var(--priv); }
.gate-dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.gate-chip { font-size: 0.72rem; font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill); background: var(--ok-soft); color: var(--ok); }
.gate-chip.alias { background: var(--alias-soft); color: var(--alias); }
.violations { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.violations li { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.v-type { font-size: 0.72rem; font-weight: 800; padding: 1px 8px; border-radius: var(--r-pill); background: var(--danger); color: #fff; }
.mappings { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.mappings li { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.mappings s { color: #ff9aa9; }
.mappings .arrow { color: var(--muted); }
.mappings .alias { color: var(--alias); font-weight: 800; }
.mappings .times { color: var(--muted); font-size: 0.78rem; }
.mappings .proof { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); margin-left: auto; }
.what-posts { display: flex; flex-direction: column; gap: 6px; }
.what-posts-card {
  padding: 10px 12px; border-radius: var(--r-sm); background: var(--bg); border-left: 3px solid var(--alias);
  color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 200px; overflow-y: auto;
}
.wp-title { display: block; color: var(--text); margin-bottom: 4px; }

/* Simulator */
.sim-readout { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sim-readout div { padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); display: flex; flex-direction: column; }
.sim-readout strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.sim-readout div:last-child strong { color: var(--down); }
.sim-label { font-size: 0.72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
#sim-range { width: 100%; accent-color: var(--brand-text); }
.sim-scale { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); margin-top: -10px; }
.sim-chart .curve { margin: 0; }
.sim-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.sim-table th { text-align: left; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.sim-table td { padding: 8px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.sim-table tr.is-current td { background: var(--brand-soft); font-weight: 700; }

/* Chide it out */
.platform-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; margin-top: -6px; }
/* From Reddit: the pasted link and what it points at */
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; }
.source-card { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--border-strong); border-left: 3px solid var(--border-strong); border-radius: var(--r); background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.source-card.reddit { border-left-color: #ff4500; }
.source-card.xcom { border-left-color: var(--text); }
.source-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.86rem; }
.source-head .platform-badge { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.source-title { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.source-text { margin: 0; font-size: 0.9rem; line-height: 1.45; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.source-by { margin: -4px 0 0; font-size: 0.8rem; color: var(--text-2); }
.source-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; }
.source-people li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.source-people small { color: var(--text-2); }
.source-people span { margin-left: auto; color: var(--text-2); }
.source-card .link-btn { align-self: flex-start; }
.posted-note { display: inline-flex; align-items: center; gap: 6px; margin: 0 6px; }
.platform-btn.big { height: 52px; justify-content: center; font-size: 0.9rem; border-radius: var(--r); }
.platform-btn.big span { font-size: 1.2rem; }
.platform-btn.is-active { background: var(--surface-3); box-shadow: 0 0 0 1px currentColor inset; }
.modal-body .seg { margin-top: -6px; }

/* Fork — circular checkboxes */
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-row {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface-2);
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.check-row:hover { border-color: var(--alias); }
.check-row.is-out { background: var(--danger-soft); border-color: rgba(255, 77, 106, 0.45); }
.check-row.is-out .check-text strong { text-decoration: line-through; color: #ff9aa9; }
.check-row.is-self { cursor: default; }
.round-check { position: absolute; opacity: 0; width: 1px; height: 1px; }
.round-check-ui {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border-strong); background: var(--bg);
  display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.round-check:checked + .round-check-ui { background: var(--ok); border-color: var(--ok); }
.round-check:checked + .round-check-ui::after {
  content: ''; width: 6px; height: 11px; margin-top: -2px;
  border: solid #04170e; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.round-check:not(:checked) + .round-check-ui { border-color: var(--danger); }
.round-check:focus-visible + .round-check-ui { outline: 2px solid var(--brand); outline-offset: 2px; }
.round-check:disabled + .round-check-ui { opacity: 0.6; }
.check-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.check-text strong { font-size: 0.9rem; }
.check-text small { font-size: 0.74rem; color: var(--muted); }
.check-status { font-size: 0.72rem; font-weight: 800; padding: 2px 9px; border-radius: var(--r-pill); background: var(--ok-soft); color: var(--ok); }
.check-row.is-out .check-status { background: var(--danger); color: #fff; }
.check-row.is-self .check-status { background: var(--surface-3); color: var(--text-2); }
.fork-summary { font-size: 0.84rem; color: var(--text-2); padding: 10px 12px; border-radius: var(--r); background: var(--alias-soft); }

/* Members */
.member-list { display: flex; flex-direction: column; gap: 6px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r); background: var(--surface-2); }

/* Truce builder */
.truce-builder { display: grid; grid-template-columns: 1fr 50px 1fr; gap: 10px; align-items: stretch; }
.tb-side { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.tb-a { border-top: 3px solid var(--priv); }
.tb-b { border-top: 3px solid var(--warn); }
.tb-tag { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.tb-clasp { display: flex; align-items: center; justify-content: center; }
.tb-clasp span {
  width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; border: 2px solid var(--truce); background: rgba(47, 208, 138, 0.12);
}

/* ============================================================================
   TOASTS
   ============================================================================ */

.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 250;
  display: flex; flex-direction: column; gap: 8px; width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--r);
  background: var(--surface-3); border: 1px solid var(--border-strong); border-left: 4px solid var(--priv);
  box-shadow: var(--shadow); font-size: 0.86rem; font-weight: 600;
  animation: toastIn 0.2s ease-out;
  transition: opacity 0.3s, transform 0.3s;
}
.toast-text { flex: 1; }
.toast-success { border-left-color: var(--ok); }
.toast-warn { border-left-color: var(--warn); }
.toast-danger { border-left-color: var(--danger); background: #2a141a; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); }
body.modal-open .toasts { top: 16px; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); }
.toast-action { border: 0; background: var(--surface); color: var(--text); font-weight: 800; font-size: 0.8rem; padding: 5px 10px; border-radius: var(--r-pill); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* ============================================================================
   MOBILE TAB BAR
   ============================================================================ */

.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(11, 12, 15, 0.96); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  align-items: center;
  justify-content: space-around;
}
.tab-item {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 4px 1px; border: 0; background: transparent; color: var(--muted); font-size: 0.62rem; font-weight: 700;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.tab-item .ic-i, .tab-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.tab-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; font-size: 0.62rem; }
.tab-item.is-active { color: var(--brand-text, var(--text)); }
.tab-item.is-active svg { stroke: var(--brand-text, var(--text)); }
.tab-create { flex: 0 0 44px; padding: 0; }
.tab-create span {
  width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: var(--brand-ink);
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem !important; filter: none !important;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 45%, transparent);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 1180px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr) 56px; }
  html.rightbar-pinned .layout,
  body.rightbar-pinned .layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  html.rightbar-pinned .rightbar,
  body.rightbar-pinned .rightbar {
    display: none;
  }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 0 12px; }
  body.view-chats .layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 4px;
    height: calc(100vh - var(--topbar-h) - var(--tabbar-h));
    height: calc(100dvh - var(--topbar-h) - var(--tabbar-h));
  }
  body.view-chats .center {
    padding: 4px 0 4px;
  }
  .leftnav { display: none; }
  .tabbar { display: flex; }
  .center { padding: 12px 0 calc(var(--tabbar-h) + 24px); }
  .hide-sm { display: none !important; }
  .persona-btn-text { display: none; }
  .toasts { bottom: calc(var(--tabbar-h) + 12px); right: 16px; }

  .chats { grid-template-columns: minmax(0, 1fr); height: calc(100vh - var(--topbar-h) - var(--tabbar-h) - 8px); }
  body.view-chats .chats {
    height: 100%;
    border-radius: 8px;
  }
  .chats .chat-pane { display: none; }
  .chats.show-pane .chat-list-pane { display: none; }
  .chats.show-pane .chat-pane { display: flex; }
  .chat-back { display: inline-flex; }
  .msg-col { max-width: 80%; }
}

@media (max-width: 640px) {
  .topbar { gap: 6px; padding: 0 10px; }
  .brand-word { display: none; }
  .topbar-search { height: 36px; padding: 0 10px; }
  .online-label { display: none; }
  .online-pill { display: none !important; }
  .hide-xs { display: none !important; }
  #take-outside-btn { display: none !important; }
  #create-post-btn { display: none !important; }
  #friends-btn { display: none !important; }
  .feed-header { padding: 14px 16px 12px; margin-bottom: 12px; }
  .feed-header-body { margin-top: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; }
  .feed-icon { width: 42px; height: 42px; font-size: 1.25rem; border-radius: 12px; flex-shrink: 0; }
  .feed-titles { flex: 1 1 calc(100% - 56px); min-width: 0; padding: 0; }
  .feed-titles h1 { font-size: 1.15rem; line-height: 1.25; margin: 0; }
  .feed-handle { font-size: 0.74rem; color: var(--muted); margin-top: 2px; line-height: 1.35; white-space: normal; word-break: break-word; }
  .feed-header-actions, .feed-header-cta { width: 100%; margin: 6px 0 0 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-start; }
  .feed-header-actions .btn-sm { padding: 5px 12px; font-size: 0.78rem; height: 32px; }
  .cred-pill-inline { padding: 4px 10px; font-size: 0.75rem; height: 32px; }
  .feed-desc { font-size: 0.78rem; line-height: 1.45; padding-top: 8px; margin: 0; }
  .odds-section { margin-bottom: 18px; }
  .odds-sec-head { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
  .odds-sec-head h2 { font-size: 1rem; margin: 0; }
  .odds-sec-controls { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 6px; }
  .odds-sec-controls .seg { flex: 0 0 auto; }
  .odds-sec-controls .btn { flex: 0 0 auto; margin-left: auto; }
  .market-grid { grid-template-columns: 1fr; gap: 10px; }
  .market-card, .odds-fight-card { padding: 12px 14px; }
  .market-question { font-size: 0.92rem; margin-bottom: 8px; }
  .market-sides { gap: 6px; }
  .market-side-btn { padding: 8px 10px; }
  .market-side-head { font-size: 0.8rem; }
  .market-side-pct { font-size: 0.92rem; }
  .market-side-btn small { font-size: 0.68rem; }
  .momentum-board { padding: 8px 10px; margin-bottom: 6px; }
  .momentum-board.multi { grid-template-columns: 1fr 1fr; gap: 6px; }
  .momentum-side strong { font-size: 0.82rem; }
  .momentum-pct { font-size: 1rem; }
  .odds-fight-foot { font-size: 0.72rem; gap: 8px; }
  .empty { padding: 22px 16px; border-radius: var(--r); }
  .empty-icon { font-size: 1.8rem; margin-bottom: 6px; }
  .empty h3 { font-size: 1rem; margin-bottom: 4px; }
  .empty p { font-size: 0.82rem; line-height: 1.4; }
  .post { padding: 10px 12px 8px; border-radius: var(--r); }
  .post-actions > .alias-note { margin-left: 0; width: 100%; }
  .warp-controls { margin-left: 0; }
  .truce-grid, .truce-builder { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
  .truce-side { width: 100%; box-sizing: border-box; }
  .truce-clasp { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 6px 0; width: 100%; margin: 0 auto; text-align: center; }
  .truce-ring { margin: 0; top: 0; left: 0; width: 100%; height: 100%; transform: none; }
  .tb-clasp { padding: 4px 0; }
  .platform-pick { grid-template-columns: repeat(2, 1fr); }
  .sim-readout { grid-template-columns: 1fr 1fr 1fr; }
  .sim-readout strong { font-size: 1rem; }
  .mappings .proof { margin-left: 0; width: 100%; }
  .modal-root { padding: 0; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: var(--r-lg) var(--r-lg) 0 0; max-width: none; }
  .chat-head { padding: 10px 8px; gap: 6px; }
  .chat-head > .chat-icon { display: none; }
  .chat-head-actions { gap: 4px; }
  .chat-head-actions .btn-sm { padding: 0 9px; }
  .chat-rules { display: none; }
  .chat-topic { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .topbar-search { padding: 0 10px; }
  .topbar-search .ic { display: none; }
}


/* ============================================================================
   FRIENDS, CONNECTED ACCOUNTS, PEOPLE PICKERS, CHAT CUSTOMIZATION
   ============================================================================ */

.topbar-icon { position: relative; width: 40px; height: 40px; }
.topbar-icon .ic { width: 22px; height: 22px; }
.topbar-icon.is-active { background: var(--surface-2); color: var(--text); }
.badge {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-pill); background: var(--danger); color: #fff;
  font-size: 0.68rem; font-weight: 800; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.nav-count.has-alert { background: var(--danger); color: #fff; }
.dropdown-sep { height: 1px; margin: 6px 4px; background: var(--border); }
.dd-emoji { width: 30px; text-align: center; font-size: 1.1rem; }

.avatar.lg { width: 52px; height: 52px; font-size: 1rem; }

.feed-friends .feed-banner { background: linear-gradient(120deg, var(--brand-2), var(--priv)); }
.friends-tabs { margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.friends-tabs::-webkit-scrollbar { display: none; }
.friends-tabs .seg-btn { flex: 1 0 auto; padding: 0 14px; }

.list-title { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 16px 4px 8px; }
.list-title:first-child { margin-top: 4px; }
.list-empty { padding: 14px 4px; color: var(--muted); font-size: 0.9rem; }

.people-list { display: flex; flex-direction: column; gap: 8px; }
.person {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border);
}
.person:hover { border-color: var(--border-strong); }
.person-main { flex: 1; min-width: 0; }
.person-name { font-weight: 800; font-size: 0.98rem; }
.person-handle { font-size: 0.8rem; color: var(--muted); }
.person-why { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 0.8rem; color: var(--text-2); }
.mutual-stack { display: inline-flex; }
.mutual-stack .avatar { width: 20px; height: 20px; font-size: 0.55rem; box-shadow: 0 0 0 2px var(--surface); }
.mutual-stack .avatar + .avatar { margin-left: -6px; }
.person-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

.connect-callout {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 14px;
  border-radius: var(--r-lg); background: var(--surface-2);
  border: 1px solid var(--border-strong);
}
.connect-callout p { font-size: 0.86rem; color: var(--text-2); }
.connect-callout > div { flex: 1; min-width: 0; }
.callout-icon { font-size: 1.5rem; }

.friend-search {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px; margin-bottom: 6px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border-strong); color: var(--muted);
}
.friend-search:focus-within { border-color: var(--brand-text); }
.friend-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 0.95rem; color: var(--text); }
.friends-body > .note { margin: 0 6px 12px; }

/* Connected accounts */
.acct-lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.acct-line { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; }
.acct-line-label { flex: 1; color: var(--text-2); }
.acct-line-val { color: var(--muted); font-size: 0.8rem; text-align: right; }
.acct-line-val.ok { color: var(--ok); }

.acct-row { display: flex; gap: 12px; padding: 12px; border-radius: var(--r); background: var(--surface-2); }
.acct-icon {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem; background: var(--surface-3);
}
.acct-icon.imessage { background: linear-gradient(160deg, #5df27c, #28c840); }
.acct-icon.instagram { background: linear-gradient(45deg, #feda75, #fa7e1e 30%, #d62976 60%, #962fbf 85%, #4f5bd5); }
.acct-icon.snapchat { background: #fffc00; }
.acct-icon.reddit { background: #ff4500; }
.acct-icon.xcom { background: #0f1419; }
.acct-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.acct-main > small { color: var(--muted); font-size: 0.8rem; margin-top: -4px; }
.acct-main > .btn { align-self: flex-start; }
.acct-value { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 0.88rem; }
.acct-ok { font-size: 0.7rem; font-weight: 800; padding: 1px 8px; border-radius: var(--r-pill); background: var(--ok-soft); color: var(--ok); }
.acct-input { display: flex; gap: 6px; }
.acct-input input {
  flex: 1; min-width: 0; height: 34px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--bg); outline: none; font-size: 0.88rem;
}
.acct-input input:focus { border-color: var(--brand-text); }

.switch-row { display: flex; align-items: center; gap: 10px; font-size: 0.84rem; color: var(--text-2); cursor: pointer; position: relative; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui {
  position: relative; width: 38px; height: 22px; flex-shrink: 0; border-radius: var(--r-pill);
  background: var(--surface-3); border: 1px solid var(--border-strong); transition: background 0.15s;
}
.switch-ui::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-2); transition: transform 0.15s, background 0.15s;
}
.switch-row input:checked + .switch-ui { background: var(--ok); border-color: var(--ok); }
.switch-row input:checked + .switch-ui::after { transform: translateX(16px); background: #fff; }
.switch-row input:focus-visible + .switch-ui { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch-row input:disabled + .switch-ui { opacity: 0.4; }
.switch-row:has(input:disabled) { cursor: not-allowed; color: var(--muted); }

.connect-box {
  display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--r);
  background: var(--warn-soft); border: 1px solid rgba(255, 181, 71, 0.35); font-size: 0.86rem; color: var(--text-2);
}
.connect-box.is-ok { background: var(--ok-soft); border-color: rgba(61, 220, 151, 0.35); }
.connect-box strong { color: var(--text); }
.connect-box > .btn { align-self: flex-start; }
.connect-done { font-size: 0.82rem; color: var(--ok); }

/* People picker */
.picker { display: flex; flex-direction: column; gap: 8px; }
.picker-search {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: var(--r-pill);
  background: var(--bg); border: 1px solid var(--border-strong); color: var(--muted);
}
.picker-search:focus-within { border-color: var(--brand-text); }
.picker-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 0.9rem; color: var(--text); }
.picker-list { max-height: 260px; overflow-y: auto; padding-right: 2px; }
.picker-list > li { flex-shrink: 0; }
.pick-row { padding: 8px 10px; }
.pick-row .round-check:not(:checked) + .round-check-ui { border-color: var(--border-strong); background: var(--bg); }
.picker-empty { padding: 12px; text-align: center; font-size: 0.86rem; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--r); }
.picker-count { font-size: 0.8rem; color: var(--ok); min-height: 1em; }

/* Invite */
.invite-box { padding: 14px; border-radius: var(--r); background: var(--bg); border: 1px dashed var(--border-strong); }
.invite-box code { background: none; padding: 0; font-size: 0.9rem; color: var(--text); overflow-wrap: anywhere; user-select: all; }
a.btn { text-decoration: none; }

/* Chat customization */
.chat-icon.custom { background: var(--surface-3); }
.chat-icon.custom.has-bg { background: var(--icon-bg); }
.chat-icon.has-img { overflow: hidden; padding: 0; background: var(--surface-3); }
.chat-icon.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-icon.big { width: 72px; height: 72px; border-radius: 20px; font-size: 2rem; }
.cust-icon-row { display: flex; align-items: center; gap: 16px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; flex: 1; min-width: 0; }
.emoji-btn {
  height: 38px; min-width: 0; overflow: hidden; padding: 0; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2); font-size: 1.15rem;
}
.emoji-btn:hover { border-color: var(--border-strong); background: var(--surface-3); }
.emoji-btn.is-active { border-color: var(--brand-text); box-shadow: 0 0 0 1px var(--brand) inset; background: var(--brand-soft); }
.cust-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.file-btn { cursor: pointer; position: relative; }
.file-btn:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.bg-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bg-swatch {
  position: relative; height: 64px; border-radius: var(--r); border: 2px solid var(--border);
  display: flex; align-items: flex-end; padding: 6px; overflow: hidden;
}
.bg-swatch span { font-size: 0.72rem; font-weight: 800; color: #fff; background: rgba(0, 0, 0, 0.45); padding: 1px 6px; border-radius: var(--r-pill); }
.bg-swatch:hover { border-color: var(--border-strong); }
.bg-swatch.is-active { border-color: var(--brand-text); box-shadow: 0 0 0 2px var(--brand-soft); }

.chat-scroll.has-bg .sys-msg { background: rgba(11, 12, 15, 0.72); color: var(--text-2); backdrop-filter: blur(4px); }
.chat-scroll.has-bg .msg-meta { color: var(--text-2); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }
.chat-scroll.has-bg .msg:not(.mine) .bubble { background: rgba(35, 39, 49, 0.92); }

@media (max-width: 640px) {
  .person { flex-wrap: wrap; padding: 12px; }
  .person-actions { width: 100%; justify-content: flex-start; padding-left: 64px; }
  .connect-callout { flex-wrap: wrap; }
  .cust-icon-row { flex-direction: column; align-items: flex-start; }
  .bg-grid { grid-template-columns: repeat(3, 1fr); }
  .topbar-icon { width: 36px; height: 36px; }
  .online-pill { display: none; }
}


/* ============================================================================
   EMOJI REACTIONS, REWARDS, CRED
   ============================================================================ */
.react-more { padding: 0 10px; gap: 4px; color: var(--muted); }
.react-more .ic { width: 18px; height: 18px; }
.react-more span { font-size: 0.78rem; }

.emoji-pop {
  position: absolute; z-index: 120; width: min(352px, calc(100vw - 16px)); max-height: min(460px, calc(100vh - 16px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow);
  animation: pop 0.14s ease-out;
}
.emoji-pop > * { flex-shrink: 0; min-width: 0; }
.pop-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 4px 14px; }
.pop-head strong { margin-right: auto; }
.tone-row { display: flex; gap: 4px; }
.tone-dot {
  width: 18px; height: 18px; padding: 0; border-radius: 50%; background: var(--tone);
  border: 2px solid transparent; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35) inset;
}
.tone-dot:hover { transform: scale(1.12); }
.tone-dot.is-active { border-color: var(--text); }
.pop-section { padding: 0 12px 8px; border-bottom: 1px solid var(--border); }
.pop-label { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 8px 2px 6px; }
.pop-more { display: flex; flex-wrap: wrap; gap: 6px; }
.pop-search { padding: 8px 12px 0; }
.pop-search input, .pop-any input {
  width: 100%; min-width: 0; height: 34px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--bg); outline: none; font-size: 0.88rem;
}
.pop-search input:focus, .pop-any input:focus { border-color: var(--brand-text); }
.pop-tabs {
  display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 2px;
  padding: 6px 10px 4px; border-bottom: 1px solid var(--border);
}
.pop-tab { min-width: 0; height: 30px; padding: 0; border: 0; border-radius: var(--r-sm); background: transparent; font-size: 1rem; line-height: 1; overflow: hidden; }
.pop-tab:hover, .pop-tab:focus-visible { background: var(--surface-3); }
/* The grid only ever scrolls up and down */
.pop-grid {
  flex: 1 1 auto; min-height: 120px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-gutter: stable; padding: 0 6px 6px 10px;
}
.emoji-group { content-visibility: auto; contain-intrinsic-size: auto 400px; }
.emoji-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 2px; min-width: 0; }
.emoji-cell {
  min-width: 0; width: 100%; height: 38px; padding: 0; overflow: hidden;
  border: 0; border-radius: var(--r-sm); background: transparent;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 1.35rem; line-height: 38px; text-align: center;
}
.emoji-cell:hover, .emoji-cell:focus-visible { background: var(--surface-3); }
.pop-any { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); }
.pop-any input { flex: 1; }
.pop-empty { padding: 12px 14px; font-size: 0.84rem; color: var(--muted); }

.awards { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.award-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: var(--r-pill);
  background: rgba(255, 181, 71, 0.12); border: 1px solid rgba(255, 181, 71, 0.35); font-size: 0.8rem; font-weight: 800; color: var(--warn);
}
.reward-pill { color: var(--warn); }
.reward-pill:hover { color: var(--warn); }

.reward-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.reward-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; text-align: left;
  border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface-2);
}
.reward-opt:hover { border-color: var(--warn); }
.reward-opt.is-active { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn) inset; background: rgba(255, 181, 71, 0.08); }
.reward-emoji { font-size: 1.6rem; }
.reward-price { font-weight: 900; font-size: 1.05rem; }
.reward-opt small { color: var(--muted); font-size: 0.74rem; }
.reward-summary { padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); font-size: 0.86rem; color: var(--text-2); }
.reward-summary strong { color: var(--text); }

.cred-card .cred-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.cred-icon { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; background: var(--logo-fill, linear-gradient(135deg, var(--logo-a), var(--logo-b))); }
.cred-total { display: block; font-size: 1.5rem; font-weight: 900; line-height: 1.1; }
.cred-label { font-size: 0.76rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.cred-card .small { margin-bottom: 10px; }

.earn-hero { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.earn-stat { padding: 12px; border-radius: var(--r); background: var(--surface-2); display: flex; flex-direction: column; }
.earn-stat strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.cred-breakdown { display: flex; flex-direction: column; gap: 6px; }
.cred-breakdown li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: var(--r); background: var(--surface-2); font-size: 0.88rem; }
.cred-breakdown small { display: block; color: var(--muted); font-size: 0.74rem; }
.pay-list { display: flex; flex-direction: column; gap: 6px; }
.pay-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); }
.pay-emoji { font-size: 1.4rem; }
.pay-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pay-main small { color: var(--muted); font-size: 0.76rem; overflow-wrap: anywhere; }
.pay-status { font-size: 0.72rem; font-weight: 800; }
.pay-status.pending { color: var(--warn); }
.pay-status.available { color: var(--ok); }
.pay-status.refunded { color: var(--danger); }
.pay-amount { font-weight: 900; text-align: right; font-variant-numeric: tabular-nums; }
.pay-amount small { display: block; font-weight: 600; font-size: 0.72rem; color: var(--muted); }
.pay-amount.in { color: var(--ok); }
.pay-amount.out { color: var(--text-2); }

@media (max-width: 640px) {
  .emoji-pop { position: fixed; left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-height: 70vh; border-radius: var(--r-lg) var(--r-lg) 0 0; z-index: 150; }
  .reward-grid { grid-template-columns: 1fr; }
  .earn-hero { grid-template-columns: 1fr 1fr 1fr; }
  .earn-stat strong { font-size: 1rem; }
}


/* Up/down votes */
.votes { display: inline-flex; align-items: center; height: 32px; border-radius: var(--r-pill); background: var(--surface-2); }
.vote-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px;
  border: 0; border-radius: var(--r-pill); background: transparent; color: var(--text-2);
  font-size: 0.82rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
button.vote-btn:hover { background: var(--surface-3); color: var(--text); }
.vote-btn .ic { width: 17px; height: 17px; }
.vote-btn.up.is-on { background: var(--brand); color: var(--brand-ink); }
.vote-btn.down.is-on { background: var(--down); color: #0b0c1f; }
.vote-sep { width: 1px; height: 16px; background: var(--border-strong); }
.votes.is-final { cursor: default; }
.votes.is-final .vote-btn { color: var(--grave); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Profile photos & reveal-yourself ---------- */
.avatar.has-img { padding: 0; overflow: hidden; background: var(--av); }
.avatar.has-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar.xl { width: 88px; height: 88px; font-size: 1.6rem; }
.profile-photo-row { display: flex; gap: 16px; align-items: flex-start; }
.profile-photo-row > div { min-width: 0; }
.profile-photo-row p { margin: 8px 0 12px; }
.revealed-tag { font-size: 0.68rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgba(255, 179, 71, 0.14); color: #ffb347; white-space: nowrap; }
@media (max-width: 480px) { .profile-photo-row { flex-direction: column; align-items: center; text-align: center; } }

/* ---------- Public chat communities ---------- */
.chat-mode-seg { margin: 0 14px 8px; }
.chat-mode-seg .seg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.community-feed { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 20px; }
.chat-mode-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px;
  flex-wrap: wrap;
}
.chat-mode-bar .chat-back { flex-shrink: 0; }
.chat-mode-bar .btn { flex-shrink: 0; }
.community-feed-title { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.community-feed-title h2 { font-size: 1.15rem; font-weight: 900; letter-spacing: -0.02em; }
.community-feed-title p { font-size: 0.8rem; color: var(--muted); }
.feed-icon.small { width: 44px; height: 44px; font-size: 1.3rem; border-width: 0; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--alias-soft); }
.community-card .post-meta .chat-icon { width: 26px; height: 26px; border-radius: 8px; font-size: 0.85rem; }
.community-card .post-title { cursor: pointer; }
.title-link { all: unset; cursor: pointer; overflow-wrap: anywhere; }
.title-link:hover, .community-card .post-title:hover { color: var(--brand-text); }
.title-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.community-preview {
  margin-top: 8px; padding: 8px 12px; border-radius: var(--r);
  background: var(--surface-2); border-left: 3px solid var(--pub);
  font-size: 0.84rem; color: var(--text-2);
}
.community-preview p { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.community-card .post-actions { flex-wrap: wrap; }
.vote-score { padding: 0 8px; font-size: 0.82rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; min-width: 2ch; text-align: center; }
.chat-votes .vote-btn { padding: 0 9px; }
.chat-head-actions .chat-votes { height: 30px; }
.chat-head-actions .chat-votes .vote-btn { height: 30px; }
.vis-badge.open { background: var(--ok-soft); color: var(--ok); }
.vis-badge.closed { background: var(--surface-3); color: var(--text-2); }
.chat-row-score {
  display: inline-flex; align-items: center; gap: 3px; font-size: 0.72rem; font-weight: 800;
  padding: 0 7px; height: 20px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2);
}
.chat-handle { font-weight: 800; color: var(--text-2); }
.join-toggle { height: auto; min-height: 28px; white-space: normal; text-align: left; }
.chat-compose.is-browsing { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.chat-compose.is-browsing p { flex: 1 1 260px; }
.locked-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.open-join-wrap { margin-top: 2px; }
.open-join-wrap .switch-row > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.open-join-wrap small { color: var(--muted); font-size: 0.76rem; }
.to-communities { flex-shrink: 0; }

/* ---------- Profile editor ---------- */
.feed-cta-row { display: flex; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; justify-content: flex-end; }
.profile-preview-text { min-width: 0; overflow-wrap: anywhere; }
.profile-where { padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); font-size: 0.82rem; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.field-hint { font-size: 0.76rem; color: var(--muted); min-height: 1em; }
.handle-input-wrap { display: flex; align-items: center; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--bg); padding-left: 12px; }
.handle-input-wrap:focus-within { border-color: var(--brand-text); }
.handle-at { color: var(--muted); font-weight: 700; user-select: none; }
.field .handle-input-wrap input { border: 0 !important; background: transparent !important; padding-left: 4px !important; flex: 1; min-width: 0; outline: none; }
#prof-handle-status.is-err, #prof-name-status.is-err { color: var(--danger); }
#prof-handle-status.is-ok { color: var(--ok); }
#profile-form { display: flex; flex-direction: column; gap: 14px; }

@media (max-width: 900px) {
  .chat-mode-bar .chat-back { display: inline-flex; }
}
@media (min-width: 901px) {
  .chat-mode-bar .chat-back { display: none; }
}
@media (max-width: 640px) {
  .community-feed { padding: 10px 10px 16px; }
  .chat-mode-bar { flex-wrap: wrap; }
  .chat-mode-bar > .btn { width: 100%; }
  .feed-cta-row { display: none; }
  .chat-head .chat-votes .vote-btn { padding: 0 6px; }
  .chat-head .chat-votes .vote-score { padding: 0 4px; }
}
.chat-sub .chat-handle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.chat-head-info { min-width: 120px; }
@media (max-width: 900px) { .to-communities { display: none; } }
@media (min-width: 901px) and (max-width: 1180px) { .chat-head-actions .btn-truce .hide-xs, .chat-head-actions .btn-ghost .hide-xs { display: none; } }
@media (max-width: 640px) {
  .chat-head { flex-wrap: wrap; row-gap: 8px; }
  .chat-head-info { flex: 1 1 160px; }
  .chat-head-actions { margin-left: auto; }
}

/* trademark mark next to the wordmark */
.tm { font-size: 0.45em; font-weight: 700; vertical-align: super; margin-left: 1px; line-height: 0; opacity: 0.85; }

/* identifying details hidden by the Gatekeeper (names are never marked) */
u.redacted { text-decoration: underline; text-decoration-color: var(--brand-text); text-decoration-thickness: 2px; text-underline-offset: 3px; font-style: italic; cursor: help; }

/* single post page (/post/<id>) */
.post-view-head { margin: 4px 0 12px; }
a.title-link { color: inherit; text-decoration: none; }
u.redacted { white-space: nowrap; }

/* posts are drawn in chunks (display: contents keeps the list's spacing) with rare ad slots between them */
.post-chunk { display: contents; }
.ad-slot { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--r-lg); padding: 10px 14px 12px; min-height: 120px; }
.ad-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ad-slot:has(ins.adsbygoogle[data-ad-status="unfilled"]), body.ads-off .ad-slot { display: none; }

/* web addresses in posts, comments and chats */
a.ext-link { color: #7cb7ff; text-decoration: none; word-break: break-all; border-bottom: 1px solid rgba(124, 183, 255, .35); }
a.ext-link:hover { border-bottom-color: currentColor; }
a.ext-link span { margin-right: 2px; font-size: .85em; }
.bubble a.ext-link { color: inherit; border-bottom-color: currentColor; }

/* polls in fight chats */
.poll { align-self: center; width: min(520px, 100%); margin: 10px auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: 12px 14px; }
.poll-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: .78rem; color: var(--muted); }
.poll-tag { font-weight: 800; color: var(--brand-text); text-transform: uppercase; letter-spacing: .06em; }
.poll-q { font-weight: 800; font-size: 1.02rem; margin: 6px 0 10px; overflow-wrap: anywhere; }
.poll-opts { display: flex; flex-direction: column; gap: 6px; }
.poll-opt { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2, rgba(255,255,255,.03)); color: inherit; font: inherit; cursor: pointer; overflow: hidden; }
.poll-opt:hover:not([disabled]) { border-color: var(--brand-text); }
.poll-opt[disabled] { cursor: default; }
.poll-opt.is-mine { border-color: var(--brand-text); }
.poll-fill { position: absolute; inset: 0 auto 0 0; background: var(--brand-soft); transition: width .3s ease; }
.poll-opt.is-mine .poll-fill { background: color-mix(in srgb, var(--brand) 30%, transparent); }
.poll-text, .poll-pct { position: relative; }
.poll-pct { font-weight: 800; font-variant-numeric: tabular-nums; }
.poll-foot { margin-top: 8px; font-size: .76rem; color: var(--muted); }
.poll-inputs { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }

/* Watch Party & Stream Polls */
.watch-party-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 0.74rem;
  font-weight: 800;
  background: #ff3cac;
  color: #ffffff;
  border: 1px solid #ff3cac;
  letter-spacing: 0.02em;
}
.watch-party-pill .ic { width: 14px; height: 14px; }

.watch-party-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r);
  background: rgba(255, 60, 172, 0.10);
  border: 1px solid rgba(255, 60, 172, 0.28);
  font-size: 0.86rem;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.45;
}
.poll-presets-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.presets-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-right: 2px;
}
.poll-preset-btn {
  border-radius: var(--r-pill);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s ease;
}
.poll-preset-btn:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: rgba(255, 60, 172, 0.45);
  transform: translateY(-1px);
}
.poll.is-watch-party-poll,
.poll.is-stream-poll {
  border-color: rgba(255, 60, 172, 0.35);
  box-shadow: 0 4px 22px rgba(255, 60, 172, 0.08);
}
.poll.is-watch-party-poll .poll-tag,
.poll.is-stream-poll .poll-tag {
  color: #ff3cac;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.poll-stream-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: rgba(255, 181, 71, 0.15);
  border: 1px solid rgba(255, 181, 71, 0.35);
  color: var(--warn, #ffb547);
  font-size: 0.72rem;
  font-weight: 800;
}
.poll-stream-badge .ic { width: 13px; height: 13px; }

/* ---------- chat header: click title or details button to toggle topic & rules drawer ---------- */
.title-toggle { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border-radius: 6px; }
.title-toggle:hover { color: var(--brand-text); }
.title-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.title-toggle .chev { font-size: .75em; color: var(--muted); display: inline-block; transition: transform .18s ease; flex-shrink: 0; }
.chat-headbox.is-open .title-toggle .chev { transform: rotate(180deg); }
.chat-headbox .chat-head-more { display: none; }
.chat-headbox.is-open .chat-head-more {
  display: block;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px 12px;
}
.chat-headbox.is-open .chat-head-more .chat-topic {
  padding: 0 0 6px;
  font-size: 0.84rem;
  color: var(--text-2);
  line-height: 1.45;
}
.chat-headbox.is-open .chat-head-more .chat-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 4px 0 0;
  font-size: 0.74rem;
  color: var(--muted);
  border-bottom: 0;
}
.chat-headbox.is-open .chat-head-more .chat-rules span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chat-headbox.is-open .chat-head-more .fork-banner {
  margin: 8px 0 0;
}

/* ---------- chat list: a slim rail of chat icons that opens on hover (desktop) ----------
   Opens quickly; closes slowly and only after the mouse has been away for a moment (see live.js). */
@media (min-width: 901px) and (hover: hover) {
  .chats { grid-template-columns: 72px minmax(0, 1fr); position: relative; }
  .chats .chat-pane { grid-column: 2; }
  .chat-list-pane {
    position: absolute; top: 0; bottom: 0; left: 0; width: 72px; z-index: 6;
    background: var(--surface); overflow: hidden;
    transition: width .45s cubic-bezier(.4, 0, .2, 1), box-shadow .45s ease;
  }
  .chat-list-pane.snap-shut { transition: none; }
  .chat-list-pane.is-open, .chat-list-pane:focus-within {
    width: 340px; box-shadow: 14px 0 34px rgba(0, 0, 0, .28);
    transition-duration: .2s;
  }
  /* keep the open layout at full width while the panel slides, so nothing re-wraps mid-animation */
  .chat-list-pane .chat-list-head, .chat-list-pane .chat-list { min-width: 340px; }
  .chat-list-pane .seg { min-width: 312px; }

  .chat-list-pane:not(.is-open):not(:focus-within) .chat-list-head h1,
  .chat-list-pane:not(.is-open):not(:focus-within) .chat-list-actions .icon-btn,
  .chat-list-pane:not(.is-open):not(:focus-within) .seg,
  .chat-list-pane:not(.is-open):not(:focus-within) .chat-row-main,
  .chat-list-pane:not(.is-open):not(:focus-within) .chat-row-score,
  .chat-list-pane:not(.is-open):not(:focus-within) .chat-list-empty { display: none; }
  .chat-list-pane:not(.is-open):not(:focus-within) .chat-list-head,
  .chat-list-pane:not(.is-open):not(:focus-within) .chat-list { min-width: 0; width: 72px; }
  /* collapsed rail: just the chat icons (the New button shows once the rail opens) */
  .chat-list-pane:not(.is-open):not(:focus-within) .chat-list-head { display: none; }
  .chat-list-pane:not(.is-open):not(:focus-within) .chat-list { padding: 14px 8px 10px; scrollbar-width: none; }
  .chat-list-pane:not(.is-open):not(:focus-within) .chat-row { justify-content: center; padding: 8px 0; }
}



/* ---------- flair picker: pill bubbles instead of a dropdown ---------- */
.flair-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.flair-popular { display: contents; }
.flair-chip {
  --flair: #8f96a3;
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px;
  font: inherit; font-size: 0.82rem; font-weight: 700; letter-spacing: -0.01em; color: var(--text); cursor: pointer;
  background: color-mix(in srgb, var(--flair) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--flair) 40%, transparent);
  transition: background .15s ease, border-color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.flair-chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--flair); flex-shrink: 0; }
.flair-chip:hover { background: color-mix(in srgb, var(--flair) 22%, transparent); border-color: var(--flair); }
.flair-chip:active { transform: scale(.97); }
.flair-chip:focus-visible { outline: 2px solid var(--flair); outline-offset: 2px; }
.flair-chip.is-active { background: var(--flair); border-color: var(--flair); color: #111; box-shadow: 0 4px 16px color-mix(in srgb, var(--flair) 35%, transparent); }
.flair-chip.is-active::before { background: rgba(0, 0, 0, .55); }
.flair-chip.flair-add { --flair: #c9ced8; border-style: dashed; background: transparent; }
.flair-chip.flair-add::before { display: none; }
.flair-chip.flair-add.is-active { background: var(--flair); border-style: solid; color: #111; }
.custom-flair { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.custom-flair input { width: 100%; }

/* ---------- light theme touch-ups for colors that were written for dark ---------- */
:root:not([data-theme="dark"]) .post.is-buried { background: linear-gradient(180deg, #eff0f3, #e9ebef); }
:root:not([data-theme="dark"]) .log-block .log-text,
:root:not([data-theme="dark"]) .chat-gate.is-blocked { color: #b4233c; }
:root:not([data-theme="dark"]) .truce-banner { color: #0d7a4b; }
:root:not([data-theme="dark"]) .tag button:hover { background: rgba(0, 0, 0, 0.08); }
:root:not([data-theme="dark"]) .mappings s,
:root:not([data-theme="dark"]) .check-row.is-out .check-text strong { color: #c2334d; }
:root:not([data-theme="dark"]) .toast-danger { background: #fdecef; }
:root:not([data-theme="dark"]) .revealed-tag { color: #a35f00; background: rgba(230, 150, 20, 0.14); }
:root:not([data-theme="dark"]) a.ext-link { color: #1a66c9; border-bottom-color: rgba(26, 102, 201, .35); }
:root:not([data-theme="dark"]) .bubble a.ext-link { color: inherit; border-bottom-color: currentColor; }
:root:not([data-theme="dark"]) .toast { box-shadow: 0 8px 24px rgba(20, 24, 35, 0.14); }
:root:not([data-theme="dark"]) .modal-backdrop { background: rgba(20, 24, 35, 0.45); }
:root:not([data-theme="dark"]) .ad-slot { border-color: var(--border-strong); }
:root:not([data-theme="dark"]) .topbar { background: rgba(255, 255, 255, 0.92); border-bottom-color: var(--border); }
:root:not([data-theme="dark"]) .tabbar { background: rgba(255, 255, 255, 0.96); }
/* Chat backgrounds are dark pictures and gradients, so the conversation on top of them always uses the dark colors */
:root:not([data-theme="dark"]) .chat-scroll.has-bg {
  color-scheme: dark;
  --bg: #0b0c0f; --surface: #14161b; --surface-2: #1b1e25; --surface-3: #232731; --hover: rgba(255, 255, 255, 0.05);
  --border: #262a33; --border-strong: #353a46; --text: #e8eaee; --text-2: #b4bac5; --muted: #a3aab6;
  --brand: #dcdbe6; --brand-2: #b6b4c6; --brand-ink: #15141d; --brand-text: #e8e7f0; --brand-soft: rgba(220, 219, 230, 0.10);
  --ok: #3ddc97; --ok-soft: rgba(61, 220, 151, 0.13); --warn: #ffb547; --warn-soft: rgba(255, 181, 71, 0.14);
  --danger: #ff4d6a; --danger-soft: rgba(255, 77, 106, 0.14); --truce: #2fd08a; --alias: #b98cff; --alias-soft: rgba(185, 140, 255, 0.15);
  color: var(--text);
}

/* ...except poll and truce cards, which are solid cards of their own, so they follow the light theme */
:root:not([data-theme="dark"]) .chat-scroll.has-bg .poll,
:root:not([data-theme="dark"]) .chat-scroll.has-bg .truce {
  color-scheme: light;
  --surface: #ffffff; --surface-2: #f0f3f5; --surface-3: #e2e8eb; --hover: rgba(10, 30, 36, 0.05);
  --border: #d5dde1; --border-strong: #bfcad0; --text: #0e1a1e; --text-2: #33454c; --muted: #627379;
  --brand: #201f2c; --brand-2: #12111a; --brand-ink: #ffffff; --brand-text: #201f2c; --brand-soft: rgba(32, 31, 44, 0.08);
  --ok: #0f9a62; --ok-soft: rgba(15, 154, 98, 0.10); --warn: #a96700; --warn-soft: rgba(230, 150, 20, 0.14);
  --danger: #d5243f; --danger-soft: rgba(213, 36, 63, 0.09); --alias: #7646d6; --alias-soft: rgba(118, 70, 214, 0.10);
  color: var(--text);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* ---------- flairs: solid pills (no see-through tint, no glow) ---------- */
.flair { background: var(--flair); color: var(--flair-ink, #fff); border: 0; padding: 2px 10px; font-weight: 700; }
.flair-chip, .flair-chip:hover { background: var(--flair); color: var(--flair-ink, #fff); border: 2px solid var(--flair); box-shadow: none; }
.flair-chip::before { display: none; }
.flair-chip:hover { filter: brightness(1.06); }
.flair-chip.is-active { background: var(--flair); color: var(--flair-ink, #fff); box-shadow: none; border-color: var(--surface); outline: 2px solid var(--text); outline-offset: 0; }
.flair-chip.is-active::after { content: '✓'; font-weight: 900; margin-left: 2px; }
.flair-chip.flair-add, .flair-chip.flair-add:hover { --flair: var(--surface-2); --flair-ink: var(--text-2); border: 2px dashed var(--border-strong); filter: none; }
.flair-chip.flair-add.is-active { --flair: var(--surface-3); --flair-ink: var(--text); border-style: solid; }
.flair-chip.flair-add.is-active::after { content: none; }

/* Feed headers: only the round icon overlaps the colored banner; the title always sits below it */
.feed-titles { padding-top: 30px; }
@media (max-width: 640px) { .feed-titles { padding-top: 26px; } }

/* =====================================================================
   Custom controls: scrollbars, selects, checkboxes, radios, search and
   date fields all drawn to match Chideout instead of the browser default.
   ===================================================================== */
:root { --scroll-thumb: rgba(255, 255, 255, 0.18); --scroll-thumb-hover: rgba(255, 255, 255, 0.32); }
:root:not([data-theme="dark"]) { --scroll-thumb: rgba(20, 24, 35, 0.20); --scroll-thumb-hover: rgba(20, 24, 35, 0.36); }

/* Slim, arrow-less scrollbars that only exist when there is something to scroll */
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); }
textarea { overflow-y: auto; }
#chat-input { overflow-y: hidden; scrollbar-width: none; }
#chat-input.is-scrolling { overflow-y: auto; scrollbar-width: thin; }

/* Selects: no native arrow box, a soft chevron instead */
:where(select) {
  appearance: none; -webkit-appearance: none;
  padding-right: 36px !important; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23868d9a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}

/* Checkboxes and radios */
:where(input[type="checkbox"], input[type="radio"]) {
  appearance: none; -webkit-appearance: none; margin: 2px 0 0; flex-shrink: 0;
  width: 20px; height: 20px; border: 2px solid var(--border-strong); background: var(--surface);
  display: inline-grid; place-content: center; cursor: pointer; vertical-align: -4px;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
:where(input[type="checkbox"]) { border-radius: 6px; }
:where(input[type="radio"]) { border-radius: 50%; }
:where(input[type="checkbox"])::after {
  content: ''; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2.5px 2.5px;
  transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform .12s ease;
}
:where(input[type="radio"])::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .12s ease; }
:where(input[type="checkbox"], input[type="radio"]):hover { border-color: var(--brand-text); }
:where(input[type="checkbox"], input[type="radio"]):checked { background: var(--brand); border-color: var(--brand-text); }
:where(input[type="checkbox"]):checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
:where(input[type="radio"]):checked::after { transform: scale(1); }
:where(input[type="checkbox"], input[type="radio"]):focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
:where(input[type="checkbox"], input[type="radio"]):disabled { opacity: .5; cursor: not-allowed; }

/* Search boxes: no browser "x" (the app has its own clear actions) */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
input[type="search"] { -webkit-appearance: none; appearance: none; }

/* Date fields (sign-up birthday) */
input[type="date"] { min-height: 42px; }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .55; border-radius: 6px; padding: 4px; }
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: .9; background: var(--hover); }
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); }

/* Number spinners never fit the look; hide them */
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* Emoji in round/square icon holders: optically centered (emoji fonts sit low on Windows by default) */
.feed-icon, .chat-icon, .avatar, .emoji-btn, .dd-emoji, .callout-icon, .empty-icon, .reward-emoji, .platform-badge, .acct-icon, .pay-emoji {
  line-height: 1; text-align: center;
}
.feed-icon, .chat-icon, .platform-badge, .acct-icon { display: inline-flex; align-items: center; justify-content: center; }

/* Report reasons: one tidy row per choice, custom radio aligned with its label */
.report-reasons { display: grid; gap: 4px; margin-top: 6px; }
.radio-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; line-height: 1.3; }
.radio-row:hover { background: var(--surface-2, rgba(127,127,127,.08)); }
.radio-row input { flex-shrink: 0; margin: 0; }
/* Textareas: no browser resize grip; they grow or scroll with the custom scrollbar instead */
textarea { resize: none; }

/* ============================================================================
   PHOTOS (posts, chats, composer, full-screen viewer)
   ============================================================================ */
.photo { display: block; padding: 0; border: 0; background: var(--surface-2); cursor: zoom-in; overflow: hidden; border-radius: 14px; max-width: 100%; }
.photo img { display: block; width: 100%; height: auto; object-fit: cover; }
.post-photo { margin-top: 10px; width: 100%; border: 1px solid var(--border); }
.post-photo img { max-height: 560px; object-fit: contain; background: var(--surface-2); }
.bubble.has-photo { padding: 4px; overflow: hidden; }
.bubble.has-photo .bubble-text { display: block; padding: 6px 10px 4px; }
.bubble.photo-only { background: transparent !important; padding: 0; }
.msg-photo { width: min(300px, 62vw); border-radius: 14px; }
.msg-photo img { max-height: 360px; }

.chat-attach {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; transition: color .15s, border-color .15s;
}
.chat-attach:hover { color: var(--brand-text); border-color: var(--border-strong); }
.chat-attach:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.chat-attach .ic { width: 20px; height: 20px; }

.photo-tray { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.photo-tray small { font-size: 0.76rem; line-height: 1.35; }
.photo-thumb { position: relative; display: inline-block; flex-shrink: 0; }
.photo-thumb img { display: block; width: 64px; height: 64px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
.photo-thumb.lg img { width: auto; height: auto; max-width: 100%; max-height: 220px; }
.photo-x {
  position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface);
  background: var(--text); color: var(--surface); font-size: 15px; line-height: 1; display: grid; place-items: center; cursor: pointer; padding: 0;
}
.photo-field { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.photo-field small { font-size: 0.78rem; }
#cmp-photo-preview:empty { display: none; }

.lightbox {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px;
  background: rgba(8, 9, 12, 0.88); opacity: 0; transition: opacity .18s ease; cursor: zoom-out;
}
.lightbox.is-open { opacity: 1; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox-x {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff; font-size: 24px; line-height: 1; display: grid; place-items: center;
}

/* ============================================================================
   DECLUTTERED HEADERS (Reddit-style): no gradient banners, small icon + title in one row
   ============================================================================ */
.feed-header { background: transparent; border: 0; border-radius: 0; overflow: visible; margin: 2px 0 12px; }
.feed-header-body { display: flex; align-items: center; gap: 10px; margin-top: 0; padding: 0 2px; }
.feed-icon, .feed-icon.small {
  width: 34px; height: 34px; font-size: 1.1rem; border: 0; border-radius: 50%;
  background: var(--surface-2); flex-shrink: 0;
}
.feed-titles { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; padding: 0; }
.feed-titles h1 { font-size: 1.2rem; line-height: 1.2; }
.feed-handle { font-size: 0.78rem; }
.feed-desc { padding: 4px 2px 0 46px; font-size: 0.84rem; color: var(--muted); line-height: 1.45; }
@media (min-width: 1181px) { .feed-header:not(.feed-friends) .feed-desc { display: none; } } /* the sidebar card says it already */
.feed-cta-row { display: flex; gap: 6px; flex-wrap: wrap; }
.about-card .about-body { padding: 16px; }

.community-feed-title { gap: 10px; }
.community-feed-title h2 { font-size: 1.05rem; }
.community-feed-title p { font-size: 0.78rem; }
.chat-mode-bar { margin-bottom: 10px; }

@media (max-width: 640px) {
  .feed-header-body { margin-top: 0; padding: 0 2px; }
  .feed-icon { width: 30px; height: 30px; font-size: 1rem; }
  .feed-titles { padding-top: 0; }
  .feed-titles h1 { font-size: 1.1rem; }
  .feed-desc { padding-left: 42px; }
  .feed-friends .feed-header-body { flex-wrap: wrap; }
}
.feed-header .feed-icon { background: var(--surface); border: 1px solid var(--border); }
@media (max-width: 640px) { .feed-desc { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; } }

/* "Chide it out" line icon */
.ic-outside { width: 1.1em; height: 1.1em; flex-shrink: 0; vertical-align: -0.18em; }
.btn .ic-outside { margin-right: 2px; }
.icon-btn .ic-outside { width: 20px; height: 20px; }
#modal-title .ic-outside { vertical-align: -0.15em; margin-right: 4px; }

/* The anonymous 🍑 (create bar, comment box): same gradient as the logo, not a dark disc */
.avatar.anon { background: linear-gradient(135deg, var(--logo-a), var(--logo-b)); box-shadow: none; line-height: 1; }

/* ============================================================================
   CHIDEOUT identity: logo, wordmark, undercover avatars, "classified" labels
   ============================================================================ */
img.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: none; display: block; }
.brand-word .wm-hide, .pb-word .wm-hide { color: var(--logo-text, var(--brand-text)); }
.topbar { box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--brand) 55%, transparent); }

/* Anonymous avatar: the Chideout mask (angry eyes + clasp) on teal (no emoji, so it looks the same on every device) */
.avatar.anon {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cmask id='m' maskUnits='userSpaceOnUse' x='0' y='0' width='64' height='64'%3E%3Cpath fill='%23fff' fill-rule='evenodd' d='M7 27.5C7 22.6 12.4 19.5 19.6 19.5c5.2 0 8.9 1.7 12.4 4.4 3.5-2.7 7.2-4.4 12.4-4.4C51.6 19.5 57 22.6 57 27.5c0 8.9-5.6 17-13.8 17-4.9 0-8.4-2.6-11.2-6.3-2.8 3.7-6.3 6.3-11.2 6.3C12.6 44.5 7 36.4 7 27.5ZM16.19 27.3A6.6 6.3 0 1 0 27.65 30.05ZM36.35 30.05A6.6 6.3 0 1 0 47.81 27.3Z'/%3E%3Cpath d='M32 20V24.2C32 27.2 28.2 27.8 32 31.2S32 35.2 32 38.2V42' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/mask%3E%3Crect width='64' height='64' fill='%23ffffff' mask='url(%23m)'/%3E%3C/svg%3E") center / 78% no-repeat,
    linear-gradient(135deg, var(--logo-a), var(--logo-b));
  font-size: 0; box-shadow: none;
}
.avatar.op { background: var(--brand-ink); color: var(--brand); font-size: 0.7rem; box-shadow: none; }

/* "classified file" labels: small monospace caps */
.nav-section-label, .card-title, .list-title, .rb-footer, .feed-handle, .gate-chip, .field-label em {
  font-family: var(--mono); letter-spacing: 0.06em;
}
.nav-section-label, .card-title, .list-title { font-size: 0.7rem; font-weight: 700; }
.nav-sub { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.02em; }

/* the Redactor's placeholders look like redaction tape */
u.redacted { text-decoration: none; background: color-mix(in srgb, var(--text) 9%, transparent); border-bottom: 2px solid var(--brand); padding: 0 3px; border-radius: 3px; font-family: var(--mono); font-size: 0.92em; }
.brand .brand-word .wm-hide { color: var(--logo-text, var(--brand-text)); }

/* Truce animation stage (drawn by playTruceScene) */
.truce-scene {
  position: fixed; inset: 0; z-index: 900; pointer-events: none; overflow: hidden;
  animation: sceneIn .35s ease-out;
}
.truce-scene canvas { display: block; width: 100vw; height: 100vh; pointer-events: none; }
.truce-scene.is-leaving { opacity: 0; transition: opacity .45s ease; }
.truce-scene-skip {
  position: fixed; right: 20px; bottom: calc(var(--tabbar-h, 62px) + env(safe-area-inset-bottom, 0px) + 12px);
  padding: 6px 16px; border-radius: 999px; border: 0; cursor: pointer;
  font-size: 0.78rem; font-weight: 700; background: rgba(11, 12, 15, 0.78); color: #fff;
  pointer-events: auto; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35); z-index: 901;
}
@media (min-width: 901px) {
  .truce-scene-skip { bottom: 24px; right: 24px; }
}
.truce.is-celebrating .truce-confetti i { animation: none; }
@keyframes sceneIn { from { opacity: 0; } to { opacity: 1; transform: none; } }

/* ============================================================================
   Interface icons (icon() in client-src/01-core.js): one line-icon set instead of emoji.
   They size to the text around them; the containers below give them their spot.
   ============================================================================ */
.ic-i { width: 1.15em; height: 1.15em; vertical-align: -0.22em; }
[role="menuitem"] .ic-i, .seg-btn .ic-i, .action-pill .ic-i, .btn .ic-i, .chip-btn .ic-i, .file-btn .ic-i { margin-right: 2px; }
[role="menuitem"] .ic-i { color: var(--text-2); }
[role="menuitem"].danger .ic-i { color: inherit; }
.empty-icon { color: var(--muted); line-height: 1; }
.empty-icon .ic, .callout-icon .ic, .feed-icon .ic, .cred-icon .ic, .truce-orb .ic, .tb-clasp span .ic { width: 1em; height: 1em; stroke-width: 1.5; vertical-align: middle; }
.dd-emoji { display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); }
.dd-emoji .ic { width: 19px; height: 19px; }
.platform-badge .ic, .chat-icon.platform .ic { width: 58%; height: 58%; color: #fff; stroke-width: 2; }
.platform-badge.snapchat .ic, .chat-icon.snapchat .ic { color: #111; }
.platform-btn .ic { width: 1.25em; height: 1.25em; }
.chat-icon .ic { width: 52%; height: 52%; }
.chat-icon.pub .ic { color: var(--alias); }
.chat-icon.priv .ic { color: var(--priv); }
.chat-icon.fork .ic { color: var(--alias); }
.tab-item .ic { width: 22px; height: 22px; }
.tab-item.is-active .ic { color: var(--brand-text); }
.toast-ic { width: 19px; height: 19px; flex: none; }
.toast-success .toast-ic { color: var(--ok); }
.toast-warn .toast-ic { color: var(--warn); }
.toast-danger .toast-ic { color: var(--danger); }
.toast-info .toast-ic { color: var(--brand-text); }
.cred-icon { color: var(--logo-ink); }
.truce-orb .ic { color: #fff; }
.tb-clasp span .ic { color: var(--truce); }
.info-strip-icon .ic, .create-bar-icon .ic { width: 18px; height: 18px; color: var(--muted); }
.reward-emoji .ic, .pay-emoji .ic { width: 1em; height: 1em; color: var(--brand-text); stroke-width: 1.6; }
.award-chip .ic { width: 15px; height: 15px; color: var(--brand-text); }
.countdown .ic { color: var(--quick); }
.burial-stamp .ic { color: var(--grave); }
.gate-chip .ic-i, .msg-note .ic-i, .alias-note .ic-i { width: 1.05em; height: 1.05em; }
.avatar .ic { width: 58%; height: 58%; stroke-width: 2; }
.ext-link .ic-i { width: 0.95em; height: 0.95em; margin-right: 3px; opacity: .75; }

a.dropdown-item, a.dropdown-item strong { text-decoration: none; }

/* ============================================================================
   PROFILES — banner, photo, 24-hour status, bio, friend / block
   ============================================================================ */
.avatar-btn { display: inline-flex; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; flex-shrink: 0; }
.avatar-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button.link-name, .link-name { padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-align: left; }
button.link-name:hover, .link-name:hover { text-decoration: underline; text-underline-offset: 2px; }
.person-name.link-name { font-weight: 700; }

/* "You blocked them" mark on a photo (only ever shown for people shown by name) */
.av-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.blocked-badge {
  position: absolute; right: -3px; bottom: -3px; width: 46%; height: 46%; min-width: 13px; min-height: 13px; max-width: 26px; max-height: 26px;
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--danger); color: #fff; box-shadow: 0 0 0 2px var(--surface);
}
.blocked-badge .ic { width: 78%; height: 78%; stroke-width: 2.4; }

.modal-profile { max-width: 440px; }
.modal-profile .modal-body { padding-top: 0; }
.profile-card { display: flex; flex-direction: column; gap: 14px; }
/* Banners are wide: whatever size someone uploads is scaled to cover this box (cropped, never stretched). */
.profile-banner {
  position: relative; margin: 0 -20px; aspect-ratio: 3 / 1; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--av) 70%, #000), color-mix(in srgb, var(--av) 35%, var(--surface-2)));
}
.profile-banner.has-img { background: var(--surface-2); }
.profile-banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.profile-banner.is-masked { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--av) 45%, #000) 0 14px, color-mix(in srgb, var(--av) 30%, #000) 14px 28px); }
.profile-id { display: flex; align-items: flex-start; gap: 12px; margin-top: -48px; position: relative; }
.profile-id .avatar.xl, .profile-id .av-wrap.xl .avatar { box-shadow: 0 0 0 4px var(--surface); }
.profile-names { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-top: 54px; }
.profile-names h3 { font-size: 1.2rem; font-weight: 850; line-height: 1.2; overflow-wrap: anywhere; }
.profile-handle { color: var(--muted); font-size: 0.86rem; }
.profile-blocked { display: inline-flex; align-items: center; gap: 4px; color: var(--danger); font-size: 0.78rem; font-weight: 700; }
.profile-blocked .ic { width: 14px; height: 14px; }
.profile-status { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); }
.profile-status.is-empty { border-style: dashed; background: transparent; }
.ps-emoji { font-size: 1.5rem; line-height: 1; }
.ps-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ps-text { font-size: 0.95rem; line-height: 1.45; overflow-wrap: anywhere; }
.profile-status.is-empty .ps-text { color: var(--muted); font-style: italic; }
#ps-quip { transition: opacity 0.22s; }
#ps-quip.is-swapping { opacity: 0; }
.ps-time { color: var(--muted); font-size: 0.74rem; }
.ps-dots i { font-style: normal; animation: ps-dot 1.4s infinite; opacity: 0.2; }
.ps-dots i:nth-child(2) { animation-delay: 0.2s; }
.ps-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes ps-dot { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }
.profile-bio { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; color: var(--text-2); }
.profile-actions { display: flex; flex-direction: column; gap: 8px; }
.profile-friend { width: 100%; justify-content: center; min-height: 48px; font-size: 1rem; font-weight: 800; border-radius: var(--r-pill); }
.profile-friend.is-friends { border-color: var(--brand); color: var(--brand-text); }
.profile-block { align-self: center; }
.profile-block.danger { color: var(--danger); }
.pick-row.is-disabled { opacity: 0.55; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { .ps-dots i { animation: none; opacity: 1; } }

/* ============================================================================
   TOP BAR: bigger Friends button, notifications bell + panel
   ============================================================================ */
/* Friends and the bell are ~40% bigger than the other top-bar icons */
.topbar-icon.topbar-friends, .topbar-icon.topbar-bell { width: 54px; height: 54px; color: var(--text); }
.topbar-icon.topbar-friends .ic, .topbar-icon.topbar-bell .ic { width: 31px; height: 31px; }
a.topbar-icon { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
/* The red count sits to the right of the icon */
.topbar-friends .badge, .topbar-bell .badge {
  top: 4px; right: auto; left: calc(50% + 7px); min-width: 20px; height: 20px; line-height: 20px; font-size: 0.72rem;
  background: #e5283f; color: #fff; box-shadow: 0 0 0 2px var(--surface, #fff);
}
.notif-menu { position: relative; }
.notif-panel { width: min(380px, calc(100vw - 16px)); right: -60px; padding: 0; overflow: hidden; display: flex; flex-direction: column; max-height: min(560px, calc(100vh - 90px)); }
.notif-panel.hidden { display: none; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 8px; }
.notif-head strong { font-size: 1rem; }
.notif-push { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 10px 8px; padding: 9px 12px; border-radius: 12px; background: var(--brand-soft); font-size: 0.82rem; }
.notif-push span { display: flex; align-items: flex-start; gap: 6px; line-height: 1.35; }
.notif-push .ic { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.notif-push.is-on { background: var(--surface-2); }
.notif-push.is-muted { background: var(--surface-2); color: var(--muted); }
.notif-list { list-style: none; margin: 0; padding: 0 6px 6px; overflow-y: auto; }
.notif-item {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px;
  color: var(--text); text-decoration: none; cursor: pointer; position: relative;
  transition: background 0.12s ease, transform 0.12s ease;
}
.notif-item:hover, .notif-item:focus-visible { background: var(--hover); transform: translateX(2px); outline: none; }
.notif-item:active { transform: scale(0.99); }
.notif-item.is-unread { background: var(--brand-soft); }
.notif-item.is-unread:hover { background: color-mix(in srgb, var(--brand-soft) 70%, var(--hover)); }
.notif-av {
  position: relative; flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; background: var(--av); color: #0b0c0f; font-weight: 800; font-size: 0.85rem;
}
.notif-av.has-img img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.notif-av > .ic { width: 22px; height: 22px; color: #fff; }
.notif-kind { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--brand); color: var(--brand-ink); box-shadow: 0 0 0 2px var(--surface); }
.notif-kind .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.notif-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.notif-line { font-size: 0.88rem; line-height: 1.35; overflow-wrap: anywhere; }
.notif-time { font-size: 0.74rem; color: var(--muted); }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; background: #e5283f; flex-shrink: 0; }
.notif-empty { padding: 18px 14px 22px; color: var(--muted); font-size: 0.86rem; text-align: center; }
@media (max-width: 640px) {
  .topbar-icon.topbar-friends, .topbar-icon.topbar-bell { width: 46px; height: 46px; }
  .topbar-icon.topbar-friends .ic, .topbar-icon.topbar-bell .ic { width: 28px; height: 28px; }
  .notif-panel { position: fixed; left: 8px; right: 8px; top: 64px; width: auto; }
}

/* Direct messages */
.vis-badge.dm { background: var(--brand-soft); color: var(--brand-text); }
.chat-icon.dm-icon { background: transparent; box-shadow: none; padding: 0; overflow: visible; }
.chat-icon.dm-icon .avatar.sm, .chat-icon.dm-icon .av-wrap { width: 100%; height: 100%; }
.chat-icon.dm-icon .avatar.sm { width: 100%; height: 100%; }
.profile-message { border-color: var(--brand); }

/* ============================================================================
   THE JURY: burns, verdicts, surrender, default victories, peace accords
   ============================================================================ */
.burn-pill {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 3px; margin: 4px 4px 0;
  height: 24px; padding: 0 8px; border-radius: var(--r-pill); border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font: inherit; font-size: 0.74rem; font-weight: 800; cursor: pointer;
  font-variant-numeric: tabular-nums; transition: color .15s, border-color .15s, background .15s, transform .15s;
}
.msg.mine .burn-pill { align-self: flex-end; }
.burn-pill .ic { width: 14px; height: 14px; }
.burn-pill:hover { color: var(--burn); border-color: var(--burn); }
.burn-pill.is-on { color: var(--burn); border-color: var(--burn); background: var(--burn-soft); }
.burn-pill.is-on .ic { fill: currentColor; }
.burn-pill.is-hot { color: #fff; background: linear-gradient(135deg, #ff9a3d, #ff4d4d); border-color: transparent; }
.burn-pill.is-static { cursor: default; }
.burn-pill:active:not(.is-static) { transform: scale(0.92); }
.burn-label { font-weight: 700; }
/* the Burn button stays out of the way until you hover or tap the message, unless the line already has burns */
.msg .burn-pill:not(.is-on):not(.is-static):not(.is-hot) { opacity: 0.55; }
@media (hover: hover) { .msg:hover .burn-pill { opacity: 1; } }
.msg.is-active .burn-pill, .msg.recent .burn-pill { opacity: 1; }

.jury-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--r-pill);
  background: var(--brand-soft); color: var(--brand-text); border: 0; font: inherit; font-size: 0.74rem; font-weight: 800;
}
button.jury-chip { cursor: pointer; }
button.jury-chip:hover { filter: brightness(1.1); }
.jury-chip .ic { width: 13px; height: 13px; }
.vis-badge.jury { background: var(--brand-soft); color: var(--brand-text); }
.watching { display: inline-flex; align-items: center; gap: 3px; color: var(--brand-text); font-weight: 700; }
.watching .ic { width: 14px; height: 14px; }
.chat-compose.is-jury p { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* truce: the jury's panel */
.truce-jury {
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-top: 12px; padding: 9px 12px;
  border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); font-size: 0.8rem;
}
.truce-jury.is-fair { border-color: color-mix(in srgb, var(--truce) 55%, transparent); background: color-mix(in srgb, var(--truce) 9%, var(--surface-2)); }
.tj-label { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; color: var(--text-2); }
.tj-btns { display: inline-flex; gap: 6px; }
.tj-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer;
}
.tj-btn b { font-variant-numeric: tabular-nums; }
.tj-btn[disabled] { cursor: default; opacity: 0.8; }
.tj-btn.fair:hover:not([disabled]), .tj-btn.fair.is-on { border-color: var(--truce); color: var(--truce); }
.tj-btn.unfair:hover:not([disabled]), .tj-btn.unfair.is-on { border-color: var(--danger); color: var(--danger); }
.tj-btn.fair.is-on { background: color-mix(in srgb, var(--truce) 14%, transparent); }
.tj-btn.unfair.is-on { background: var(--danger-soft); }
.tj-ruling { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 700; }
.truce-jury.is-fair .tj-ruling { color: var(--truce); }

/* truce: surrender and default victory */
.truce-b-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flag-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 0.8rem; }
.flag-btn:hover { color: var(--danger); }
.truce-claim {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding: 9px 12px;
  border-radius: var(--r); background: var(--surface-2); font-size: 0.8rem; color: var(--text-2);
}
.truce-claim > span { flex: 1; min-width: 180px; }
.truce-claim.is-quiet { background: transparent; padding: 4px 2px 0; color: var(--muted); }
.truce-claim.is-ready { background: var(--victory-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--victory) 50%, transparent); }
.truce-claim.is-ready > .ic { color: var(--victory); }
.truce.is-decided {
  background: linear-gradient(180deg, var(--victory-soft), transparent);
  border: 1px solid color-mix(in srgb, var(--victory) 55%, transparent);
}
.truce.is-decided .truce-badge, .truce.is-decided .truce-stamp { background: var(--victory-soft); color: var(--victory); }
.truce.is-decided .truce-orb { border-color: var(--victory); color: var(--victory); }
.truce-waiting.is-flag { display: flex; align-items: flex-start; gap: 6px; color: var(--text-2); font-style: italic; }
.truce-banner.is-victory { color: var(--victory); background: var(--victory-soft); }
.share-accord-btn { margin-left: auto; }
.share-accord-btn + .msg-act { margin-left: 0; }

/* truce: cosigners on peace accords */
.truce-cosigners-wrap {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.truce-cosigners-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.truce-cosigners-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-2);
}
.truce-cosigners-title strong { color: var(--text); }
.cosign-count { color: var(--muted); font-weight: 700; font-size: 0.76rem; }
.cosign-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--brand-text, #ff3cac);
}
.truce-cosigners-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 24px;
}
.cosigner-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.cosigner-chip.side-a {
  border-color: color-mix(in srgb, var(--priv) 50%, var(--border));
  background: color-mix(in srgb, var(--priv) 10%, var(--surface));
}
.cosigner-chip.side-b {
  border-color: color-mix(in srgb, var(--warn) 50%, var(--border));
  background: color-mix(in srgb, var(--warn) 10%, var(--surface));
}
.cosigner-chip.peace {
  border-color: color-mix(in srgb, var(--brand, #ff3cac) 50%, var(--border));
  background: color-mix(in srgb, var(--brand, #ff3cac) 12%, var(--surface));
}
.cosigner-chip.is-mine {
  box-shadow: 0 0 0 1px var(--brand);
}
.cosigners-empty { color: var(--muted); font-size: 0.76rem; font-style: italic; }
.truce-cosign-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.cosign-prompt { font-size: 0.74rem; color: var(--muted); font-weight: 700; }
.cosign-btn-group { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.cosign-btn-group .btn.is-active {
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 800;
}

/* peace accord preview + members modal jury list */
.accord-preview { display: flex; justify-content: center; background: var(--surface-2); border-radius: var(--r-lg); padding: 12px; }
.accord-preview img { display: block; max-width: 100%; max-height: min(62vh, 640px); height: auto; border-radius: 10px; box-shadow: var(--shadow); }
.member-sub { display: flex; align-items: center; gap: 6px; margin: 16px 0 6px; font-size: 0.9rem; font-weight: 800; }
.jury-note { display: flex; align-items: flex-start; gap: 6px; margin-top: 12px; }
@media (max-width: 560px) {
  .tj-ruling { margin-left: 0; width: 100%; }
}

/* ============================================================================
   BROWSING WITHOUT AN ACCOUNT — "Create account" button and the round sign-up card
   ============================================================================ */

body.is-guest #friends-btn,
body.is-guest .notif-menu { display: none; }
body.is-guest #create-post-btn { background: transparent; color: var(--text); border-color: var(--border-strong); }
body.is-guest #create-post-btn:hover { background: var(--hover); }
.signup-cta { box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--brand) 70%, transparent); }

.signup-backdrop { background: rgba(3, 10, 12, 0.62); backdrop-filter: blur(8px) saturate(120%); }
.signup-sheet {
  position: relative; z-index: 1;
  width: 100%; max-width: 380px; max-height: calc(100vh - 40px); overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 40px 28px 22px;
  border-radius: 32px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--border-strong));
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  animation: signup-in 0.32s cubic-bezier(0.2, 0.9, 0.25, 1.15);
}
@keyframes signup-in { from { opacity: 0; transform: translateY(14px) scale(0.94); } }
.signup-x {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted); border: 0;
  transition: background 0.15s, color 0.15s;
}
.signup-x:hover { background: var(--surface-3); color: var(--text); }
.signup-orb {
  width: 92px; height: 92px; border-radius: 50%;
  display: grid; place-items: center; margin-bottom: 18px;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--border), 0 14px 40px -12px rgba(0, 0, 0, 0.35);
}
.signup-orb img { width: 56px; height: 56px; }
.signup-title { font-size: 1.55rem; font-weight: 900; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 8px; }
.signup-sub { color: var(--text-2); font-size: 0.95rem; line-height: 1.45; margin: 0 0 22px; max-width: 30ch; }
.signup-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 50px; border-radius: 999px;
  font-weight: 800; font-size: 1rem; text-decoration: none;
  transition: transform 0.12s, filter 0.15s, background 0.15s;
}
.signup-btn:active { transform: scale(0.98); }
.signup-btn-main {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--brand-ink);
  box-shadow: 0 10px 28px -10px color-mix(in srgb, var(--brand) 75%, transparent);
}
.signup-btn-main:hover { filter: brightness(1.08); color: var(--brand-ink); }
.signup-btn-alt { margin-top: 10px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.signup-btn-alt:hover { background: var(--surface-3); color: var(--text); }
.signup-fine { margin: 16px 0 0; font-size: 0.74rem; color: var(--muted); }
.signup-fine a { color: var(--muted); text-decoration: underline; }
.join-card .btn + .btn { margin-top: 8px; }
@media (max-width: 480px) {
  .signup-sheet { padding: 36px 20px 20px; border-radius: 28px; }
  .signup-cta { height: 34px; padding: 0 12px; font-size: 0.82rem; }
}
@media (prefers-reduced-motion: reduce) { .signup-sheet { animation: none; } }
/* The sign-up card always sits in the middle, even where other dialogs become bottom sheets. */
.modal-root:has(.signup-sheet) { align-items: center; justify-content: center; padding: 16px; }

/* ============================================================================
   OPTION C: STAGE & COURTROOM FEED LAYOUT + ODDS & BETS TAB
   ============================================================================ */

/* Floating Navigation Dock & Stage Layout */
@media (min-width: 901px) {
  .layout {
    grid-template-columns: 244px minmax(0, 1fr) 56px;
    gap: 24px;
    max-width: 1480px;
    padding: 0 22px;
    position: relative;
  }
  html.rightbar-pinned .layout,
  body.rightbar-pinned .layout {
    grid-template-columns: 244px minmax(0, 1fr) 304px;
  }
  body.view-odds .layout {
    grid-template-columns: 244px minmax(0, 1fr);
  }
  body.view-odds .rightbar {
    display: none;
  }
  .leftnav {
    top: calc(var(--topbar-h) + 14px);
    height: calc(100vh - var(--topbar-h) - 28px);
    padding: 14px 10px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
  }
}

/* Upgraded Feed Header (replaces old subreddit-banner overlap) */
.feed-header {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.feed-header-body {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0;
  margin-top: 0;
}
.feed-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand-text);
  border: 1px solid color-mix(in srgb, var(--brand) 28%, transparent);
  font-size: 1.5rem;
}
.feed-titles { padding-bottom: 0; }
.feed-titles h1 { font-size: 1.35rem; font-weight: 900; letter-spacing: -0.02em; }
.feed-handle { font-size: 0.78rem; color: var(--muted); font-weight: 700; margin-top: 2px; }
.feed-desc { padding: 10px 0 0; margin: 0; font-size: 0.88rem; color: var(--text-2); line-height: 1.45; }
.feed-header-actions, .feed-header-cta { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cred-pill-inline {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: var(--r-pill);
  background: var(--brand-soft); color: var(--brand-text);
  font-size: 0.8rem; font-weight: 800;
}

/* Inline Composer Bar */
.create-bar {
  padding: 10px 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.12s;
}
.create-bar:hover {
  border-color: color-mix(in srgb, var(--brand) 50%, var(--border-strong));
}
.create-bar-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--brand-soft); color: var(--brand-text);
  font-size: 0.74rem; font-weight: 800; white-space: nowrap;
}
@media (max-width: 560px) {
  .create-bar-badge { display: none; }
}

/* Live Fight Stage Strip (Top of Main Feed) */
.live-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.live-stage-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.live-stage-title {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.live-stage-title h2 {
  font-size: 0.92rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.05em; margin: 0;
}
.live-stage-sub {
  font-size: 0.78rem; color: var(--muted); font-weight: 600;
}
.live-stage-actions {
  display: flex; align-items: center; gap: 6px;
}
.stage-card {
  position: relative;
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 16px 13px; text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 10px 28px -16px rgba(0, 0, 0, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.stage-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 20px 40px -18px rgba(0, 0, 0, 0.32);
}
.stage-card-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 0.7rem; font-weight: 700; color: var(--muted);
}
.stage-live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--text); color: var(--surface);
  font-size: 0.66rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
}
.stage-live-pill .live-dot { box-shadow: 0 0 0 2px color-mix(in srgb, var(--surface) 35%, transparent); }
.stage-card-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.98rem; line-height: 1.2; letter-spacing: -0.01em;
}
.stage-card-title strong {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800;
}
.stage-versus {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font-size: 0.76rem; color: var(--text-2); font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stage-side {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 44%;
}
.stage-side.a b { color: var(--side-a-color, var(--text)); font-weight: 800; }
.stage-side.b b { color: var(--side-b-color, var(--text)); font-weight: 800; }
.stage-vs {
  font-size: 0.62rem; font-weight: 900; color: var(--muted); letter-spacing: 0.08em;
}
.stage-tug {
  height: 6px; border-radius: 999px; overflow: hidden;
  background: var(--side-b-color, var(--surface-3));
}
.stage-tug > span {
  display: block; height: 100%;
  background: var(--side-a-color, var(--brand));
  border-radius: 999px 0 0 999px;
}
.stage-card-foot {
  display: flex; align-items: center; gap: 12px;
  font-size: 0.74rem; color: var(--muted); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stage-enter {
  margin-left: auto; padding: 5px 11px; border-radius: var(--r-pill);
  background: var(--text); color: var(--surface); font-weight: 800; font-size: 0.72rem;
  transition: background 0.15s ease;
}
.stage-card:hover .stage-enter { background: var(--brand); color: var(--surface); }
.live-stage-empty {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: var(--r); background: var(--surface-2);
  font-size: 0.84rem; color: var(--text-2);
}

/* Sort + Clickable Flair Filter Ribbon */
.feed-controls-row {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px;
}
.feed-controls-row .sort-bar { margin-bottom: 0; }
.flair-ribbon {
  display: flex; align-items: center; gap: 6px;
  overflow-x: auto; padding: 2px 0 4px;
  scrollbar-width: thin;
}
.flair-filter-pill {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  height: 30px; padding: 0 11px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: 0.76rem; font-weight: 700;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.flair-filter-pill:hover {
  background: var(--hover); color: var(--text); border-color: var(--border-strong);
}
.flair-filter-pill.is-active {
  background: var(--brand-soft); color: var(--brand-text);
  border-color: color-mix(in srgb, var(--brand) 45%, transparent);
}
.flair-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--flair-dot, var(--brand));
}
.flair.flair-clickable {
  border: 0; cursor: pointer;
  transition: transform 0.12s, filter 0.15s;
}
.flair.flair-clickable:hover {
  filter: brightness(1.08); transform: translateY(-1px);
}

/* Courtroom Post Cards & Verdict Bar */
.post {
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.post-mask-av { margin-right: 2px; }
.verdict-box {
  margin: 12px 0 10px;
  padding: 11px 13px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.verdict-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  margin-bottom: 7px; font-size: 0.76rem;
}
.verdict-label {
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text);
}
.verdict-summary { color: var(--muted); font-weight: 600; }
.verdict-bar-track {
  height: 6px; border-radius: 999px; overflow: hidden;
  background: var(--surface-3);
  margin-bottom: 9px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}
.verdict-fill-valid {
  display: block; height: 100%;
  background: linear-gradient(90deg, #ff3cac 0%, #a855f7 50%, #6366f1 100%);
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(255, 60, 172, 0.45);
  transition: width 0.25s ease;
}
.verdict-btns {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.verdict-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 10px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: 0.78rem; font-weight: 700;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.verdict-btn:hover { background: var(--hover); color: var(--text); border-color: var(--border-strong); }
.verdict-btn.valid.is-on {
  background: var(--brand-soft); color: var(--brand-text);
  border-color: color-mix(in srgb, var(--brand) 50%, transparent);
}
.verdict-btn.over.is-on {
  background: var(--down-soft); color: var(--down);
  border-color: color-mix(in srgb, var(--down) 50%, transparent);
}

.square-up-pill {
  color: var(--brand-text);
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
}
.square-up-pill:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
}

/* Comment 🔥 Burns & Self-Delete Tools */
.comment-tools {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 8px;
}
.cm-burn-btn, .cm-burn-static {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: var(--r-pill);
  background: transparent; border: 1px solid transparent;
  color: var(--muted); font-size: 0.74rem; font-weight: 700;
}
.cm-burn-btn:hover {
  background: var(--surface-3); color: var(--text);
}
.cm-burn-btn.is-on {
  background: var(--brand-soft); color: var(--brand-text);
  border-color: color-mix(in srgb, var(--brand) 40%, transparent);
}
.comment-del {
  color: var(--muted); padding: 2px 4px;
}
.comment-del:hover { color: var(--danger); }

/* Dedicated Odds & Bets Tab (#view-odds) */
.odds-section {
  margin-bottom: 22px;
}
.odds-sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.odds-sec-head h2 {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 1.05rem; font-weight: 900; margin: 0;
}
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}
.market-card, .odds-fight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.market-card.is-settled { opacity: 0.82; }
.market-card-top, .odds-fight-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  margin-bottom: 8px; font-size: 0.75rem; color: var(--muted);
}
.market-status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--r-pill);
  font-size: 0.72rem; font-weight: 800;
  background: var(--brand-soft); color: var(--brand-text);
}
.market-status-pill.settled {
  background: var(--surface-3); color: var(--text-2);
}
.market-pool { font-weight: 700; margin-left: auto; }
.market-question {
  font-size: 1rem; font-weight: 800; line-height: 1.35; margin: 0 0 10px;
}
.market-odds-track, .momentum-bar {
  height: 8px; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, var(--up) 45%, var(--surface-3));
  margin-bottom: 10px;
}
.market-fill-a, .momentum-fill-a {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 999px;
  transition: width 0.25s ease;
}
.market-sides {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.market-side-btn {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px; border-radius: var(--r); text-align: left;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); transition: border-color 0.15s, background 0.15s;
}
.market-side-btn:hover:not(:disabled) {
  border-color: var(--brand); background: var(--surface-3);
}
.market-side-btn.is-mine {
  background: var(--brand-soft);
  border-color: var(--brand);
}
.market-side-head {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font-size: 0.88rem;
}
.market-side-pct { font-weight: 900; color: var(--brand-text); }
.market-side-btn small { font-size: 0.72rem; color: var(--muted); }
.market-settle-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 0.75rem; color: var(--muted);
}

.odds-fight-list {
  display: flex; flex-direction: column; gap: 12px;
}
.odds-fight-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.odds-fight-title {
  font-size: 1.05rem; font-weight: 800; margin: 0 0 4px;
}
.odds-fight-title a { color: var(--text); text-decoration: none; }
.odds-fight-title a:hover { color: var(--brand-text); }
.odds-fight-topic {
  font-size: 0.85rem; color: var(--text-2); margin: 0 0 12px;
}
.momentum-board {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: var(--r); background: var(--surface-2);
  margin-bottom: 8px;
}
.momentum-board.multi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  align-items: stretch;
}
.momentum-board.multi .momentum-side {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 0;
}
.momentum-board.multi .momentum-fighter {
  flex: 1;
  min-width: 0;
}
.momentum-board.multi .momentum-fighter strong {
  font-size: 0.82rem;
  display: block;
}
.momentum-board.multi .momentum-pct {
  font-size: 1.05rem;
  font-weight: 900;
}
.momentum-bar.multi {
  display: flex;
  background: var(--surface-3);
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  gap: 1px;
}
.momentum-bar.multi .momentum-seg {
  height: 100%;
  transition: width 0.25s ease;
  min-width: 0;
}
.stage-versus.multi {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.stage-versus.multi .stage-side {
  max-width: 48%;
  font-size: 0.72rem;
}
.stage-tug.multi {
  display: flex;
  gap: 1px;
  overflow: hidden;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
}
.stage-tug.multi > span {
  height: 100%;
  border-radius: 0;
  display: block;
  transition: width 0.25s ease;
}
.momentum-side {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
}
.momentum-side.b { justify-content: flex-end; text-align: right; }
.momentum-fighter {
  display: flex; flex-direction: column; min-width: 0;
}
.momentum-fighter strong {
  font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.momentum-fighter small { font-size: 0.73rem; color: var(--muted); }
.momentum-pct {
  font-size: 1.15rem; font-weight: 900; color: var(--brand-text);
}
.momentum-side.b .momentum-pct { color: var(--up); }
.momentum-vs {
  font-size: 0.72rem; font-weight: 900; color: var(--muted);
  padding: 3px 7px; border-radius: 6px; background: var(--surface);
}
.odds-fight-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: 0.78rem; color: var(--muted);
}
.form-row-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}

/* Community / Chat Assigned Colors (--chat-accent, --side-a-color, --side-b-color).
   The stage card uses the chat's accent as solid ink (icon chip, Watch button), never as a wash or an outline. */
.stage-card .stage-live-dot {
  color: var(--chat-accent, var(--brand-text));
}
.stage-card .stage-live-dot::before {
  background: var(--chat-accent, var(--brand));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--chat-accent, var(--brand)) 24%, transparent);
}
.stage-card .stage-bar {
  background: color-mix(in srgb, var(--side-b-color, var(--up)) 45%, var(--surface-3));
}
.stage-card .stage-bar-a {
  background: var(--side-a-color, var(--chat-accent, var(--brand)));
}
.stage-card .stage-pct-a {
  color: var(--side-a-color, var(--chat-accent, var(--brand-text)));
}
.stage-card .stage-pct-b {
  color: var(--side-b-color, var(--up));
}

.odds-fight-card, .market-card {
  border-left: 4px solid var(--chat-accent, var(--brand));
}
.odds-fight-card .market-status-pill {
  background: color-mix(in srgb, var(--chat-accent, var(--brand)) 15%, var(--surface-2));
  color: var(--chat-accent, var(--brand-text));
}
.odds-fight-card .momentum-bar {
  background: color-mix(in srgb, var(--side-b-color, var(--up)) 42%, var(--surface-3));
}
.odds-fight-card .momentum-fill-a {
  background: var(--side-a-color, var(--chat-accent, var(--brand)));
}
.odds-fight-card .momentum-side.a .momentum-pct {
  color: var(--side-a-color, var(--chat-accent, var(--brand-text)));
}
.odds-fight-card .momentum-side.b .momentum-pct {
  color: var(--side-b-color, var(--up));
}

.community-card {
  /* one solid colour across the whole card, made from the chat's accent */
  --card-tint: color-mix(in srgb, var(--chat-accent, var(--brand)) 13%, var(--surface));
  border-top: 3px solid var(--chat-accent, var(--brand));
  border-color: color-mix(in srgb, var(--chat-accent, var(--brand)) 30%, var(--border));
  border-top-color: var(--chat-accent, var(--brand));
  background: var(--card-tint);
}
:root[data-theme="dark"] .community-card { --card-tint: color-mix(in srgb, var(--chat-accent, var(--brand)) 16%, var(--surface)); }
/* pieces inside sit on a deeper shade of the same colour instead of plain gray */
.community-card .community-preview,
.community-card .action-pill,
.community-card .votes {
  background: color-mix(in srgb, var(--chat-accent, var(--brand)) 12%, var(--card-tint));
}
.community-card .action-pill:hover {
  background: color-mix(in srgb, var(--chat-accent, var(--brand)) 22%, var(--card-tint));
}
.community-card .community-handle {
  color: var(--chat-accent, var(--brand-text));
}
.chat-row {
  border-left: 3px solid var(--chat-accent, transparent);
}
.chat-row.is-active {
  background: color-mix(in srgb, var(--chat-accent, var(--brand)) 12%, var(--surface-2));
}
.chat-icon {
  background: color-mix(in srgb, var(--chat-accent, var(--brand)) 16%, var(--surface-3));
  color: var(--chat-accent, var(--text));
  border: 1px solid color-mix(in srgb, var(--chat-accent, var(--brand)) 32%, transparent);
}
.chat-pane {
  border-top: 3px solid var(--chat-accent, var(--brand));
}

/* Color Swatch Picker */
.color-swatch-row {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.color-dot {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.color-dot:hover { transform: scale(1.1); }
.color-dot.is-active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text);
}
.color-custom-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px dashed var(--border-strong); cursor: pointer; overflow: hidden;
}
.color-custom-btn input[type="color"] {
  width: 36px; height: 36px; border: 0; padding: 0; background: none; cursor: pointer;
}

/* Twitch / YouTube / Kick Stream Stage & Stream Polls */
.stream-stage {
  margin: 0 14px 10px;
  border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--chat-accent, var(--brand)) 35%, var(--border));
  background: var(--surface-2);
  overflow: hidden;
}
.stream-stage-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--chat-accent, var(--brand)) 10%, var(--surface));
}
.stream-stage-title {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 0.82rem;
}
.stream-live-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: var(--r-pill);
  background: #e11d48; color: #fff;
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em;
}
.stream-stage-actions {
  display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.stream-stage-frame-wrap {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 340px;
  background: #000;
}
.stream-stage-iframe {
  width: 100%; height: 100%; border: 0; display: block;
}
.stream-pill {
  background: color-mix(in srgb, #8b5cf6 18%, var(--surface-2));
  color: #8b5cf6;
  padding: 1px 7px; border-radius: var(--r-pill); font-weight: 800; font-size: 0.68rem;
}
.poll-stream {
  border-color: color-mix(in srgb, #8b5cf6 45%, var(--border));
}
.poll-stream-badge {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 0.72rem; font-weight: 800; color: #8b5cf6;
  margin-bottom: 6px;
}
.poll-cred-tag {
  padding: 2px 7px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--up) 18%, var(--surface-2));
  color: var(--up);
}

/* Public Fight Challenge Consent Banner */
.challenge-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 10px 14px; padding: 12px 14px;
  border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--chat-accent, var(--brand)) 45%, var(--border));
  background: color-mix(in srgb, var(--chat-accent, var(--brand)) 10%, var(--surface-2));
}
.challenge-banner-text {
  display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 220px;
}
.challenge-banner-text strong { font-size: 0.9rem; }
.challenge-banner-text span { font-size: 0.78rem; color: var(--text-2); }
.challenge-banner-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}



/* ============================================================================
   LIVE FIGHT STAGE SCROLLER, CHAT BACKGROUNDS ON STAGE CARDS, COLOUR SWATCH GRID,
   ICON COLOUR PICKER & EMOJI PICKER ABOVE MODALS  (homepage strip + Customize modal)
   ============================================================================ */

/* --- the strip: one row, swipe/scroll sideways, scrollbar hidden, arrows overlaid on the edges --- */
.live-stage-scroller {
  position: relative;
  margin: 0 -16px -4px;
  overflow: hidden;
  border-radius: inherit;
}
.live-stage-rail {
  display: flex; flex-wrap: nowrap; align-items: stretch; gap: 10px;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x proximity; scroll-behavior: smooth; overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; -ms-overflow-style: none;
  padding: 4px 16px 8px;
  scroll-padding: 0 16px;
  border-radius: 0;
  cursor: grab;
  user-select: none;
}
.live-stage-rail::-webkit-scrollbar { display: none; width: 0; height: 0; }
.live-stage-rail:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.live-stage-rail.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
  scroll-snap-type: none;
}
.live-stage-rail.is-dragging * {
  pointer-events: none;
}
.live-stage-rail > .stage-card {
  flex: 0 0 250px; width: 250px; min-width: 250px; max-width: 250px;
  scroll-snap-align: start; scroll-snap-stop: normal;
  min-height: 150px;
}
@media (max-width: 480px) {
  .live-stage-rail > .stage-card { flex-basis: 228px; width: 228px; min-width: 228px; max-width: 228px; }
}
.stage-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 34px; height: 34px; border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  cursor: pointer; transition: background 0.15s, transform 0.12s, border-color 0.15s;
  user-select: none; touch-action: manipulation;
}
.stage-arrow .ic { width: 18px; height: 18px; }
.stage-arrow.prev { left: 8px; }
.stage-arrow.next { right: 8px; }
.stage-arrow.next .ic { transform: rotate(180deg); }
.stage-arrow:hover { background: var(--surface-3); border-color: var(--brand); }
.stage-arrow:active { transform: translateY(-50%) scale(0.94); }
.stage-arrow:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.live-stage-scroller.can-prev .stage-arrow.prev,
.live-stage-scroller.can-next .stage-arrow.next { display: inline-flex; }
/* a soft fade under each visible arrow so the cut-off card reads as "more this way" */
.live-stage-scroller::before, .live-stage-scroller::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 84px; z-index: 2; pointer-events: none;
  opacity: 0; transition: opacity 0.15s;
}
.live-stage-scroller::before {
  left: 0; border-radius: 0;
  background: linear-gradient(to right, var(--surface) 0%, color-mix(in srgb, var(--surface) 80%, transparent) 40%, transparent 100%);
}
.live-stage-scroller::after {
  right: 0; border-radius: 0;
  background: linear-gradient(to left, var(--surface) 0%, color-mix(in srgb, var(--surface) 80%, transparent) 40%, transparent 100%);
}
.live-stage-scroller.can-prev::before, .live-stage-scroller.can-next::after { opacity: 1; }
@media (hover: none) and (pointer: coarse) {
  .stage-arrow { width: 30px; height: 30px; }
}

/* --- emoji icon on a stage card: a small chip that can carry the icon's own background colour (--icon-bg) --- */
.stage-card-emoji {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 32px; height: 32px; border-radius: 9px; font-size: 1.05rem; line-height: 1;
  background: var(--chat-accent, var(--brand));
  border: 0;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.stage-card-emoji .ic { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28)); } /* a white glyph stays readable on a light accent */
.stage-card-emoji .ic { width: 16px; height: 16px; }
.stage-card-emoji.has-bg { background: var(--icon-bg); }
.stage-card-emoji.has-img { overflow: hidden; padding: 0; background: var(--surface-3); }
.stage-card-emoji.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- a card wearing the chat's own background (preset gradient or dimmed photo): light text throughout --- */
.stage-card.has-bg {
  --stage-fg: #ffffff;
  --stage-fg-2: rgba(255, 255, 255, 0.82);
  --stage-fg-3: rgba(255, 255, 255, 0.66);
  color: var(--stage-fg);
  border-color: rgba(255, 255, 255, 0.16);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  background-color: #1b1f2a; /* under a transparent preset or while a photo loads */
}
.stage-card.has-bg:hover { border-color: rgba(255, 255, 255, 0.42); }
.stage-card.has-bg .stage-card-top, .stage-card.has-bg .stage-card-foot { color: var(--stage-fg-3); }
.stage-card.has-bg .stage-versus { color: var(--stage-fg-2); }
.stage-card.has-bg .stage-side.a b, .stage-card.has-bg .stage-side.b b, .stage-card.has-bg .stage-enter { color: var(--stage-fg); }
.stage-card.has-bg .stage-live-pill {
  background: rgba(255, 255, 255, 0.16); color: var(--stage-fg);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.18); text-shadow: none;
}
.stage-card.has-bg .stage-vs {
  background: rgba(255, 255, 255, 0.16); color: var(--stage-fg-2);
  border: 1px solid rgba(255, 255, 255, 0.14); text-shadow: none;
}
.stage-card.has-bg .stage-tug { background: rgba(255, 255, 255, 0.28); }
.stage-card.has-bg .stage-tug > span { background: var(--side-a-color, #fff); }
.stage-card.has-bg .stage-live-pill { background: rgba(255, 255, 255, 0.16); color: var(--stage-fg); }
.stage-card.has-bg .stage-card-emoji { text-shadow: none; }
.stage-card.has-bg .stage-card-emoji:not(.has-bg):not(.has-img) {
  background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.24); color: #fff;
}
.stage-card.has-bg .stage-card-title strong { color: var(--stage-fg); }
/* light theme: the plain (accent-tinted) card keeps its light surface; only backgrounds switch to light text */
:root:not([data-theme="dark"]) .stage-arrow { box-shadow: 0 6px 18px rgba(20, 24, 35, 0.16); }

/* --- colour swatches: a wrapping grid of small dots (one hue per column, one lightness per row) + "any colour" --- */
.color-swatch-grid {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
}
.color-swatch-dots {
  display: grid; grid-template-columns: repeat(var(--swatch-cols, 12), minmax(0, 24px)); gap: 5px 6px;
  flex: 0 1 auto; min-width: 0; max-width: 100%;
}
.color-swatch-grid .color-dot {
  display: flex; align-items: center; justify-content: center; padding: 0;
  width: 100%; aspect-ratio: 1 / 1; height: auto; max-width: 24px; min-width: 16px;
  border-radius: 50%; border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.color-swatch-grid .color-dot:hover { transform: scale(1.18); z-index: 1; }
.color-swatch-grid .color-dot.is-active {
  border-color: var(--surface);
  box-shadow: 0 0 0 2px var(--text), inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  transform: scale(1.12);
}
.color-swatch-grid .color-dot.is-active::after {
  content: ''; display: block; width: 7px; height: 7px; margin: auto; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.color-swatch-grid .color-custom-btn {
  width: auto; height: 30px; padding: 0 10px 0 4px; gap: 7px; border-radius: var(--r-pill);
  border: 1px dashed var(--border-strong); color: var(--text-2); font-size: 0.74rem; font-weight: 700;
  background: var(--surface-2); overflow: visible;
}
.color-swatch-grid .color-custom-btn:hover { border-color: var(--text-2); color: var(--text); }
.color-swatch-grid .color-custom-btn input[type="color"] {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border: 0; padding: 0; border-radius: 50%; overflow: hidden; background: none; cursor: pointer;
}
.color-swatch-grid .color-custom-btn input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-swatch-grid .color-custom-btn input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.color-swatch-grid .color-custom-btn input[type="color"]::-moz-color-swatch { border: 0; border-radius: 50%; }
.color-swatch-grid .color-custom-btn input[type="color"]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.color-custom-label { white-space: nowrap; }
@media (max-width: 420px) {
  .color-swatch-dots { gap: 4px 5px; }
}

/* --- Customize modal: icon-colour field and the "More emoji…" row --- */
#cust-icon-color-field .cust-actions { margin-top: 8px; }
#cust-icon-color-field .link-btn.hidden { display: none; }
.cust-actions .btn-ghost.btn-sm .ic { width: 15px; height: 15px; }

/* --- the emoji popover must float above the modal (modal-root is z-index 200) when it picks a chat icon --- */
body .emoji-pop { z-index: 320; }
.live-stage-rail .stage-live-pill { white-space: nowrap; flex: 0 0 auto; }
.live-stage-rail .stage-origin { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================================
   STREAM ENHANCEMENTS: ROUNDED COMMUNITY CARD EMBEDS, STREAMER CHAT & MOBILE
   ============================================================================ */
.community-stream-card-embed {
  margin: 10px 0 12px;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 280px;
  border-radius: var(--r);
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
}
.community-stream-card-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.stream-viewers-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--brand) 18%, var(--surface-2));
  color: var(--brand-text);
  font-size: 0.72rem;
  font-weight: 700;
}
.stream-unpinned-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--warn) 18%, var(--surface-2));
  color: var(--warn);
  font-size: 0.72rem;
  font-weight: 700;
}
.stream-alert-btn.is-following, .stream-alert-pill.is-following {
  background: color-mix(in srgb, var(--brand) 25%, var(--surface-2)) !important;
  color: var(--brand-text) !important;
  border-color: var(--brand) !important;
}

.streamer-chat-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.streamer-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.streamer-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.streamer-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.streamer-name {
  font-size: 0.95rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.streamer-handle {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.2;
}
.streamer-head-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.stream-stage.is-unpinned:not(:hover) {
  opacity: 0.92;
}

.stream-stage-content.has-split-chat {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: 10px;
  padding: 8px 12px 10px;
  background: var(--surface-2);
}
.stream-stage-content.has-split-chat .stream-stage-player {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 420px;
  border-radius: var(--r);
  overflow: hidden;
  background: #000;
}
.stream-stage-content.has-split-chat .stream-stage-player iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.stream-stage-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 280px;
  max-height: 420px;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}
.stream-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--surface-3);
  font-size: 0.75rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.stream-chat-iframe {
  flex: 1;
  width: 100%;
  border: 0;
  min-height: 240px;
}

@media (max-width: 860px) {
  .stream-stage-content.has-split-chat {
    grid-template-columns: 1fr;
  }
  .stream-stage-chat {
    max-height: 300px;
  }
}

/* Fix mobile feed header text squeezing & mobile bottom nav item distribution */
@media (max-width: 640px) {
  .feed-header {
    padding: 14px 14px 12px !important;
    margin-bottom: 10px !important;
  }
  .feed-header-body {
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px 10px !important;
  }
  .feed-icon {
    width: 38px !important;
    height: 38px !important;
    font-size: 1.15rem !important;
    flex-shrink: 0 !important;
  }
  .feed-titles {
    flex: 1 1 calc(100% - 52px) !important;
    min-width: 0 !important;
  }
  .feed-titles h1 {
    font-size: 1.15rem !important;
    line-height: 1.25 !important;
    margin: 0 !important;
  }
  .feed-handle {
    font-size: 0.75rem !important;
    line-height: 1.35 !important;
    margin-top: 2px !important;
    white-space: normal !important;
    word-break: break-word !important;
  }
  .feed-header-actions, .feed-header-cta {
    width: 100% !important;
    margin-left: 0 !important;
    margin-top: 6px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
  }
  .tabbar {
    padding: 0 4px calc(env(safe-area-inset-bottom, 0px) + 2px) !important;
  }
  .tab-item {
    font-size: 0.58rem !important;
    padding: 4px 1px !important;
    gap: 1px !important;
  }
  .tab-item svg, .tab-item .ic-i {
    width: 18px !important;
    height: 18px !important;
  }
  .tab-create {
    flex: 0 0 38px !important;
  }
  .tab-create span {
    width: 32px !important;
    height: 32px !important;
    font-size: 1.15rem !important;
  }
}

/* =====================================================================
   Colour designators. A thick one-sided border on a rounded box bends
   around the corners into a lopsided crescent, so instead each of these
   gets a separate rounded bar that sits along the edge and stops short of
   the corners. Set --stripe for the colour; the box keeps its normal border.
   ===================================================================== */
.community-card, .odds-fight-card, .market-card, .toast, .source-card, .truce-side, .tb-side,
.community-preview, .what-posts-card, .chat-row, .nav-item { position: relative; }

/* bars on the left edge */
.odds-fight-card, .market-card { border-left: 1px solid var(--border); --stripe: var(--chat-accent, var(--brand)); }
.toast { border-left: 1px solid var(--border-strong); --stripe: var(--priv); }
.toast-success { --stripe: var(--ok); }
.toast-warn { --stripe: var(--warn); }
.toast-danger { --stripe: var(--danger); }
.source-card { border-left: 1px solid var(--border-strong); --stripe: var(--muted); }
.source-card.reddit { border-left-color: var(--border-strong); --stripe: #ff4500; }
.truce-side.side-a { border-left: 1px solid var(--border); --stripe: var(--priv); }
.truce-side.side-b { border-right: 1px solid var(--border); --stripe: var(--warn); }
.community-preview { border-left: 0; --stripe: var(--pub); }
.what-posts-card { border-left: 0; --stripe: var(--alias); }
.chat-row { border-left: 0; --stripe: var(--chat-accent, transparent); }
.nav-item.is-active { box-shadow: none; --stripe: var(--brand); }

:is(.odds-fight-card, .market-card, .toast, .source-card, .truce-side.side-a, .community-preview, .what-posts-card, .chat-row, .nav-item.is-active)::before {
  content: ''; position: absolute; pointer-events: none;
  left: var(--stripe-x, 0); top: var(--stripe-gap, 10px); bottom: var(--stripe-gap, 10px);
  width: 4px; border-radius: 0 4px 4px 0; background: var(--stripe);
}
/* boxes with a 1px border: the bar sits over the border line, flush with the outside edge */
.odds-fight-card, .market-card, .toast, .source-card, .truce-side { --stripe-x: -1px; }
.odds-fight-card, .market-card { --stripe-gap: 16px; }
.community-preview, .chat-row, .nav-item { --stripe-gap: 8px; }
.chat-row::before { width: 3px; }
.nav-item.is-active::before { width: 3px; }

/* bar on the right edge */
.truce-side.side-b::before {
  content: ''; position: absolute; pointer-events: none;
  right: -1px; top: 10px; bottom: 10px; width: 4px; border-radius: 4px 0 0 4px; background: var(--stripe);
}

/* bars along the top edge, inset from the rounded corners */
.community-card { border-top: 1px solid color-mix(in srgb, var(--chat-accent, var(--brand)) 30%, var(--border)); }
.tb-a { border-top: 1px solid var(--border); --stripe: var(--priv); }
.tb-b { border-top: 1px solid var(--border); --stripe: var(--warn); }
.community-card { --stripe: var(--chat-accent, var(--brand)); }
:is(.community-card, .tb-a, .tb-b)::before {
  content: ''; position: absolute; pointer-events: none;
  top: -1px; left: 22px; right: 22px; height: 4px; border-radius: 0 0 4px 4px; background: var(--stripe);
}
.tb-a::before, .tb-b::before { left: 14px; right: 14px; }

/* ---------- truce box in light mode (its base colours were written for dark) ---------- */
:root:not([data-theme="dark"]) .truce,
:root:not([data-theme="dark"]) .chat-scroll.has-bg .truce {
  background: var(--surface) !important;
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border)) !important;
  box-shadow: 0 6px 22px rgba(20, 24, 35, 0.16) !important;
}
:root:not([data-theme="dark"]) .truce.is-pending,
:root:not([data-theme="dark"]) .chat-scroll.has-bg .truce.is-pending {
  background: color-mix(in srgb, var(--warn) 7%, var(--surface)) !important;
  border: 1px dashed color-mix(in srgb, var(--warn) 60%, var(--border)) !important;
}
:root:not([data-theme="dark"]) .truce.is-decided { background: color-mix(in srgb, var(--victory, var(--ok)) 8%, var(--surface)) !important; }
:root:not([data-theme="dark"]) .truce.is-celebrating { animation: truceGlow 3.8s ease-out; }
:root:not([data-theme="dark"]) .truce-side { background: var(--surface-2); border: 1px solid var(--border); }
:root:not([data-theme="dark"]) .truce.is-sealed .truce-side { border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); }
:root:not([data-theme="dark"]) .truce-badge { background: var(--brand-soft); color: var(--brand-text); }
:root:not([data-theme="dark"]) .truce-orb { background: var(--brand); border-color: var(--brand); box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 35%, transparent); }
:root:not([data-theme="dark"]) .truce-orb .ic { color: var(--brand-ink); }
:root:not([data-theme="dark"]) .truce.is-pending .truce-orb { background: var(--surface-2); border-color: var(--warn); box-shadow: none; }
:root:not([data-theme="dark"]) .truce.is-pending .truce-orb .ic { color: var(--warn); }
:root:not([data-theme="dark"]) .truce-jury { background: var(--surface-2); border-color: var(--border); }
:root:not([data-theme="dark"]) .truce-input { background: var(--surface); }
:root:not([data-theme="dark"]) .truce-banner:not(.is-victory) { background: color-mix(in srgb, var(--truce) 12%, var(--surface)); }


/* ============================================================================
   JELLY BALL (.jb-) — the Jelly Fights lobby, the match view and the creator's arena editor
   The arena itself is a canvas drawn in 800×500 space and scaled by CSS; everything around it is DOM.
   ============================================================================ */
.jb-emoji { font-size: 1.25em; line-height: 1; }
.jb-emoji.lg { font-size: 1.9rem; }
.jb-logo-ball { width: 1.35em; height: 1.35em; vertical-align: middle; border-radius: 6px; }
.jb-logo-ball.lg { width: 1.9rem; height: 1.9rem; }
.jb-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: 0.74rem; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.jb-pill .ic { width: 14px; height: 14px; }
.jb-pill-live { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.jb-pill-wait { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

/* ---- lobby ---- */
.feed-jelly .feed-icon { font-size: 1.5rem; }
.jb-section { margin-bottom: 22px; }
.jb-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 2px 10px; }
.jb-sec-head h2 { font-size: 1rem; margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.jb-empty-line { color: var(--muted); font-size: 0.88rem; padding: 14px 16px; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); margin: 0; }
.jb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.jb-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.jb-card.is-active { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.jb-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.jb-card-meta { font-size: 0.76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jb-card-sides { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.jb-card-side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.jb-card-side.b { justify-content: flex-end; text-align: right; }
.jb-card-side.is-winner .jb-card-who strong { color: var(--victory); }
.jb-card-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.jb-card-who strong { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jb-card-who small { font-size: 0.72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jb-card-score { display: flex; align-items: center; gap: 4px; font-size: 1.5rem; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.jb-card-score i { font-style: normal; color: var(--muted); font-weight: 500; }
.jb-vs { font-size: 0.8rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.jb-pool-bar { position: relative; height: 6px; border-radius: 3px; background: #ff5c7a; overflow: hidden; }
.jb-pool-bar span { position: absolute; left: 0; top: 0; bottom: 0; background: #36c5f0; transition: width 0.4s ease; }
.jb-pool-bar.big { height: 10px; border-radius: 5px; }
.jb-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.jb-card-pool { font-size: 0.78rem; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.jb-card-pool .ic { width: 15px; height: 15px; }
.jb-card-cta { display: inline-flex; gap: 6px; margin-left: auto; }

/* ---- match view ---- */
.jb-match {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  width: 100%;
}
.jb-match-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.jb-match-meta {
  font-size: 0.74rem;
  color: var(--muted);
}
.jb-vis-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.jb-vis-pill.is-pub {
  background: color-mix(in srgb, var(--accent, #6366f1) 18%, transparent);
  color: var(--accent, #6366f1);
  border: 1px solid color-mix(in srgb, var(--accent, #6366f1) 32%, transparent);
}
.jb-vis-pill.is-priv {
  background: color-mix(in srgb, #f59e0b 20%, transparent);
  color: #f59e0b;
  border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent);
}
.jb-share-btn.is-copied {
  background: var(--ok, #10b981) !important;
  color: #fff !important;
  border-color: var(--ok, #10b981) !important;
}
.jb-waiting-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}
.jb-fs-toggle {
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 10000;
  opacity: 0;
  pointer-events: auto;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), 0 0 0 1px var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 999px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.18s ease, background 0.15s ease, border-color 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}
.jb-fs-toggle .ic { width: 14px; height: 14px; }
.jb-fs-toggle:hover, .jb-fs-toggle:focus-visible {
  opacity: 1 !important;
  transform: scale(1.04);
  background: var(--surface-2);
  border-color: var(--border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}
[data-theme="dark"] .jb-fs-toggle {
  background: rgba(18, 16, 28, 0.88);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .jb-fs-toggle:hover, [data-theme="dark"] .jb-fs-toggle:focus-visible {
  background: rgba(30, 27, 46, 0.96);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 16px rgba(180, 160, 255, 0.3);
}
.jb-match:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  padding: 8px 16px;
  background: var(--bg);
  color: var(--text);
  overflow-y: auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}
[data-theme="dark"] .jb-match:fullscreen {
  background: radial-gradient(circle at 50% 20%, #1e1b2e 0%, #0d0c14 100%);
  color: #ffffff;
}

.jb-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
}
.jb-canvas-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #0b1014;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}
.jb-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 165px);
  max-width: calc((100vh - 165px) * 1.6);
  aspect-ratio: 800 / 500;
  object-fit: contain;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
  margin: 0 auto;
}
.jb-match:fullscreen .jb-canvas {
  max-height: calc(100vh - 120px);
  max-width: calc((100vh - 120px) * 1.6);
}

.jb-bottom-bar {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.jb-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 1200px;
}
.jb-board {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 800px;
}
.jb-pcard {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 3px 10px;
  height: 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  border-left: 4px solid var(--side);
  transition: box-shadow 0.2s, transform 0.2s;
  flex: 1 1 0;
  max-width: 360px;
}
.jb-pcard.b {
  flex-direction: row-reverse;
  text-align: right;
  border-left: 1px solid var(--border);
  border-right: 4px solid var(--side);
}
.jb-pcard.is-turn {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--side) 55%, transparent), 0 4px 14px color-mix(in srgb, var(--side) 22%, transparent);
}
.jb-pcard.is-winner {
  background: var(--victory-soft);
}
.jb-pcard .avatar {
  width: 24px;
  height: 24px;
  min-width: 24px;
  font-size: 0.7rem;
}
.jb-pcard-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.1;
  flex: 1;
}
.jb-pcard-who strong {
  font-size: 0.78rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.jb-pcard-who strong em {
  font-style: normal;
  font-weight: 600;
  color: var(--muted);
}
.jb-pcard-who small {
  display: none;
}
.jb-pcard-score {
  font-size: 1.25rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  min-width: 1.3ch;
  text-align: center;
  color: var(--side);
}
.jb-pcard .jb-emoji.lg {
  font-size: 1.1rem;
}
.jb-pcard .jb-logo-ball.lg {
  width: 1.15rem;
  height: 1.15rem;
}
.jb-board-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 0 4px;
}
.jb-clock {
  font-size: 1.15rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}
.jb-clock.is-low {
  color: var(--danger);
  animation: jbBlink 0.6s steps(2) infinite;
}
.jb-clock-sub {
  font-size: 0.62rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.1;
  margin-top: 1px;
}
.jb-editor-wrap { display: flex; justify-content: center; background: #0b1014; }
.jb-editor-canvas { cursor: default; outline: none; width: auto; height: auto; max-width: 100%; max-height: 52vh; }
.jb-editor-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--brand-text); }
.jb-banner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(6, 10, 14, 0.45); backdrop-filter: blur(2px); animation: fade 0.25s ease-out; }
.jb-banner-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px; max-width: 92%;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-left: 6px solid var(--side, var(--border-strong)); border-radius: var(--r-lg); box-shadow: var(--shadow);
  animation: pop 0.25s ease-out;
}
.jb-banner-card strong { display: flex; align-items: center; gap: 6px; font-size: 1.05rem; }
.jb-banner-card small { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.jb-turnbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 22px;
  padding: 2px 8px;
  font-size: 0.76rem;
  color: var(--text-2);
  text-align: center;
}
.jb-turnbar .ic {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}
.jb-your-turn {
  color: var(--text);
}
.jb-power {
  display: inline-block;
  width: 90px;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
  vertical-align: middle;
}
.jb-power i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ok);
  transition: width 0.05s linear;
}

/* ---- side panels (now in bottom bar) ---- */
.jb-side {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.jb-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 3px 8px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  flex-wrap: wrap;
}
.jb-panel h3 {
  margin: 0;
  font-size: 0.74rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  color: var(--text-2);
}
.jb-panel h4 {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-2);
}
.jb-panel .note {
  margin: 0;
  font-size: 0.68rem;
}
.jb-lead {
  font-size: 0.72rem;
  white-space: nowrap;
}
.jb-pool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.jb-pool-row {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 0.7rem;
}
.jb-pool-row span:first-child {
  font-weight: 700;
}
.jb-pool-row b {
  font-variant-numeric: tabular-nums;
}
.jb-pool-bar {
  position: relative;
  width: 50px;
  height: 4px;
  border-radius: 2px;
  background: #ff5c7a;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}
.jb-pool-bar span {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: #36c5f0;
  transition: width 0.4s ease;
}
.jb-pool-bar.big {
  height: 5px;
}
.jb-bet-sides {
  display: inline-flex;
  gap: 4px;
}
.jb-bet-side {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  font-size: 0.7rem;
  cursor: pointer;
}
.jb-bet-side span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 80px;
}
.jb-bet-side:hover {
  border-color: color-mix(in srgb, var(--side) 60%, var(--border-strong));
}
.jb-bet-side.is-on {
  border-color: var(--side);
  background: color-mix(in srgb, var(--side) 16%, var(--surface-2));
}
.jb-bet-amounts {
  display: inline-flex;
  flex-wrap: wrap; /* a narrow side panel wraps the custom box instead of pushing it out of the panel */
  align-items: center;
  gap: 4px;
}
.jb-bet-amounts .chip-btn {
  padding: 1px 6px;
  font-size: 0.7rem;
  height: 22px;
}
/* Wide enough for "Custom" and a 3-digit amount; the number spinners are hidden because at this size they ate the
   text box (amounts are typed or picked from the chips anyway). */
.jb-bet-custom {
  box-sizing: border-box;
  width: 64px;
  min-width: 0;
  height: 22px;
  padding: 0 8px;
  text-align: center;
  line-height: 20px;
  -moz-appearance: textfield;
  appearance: textfield;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 700;
  outline: none;
}
.jb-bet-custom:focus {
  border-color: var(--brand-text);
}
.jb-bet-custom::-webkit-outer-spin-button,
.jb-bet-custom::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.jb-bet-custom::placeholder {
  color: var(--text-muted, inherit);
  opacity: 0.8;
}
.jb-my-bets ul {
  display: inline-flex;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.jb-turns {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.72rem;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 3px 6px;
  max-height: 48px;
  overflow-y: auto;
}
.jb-turns li {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: var(--r-sm);
  white-space: nowrap;
}
.jb-turn-no {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-right: 1px;
}
.jb-ok {
  color: var(--ok);
  font-weight: 700;
}
.jb-bad {
  color: var(--danger);
  font-weight: 700;
}

/* ---- creator + arena editor ---- */
.modal[data-modal="jb-creator"] { max-width: 900px; }
.jb-creator { display: flex; flex-direction: column; gap: 14px; }
.jb-cr-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.jb-cr-grid .field input[type="number"], .jb-cr-grid .field select { width: 100%; padding: 9px 12px; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font-size: 0.92rem; outline: none; }
.jb-cr-grid .field input:focus, .jb-cr-grid .field select:focus { border-color: var(--brand-text); }
.jb-emoji-row { display: flex; align-items: center; gap: 8px; }
.jb-emoji-btn { width: 48px; height: 44px; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--bg); font-size: 1.6rem; display: inline-flex; align-items: center; justify-content: center; }
.jb-emoji-btn:hover { border-color: var(--brand-text); }
.jb-emoji-btn .jb-logo-ball { width: 30px; height: 30px; }
.jb-seg .seg-btn { font-size: 0.78rem; padding: 0 8px; }
.jb-editor { display: flex; flex-direction: column; gap: 8px; }
.jb-editor-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.jb-editor-bar .seg { flex: 0 0 auto; }
.jb-file-btn { position: relative; overflow: hidden; cursor: pointer; }
.jb-file-btn input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.jb-editor-hint { margin: 0; min-height: 1.2em; }
.jb-poly-list { display: flex; flex-wrap: wrap; gap: 6px; }
.jb-poly-chip { display: inline-flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--r-pill); overflow: hidden; background: var(--surface-2); font-size: 0.78rem; font-weight: 700; }
.jb-poly-chip button { border: 0; background: transparent; color: var(--text-2); padding: 3px 10px; font: inherit; }
.jb-poly-chip button small { font-weight: 500; color: var(--muted); }
.jb-poly-chip.is-on { border-color: #36c5f0; background: rgba(54, 197, 240, 0.14); }
.jb-poly-chip .jb-poly-x { padding: 0 9px; border-left: 1px solid var(--border); font-size: 1rem; line-height: 1; }
.jb-poly-chip .jb-poly-x:hover { background: var(--danger-soft); color: var(--danger); }

/* ---- phones and narrow columns: the canvas takes the width, the panels stack ---- */
@media (max-width: 1180px) {
  .jb-stage-grid { grid-template-columns: minmax(0, 1fr); }
  .jb-side { flex-direction: row; flex-wrap: wrap; }
  .jb-side .jb-panel { flex: 1 1 280px; }
}
@media (max-width: 640px) {
  .jb-grid { grid-template-columns: minmax(0, 1fr); }
  .jb-board { flex-wrap: nowrap; gap: 4px; }
  .jb-pcard { padding: 2px 6px; height: 32px; gap: 4px; }
  .jb-pcard .avatar { width: 20px; height: 20px; min-width: 20px; font-size: 0.65rem; }
  .jb-pcard-who strong { max-width: 75px; font-size: 0.72rem; }
  .jb-pcard-score { font-size: 1.1rem; }
  .jb-pcard .jb-emoji.lg, .jb-pcard .jb-logo-ball.lg { font-size: 1rem; width: 1rem; height: 1rem; }
  .jb-board-mid { min-width: 44px; }
  .jb-clock { font-size: 1rem; }
  .jb-cr-grid { grid-template-columns: 1fr 1fr; }
  .jb-canvas-wrap { border-radius: var(--r); }
  .jb-match-meta { width: 100%; }
}

/* ============================================================================
   JELLY BALL LEVELS (.jl-) — the level page and player, races, the level editor, the card on posts
   ============================================================================ */
body.jl-ed-open { overflow: hidden; }
.jl-ok { color: var(--ok); }
.jl-bad { color: var(--danger); }

/* ---- the level page ---- */
.jl-view { display: flex; flex-direction: column; gap: 12px; }
.jl-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.jl-head-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 260px; }
.jl-head-title h1 { margin: 0; font-size: clamp(1.4rem, 3vw, 2rem); overflow-wrap: anywhere; }
.jl-head-title .jb-logo-ball, .jl-head-title .jb-emoji { width: 34px; height: 34px; font-size: 30px; border-radius: 0; flex: none; }
.jl-head-meta { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); width: 100%; order: 3; }
.jl-head-meta > span + span::before { content: '·'; margin-right: 12px; color: var(--border-strong); }
.jl-by { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 700; }
.jl-head-actions { display: flex; gap: 6px; margin-left: auto; }
.jl-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 14px; align-items: start; }
.jl-stage-host { min-width: 0; }
.jl-stage-wait { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; height: clamp(320px, 62vh, 720px); border-radius: var(--r-lg); background: var(--jl-backdrop); color: var(--text-2); border: 1px solid var(--border-strong); }
.jl-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.jl-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.jl-panel h3 { margin: 0; font-size: 0.95rem; display: flex; align-items: center; gap: 6px; }
.jl-panel .note { margin: 0; display: flex; align-items: center; gap: 6px; }
.jl-ghost-row { display: flex; align-items: center; gap: 6px; font-size: 0.84rem; font-weight: 700; cursor: pointer; }
.jl-ghost-row .ic { width: 16px; height: 16px; }
.jl-ghost-row small { font-weight: 500; }
.jl-board, .jl-racers, .jl-mini-board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.jl-board li, .jl-racers li, .jl-mini-board li { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: var(--r-sm); font-size: 0.84rem; min-width: 0; }
.jl-board li.is-me, .jl-racers li.is-me, .jl-mini-board li.is-me { background: var(--brand-soft); }
.jl-b-n, .jl-mb-n { width: 1.6em; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; flex: none; }
.jl-board li:nth-child(1) .jl-b-n { color: var(--victory); }
.jl-b-name, .jl-mb-name, .jl-r-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.jl-b-name em, .jl-r-name em { font-style: normal; font-weight: 500; color: var(--muted); }
.jl-b-d { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 0.75rem; }
.jl-b-d .ic { width: 13px; height: 13px; }
.jl-b-t, .jl-mini-board b { font-variant-numeric: tabular-nums; }

/* ---- races ---- */
.jl-race-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.jl-share { display: flex; gap: 6px; }
.jl-share input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: var(--bg); color: var(--text-2); font-size: 0.78rem; }
.jl-racers li { border-left: 3px solid var(--c, var(--border-strong)); }
.jl-racers li[data-action] { cursor: pointer; }
.jl-racers li[data-action]:hover { background: var(--hover); }
.jl-racers li.is-followed { box-shadow: inset 0 0 0 1px var(--c); }
.jl-racers li.is-empty { opacity: 0.6; border-left-style: dashed; }
.jl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--border-strong)); flex: none; }
.jl-r-st { font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jl-place { display: inline-block; padding: 0 6px; border-radius: var(--r-pill); background: var(--victory-soft); color: var(--victory); font-weight: 800; font-size: 0.72rem; }
.jl-live { color: var(--ok); font-weight: 700; }
.jl-race-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- the stage: canvas, HUD, overlays, touch buttons ---- */
/* The stage's backdrop follows the site theme (light by default) with the same jelly pattern the canvas draws,
   so nothing flashes dark before the first frame. */
:root {
  --jl-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cg fill-opacity='.13'%3E%3Ccircle cx='46' cy='52' r='20' fill='%237c4dff'/%3E%3Ccircle cx='150' cy='128' r='14' fill='%2336c5f0'/%3E%3Ccircle cx='118' cy='30' r='8' fill='%23ffc23d'/%3E%3Ccircle cx='36' cy='156' r='11' fill='%23ff5c7a'/%3E%3Ccircle cx='178' cy='184' r='6' fill='%237c4dff'/%3E%3C/g%3E%3Cg fill='%23fff' fill-opacity='.35'%3E%3Cellipse cx='39' cy='44' rx='7' ry='4' transform='rotate(-34 39 44)'/%3E%3Cellipse cx='145' cy='122' rx='5' ry='3' transform='rotate(-34 145 122)'/%3E%3C/g%3E%3Cg fill='none' stroke-width='2' stroke-opacity='.15' stroke-linecap='round'%3E%3Ccircle cx='160' cy='58' r='9' stroke='%237c4dff'/%3E%3Ccircle cx='90' cy='168' r='6' stroke='%2336c5f0'/%3E%3Cpath d='M90 96h12M96 90v12' stroke='%23ffc23d' stroke-opacity='.24'/%3E%3Cpath d='M180 20h8M184 16v8' stroke='%237c4dff' stroke-opacity='.2'/%3E%3C/g%3E%3C/svg%3E");
  --jl-backdrop: var(--jl-tile) 0 0 / 200px 200px repeat, linear-gradient(180deg, #f6f2ff, #e8f3ff);
}
:root[data-theme="dark"] { --jl-backdrop: var(--jl-tile) 0 0 / 200px 200px repeat, linear-gradient(180deg, #12152d, #090c1a); }
.jl-stage { position: relative; height: clamp(320px, 62vh, 720px); border-radius: var(--r-lg); overflow: hidden; background: var(--jl-backdrop); border: 1px solid var(--border-strong); box-shadow: var(--shadow); outline: none; user-select: none; -webkit-user-select: none; touch-action: none; }
.jl-stage:fullscreen, .jl-stage:-webkit-full-screen { height: 100vh; border-radius: 0; border: 0; }
.jl-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.jl-stage.is-hurt::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 70px rgba(255, 50, 70, 0.6); animation: jlHurt 0.5s ease-out forwards; }
@keyframes jlHurt { to { opacity: 0; } }
.jl-hud { position: absolute; left: 10px; right: 10px; top: 10px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; pointer-events: none; z-index: 2; }
.jl-hud-stats, .jl-hud-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.jl-hud-btns { justify-content: flex-end; }
.jl-hud-chip { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px; border-radius: var(--r-pill); background: rgba(8, 12, 18, 0.62); color: #fff; font-weight: 800; font-size: 0.88rem; font-variant-numeric: tabular-nums; backdrop-filter: blur(4px); }
.jl-hud-chip .ic { width: 16px; height: 16px; }
.jl-timer { font-size: 1.05rem; min-width: 5.4em; justify-content: center; letter-spacing: 0.01em; }
.jl-hud-btn { pointer-events: auto; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: rgba(8, 12, 18, 0.62); color: #fff; backdrop-filter: blur(4px); cursor: pointer; }
.jl-hud-btn:hover { background: rgba(8, 12, 18, 0.82); }
.jl-hud-btn .ic { width: 18px; height: 18px; }
.jl-hud-btn.jl-ghost-btn:not(.is-on) { opacity: 0.55; }
.jl-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(255, 255, 255, 0.12); z-index: 2; pointer-events: none; }
.jl-progress i, .jl-prog-finish { position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; }
.jl-prog-finish { background: #ff7a1a; border-radius: 2px; }
.jl-prog-me { background: #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4); width: 11px !important; height: 11px !important; margin: -5.5px 0 0 -5.5px !important; z-index: 1; }
.jl-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 56px 16px 16px; background: rgba(6, 10, 14, 0.42); z-index: 3; animation: fade 0.2s ease-out; }
.jl-ov-card { width: min(420px, 100%); max-height: 100%; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 18px 20px; border-radius: var(--r-lg); background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow); animation: pop 0.25s ease-out; }
.jl-ov-card h3 { margin: 0; font-size: 1.15rem; }
.jl-ov-card h3.jb-wordmark { font-size: 1.6rem; }
.jl-ov-card p { margin: 0; }
.jl-ov-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.jl-ov-ready { background: rgba(14, 20, 28, 0.86); color: #fff; border-color: rgba(255, 255, 255, 0.14); backdrop-filter: blur(6px); }
/* light theme (the default): light glass instead of the dark HUD */
:root:not([data-theme="dark"]):not([data-brand="jellyball"]) .jl-hud-chip,
:root:not([data-theme="dark"]):not([data-brand="jellyball"]) .jl-hud-btn { background: rgba(255, 255, 255, 0.8); color: #1d1838; box-shadow: 0 2px 10px rgba(40, 30, 90, 0.14); }
:root:not([data-theme="dark"]):not([data-brand="jellyball"]) .jl-hud-btn:hover { background: rgba(255, 255, 255, 0.95); }
:root:not([data-theme="dark"]):not([data-brand="jellyball"]) .jl-overlay { background: rgba(236, 232, 255, 0.32); }
:root:not([data-theme="dark"]):not([data-brand="jellyball"]) .jl-ov-ready { background: rgba(255, 255, 255, 0.9); color: var(--text); border-color: rgba(124, 77, 255, 0.18); box-shadow: 0 14px 40px rgba(50, 30, 120, 0.18); }
:root:not([data-theme="dark"]):not([data-brand="jellyball"]) .jl-keys,
:root:not([data-theme="dark"]):not([data-brand="jellyball"]) .jl-ready-note,
:root:not([data-theme="dark"]):not([data-brand="jellyball"]) .jl-touch-note { color: var(--text-2); }
:root:not([data-theme="dark"]):not([data-brand="jellyball"]) .jl-keys kbd,
:root:not([data-theme="dark"]):not([data-brand="jellyball"]) .jl-ready-note kbd { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
:root:not([data-theme="dark"]):not([data-brand="jellyball"]) .jl-count { color: #1d1838; text-shadow: 0 4px 24px rgba(255, 255, 255, 0.8); }
:root:not([data-theme="dark"]):not([data-brand="jellyball"]) .jl-progress { background: rgba(40, 30, 90, 0.12); }
.jl-play-big { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--brand); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.4); transition: transform 0.12s; }
.jl-play-big:hover { transform: scale(1.06); }
.jl-play-big .ic { width: 52px; height: 52px; }
.jl-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: 0.8rem; color: rgba(255, 255, 255, 0.82); }
.jl-keys kbd:not(.jui-kbd), .jl-ready-note kbd:not(.jui-kbd) { display: inline-block; min-width: 1.6em; padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.24); font: 700 0.74rem var(--font); text-align: center; }
.jl-ready-note { font-size: 0.82rem; color: rgba(255, 255, 255, 0.8); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.jl-ready-note .ic { width: 16px; height: 16px; }
.jl-touch-note { display: none; font-size: 0.8rem; color: rgba(255, 255, 255, 0.8); }
.jl-count { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.5); }
.jl-count-n { font-size: clamp(4rem, 14vw, 8rem); font-weight: 900; line-height: 1; animation: pop 0.3s ease-out; }
.jl-count small { font-size: 0.9rem; opacity: 0.85; }
.jl-res-label { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.jl-res-time { font-size: 2.6rem; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1; }
.jl-res-sub { font-size: 0.85rem; color: var(--text-2); }
.jl-res-rank { font-size: 0.9rem; }
.jl-rank { font-weight: 900; color: var(--victory); font-size: 1.05rem; }
.jl-result .jl-mini-board, .jl-result .jl-racers { width: 100%; text-align: left; }
.jl-touch { position: absolute; left: 0; right: 0; bottom: 12px; display: none; justify-content: space-between; padding: 0 14px; pointer-events: none; z-index: 2; }
.jl-touch-l, .jl-touch-r { display: flex; gap: 14px; align-items: flex-end; }
.jl-tbtn { pointer-events: auto; width: 74px; height: 74px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); background: rgba(10, 14, 20, 0.42); color: #fff; display: inline-flex; align-items: center; justify-content: center; touch-action: none; -webkit-tap-highlight-color: transparent; backdrop-filter: blur(3px); }
.jl-tbtn .ic { width: 34px; height: 34px; }
.jl-tbtn.is-down { background: rgba(255, 255, 255, 0.34); border-color: #fff; transform: scale(0.95); }
.jl-tbtn-jump { width: 88px; height: 88px; }
.jl-stage.is-touch .jl-touch { display: flex; }
.jl-stage.is-touch .jl-keys { display: none; }
.jl-stage.is-touch .jl-touch-note { display: block; }
.jl-stage.is-watch .jl-touch { display: none !important; }
@media (pointer: coarse) {
  .jl-touch { display: flex; }
  .jl-keys { display: none; }
  .jl-touch-note { display: block; }
}

/* ---- the card on posts ---- */
.jl-card { display: flex; flex-direction: column; margin: 10px 0 4px; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); }
.jl-card-strip { position: relative; display: block; width: 100%; height: 124px; padding: 0; border: 0; background: #0b1014; cursor: pointer; overflow: hidden; }
.jl-card-img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: left center; transition: transform 0.4s ease; }
.jl-card.is-tall .jl-card-img { object-position: center bottom; }
.jl-card-strip:hover .jl-card-img { transform: scale(1.03); }
.jl-strip-empty { display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); }
.jl-card-play { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(8, 12, 18, 0.62); color: #fff; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35); }
.jl-card-play .ic { width: 34px; height: 34px; }
.jl-card-len { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: var(--r-pill); background: rgba(8, 12, 18, 0.62); color: #fff; font-size: 0.72rem; font-weight: 800; }
.jl-card-body { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px 12px; }
.jl-card-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.jl-card-title .jb-wordmark { font-size: 1.35rem; overflow-wrap: anywhere; min-width: 0; }
.jl-card-title .jb-logo-ball, .jl-card-title .jb-emoji { width: 26px; height: 26px; font-size: 22px; border-radius: 0; flex: none; }
.jl-card-meta { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); }
.jl-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-2); font-weight: 700; }
.jl-chip .ic { width: 14px; height: 14px; }
.jl-card-best { display: inline-flex; align-items: center; gap: 5px; font-size: 0.84rem; color: var(--text-2); }
.jl-card-best .ic { width: 15px; height: 15px; color: var(--victory); }
.jl-card-best b { color: var(--text); font-variant-numeric: tabular-nums; }
.jl-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.jl-board-modal { min-height: 80px; }

/* ---- the composer ---- */
.cmp-attach-row { display: flex; gap: 6px; flex-wrap: wrap; }
.jl-cmp-btn .jb-ball-logo { width: 18px; height: 18px; }
.jl-cmp-btn.is-on { box-shadow: inset 0 0 0 1.5px var(--ok); }
#cmp-level-preview:empty { display: none; }
#cmp-level-preview { width: 100%; }
.jl-attach { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface-2); }
.jl-attach-img { width: 96px; height: 40px; border-radius: 6px; object-fit: cover; object-position: left center; flex: none; }
.jl-attach-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.jl-attach-info .jb-wordmark { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jl-attach-info small { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); font-size: 0.74rem; }
.jl-attach-info small .ic { width: 13px; height: 13px; }
.jl-chooser { display: flex; flex-direction: column; gap: 6px; align-items: stretch; padding: 8px; border: 1px dashed var(--border-strong); border-radius: var(--r); }
.jl-chooser-new, .jl-chooser-draft { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); color: var(--text); text-align: left; cursor: pointer; }
.jl-chooser-new:hover, .jl-chooser-draft:hover { border-color: var(--brand-text); }
.jl-chooser-new span, .jl-chooser-draft span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.jl-chooser small { color: var(--muted); font-size: 0.74rem; }
.jl-chooser .link-btn { align-self: flex-start; }

/* ---- the editor ---- */
.jl-ed { position: fixed; inset: 0; z-index: 210; display: flex; flex-direction: column; background: var(--bg); color: var(--text); }
.jl-ed-top { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 12px; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; }
.jl-ed-brand { display: inline-flex; align-items: center; gap: 8px; }
.jl-ed-brand .jb-wordmark { font-size: 1.3rem; }
.jl-ed-status { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.jl-ed-status.is-ok { color: var(--ok); font-weight: 700; }
.jl-ed-actions { display: flex; gap: 6px; margin-left: auto; flex: none; }
.jl-ed-actions .ic { width: 16px; height: 16px; }
.jl-ed-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 74px minmax(0, 1fr) 310px; }
.jl-ed-tools { display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; border-right: 1px solid var(--border); background: var(--surface); overflow-y: auto; }
.jl-ed-tool { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border: 0; border-radius: var(--r); background: transparent; color: var(--text-2); font-size: 0.64rem; font-weight: 700; cursor: pointer; }
.jl-ed-tool .ic { width: 22px; height: 22px; }
.jl-ed-tool:hover { background: var(--hover); color: var(--text); }
.jl-ed-tool.is-active { background: var(--brand-soft); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--brand-text); }
.jl-ed-stage { position: relative; min-width: 0; min-height: 0; background: var(--jl-backdrop); overflow: hidden; }
.jl-ed-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.jl-ed-zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.jl-ed-hint { position: absolute; left: 10px; top: 10px; max-width: min(560px, calc(100% - 74px)); margin: 0; padding: 6px 10px; border-radius: var(--r); background: rgba(8, 12, 18, 0.62); color: #fff; font-size: 0.78rem; line-height: 1.35; pointer-events: none; z-index: 2; }
.jl-ed-hint:empty { display: none; }
.jl-ed-mini { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 56px; width: calc(100% - 20px); border-radius: var(--r); background: rgba(8, 12, 18, 0.66); border: 1px solid rgba(255, 255, 255, 0.16); cursor: pointer; z-index: 2; touch-action: none; }
.jl-ed-stage.is-tall .jl-ed-mini { left: auto; right: 10px; top: 132px; bottom: 10px; width: 52px; height: auto; }
.jl-ed-play { position: absolute; inset: 0; z-index: 4; background: var(--bg); padding: 10px; }
.jl-ed-play .jl-stage { height: 100%; }
.jl-ed-dialog { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(6, 10, 14, 0.5); }
.jl-ed-panel { position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 10px 12px; border-left: 1px solid var(--border); background: var(--surface); }
.jl-ed-sheet-handle { display: none; }
.jl-ed-tabs .seg-btn { flex: 1; font-size: 0.82rem; }
.jl-ed-tabs .ic { width: 15px; height: 15px; }
.jl-ed-panel-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; }
.jl-ed-sec { display: flex; flex-direction: column; gap: 8px; }
.jl-ed-sec h4 { margin: 0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.jl-ed-sec h4 em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 500; }
.jl-ed-sec small { font-size: 0.76rem; line-height: 1.35; }
.jl-ed-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jl-ed-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.jl-ed-item-head h4 { font-size: 0.95rem; color: var(--text); text-transform: none; letter-spacing: 0; }
.jl-ed-empty { display: flex; gap: 6px; align-items: flex-start; }
.jl-file-btn { position: relative; overflow: hidden; cursor: pointer; align-self: flex-start; }
.jl-file-btn input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.jl-progbar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.jl-progbar i { display: block; height: 100%; background: var(--ok); transition: width 0.25s ease; }
.jl-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.jl-field input { height: 38px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font: 600 0.95rem var(--font); text-transform: none; letter-spacing: 0; outline: none; }
.jl-field input:focus { border-color: var(--brand-text); }
.jl-prop { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; }
.jl-prop > span { display: flex; justify-content: space-between; gap: 8px; color: var(--text-2); font-weight: 700; }
.jl-prop b { font-variant-numeric: tabular-nums; color: var(--text); }
.jl-prop input[type="range"] { width: 100%; accent-color: var(--ok); }
.jl-check { display: flex; align-items: center; gap: 6px; font-size: 0.84rem; font-weight: 700; flex-wrap: wrap; }
.jl-seg { flex-wrap: wrap; border-radius: var(--r); }
.jl-seg .seg-btn { font-size: 0.78rem; padding: 0 9px; flex: 1 1 auto; }
.jl-color input { width: 44px; height: 32px; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: none; cursor: pointer; }
.jl-ball-opt { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font-weight: 700; font-size: 0.84rem; cursor: pointer; }
.jl-ball-opt.is-on { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.jl-ball-opt .jb-emoji { font-size: 1.5rem; }
.jl-ball-q { font-size: 1.4rem; opacity: 0.6; }
.jl-ed-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 0.76rem; color: var(--muted); }
.jl-ed-counts b { color: var(--text-2); font-variant-numeric: tabular-nums; }
.jl-ed-counts .is-over, .jl-ed-counts .is-over b { color: var(--danger); }
.jl-del { color: var(--danger); }
.jl-ed.is-testing .jl-ed-tools, .jl-ed.is-testing .jl-ed-panel { pointer-events: none; opacity: 0.5; }

/* ---- narrow screens ---- */
@media (max-width: 1180px) {
  .jl-grid { grid-template-columns: minmax(0, 1fr); }
  .jl-side { flex-direction: row; flex-wrap: wrap; }
  .jl-side .jl-panel { flex: 1 1 280px; }
}
@media (max-width: 900px) {
  .jl-ed-body { grid-template-columns: 64px minmax(0, 1fr) 270px; }
}
@media (max-width: 760px) {
  .jl-ed-top { gap: 6px; padding: 0 8px; height: 50px; }
  .jl-ed-brand .jb-wordmark, .jl-ed-status { display: none; }
  .jl-ed-actions .btn { padding: 0 9px; }
  .jl-ed-body { display: flex; flex-direction: column; }
  .jl-ed-stage { flex: 1; order: 1; }
  .jl-ed-tools { order: 2; flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: 0; border-top: 1px solid var(--border); padding: 4px 6px; flex: none; }
  .jl-ed-tool { flex: none; width: 58px; }
  .jl-ed-panel { order: 3; flex: none; max-height: 54px; overflow: hidden; border-left: 0; border-top: 1px solid var(--border); padding: 4px 10px 8px; transition: max-height 0.25s ease; }
  .jl-ed.sheet-open .jl-ed-panel { max-height: 46vh; }
  .jl-ed-sheet-handle { display: flex; justify-content: center; align-items: center; height: 12px; border: 0; background: none; padding: 0; cursor: pointer; }
  .jl-ed-sheet-handle i { width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); }
  .jl-ed-hint { font-size: 0.72rem; right: 56px; }
  .jl-ed-mini { height: 44px; }
}
@media (max-width: 640px) {
  .jl-head-actions { margin-left: 0; }
  .jl-stage { height: calc(100svh - var(--topbar-h) - var(--tabbar-h) - 150px); min-height: 300px; border-radius: var(--r); }
  .jl-stage-wait { height: 300px; }
  .jl-hud-chip { height: 28px; padding: 0 9px; font-size: 0.8rem; }
  .jl-timer { font-size: 0.92rem; }
  .jl-hud-btn { width: 30px; height: 30px; }
  .jl-tbtn { width: 66px; height: 66px; }
  .jl-tbtn-jump { width: 80px; height: 80px; }
  .jl-res-time { font-size: 2.1rem; }
  .jl-card-strip { height: 104px; }
  .jl-card-title .jb-wordmark { font-size: 1.2rem; }
}

/* Custom ball image styling */
.jb-custom-ball {
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.jb-custom-ball.lg { width: 1.9rem; height: 1.9rem; }
.jb-pcard .jb-custom-ball.lg { width: 1.4rem; height: 1.4rem; }
.jl-head-title .jb-custom-ball { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.jl-card-title .jb-custom-ball { width: 26px; height: 26px; border-radius: 50%; flex: none; }
.jb-emoji-btn .jb-custom-ball { width: 30px; height: 30px; }
.jl-ball-opt .jb-custom-ball { width: 26px; height: 26px; }

/* ======================================================================
   JELLY BALL SITE — the 2D levels in the cartoony game skin (docs/handoff/jelly-ui-skin.md, surface 1)
   Built on the shared skin (public/jellyball/ui/ui.css: .jui-btn, .jui-frame, .jui-container, .jui-bar, .jui-kbd,
   .jui-ic); 04f-jellylevels.js adds those classes on the Jelly site only (jlJ / jlSkin), so this block is layout,
   sizing and the few things the skin has no class for. Everything is under html[data-brand="jellyball"]: chideout.com
   renders the same player inside posts in its own look.
   ====================================================================== */
html[data-brand="jellyball"] {
  --jlk-ink: #324652; --jlk-ink-2: #1b2d38; --jlk-white-l: #d3dee3;
  --jlk-red-o: #b30039; --jlk-red-l: #e62e49; --jlk-red-f: #f5535c;
  --jlk-blue-o: #0049c7; --jlk-blue-l: #1778ff; --jlk-blue-f: #37b9ff;
  --jlk-yellow-o: #f15a24; --jlk-yellow-l: #fc9504; --jlk-yellow-f: #fdaf18;
  --jlk-green-o: #006837; --jlk-green-l: #4ea800; --jlk-green-f: #8cc936;
  /* page-level panels follow the app theme; in-game cards are always the white pack frame */
  --jlk-panel-f: #ffffff; --jlk-panel-l: #d3dee3; --jlk-panel-o: #5d7c8c; --jlk-panel-t: #1b2d38; --jlk-panel-dim: #476475;
}
html[data-brand="jellyball"][data-theme="dark"] {
  --jlk-panel-f: #324652; --jlk-panel-l: #1b2d38; --jlk-panel-o: #0f1d26; --jlk-panel-t: #f2f7fa; --jlk-panel-dim: #abc0c9;
}
html[data-brand="jellyball"] .jl-pi.jui-ic { vertical-align: middle; }

/* ---------- the stage + HUD ---------- */
html[data-brand="jellyball"] .jl-stage .jl-hud { left: 10px; right: 10px; top: 10px; gap: 8px; align-items: flex-start; }
html[data-brand="jellyball"] .jl-stage .jl-hud-stats { gap: 6px; align-items: flex-start; }
html[data-brand="jellyball"] .jl-stage .jl-hud-btns { gap: 4px; }
/* chips: small white pack containers */
html[data-brand="jellyball"] .jl-stage .jl-hud-chip.jui-container {
  --jui-s: 0.62; display: inline-flex; align-items: center; gap: 5px; height: auto; min-height: 44px; padding: 0 6px 0 2px;
  background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; border-radius: 0;
  color: var(--jlk-ink-2); font: 900 1rem/1 var(--jui-font, inherit); font-variant-numeric: tabular-nums;
}
html[data-brand="jellyball"] .jl-stage .jl-hud-chip .jl-pi { width: 26px; height: 26px; }
html[data-brand="jellyball"] .jl-stage .jl-chip-time .jl-timer { display: inline-block; min-width: 4.5em; font-size: 1.14rem; letter-spacing: 0.01em; }
/* round buttons (.jui-btn--round --icon --sm, the close one red) */
html[data-brand="jellyball"] .jl-stage .jl-hud-btn.jui-btn,
html[data-brand="jellyball"] .jl-ed .jl-hud-btn.jui-btn { pointer-events: auto; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; border-radius: 0; }
html[data-brand="jellyball"] .jl-stage .jl-hud-btn .jui-ic.jui-ic--mask,
html[data-brand="jellyball"] .jl-ed .jl-hud-btn .jui-ic.jui-ic--mask { width: 22px; height: 22px; }
html[data-brand="jellyball"] .jl-stage .jl-hud-btn.jl-ghost-btn:not(.is-on) { opacity: 1; }
html[data-brand="jellyball"] .jl-stage .jl-hud-btn.jl-ghost-btn:not(.is-on) .jui-ic { filter: grayscale(1); opacity: 0.5; }
/* the immersive "menus" corner: a round white 3D button with the pack's menu icon */
html[data-brand="jellyball"] .jl-stage .jl-chrome-hot { padding: 8px 8px 0 0; }
html[data-brand="jellyball"] .jl-stage .jl-chrome-btn { pointer-events: none; opacity: 0.9; transition: transform 0.15s ease, opacity 0.15s; }
html[data-brand="jellyball"] .jl-stage .jl-chrome-hot:hover .jl-chrome-btn, html[data-brand="jellyball"] .jl-stage .jl-chrome-hot:focus-visible .jl-chrome-btn { opacity: 1; transform: scale(1.06); }
html[data-brand="jellyball"] .jl-stage .jl-chrome-btn .jui-ic { width: 22px; height: 22px; }

/* ---------- progress strip: a pack bar with the finish flag and racer dots ---------- */
html[data-brand="jellyball"] .jl-stage .jl-progress { left: 50%; right: auto; bottom: 12px; width: min(560px, calc(100% - 32px)); height: 20px; transform: translateX(-50%); background: none; }
html[data-brand="jellyball"] .jl-stage .jl-prog-bar { position: absolute; inset: 0; height: 100%; }
html[data-brand="jellyball"] .jl-stage .jl-prog-fill { width: 0; transition: none; }
html[data-brand="jellyball"] .jl-stage .jl-prog-finish { top: 0; width: 28px; height: 28px; margin: -24px 0 0 -6px; background: none; border-radius: 0; z-index: 1; }
html[data-brand="jellyball"] .jl-stage .jl-prog-finish .jl-pi { width: 28px; height: 28px; display: block; }
html[data-brand="jellyball"] .jl-stage .jl-prog-dots i { width: 12px; height: 12px; margin: -6px 0 0 -6px; border: 2px solid var(--jlk-ink-2); box-sizing: border-box; z-index: 1; }
html[data-brand="jellyball"] .jl-stage .jl-prog-me { width: 20px !important; height: 20px !important; margin: -10px 0 0 -10px !important; background: #fff; border: 4px solid var(--jlk-red-o); box-sizing: border-box; box-shadow: 0 2px 0 rgba(27, 45, 56, 0.35); z-index: 2; }

/* ---------- overlay + cards (white pack 3D containers, in either theme: they sit on the level's picture) ---------- */
html[data-brand="jellyball"] .jl-stage .jl-overlay { background: rgba(27, 45, 56, 0.3); }
html[data-brand="jellyball"] .jl-stage .jl-ov-card.jui-container,
html[data-brand="jellyball"] .jl-ed .jl-ov-card.jui-container {
  width: min(440px, 100%); gap: 12px; border-radius: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; background-color: transparent;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  --jui-s: 1.25; padding: 14px 18px 8px; color: var(--jlk-ink-2); filter: drop-shadow(0 10px 18px rgba(27, 45, 56, 0.35));
  animation: jlkPop 0.32s cubic-bezier(.2, .9, .3, 1.35) both;
}
html[data-brand="jellyball"] .jl-ov-card.jui-container .muted { color: #476475; }
html[data-brand="jellyball"] .jl-ov-card.jui-container h3 { font-weight: 900; font-size: 1.35rem; line-height: 1.15; color: var(--jlk-ink-2); }
html[data-brand="jellyball"] .jl-ov-card.jui-container .jl-bad { color: #c6263d; font-weight: 700; }
html[data-brand="jellyball"] .jl-stage .jl-ov-btns { gap: 8px; margin-top: 2px; }
html[data-brand="jellyball"] .jl-ov-btns .jui-btn:not(.jui-btn--sm) { --jui-s: 0.86; }
@keyframes jlkPop { from { transform: scale(0.82); opacity: 0; } to { transform: none; opacity: 1; } }

/* the ready card: the big round red play button (.jui-btn --round --icon --xl) + keycaps */
html[data-brand="jellyball"] .jl-stage .jl-play-big.jui-btn { box-shadow: none; animation: jlkBreathe 1.8s ease-in-out infinite; }
html[data-brand="jellyball"] .jl-stage .jl-play-big.jui-btn:hover { transform: scale(1.05); animation: none; }
/* Round play buttons: the pack's triangle (arrow-right, 69% of its icon box tall) sized so it is ~58% of the face's
   diameter (the round button's face is 46/64 of the box), centred on the face above the lip (the button's bottom
   padding is the lip, so flex centring lands on the face), nudged right ~6% of the face for the optical centre. */
html[data-brand="jellyball"] :is(.jl-stage .jl-play-big, .jx-page .jx-level-play).jui-btn .jui-ic {
  width: calc(38.6px * var(--jui-s)); height: calc(38.6px * var(--jui-s)); margin: 0; transform: translateX(calc(2.8px * var(--jui-s)));
}
@keyframes jlkBreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
html[data-brand="jellyball"] .jl-stage .jl-keys { gap: 8px 16px; color: #476475; font-size: 0.86rem; font-weight: 800; }
html[data-brand="jellyball"] .jl-stage .jl-keys > span { display: inline-flex; align-items: center; gap: 3px; }
html[data-brand="jellyball"] .jl-stage .jl-ready-note,
html[data-brand="jellyball"] .jl-stage .jl-touch-note { color: var(--jlk-ink-2); font-size: 0.92rem; font-weight: 700; line-height: 1.45; }

/* countdown: big outlined yellow numbers that bounce in */
html[data-brand="jellyball"] .jl-stage .jl-count { text-shadow: none; }
html[data-brand="jellyball"] .jl-stage .jl-count-n {
  font-size: clamp(5rem, 16vw, 9rem); font-weight: 900; line-height: 1; color: #fec92b;
  -webkit-text-stroke: 8px var(--jlk-ink-2); paint-order: stroke fill;
  text-shadow: 0 8px 0 var(--jlk-ink-2); animation: jlkCount 0.5s cubic-bezier(.2, .9, .3, 1.5) both;
}
html[data-brand="jellyball"] .jl-stage .jl-count small {
  margin-top: 10px; padding: 8px 14px 11px; border: 3px solid var(--jlk-ink); border-radius: 12px; background: #fff; color: var(--jlk-ink-2);
  box-shadow: inset 0 -5px 0 var(--jlk-white-l); font-size: 0.92rem; font-weight: 800; opacity: 1;
}
@keyframes jlkCount { 0% { transform: scale(2.2); opacity: 0; } 60% { transform: scale(0.9); opacity: 1; } 100% { transform: scale(1); } }

/* finish / results: a trophy, a red ribbon label, stars that pop in one by one */
html[data-brand="jellyball"] .jl-stage .jl-result::before {
  content: ''; width: 72px; height: 72px; margin: -2px 0 -4px; flex: none;
  background: url('/jellyball/ui/icons/general/trophy/trophy.svg') center / contain no-repeat;
  filter: drop-shadow(0 4px 0 rgba(27, 45, 56, 0.2)); animation: jlkCount 0.55s cubic-bezier(.2, .9, .3, 1.5) both;
}
html[data-brand="jellyball"] .jl-stage .jx-win::before { content: none; }
html[data-brand="jellyball"] .jl-stage .jl-res-label {
  padding: 6px 14px 9px; border: 3px solid var(--jlk-red-o); border-radius: 11px; background: var(--jlk-red-f); color: #fff;
  box-shadow: inset 0 -4px 0 var(--jlk-red-l); font-size: 0.8rem; font-weight: 900; letter-spacing: 0.1em; text-shadow: 0 2px 0 var(--jlk-red-o);
}
html[data-brand="jellyball"] .jl-stage .jl-res-time { font-size: 3rem; font-weight: 900; color: var(--jlk-ink-2); }
html[data-brand="jellyball"] .jl-stage .jl-res-sub { color: #476475; font-weight: 800; }
html[data-brand="jellyball"] .jl-stage .jl-res-rank { color: var(--jlk-ink-2); font-weight: 700; }
html[data-brand="jellyball"] .jl-stage .jl-rank { color: var(--jlk-yellow-o); font-size: 1.2rem; }
html[data-brand="jellyball"] .jl-stage .jl-res-stars { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
html[data-brand="jellyball"] .jl-stage .jl-res-star .jl-pi { width: 36px; height: 36px; filter: grayscale(1) brightness(1.15); opacity: 0.45; }
html[data-brand="jellyball"] .jl-stage .jl-res-star.is-on .jl-pi { filter: drop-shadow(0 3px 0 rgba(27, 45, 56, 0.25)); opacity: 1; animation: jlkCount 0.45s cubic-bezier(.2, .9, .3, 1.6) both; animation-delay: calc(0.25s + var(--i) * 0.14s); }
html[data-brand="jellyball"] .jl-stage :is(.jl-mini-board, .jl-racers) li { border-radius: 10px; font-weight: 700; color: var(--jlk-ink-2); }
html[data-brand="jellyball"] .jl-stage :is(.jl-mini-board, .jl-racers) li.is-me { background: #ffe1df; box-shadow: inset 0 0 0 2px var(--jlk-red-f); }
html[data-brand="jellyball"] .jl-stage :is(.jl-mini-board, .jl-racers) :is(.jl-mb-n, em) { color: #476475; }
html[data-brand="jellyball"] .jl-stage .jl-place { background: var(--jlk-yellow-f); color: var(--jlk-ink-2); }
html[data-brand="jellyball"] .jl-stage .jl-live { color: var(--jlk-green-o); }

/* ---------- touch controls: big round 3D pack buttons ---------- */
html[data-brand="jellyball"] .jl-stage .jl-touch { bottom: max(26px, env(safe-area-inset-bottom)); padding: 0 10px; }
html[data-brand="jellyball"] .jl-stage .jl-touch-l, html[data-brand="jellyball"] .jl-stage .jl-touch-r { gap: 6px; }
html[data-brand="jellyball"] .jl-stage .jl-tbtn.jui-btn { --jui-s: 1.12; border-radius: 0; backdrop-filter: none; -webkit-backdrop-filter: none; transform: none; }
html[data-brand="jellyball"] .jl-stage .jl-tbtn-jump.jui-btn { --jui-s: 1.4; }
html[data-brand="jellyball"] .jl-stage .jl-tbtn .jui-ic { width: 34px; height: 34px; }
html[data-brand="jellyball"] .jl-stage .jl-tbtn-jump .jui-ic { width: 42px; height: 42px; }
/* with the touch buttons showing, the bar runs thin along the bottom edge, under them */
html[data-brand="jellyball"] .jl-stage.is-touch:not(.is-watch) .jl-progress { bottom: 6px; height: 14px; width: calc(100% - 24px); }
html[data-brand="jellyball"] .jl-stage.is-touch:not(.is-watch) .jl-prog-finish { margin-top: -22px; }
@media (pointer: coarse) {
  html[data-brand="jellyball"] .jl-stage:not(.is-watch) .jl-progress { bottom: 6px; height: 14px; width: calc(100% - 24px); }
  html[data-brand="jellyball"] .jl-stage:not(.is-watch) .jl-prog-finish { margin-top: -22px; }
}

/* ---------- the level page (a posted level on the Jelly site) ---------- */
html[data-brand="jellyball"] .jl-view .jl-panel {
  border: 3px solid var(--jlk-panel-o); border-radius: 18px; background: var(--jlk-panel-f); color: var(--jlk-panel-t);
  box-shadow: inset 0 -7px 0 var(--jlk-panel-l), 0 4px 0 rgba(27, 45, 56, 0.16); padding: 14px 16px 20px;
}
html[data-brand="jellyball"] .jl-view .jl-panel h3 { font-size: 1.05rem; font-weight: 900; }
html[data-brand="jellyball"] .jl-view .jl-panel h3 .jl-pi { width: 26px; height: 26px; }
html[data-brand="jellyball"] .jl-view :is(.jl-board, .jl-racers) li.is-me { background: color-mix(in srgb, var(--jlk-red-f) 20%, transparent); box-shadow: inset 0 0 0 2px var(--jlk-red-f); }
html[data-brand="jellyball"] .jl-view .jl-board li:nth-child(1) .jl-b-n { color: var(--jlk-yellow-l); }
html[data-brand="jellyball"] .jl-view .jl-b-d .jl-pi { width: 15px; height: 15px; }
html[data-brand="jellyball"] .jl-view .jl-ghost-row .jl-pi { width: 22px; height: 22px; }
html[data-brand="jellyball"] .jl-view .jl-stage { border: 4px solid var(--jlk-ink); border-radius: 20px; box-shadow: 0 6px 0 rgba(27, 45, 56, 0.22); }
html[data-brand="jellyball"] .jl-view .jl-share input { height: 44px; border: 3px solid var(--jlk-panel-o); border-radius: 12px; background: var(--jlk-panel-l); color: var(--jlk-panel-t); font-weight: 700; }

/* ---------- the level card on posts ---------- */
html[data-brand="jellyball"] .jl-card { border: 3px solid var(--jlk-panel-o); border-radius: 18px; background: var(--jlk-panel-f); box-shadow: inset 0 -7px 0 var(--jlk-panel-l), 0 4px 0 rgba(27, 45, 56, 0.16); padding-bottom: 6px; }
html[data-brand="jellyball"] .jl-card-strip { border-bottom: 3px solid var(--jlk-panel-o); }
html[data-brand="jellyball"] .jl-card-play { width: 60px; height: 60px; margin: -30px 0 0 -30px; padding: 0 0 6px 4px; border: 4px solid var(--jlk-red-o); background: var(--jlk-red-f); color: #fff; box-shadow: inset 0 -7px 0 var(--jlk-red-l), 0 4px 0 rgba(27, 45, 56, 0.3); backdrop-filter: none; -webkit-backdrop-filter: none; }
html[data-brand="jellyball"] .jl-card-play :is(.jl-pi, .ic) { width: 28px; height: 28px; }
html[data-brand="jellyball"] .jl-card-len { border: 2px solid var(--jlk-ink); background: #fff; color: var(--jlk-ink-2); backdrop-filter: none; }
html[data-brand="jellyball"] .jl-card .jl-chip { border: 2px solid var(--jlk-panel-o); background: var(--jlk-panel-l); color: var(--jlk-panel-t); }
html[data-brand="jellyball"] .jl-card-best .jl-pi { width: 20px; height: 20px; }

/* ---------- the level editor ---------- */
html[data-brand="jellyball"] .jl-ed { background: var(--jlk-panel-l); }
html[data-brand="jellyball"] .jl-ed-top { height: 66px; gap: 8px; border-bottom: 4px solid var(--jlk-panel-o); background: var(--jlk-panel-f); }
html[data-brand="jellyball"] .jl-ed-actions { gap: 6px; }
html[data-brand="jellyball"] .jl-ed-status { color: var(--jlk-panel-dim); font-weight: 700; }
html[data-brand="jellyball"] .jl-ed-body { grid-template-columns: 88px minmax(0, 1fr) 320px; }
/* tool palette: square 3D pack buttons with pack icons; the picked tool is blue and pressed */
html[data-brand="jellyball"] .jl-ed-tools { gap: 4px; padding: 8px 6px; border-right: 4px solid var(--jlk-panel-o); background: var(--jlk-panel-f); }
html[data-brand="jellyball"] .jl-ed-tool.jui-btn { --jui-s: 0.9; flex: none; flex-direction: column; gap: 2px; min-height: 66px; padding: 0 2px; border-radius: 0; font-size: 0.66rem; white-space: nowrap; }
html[data-brand="jellyball"] .jl-ed-tool.jui-btn:hover, html[data-brand="jellyball"] .jl-ed-tool.jui-btn.is-active { background: none; box-shadow: none; }
html[data-brand="jellyball"] .jl-ed-tool .jui-ic { width: 28px; height: 28px; }
html[data-brand="jellyball"] .jl-ed-tool.jui-btn, html[data-brand="jellyball"] .jl-ed-tool.jui-btn:hover, html[data-brand="jellyball"] .jl-ed-tool.jui-btn.is-active { color: var(--jtx); }
html[data-brand="jellyball"] :is(.jl-ed-top, .jl-ed-panel) .jui-btn .jui-ic { width: 22px; height: 22px; }
html[data-brand="jellyball"] .jl-ed-zoom { gap: 2px; right: 10px; top: 10px; }
html[data-brand="jellyball"] .jl-ed-hint { padding: 8px 12px 11px; border: 3px solid var(--jlk-ink); border-radius: 12px; background: #fff; color: var(--jlk-ink-2); box-shadow: inset 0 -4px 0 var(--jlk-white-l); font-weight: 700; }
html[data-brand="jellyball"] .jl-ed-mini { border: 3px solid var(--jlk-ink); border-radius: 12px; background: rgba(27, 45, 56, 0.85); }
html[data-brand="jellyball"] .jl-ed-dialog { background: rgba(27, 45, 56, 0.4); }
html[data-brand="jellyball"] .jl-ed-play { background: var(--jlk-panel-l); }
/* the level / item panel */
html[data-brand="jellyball"] .jl-ed-panel { border-left: 4px solid var(--jlk-panel-o); background: var(--jlk-panel-f); color: var(--jlk-panel-t); padding: 12px 14px; }
html[data-brand="jellyball"] .jl-ed-tabs.seg { padding: 4px; gap: 4px; border: 3px solid var(--jlk-panel-o); border-radius: 14px; background: var(--jlk-panel-l); }
html[data-brand="jellyball"] .jl-ed-tabs .seg-btn { min-height: 40px; border-radius: 10px; color: var(--jlk-panel-dim); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
html[data-brand="jellyball"] .jl-ed-tabs .seg-btn.is-active { background: #fff; color: var(--jlk-ink-2); box-shadow: inset 0 0 0 2.5px var(--jlk-ink), inset 0 -5px 0 var(--jlk-white-l); }
html[data-brand="jellyball"] .jl-ed-tabs .seg-btn .jl-pi { width: 20px; height: 20px; }
html[data-brand="jellyball"] .jl-ed-sec h4 { color: var(--jlk-panel-dim); font-weight: 900; letter-spacing: 0.08em; }
html[data-brand="jellyball"] .jl-ed-item-head h4 { color: var(--jlk-panel-t); font-size: 1rem; }
html[data-brand="jellyball"] .jl-ed :is(.jl-field input, .jl-color input) { border: 3px solid var(--jlk-panel-o); border-radius: 12px; background: var(--jlk-panel-l); color: var(--jlk-panel-t); }
html[data-brand="jellyball"] .jl-ed .jl-field input { height: 44px; }
html[data-brand="jellyball"] .jl-ed .jl-prop input[type="range"] { accent-color: var(--jlk-red-f); height: 28px; }
html[data-brand="jellyball"] .jl-ed .jl-check input { width: 22px; height: 22px; accent-color: var(--jlk-green-l); }
html[data-brand="jellyball"] .jl-ed .jl-seg.seg { border: 3px solid var(--jlk-panel-o); border-radius: 12px; background: var(--jlk-panel-l); }
html[data-brand="jellyball"] .jl-ed .jl-seg .seg-btn { min-height: 36px; font-weight: 800; border-radius: 8px; }
html[data-brand="jellyball"] .jl-ed .jl-seg .seg-btn.is-active { background: var(--jlk-blue-f); color: #fff; box-shadow: inset 0 -4px 0 var(--jlk-blue-l); text-shadow: 0 1px 0 var(--jlk-blue-o); }
html[data-brand="jellyball"] .jl-ed .jl-ball-opt { border: 3px solid var(--jlk-panel-o); border-radius: 12px; background: var(--jlk-panel-f); color: var(--jlk-panel-t); box-shadow: inset 0 -4px 0 var(--jlk-panel-l); }
html[data-brand="jellyball"] .jl-ed .jl-ball-opt.is-on { border-color: var(--jlk-green-o); box-shadow: inset 0 0 0 2px var(--jlk-green-f), inset 0 -4px 0 var(--jlk-green-l); }
html[data-brand="jellyball"] .jl-ed .jl-progbar { height: 18px; border: 3px solid var(--jlk-ink); border-radius: 10px; background: var(--jlk-ink-2); }
html[data-brand="jellyball"] .jl-ed .jl-progbar i { border-radius: 6px; background: var(--jlk-green-f); box-shadow: inset 0 -4px 0 var(--jlk-green-l); }
html[data-brand="jellyball"] .jl-ed .jl-file-btn.jui-btn { align-self: flex-start; }
html[data-brand="jellyball"] .jl-ed-counts { color: var(--jlk-panel-dim); font-weight: 700; }
html[data-brand="jellyball"] .jl-ed-counts b { color: var(--jlk-panel-t); }
html[data-brand="jellyball"] .jl-ed-sheet-handle i { background: var(--jlk-panel-o); height: 5px; }
@media (max-width: 1100px) { html[data-brand="jellyball"] .jl-ed-body { grid-template-columns: 80px minmax(0, 1fr) 280px; } }
@media (max-width: 720px) {
  html[data-brand="jellyball"] .jl-ed-top { height: 60px; gap: 6px; padding: 0 6px; }
  html[data-brand="jellyball"] .jl-ed-brand { display: none; }
  html[data-brand="jellyball"] .jl-ed-body { display: flex; }
  html[data-brand="jellyball"] .jl-ed-tools { border-right: 0; border-top: 4px solid var(--jlk-panel-o); padding: 6px; gap: 4px; }
  html[data-brand="jellyball"] .jl-ed-tool.jui-btn { width: 66px; min-height: 62px; }
  html[data-brand="jellyball"] .jl-ed-panel { border-left: 0; border-top: 4px solid var(--jlk-panel-o); max-height: 62px; }
  html[data-brand="jellyball"] .jl-ed.sheet-open .jl-ed-panel { max-height: 46vh; }
}
@media (max-width: 520px) {
  html[data-brand="jellyball"] .jl-ed-beat > span { display: none; }
  html[data-brand="jellyball"] .jl-ed-actions .jui-btn { padding-left: 8px; padding-right: 8px; }
}

/* ---------- /levels (the campaign list) and the run page ---------- */
html[data-brand="jellyball"] .jx-page .jx-progress {
  padding: 12px 16px 18px; border: 3px solid var(--jlk-panel-o); border-radius: 18px; background: var(--jlk-panel-f);
  box-shadow: inset 0 -7px 0 var(--jlk-panel-l), 0 4px 0 rgba(27, 45, 56, 0.16); backdrop-filter: none; -webkit-backdrop-filter: none;
}
html[data-brand="jellyball"] .jx-page .jx-progress-text { color: var(--jlk-panel-dim); font-weight: 700; }
html[data-brand="jellyball"] .jx-page .jx-progress-text b { color: var(--jlk-panel-t); font-weight: 900; font-size: 1.25rem; }
html[data-brand="jellyball"] .jx-page .jx-bar.jui-bar { background: none; border-radius: 0; overflow: hidden; }
html[data-brand="jellyball"] .jx-page .jx-star .jx-pi { width: 22px; height: 22px; display: block; }
html[data-brand="jellyball"] .jx-page .jx-level-stars .jx-pi.jui-ic--off { filter: grayscale(1) brightness(0.85); opacity: 0.4; }
/* level cards: 3D containers in the pack's colours */
html[data-brand="jellyball"] .jx-page .jx-level {
  border: 4px solid var(--jlk-panel-o); border-radius: 22px; background: var(--jlk-panel-f);
  box-shadow: inset 0 -9px 0 var(--jlk-panel-l), 0 6px 0 rgba(27, 45, 56, 0.2);
}
html[data-brand="jellyball"] .jx-page .jx-level:hover { transform: translateY(-4px); border-color: var(--jlk-panel-o); box-shadow: inset 0 -9px 0 var(--jlk-panel-l), 0 10px 0 rgba(27, 45, 56, 0.2); }
html[data-brand="jellyball"] .jx-page .jx-level:has(.jx-level-hit:active) { transform: translateY(2px); box-shadow: inset 0 -9px 0 var(--jlk-panel-l), 0 2px 0 rgba(27, 45, 56, 0.2); }
html[data-brand="jellyball"] .jx-page .jx-level-hit:focus-visible { outline: 4px solid var(--jlk-blue-f); outline-offset: 3px; }
html[data-brand="jellyball"] .jx-page .jx-level-art { border-bottom: 4px solid var(--jlk-panel-o); }
html[data-brand="jellyball"] .jx-page .jx-level-num {
  left: 12px; top: 12px; padding: 7px 12px 10px; border: 3px solid var(--jlk-red-o); border-radius: 12px; background: var(--jlk-red-f); color: #fff;
  box-shadow: inset 0 -4px 0 var(--jlk-red-l), 0 3px 0 rgba(27, 45, 56, 0.3); backdrop-filter: none; -webkit-backdrop-filter: none;
  font-size: 0.86rem; font-weight: 900; text-shadow: 0 2px 0 var(--jlk-red-o);
}
html[data-brand="jellyball"] .jx-page .jx-level-stars {
  right: 12px; top: 12px; padding: 5px 8px 8px; gap: 2px; border: 3px solid var(--jlk-ink); border-radius: 12px; background: #fff;
  box-shadow: inset 0 -4px 0 var(--jlk-white-l), 0 3px 0 rgba(27, 45, 56, 0.3); backdrop-filter: none; -webkit-backdrop-filter: none;
}
html[data-brand="jellyball"] .jx-page .jx-level-play.jui-btn { right: 12px; bottom: 8px; position: absolute; z-index: 1; border-radius: 0; box-shadow: none; }
html[data-brand="jellyball"] .jx-page .jx-level-body { padding: 14px 18px 22px; }
html[data-brand="jellyball"] .jx-page .jx-level-title { color: var(--jlk-panel-t); font-size: 1.3rem; font-weight: 900; letter-spacing: 0; }
html[data-brand="jellyball"] .jx-page .jx-level-place { color: var(--jlk-panel-dim); font-weight: 700; }
html[data-brand="jellyball"] .jx-page .jx-level-blurb { color: var(--jlk-panel-dim); font-weight: 600; }
html[data-brand="jellyball"] .jx-page .jx-level-meta { color: var(--jlk-panel-dim); font-weight: 700; }
html[data-brand="jellyball"] .jx-page .jx-level-meta b { color: var(--jlk-panel-t); font-weight: 900; }
html[data-brand="jellyball"] .jx-page .jx-level-meta > span { padding: 4px 10px 6px 5px; border: 2.5px solid var(--jlk-panel-o); border-radius: 10px; background: var(--jlk-panel-f); box-shadow: inset 0 -3px 0 var(--jlk-panel-l); }
html[data-brand="jellyball"] .jx-page .jx-level-meta .jx-pi { width: 22px; height: 22px; }
/* the run page */
html[data-brand="jellyball"] .jx-page .jx-run-bar {
  padding: 8px 12px 13px 8px; border: 3px solid var(--jlk-panel-o); border-radius: 18px; background: var(--jlk-panel-f);
  box-shadow: inset 0 -6px 0 var(--jlk-panel-l), 0 4px 0 rgba(27, 45, 56, 0.16); backdrop-filter: none; -webkit-backdrop-filter: none;
}
html[data-brand="jellyball"] .jx-page .jx-run-title b { color: var(--jlk-panel-t); font-weight: 900; }
html[data-brand="jellyball"] .jx-page .jx-run-title span { color: var(--jlk-panel-dim); font-weight: 700; }
html[data-brand="jellyball"] .jx-page .jx-run-back.jui-btn, html[data-brand="jellyball"] .jx-page .jx-run-back.jui-btn:hover { background: none; border-radius: 0; flex: none; }
html[data-brand="jellyball"] .jx-page .jx-run-stage { border: 4px solid var(--jlk-ink); border-radius: 22px; box-shadow: 0 6px 0 rgba(27, 45, 56, 0.22); }
html[data-brand="jellyball"] .jx-page .jx-run-stage > .jl-stage { border: 0; border-radius: 0; }
/* the campaign finish card */
html[data-brand="jellyball"] .jl-stage .jx-win-ribbon { display: flex; justify-content: center; margin-bottom: -6px; }
html[data-brand="jellyball"] .jl-stage .jx-win-trophy { width: 70px; height: 70px; filter: drop-shadow(0 4px 0 rgba(27, 45, 56, 0.2)); animation: jlkCount 0.55s cubic-bezier(.2, .9, .3, 1.5) both; }
html[data-brand="jellyball"] .jl-stage .jx-win-stars { gap: 4px; align-items: flex-end; margin-bottom: 0; }
html[data-brand="jellyball"] .jl-stage .jx-win-star .jx-pi { display: block; width: 50px; height: 50px; }
html[data-brand="jellyball"] .jl-stage .jx-win-star:nth-child(2) .jx-pi { width: 64px; height: 64px; margin-bottom: 8px; }
html[data-brand="jellyball"] .jl-stage .jx-win-star.is-on .jx-pi { filter: drop-shadow(0 4px 0 rgba(27, 45, 56, 0.25)); animation: jlkCount 0.5s cubic-bezier(.2, .9, .3, 1.6) both; animation-delay: calc(0.3s + var(--i) * 0.18s); }
html[data-brand="jellyball"] .jl-stage .jx-win-title { font-size: 1.7rem; font-weight: 900; line-height: 1.1; color: var(--jlk-ink-2); letter-spacing: 0; }
html[data-brand="jellyball"] .jl-stage .jx-win-time { font-size: 2.3rem; font-weight: 900; color: var(--jlk-ink-2); }
html[data-brand="jellyball"] .jl-stage .jx-badge { padding: 5px 10px 8px; border: 3px solid var(--jlk-yellow-o); border-radius: 10px; background: var(--jlk-yellow-f); color: var(--jlk-ink-2); box-shadow: inset 0 -4px 0 var(--jlk-yellow-l); font-size: 0.78rem; font-weight: 900; }
html[data-brand="jellyball"] .jl-stage .jx-goals li { color: #476475; font-weight: 700; }
html[data-brand="jellyball"] .jl-stage .jx-goals li.is-met { color: var(--jlk-ink-2); font-weight: 800; }
html[data-brand="jellyball"] .jl-stage .jx-goal-ic { width: 26px; height: 26px; border: 3px solid var(--jlk-ink); border-radius: 8px; background: var(--jlk-white-l); opacity: 1; }
html[data-brand="jellyball"] .jl-stage .jx-goals li.is-met .jx-goal-ic { border-color: var(--jlk-green-o); background: var(--jlk-green-f); color: #fff; }
html[data-brand="jellyball"] .jl-stage .jx-goal-ic .jui-ic { width: 15px; height: 15px; }
html[data-brand="jellyball"] .jl-stage .jx-win-meta { color: #476475; font-weight: 700; }

@media (max-width: 720px) {
  html[data-brand="jellyball"] .jl-stage .jl-hud { left: 6px; right: 6px; top: 6px; gap: 4px; }
  html[data-brand="jellyball"] .jl-stage .jl-hud-stats { gap: 2px; }
  html[data-brand="jellyball"] .jl-stage .jl-hud-btns { gap: 0; }
  html[data-brand="jellyball"] .jl-stage .jl-hud-chip.jui-container { --jui-s: 0.55; font-size: 0.9rem; }
  html[data-brand="jellyball"] .jl-stage .jl-hud-chip .jl-pi { width: 22px; height: 22px; }
  html[data-brand="jellyball"] .jl-stage .jl-chip-time .jl-timer { font-size: 1rem; }
  html[data-brand="jellyball"] .jl-stage .jl-tbtn.jui-btn { --jui-s: 1.02; }
  html[data-brand="jellyball"] .jl-stage .jl-tbtn-jump.jui-btn { --jui-s: 1.26; }
  html[data-brand="jellyball"] .jl-stage .jl-res-time { font-size: 2.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-brand="jellyball"] .jl-stage :is(.jl-play-big, .jl-ov-card, .jl-count-n, .jl-res-star .jl-pi, .jx-win-star .jx-pi, .jx-win-trophy),
  html[data-brand="jellyball"] .jl-stage .jl-result::before { animation: none !important; }
  html[data-brand="jellyball"] .jx-page .jx-level, html[data-brand="jellyball"] .jx-page .jx-level:hover { transform: none; }
}
/* ---------- 2D level menus on phones (owner, checklist #53) ----------
   Phones (narrow, or short = landscape): the level stays full screen while the menus (☰) are open, and the city
   level's bar becomes a pause card in the middle (title, Levels, Resume) instead of the page coming back under a
   header that covered it. The touch row sits clear of the progress strip; the win card compacts on short screens. */
.jx-run-resume { display: none; }
@media (max-width: 840px), (max-height: 560px) {
  html.jl-immersive.jl-chrome .jx-run .jl-stage.is-immersive {
    position: fixed; inset: 0; z-index: 200; height: auto !important; min-height: 0; border: 0; border-radius: 0; box-shadow: none;
  }
  html.jl-immersive.jl-chrome, html.jl-immersive.jl-chrome body { overflow: hidden; overscroll-behavior: none; }
  html.jl-immersive.jl-chrome .jx-page .jx-run-bar {
    position: fixed; z-index: 205; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: min(340px, calc(100vw - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px 16px 18px; text-align: center;
    filter: drop-shadow(0 10px 18px rgba(27, 45, 56, 0.35));
  }
  html.jl-immersive.jl-chrome .jx-page .jx-run-title { grid-column: 1 / -1; order: -1; align-items: center; }
  html.jl-immersive.jl-chrome .jx-page .jx-run-title b { font-size: 1.25rem; }
  html.jl-immersive.jl-chrome .jx-page .jx-run-title span { white-space: normal; }
  html.jl-immersive.jl-chrome .jx-page .jx-run-credit { display: none; }
  html.jl-immersive.jl-chrome .jx-page .jx-run-bar .jui-btn { justify-content: center; min-height: 48px; margin: 0; }
  html.jl-immersive.jl-chrome .jx-page .jx-run-resume { display: inline-flex; }
  /* dims the level a little behind the card (the HUD buttons stay above it) */
  html.jl-immersive.jl-chrome .jx-run .jl-stage.is-immersive::after {
    content: ''; position: absolute; inset: 0; z-index: 3; background: rgba(27, 45, 56, 0.28); pointer-events: none;
  }
  /* the HUD and the touch row keep off the screen's rounded corners / notch / home bar */
  html[data-brand="jellyball"] .jl-stage.is-immersive .jl-hud {
    top: max(6px, env(safe-area-inset-top, 0px)); left: max(6px, env(safe-area-inset-left, 0px)); right: max(6px, env(safe-area-inset-right, 0px));
  }
}
/* touch: the buttons sit above the progress strip (its finish flag used to poke into the jump button) */
html[data-brand="jellyball"] .jl-stage.is-touch:not(.is-watch) .jl-touch {
  bottom: calc(max(6px, env(safe-area-inset-bottom, 0px)) + 30px);
  padding: 0 max(10px, env(safe-area-inset-right, 0px)) 0 max(10px, env(safe-area-inset-left, 0px));
}
html[data-brand="jellyball"] .jl-stage.is-touch:not(.is-watch) .jl-progress { bottom: max(6px, env(safe-area-inset-bottom, 0px)); }
html[data-brand="jellyball"] .jl-stage.is-touch:not(.is-watch) .jl-prog-finish,
html[data-brand="jellyball"] .jl-stage.is-touch:not(.is-watch) .jl-prog-finish .jl-pi { width: 20px; height: 20px; }
html[data-brand="jellyball"] .jl-stage.is-touch:not(.is-watch) .jl-prog-finish { margin-top: -16px; }
/* short screens (phones on their side): the overlay hugs the edges and the win card goes two columns */
@media (max-height: 560px) {
  html[data-brand="jellyball"] .jl-stage .jl-overlay { padding: max(8px, env(safe-area-inset-top, 0px)) 12px 8px; overflow-y: auto; align-items: safe center; }
  html[data-brand="jellyball"] .jl-stage .jl-ov-card.jui-container { --jui-s: 1; padding: 10px 14px 6px; gap: 8px; max-height: none; }
  html[data-brand="jellyball"] .jl-stage .jl-ov-card.jx-win {
    width: min(620px, 100%); max-width: none; display: grid; grid-template-columns: auto 1fr; column-gap: 18px; row-gap: 4px;
    align-items: center; text-align: left;
  }
  html[data-brand="jellyball"] .jl-stage .jx-win-ribbon { display: none; }
  html[data-brand="jellyball"] .jl-stage .jx-win > :is(.jx-win-stars, .jx-win-title, .jx-win-time) { grid-column: 1; justify-self: center; text-align: center; margin: 0; }
  html[data-brand="jellyball"] .jl-stage .jx-win > :is(.jx-goals, .jx-win-meta, .jx-win-btns) { grid-column: 2; margin: 0; }
  html[data-brand="jellyball"] .jl-stage .jx-win > .jx-goals { grid-row: 1 / span 2; align-self: end; }
  html[data-brand="jellyball"] .jl-stage .jx-win > .jx-win-meta { grid-row: 3; }
  html[data-brand="jellyball"] .jl-stage .jx-win > .jx-win-btns { grid-row: 4; justify-content: flex-start; }
  html[data-brand="jellyball"] .jl-stage .jx-win > .jx-win-time { grid-row: 3 / span 2; }
  html[data-brand="jellyball"] .jl-stage .jx-win-star .jx-pi { width: 38px; height: 38px; }
  html[data-brand="jellyball"] .jl-stage .jx-win-star:nth-child(2) .jx-pi { width: 48px; height: 48px; margin-bottom: 6px; }
  html[data-brand="jellyball"] .jl-stage .jx-win-title { font-size: 1.3rem; }
  html[data-brand="jellyball"] .jl-stage .jx-win-time { font-size: 1.7rem; }
  html[data-brand="jellyball"] .jl-stage .jx-goals { gap: 4px; font-size: 0.9rem; }
}
/* phones, menus put away: the hidden HUD buttons take no room, so the timer / falls / stars chips stay on one row
   (clear of the ☰ button); with the menus out the buttons stay on one row and the chips wrap instead (#53) */
@media (max-width: 840px), (max-height: 560px) {
  html.jl-immersive:not(.jl-chrome) .jl-stage.is-immersive .jl-hud-btns { position: absolute; right: 0; top: 0; }
  html.jl-immersive:not(.jl-chrome) .jl-stage.is-immersive .jl-hud-stats { max-width: calc(100% - 60px); }
  html[data-brand="jellyball"] .jl-stage.is-immersive .jl-hud-btns { flex-wrap: nowrap; flex: none; }
  html[data-brand="jellyball"] .jl-stage.is-immersive .jl-hud-stats { min-width: 0; }
}
/* a full-screen 2D level (playing, races) or the level editor: the site's phone tab bar stays out of the way and
   comes back when it closes (the classes go with them) (#65) */
html.jl-immersive .tabbar, body.jl-ed-open .tabbar { display: none !important; }

/* ---------- the level editor on phones (owner, checklist #65) ----------
   Portrait: the Level / Selected panel is a bottom sheet. Closed, its handle and both tabs show in full (tap a tab
   or the handle to pull it up; tap the open tab or the handle again to put it away); open, it takes about half the
   screen and scrolls, with room for the home bar. Landscape: a slimmer top bar and side columns. Test play (and
   "Beat it to publish") gets the whole screen: no top bar, tools or sheet until you leave it with the player's ✕. */
@media (max-width: 760px) {
  .jl-ed-top { padding-top: env(safe-area-inset-top, 0px); height: calc(50px + env(safe-area-inset-top, 0px)); }
  .jl-ed-panel { max-height: calc(98px + env(safe-area-inset-bottom, 0px)); gap: 6px; padding: 0 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .jl-ed.sheet-open .jl-ed-panel { max-height: 54vh; max-height: 54dvh; }
  .jl-ed-sheet-handle { height: 24px; width: 100%; flex: none; }
  .jl-ed-sheet-handle i { width: 48px; height: 5px; transition: transform 0.2s ease; }
  .jl-ed-tabs { flex: none; }
  .jl-ed-tabs .seg-btn { min-height: 44px; }
  .jl-ed-panel-body { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); overscroll-behavior: contain; }
  .jl-ed:not(.sheet-open) .jl-ed-panel-body { visibility: hidden; }
  .jl-ed-tools { scrollbar-width: none; }
  .jl-ed-tools::-webkit-scrollbar { display: none; }
  body.jl-ed-open .toasts { top: calc(60px + env(safe-area-inset-top, 0px)); bottom: auto; }
}
@media (max-width: 760px), (max-height: 560px) {
  .jl-ed.is-testing .jl-ed-top, .jl-ed.is-testing .jl-ed-tools, .jl-ed.is-testing .jl-ed-panel { display: none; }
  .jl-ed.is-testing .jl-ed-body { display: flex; }
  .jl-ed.is-testing .jl-ed-stage { flex: 1; }
  .jl-ed.is-testing .jl-ed-play { padding: 0; }
  .jl-ed.is-testing .jl-ed-play .jl-stage { border-radius: 0; border: 0; min-height: 0; }
  html[data-brand="jellyball"] .jl-ed.is-testing .jl-ed-play .jl-stage .jl-hud {
    top: max(6px, env(safe-area-inset-top, 0px)); left: max(6px, env(safe-area-inset-left, 0px)); right: max(6px, env(safe-area-inset-right, 0px));
  }
}
@media (max-width: 720px) {
  html[data-brand="jellyball"] .jl-ed-top { height: calc(60px + env(safe-area-inset-top, 0px)); }
  html[data-brand="jellyball"] .jl-ed-panel { max-height: calc(98px + env(safe-area-inset-bottom, 0px)); padding: 0 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
  html[data-brand="jellyball"] .jl-ed.sheet-open .jl-ed-panel { max-height: 54vh; max-height: 54dvh; }
  html[data-brand="jellyball"] .jl-ed-tabs.seg { flex: none; }
  html[data-brand="jellyball"] .jl-ed-tabs .seg-btn { min-height: 44px; }
  html[data-brand="jellyball"] .jl-ed-sheet-handle i { width: 52px; height: 6px; border-radius: 3px; }
  html[data-brand="jellyball"] .jl-ed.sheet-open .jl-ed-tabs.seg { margin-bottom: 4px; }
}
@media (max-height: 560px) and (min-width: 761px) {
  .jl-ed-top { height: 50px; }
  html[data-brand="jellyball"] .jl-ed-top { height: 54px; padding: 0 max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px)); }
  html[data-brand="jellyball"] .jl-ed-top .jui-btn { --jui-s: 0.85; }
  html[data-brand="jellyball"] .jl-ed-brand, html[data-brand="jellyball"] .jl-ed-status { display: none; }
  html[data-brand="jellyball"] .jl-ed-body { grid-template-columns: calc(76px + env(safe-area-inset-left, 0px)) minmax(0, 1fr) calc(272px + env(safe-area-inset-right, 0px)); }
  html[data-brand="jellyball"] .jl-ed-tools { padding-left: max(6px, env(safe-area-inset-left, 0px)); }
  html[data-brand="jellyball"] .jl-ed-tool.jui-btn { min-height: 58px; }
  html[data-brand="jellyball"] .jl-ed-panel { padding: 8px max(10px, env(safe-area-inset-right, 0px)) 0 10px; gap: 8px; }
  html[data-brand="jellyball"] .jl-ed-panel-body { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}
/* ---------- end of the Jelly Ball 2D levels skin ---------- */

/* Jelly Ball & Levels galaxy win celebration */
.jb-galaxy-scene {
  position: fixed; inset: 0; z-index: 920; pointer-events: none; overflow: hidden;
  animation: sceneIn .3s ease-out;
}
.jb-galaxy-scene canvas { display: block; width: 100vw; height: 100vh; pointer-events: none; }
.jb-galaxy-scene.is-leaving { opacity: 0; transition: opacity .45s ease; }
.jb-galaxy-scene.is-still { animation: none; }
.jb-galaxy-skip {
  position: fixed; right: 20px; bottom: calc(var(--tabbar-h, 62px) + env(safe-area-inset-bottom, 0px) + 12px);
  padding: 6px 16px; border-radius: 999px; border: 0; cursor: pointer;
  font-size: 0.78rem; font-weight: 700; background: rgba(11, 12, 15, 0.78); color: #fff;
  pointer-events: auto; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35); z-index: 921;
}
@media (min-width: 901px) {
  .jb-galaxy-skip { bottom: 24px; right: 24px; }
}
