/* ========================================================================== ARCADE CAMPUS HUB — v2 interface A… */

/* --------------------------------------------------------------------------
   01 · TOKENS
   -------------------------------------------------------------------------- */

:root {
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", "Segoe UI Mono", Menlo,
          Consolas, "Liberation Mono", monospace;

  --rail: 240px;
  --r: 12px;
  --gutter: clamp(1rem, 3vw, 2.25rem);
  --grid-line: transparent;
}

/* ---- NOIR (default) ---- */
:root,
html[data-skin="noir"] {
  color-scheme: dark;
  --paper: #101722;
  --surface: #182231;
  --surface-2: #202d40;
  --surface-3: #293951;
  --line: #2c394c;
  --line-2: #46566d;
  --ink: #f1f5fc;
  --ink-2: #b7c3d5;
  --ink-3: #96a6bd;
  --accent: #75a7ff;
  --accent-2: #a3c5ff;
  --accent-ink: #0c1c35;
  --good: #3ddc97;
  --warn: #ffc247;
  --bad: #ff5d73;
  --sel: rgba(117, 167, 255, 0.14);
}

/* ---- PAPER ---- */
html[data-skin="paper"] {
  color-scheme: light;
  --paper: #f7f5f1;
  --surface: #ffffff;
  --surface-2: #f2efe9;
  --surface-3: #e7e3db;
  --line: #ddd8ce;
  --line-2: #c3bcae;
  --ink: #16150f;
  --ink-2: #56534a;
  --ink-3: #86827a;
  --accent: #d13a12;
  --accent-2: #a52c08;
  --accent-ink: #ffffff;
  --good: #0f8a5f;
  --warn: #9a6600;
  --bad: #b5243b;
  --sel: rgba(209, 58, 18, 0.1);
}

/* ---- SLATE ---- */
html[data-skin="slate"] {
  color-scheme: dark;
  --paper: #1a1e24;
  --surface: #212630;
  --surface-2: #283040;
  --surface-3: #333c4d;
  --line: #333b47;
  --line-2: #48525f;
  --ink: #eef1f6;
  --ink-2: #a9b2c0;
  --ink-3: #78828f;
  --accent: #ffa03d;
  --accent-2: #ffbc74;
  --accent-ink: #1d1103;
  --good: #4fd39a;
  --warn: #ffcc66;
  --bad: #ff7186;
  --sel: rgba(255, 160, 61, 0.15);
}

/* ---- TERMINAL ---- */
html[data-skin="terminal"] {
  color-scheme: dark;
  --paper: #060a07;
  --surface: #0b120d;
  --surface-2: #101a13;
  --surface-3: #16251a;
  --line: #1c2c20;
  --line-2: #2c452f;
  --ink: #d8f5de;
  --ink-2: #7fb98d;
  --ink-3: #4e7c5a;
  --accent: #38e07b;
  --accent-2: #7ef2ab;
  --accent-ink: #02160a;
  --good: #38e07b;
  --warn: #d8d24a;
  --bad: #ff6b6b;
  --sel: rgba(56, 224, 123, 0.14);
  --grid-line: rgba(56, 224, 123, 0.045);
}

/* ---- BLUEPRINT ---- */
html[data-skin="blueprint"] {
  color-scheme: dark;
  --paper: #071021;
  --surface: #0c1930;
  --surface-2: #12213c;
  --surface-3: #1a2e4f;
  --line: #1b2c48;
  --line-2: #2b4368;
  --ink: #e6f1ff;
  --ink-2: #93aecd;
  --ink-3: #5f7899;
  --accent: #4dd9ff;
  --accent-2: #9aeaff;
  --accent-ink: #041520;
  --good: #56e2b8;
  --warn: #ffd166;
  --bad: #ff7a90;
  --sel: rgba(77, 217, 255, 0.13);
  --grid-line: rgba(77, 217, 255, 0.05);
}

/* ---- GRAPE ---- */
html[data-skin="grape"] {
  color-scheme: dark;
  --paper: #140a1f;
  --surface: #1c1029;
  --surface-2: #241634;
  --surface-3: #301f45;
  --line: #2f1f44;
  --line-2: #45305e;
  --ink: #f3ecff;
  --ink-2: #b9a6d4;
  --ink-3: #86749f;
  --accent: #b06cff;
  --accent-2: #cb9bff;
  --accent-ink: #150522;
  --good: #59e0b0;
  --warn: #ffc861;
  --bad: #ff6f96;
  --sel: rgba(176, 108, 255, 0.16);
}

/* ---- EMBER ---- */
html[data-skin="ember"] {
  color-scheme: dark;
  --paper: #160d0a;
  --surface: #1f1310;
  --surface-2: #2a1a15;
  --surface-3: #38241d;
  --line: #37231c;
  --line-2: #513329;
  --ink: #fdeee6;
  --ink-2: #cfab99;
  --ink-3: #9b7a6b;
  --accent: #ff8a3d;
  --accent-2: #ffb072;
  --accent-ink: #1c0c03;
  --good: #6fd88f;
  --warn: #ffcc5c;
  --bad: #ff6b6b;
  --sel: rgba(255, 138, 61, 0.15);
}

/* ---- LINEN (light) ---- */
html[data-skin="linen"] {
  color-scheme: light;
  --paper: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --surface-3: #e2e7ee;
  --line: #dde3ea;
  --line-2: #c0c9d4;
  --ink: #10151b;
  --ink-2: #4d5a68;
  --ink-3: #7c8794;
  --accent: #0f6fd1;
  --accent-2: #0a559f;
  --accent-ink: #ffffff;
  --good: #0f8a5f;
  --warn: #96650a;
  --bad: #c02a3f;
  --sel: rgba(15, 111, 209, 0.1);
}

/* Reduced-effort mode for slow machines and locked-down GPUs. */
html[data-lite="on"] * {
  animation: none !important;
  transition: none !important;
}
html[data-lite="on"] { --grid-line: transparent; }

/* Motion off is its own switch: lite mode is about slow hardware, this is
   about people who find movement unpleasant. theme-boot also flips it when
   the OS asks for reduced motion. */
html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 1ms !important;
  scroll-behavior: auto !important;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* Text size. Everything is sized in rem off the body, so one number moves
   the whole interface rather than a handful of hand-picked elements. */
html[data-text="large"] body { font-size: 17px; }
html[data-text="huge"] body { font-size: 19px; }
html[data-text="huge"] .tile-desc,
html[data-text="large"] .tile-desc { -webkit-line-clamp: 3; }

/* --------------------------------------------------------------------------
   02 · BASE
   -------------------------------------------------------------------------- */

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

/* Global hidden reset with !important. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, var(--grid-line) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px 34px);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--accent-ink); }

/* Page-in transition: fade + a hair of upward drift on each navigation, so moving between pages feels composed… */
html[data-loading] body { opacity: 0; }
body {
  opacity: 1;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
@media (prefers-reduced-motion: reduce) {
  html[data-loading] body { opacity: 1; }
  body { transition: none; }
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.025em; line-height: 1.08; }
h1 { font-size: clamp(1.75rem, 3.4vw, 2.6rem); }
h2 { font-size: clamp(1.15rem, 2vw, 1.4rem); }
h3 { font-size: 1rem; letter-spacing: -0.015em; }
p { margin: 0 0 0.9em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
code { font-family: var(--mono); font-size: 0.88em; }

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

.skip-link {
  position: fixed; top: -5rem; left: 1rem; z-index: 200;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.6rem 1rem; font-weight: 700;
}
.skip-link:focus { top: 1rem; text-decoration: none; }

.mono { font-family: var(--mono); }
.dim { color: var(--ink-2); }
.dimmer { color: var(--ink-3); }
.tiny { font-size: 0.78rem; }
.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;
}

/* Quiet section labels keep the games in the foreground. */
.label {
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

/* --------------------------------------------------------------------------
   03 · APP FRAME
   -------------------------------------------------------------------------- */

.rail {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  width: var(--rail);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.main {
  margin-left: var(--rail);
  min-height: 100dvh;
  padding: 0 var(--gutter) 5rem;
}

.topbar { display: none; }
.tabbar { display: none; }

/* ---- rail contents ---- */

.rail-brand {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 1.15rem var(--rail-pad, 1.1rem) 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.rail-brand:hover { text-decoration: none; }
.mark {
  width: 2rem; height: 2rem; flex: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 0.82rem;
  letter-spacing: -0.04em;
}
.rail-brand .name { font-weight: 700; font-size: 0.94rem; letter-spacing: -0.02em; }
.rail-brand .sub {
  display: block; font-family: var(--mono); font-size: 0.62rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3);
}

.rail-search { padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--line); }
.rail-search .box { position: relative; }
.rail-search input { padding-right: 2.1rem; }
.rail-search .hint {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 0.66rem; color: var(--ink-3);
  border: 1px solid var(--line-2); padding: 0.05rem 0.3rem; pointer-events: none;
}

.rail-nav { padding: 0.9rem 0.6rem; flex: 1; }
.rail-nav .label { padding: 0.6rem 0.5rem 0.35rem; display: block; }
.rail-nav a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  min-height: 44px;
  border-radius: 9px;
  margin: 3px 0;
  color: var(--ink-2); font-size: 0.88rem; font-weight: 500;
  border-left: 2px solid transparent;
}
.rail-nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.rail-nav a[aria-current="page"] {
  background: var(--sel); color: var(--ink); border-left-color: var(--accent); font-weight: 600;
}
.rail-nav .ico { width: 1.1rem; text-align: center; flex: none; font-size: 0.95rem; }
.rail-nav .n {
  margin-left: auto; font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3);
}

.rail-foot { padding: 0.9rem 1.1rem 1.2rem; border-top: 1px solid var(--line); }
.rail-foot .row { display: flex; gap: 0.4rem; margin-bottom: 0.7rem; }
.rail-foot .row .btn { flex: 1; }
.rail-foot .meta { font-family: var(--mono); font-size: 0.66rem; color: var(--ink-3); line-height: 1.6; }

/* Quick settings: the handful of things people change often, inline in the
   rail rather than behind a modal that duplicated the Settings page. */
.quick {
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--paper);
  padding: 0.6rem;
  margin-bottom: 0.7rem;
}
.quick[hidden] { display: none; }
.quick .label { display: block; margin: 0 0 0.35rem; }
.quick .label + * { margin-bottom: 0.7rem; }

.quick-skins { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.quick-skin {
  width: 44px; height: 44px; padding: 0; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 4px;
}
.quick-skin[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }

.quick-seg { display: flex; gap: 0.25rem; }
.quick-size {
  flex: 1; cursor: pointer; padding: 0.25rem 0; min-height: 44px;
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r);
  font-family: var(--font); line-height: 1;
}
.quick-size[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.quick-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; font-size: 0.78rem; padding: 0.3rem 0;
}
.quick-row .toggle { width: 2.2rem; height: 1.2rem; }
.quick-row .toggle i::after { width: calc(1.2rem - 6px); height: calc(1.2rem - 6px); }
.quick-row .toggle input:checked + i::after { transform: translateX(1rem); }

.quick-more {
  display: block; margin-top: 0.5rem; padding-top: 0.5rem;
  border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 0.68rem;
  letter-spacing: 0.06em; text-align: center;
}

/* ---- mobile frame ---- */

@media (max-width: 900px) {
  .main { margin-left: 0; padding-top: 3.5rem; padding-bottom: 5.2rem; }

  .rail {
    width: min(84vw, 300px);
    transform: translateX(-101%);
    transition: transform 0.18s ease;
  }
  .rail.open { transform: none; }

  .scrim {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(0, 0, 0, 0.55);
  }
  .scrim[hidden] { display: none; }

  .topbar {
    position: fixed; inset: 0 0 auto 0; z-index: 50;
    display: flex; align-items: center; gap: 0.6rem;
    height: 3.5rem; padding: 0 0.75rem;
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .topbar .name { font-weight: 700; font-size: 0.9rem; }

  .tabbar {
    position: fixed; inset: auto 0 0 0; z-index: 50;
    display: grid; grid-template-columns: repeat(5, 1fr);
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    display: grid; place-items: center; gap: 0.15rem;
    padding: 0.5rem 0.2rem;
    color: var(--ink-3); font-family: var(--mono);
    font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a .ico { font-size: 1.05rem; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
}

/* --------------------------------------------------------------------------
   04 · PAGE HEAD / SECTIONS
   -------------------------------------------------------------------------- */

.page-head {
  padding: 2.6rem 0 1.8rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.8rem;
}
.page-head .label { display: block; margin-bottom: 0.7rem; }
.page-head p { margin: 0.7rem 0 0; color: var(--ink-2); max-width: 62ch; }

/* Readout strip: the monospace status line under the page title. */
.readout {
  display: flex; flex-wrap: wrap; gap: 0 1.6rem;
  margin-top: 1.1rem;
  font-family: var(--font); font-size: 0.8rem; color: var(--ink-2);
}
.readout b { color: var(--ink); font-weight: 600; }
.readout span::before { content: none; }

.block { margin: 2.6rem 0; }
.block-head {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1rem;
}
.block-head h2 { flex: none; }
.block-head .fill { flex: 1; }
.block-head .more { font-family: var(--font); font-size: 0.85rem; font-weight: 500; }

/* Home is a search-first library, followed by artwork-led game shelves. */
.home-head { position: relative; padding-bottom: 1.8rem; }
.home-head h1 { font-size: clamp(2rem, 4vw, 3.2rem); max-width: 22ch; letter-spacing: -0.045em; }
.home-head > .label { color: var(--accent); }
.home-search { display: flex; gap: 0.65rem; max-width: 720px; margin-top: 1.5rem; }
.home-search input { min-width: 0; background: var(--surface); min-height: 52px; padding: 0.85rem 1rem; }
.home-shortcuts { display: flex; flex-wrap: wrap; gap: 0.3rem 1.5rem; margin-top: 0.65rem; }
.home-shortcuts a { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; font-size: 0.85rem; color: var(--ink-2); }
.home-shortcuts a:first-child { color: var(--accent); }
.home-head .readout { gap: 0.5rem 1.5rem; }
.home-head .readout #r-date { margin-left: auto; }
.rail-extras { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 0.5rem; }
.rail-extras summary { min-height: 44px; padding: 0.7rem 0.5rem; font-size: 0.8rem; color: var(--ink-2); cursor: pointer; }
@media (max-width: 560px) {
  .home-search { flex-direction: column; }
  .home-search .btn { align-self: stretch; }
  .home-head .readout #r-date { margin-left: 0; }
  .block-head { flex-wrap: wrap; gap: 0.4rem 0.75rem; }
  .block-head h2 { flex-shrink: 1; }
  .block-head .more { min-height: 44px; display: inline-flex; align-items: center; }
}

/* --------------------------------------------------------------------------
   05 · CONTROLS
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-size: 0.84rem; font-weight: 600;
  padding: 0.65rem 1rem;
  min-height: 44px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn:active { background: var(--surface-3); }
.btn-cta {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.btn-cta:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); }
.btn-flat { background: transparent; border-color: var(--line); }
.btn-sq { width: 44px; min-height: 44px; padding: 0; flex: none; }
.btn-sm { font-size: 0.76rem; padding: 0.32rem 0.6rem; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--sel); }

input[type="search"], input[type="text"], input[type="email"], input[type="password"], select, textarea {
  font: inherit; font-size: 1rem;
  min-height: 44px;
  width: 100%;
  padding: 0.46rem 0.6rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
}
input::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); background: var(--surface);
}
select { cursor: pointer; }

.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--mono); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.24rem 0.5rem;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: transparent; color: var(--ink-2);
  cursor: pointer; white-space: nowrap;
}
.pill:hover { border-color: var(--line-2); color: var(--ink); text-decoration: none; }
.pill.on, .pill[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}

.flag {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-family: var(--mono); font-size: 0.64rem; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-3);
}
.flag::before {
  content: ""; width: 6px; height: 6px; flex: none;
  background: currentColor;
}
.flag-good { color: var(--good); }
.flag-warn { color: var(--warn); }
.flag-bad { color: var(--bad); }

/* --------------------------------------------------------------------------
   06 · TILE GRID
   -------------------------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 1.25rem;
  background: transparent;
}
.grid-sm { grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }

/* Horizontal scroller uses its own spacing, not the shared hairline sheet. */
.strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(212px, 1fr);
  gap: 1rem;
  overflow-x: auto; overscroll-behavior-x: contain;
  padding-bottom: 0.8rem;
  scroll-snap-type: x proximity;
}
.strip > * { scroll-snap-align: start; }
.strip .tile { border: 1px solid var(--line); }

.tile {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  isolation: isolate;
}
/* Cards settle in with a short fade + upward drift, staggered by their grid position (--i, set at render time). */
@keyframes tile-in { from { opacity: 0; transform: translateY(9px); } }
.grid .tile, .grid-sm .tile, .strip .tile {
  animation: tile-in 0.34s ease backwards;
  animation-delay: calc(min(var(--i, 0), 24) * 22ms);
}
.tile::after {
  content: ""; position: absolute; inset: 0; z-index: 3;
  border: 1px solid transparent;
  border-radius: var(--r);
  transition: border-color 0.12s;
  pointer-events: none;
}
.tile:hover::after, .tile:focus-within::after { border-color: var(--accent); }

.tile-art {
  position: relative;
  aspect-ratio: 8 / 5;
  overflow: hidden;
  background: var(--surface-2);
}
.tile-art > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Harvested icon, contained over its generated plate rather than cropped. */
.tile-art > img.badge {
  position: absolute; inset: 11%;
  width: 78%; height: 78%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}
/* A slow push-in on the art when a card is hovered or keyboard-focused. No
   colour change and no shadow bloom — it reads as "this one is live" without
   turning into the glossy card treatment the rest of the site avoids. */
.tile-art > svg, .tile-art > img.badge { transition: transform 0.35s ease; }
.tile:hover .tile-art > svg,
.tile:focus-within .tile-art > svg { transform: scale(1.06); }
.tile:hover .tile-art > img.badge,
.tile:focus-within .tile-art > img.badge { transform: scale(1.09); }

/* --- 3D pointer tilt (motion-fx.js) -------------------------------------- */
/* The card becomes a 3D stage while the pointer is over it; children can sit on nearer planes. */
.tile.fx-tilt {
  transform-style: preserve-3d;
  transition: transform 0.08s ease-out;
  z-index: 5;
}
.tile.fx-tilt .tile-art {
  transform-style: preserve-3d;
  transition: transform 0.12s ease-out;
}
.tile.fx-tilt::before {
  content: "";
  position: absolute; inset: 0; z-index: 4;
  border-radius: var(--r);
  pointer-events: none;
  background: radial-gradient(
    240px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--accent) 22%, transparent),
    transparent 60%
  );
  opacity: 0.7;
  mix-blend-mode: soft-light;
}
/* Return glide when the pointer leaves (class removed): a slightly longer,
   eased settle so cards don't snap flat. */
.grid .tile, .grid-sm .tile, .strip .tile { transition: transform 0.3s ease; }
.marquee.fx-tilt { transform-style: preserve-3d; transition: transform 0.1s ease-out; }
.marquee.fx-tilt .marquee-art { transition: transform 0.14s ease-out; }
/* Older engines without color-mix still get a usable (accent-less) glow. */
@supports not (background: color-mix(in srgb, red, blue)) {
  .tile.fx-tilt::before {
    background: radial-gradient(240px circle at var(--mx,50%) var(--my,50%),
      rgba(255,255,255,0.18), transparent 60%);
  }
}
html[data-motion="off"] .tile.fx-tilt::before,
html[data-lite="on"] .tile.fx-tilt::before { display: none; }

/* --- Pinned page toolbar + drag-to-reorder ------------------------------- */
.pin-tools { display: flex; align-items: center; gap: 0.5rem; }
.pin-sort select {
  font: inherit; font-size: 0.82rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 0.3rem 0.5rem; cursor: pointer;
}
.pin-hint {
  margin: 0 0 0.7rem; font-size: 0.8rem; color: var(--ink-3);
  font-family: var(--mono); letter-spacing: 0.02em;
}
.tile.is-draggable { cursor: grab; }
.tile.is-draggable:active { cursor: grabbing; }
.tile.is-dragging {
  opacity: 0.55; outline: 2px dashed var(--accent); outline-offset: -2px;
}
/* A dragged card shouldn't also tilt. */
.tile.is-dragging { transform: none !important; }

.tile-no {
  position: absolute; top: 0; left: 0; z-index: 2;
  font-family: var(--mono); font-size: 0.64rem; font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.22rem 0.45rem;
  background: var(--paper); color: var(--ink-2);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}

.tile-star {
  position: absolute; top: 0; right: 0; z-index: 4;
  width: 44px; height: 44px;
  border-radius: 0 0 0 12px;
  display: grid; place-items: center;
  background: var(--paper); color: var(--ink-3);
  border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  border-top: 0; border-right: 0;
  font-size: 0.8rem; cursor: pointer;
}
.tile-star:hover { color: var(--accent); }
.tile-star[aria-pressed="true"] { color: var(--accent); }

/* Marks a self-hosted original — sits bottom-left of the art, flat and
   square like tile-no, so it reads as a plain label and not a glossy badge. */
.tile-tag {
  position: absolute; left: 0; bottom: 0; z-index: 2;
  font-family: var(--mono); font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.2rem 0.42rem;
  background: var(--paper); color: var(--accent);
  border-right: 1px solid var(--line); border-top: 1px solid var(--line);
}

.tile-body {
  padding: 1rem;
  display: flex; flex-direction: column; gap: 0.4rem; flex: 1;
}
.tile-name {
  font-size: 1rem; font-weight: 650; letter-spacing: -0.015em; line-height: 1.35;
  color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-name a { color: inherit; }
.tile-name a:hover { color: var(--accent); text-decoration: none; }
.tile-desc {
  font-size: 0.78rem; color: var(--ink-2); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-foot {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  margin-top: auto; padding-top: 0.25rem;
}
.tile-cat {
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-3);
}
.tile-hit { position: absolute; inset: 0; z-index: 2; }

/* --------------------------------------------------------------------------
   07 · LIST VIEW
   -------------------------------------------------------------------------- */

.rows { border: 1px solid var(--line); background: var(--surface); }
.rows-scroll { overflow-x: auto; }
.rows-head, .row {
  display: grid;
  grid-template-columns: 3.2rem 1fr 8rem 8.5rem 5.5rem 2.4rem;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0.8rem;
}
.rows-head {
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--ink-3);
}
.row { border-bottom: 1px solid var(--line); position: relative; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row .idx { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3); }
.row .name { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .name a { color: var(--ink); }
.row .name a:hover { color: var(--accent); text-decoration: none; }
.row .cat { font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
.row .plays { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3); text-align: right; }
.row .star { background: none; border: 0; color: var(--ink-3); cursor: pointer; font-size: 0.85rem; }
.row .star[aria-pressed="true"] { color: var(--accent); }

@media (max-width: 820px) {
  .rows-head { display: none; }
  .row { grid-template-columns: 2.4rem 1fr 2.4rem; row-gap: 0.2rem; }
  .row .cat { grid-column: 2; font-size: 0.66rem; }
  .row .compat, .row .plays { display: none; }
}

/* --------------------------------------------------------------------------
   08 · MARQUEE (featured)
   -------------------------------------------------------------------------- */

.marquee {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.marquee-art { position: relative; min-height: 260px; overflow: hidden; }
.marquee-art > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.marquee-art > img.badge {
  position: absolute; inset: 16%;
  width: 68%; height: 68%;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}
.marquee-body {
  padding: clamp(1.2rem, 3vw, 2.1rem);
  display: flex; flex-direction: column; justify-content: center; gap: 0.9rem;
  border-left: 1px solid var(--line);
}
.marquee-body h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.marquee-body p { color: var(--ink-2); margin: 0; max-width: 48ch; }
.marquee-acts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.4rem; }
.marquee-specs {
  display: flex; flex-wrap: wrap; gap: 0 1.4rem;
  font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3);
}
@media (max-width: 780px) {
  .marquee { grid-template-columns: 1fr; }
  .marquee-body { border-left: 0; border-top: 1px solid var(--line); }
  .marquee-art { min-height: 190px; }
}

/* --------------------------------------------------------------------------
   09 · CATEGORY INDEX
   -------------------------------------------------------------------------- */

.cats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 1rem; background: transparent;
}
.cat {
  position: relative; overflow: hidden;
  background: var(--surface);
  padding: 1rem 1rem 0.9rem;
  display: flex; flex-direction: column; gap: 0.25rem;
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink);
}
.cat:hover { background: var(--surface-2); text-decoration: none; }
.cat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); transform: scaleY(0); transform-origin: top;
  transition: transform 0.14s;
}
.cat:hover::before { transform: scaleY(1); }
.cat .ico { font-size: 1.15rem; }
.cat strong { font-size: 0.98rem; font-weight: 650; letter-spacing: -0.015em; }
.cat .n {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-3); margin-top: auto;
}

/* --------------------------------------------------------------------------
   10 · PLAYER
   -------------------------------------------------------------------------- */

.player-top {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem;
  padding: 1.8rem 0 1.1rem;
}
.player-top .who { flex: 1; min-width: 240px; }
.player-top h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.player-top .line {
  display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; margin-top: 0.5rem;
}

.deck {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0.5rem;
  border: 1px solid var(--line); border-bottom: 0;
  background: var(--surface-2);
}
.deck .spacer { flex: 1; }

.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--line);
  overflow: hidden;
}
.stage.tall { aspect-ratio: 4 / 3; }
.stage iframe { width: 100%; height: 100%; border: 0; display: block; }
.stage:fullscreen,
.stage.is-fullscreen { aspect-ratio: auto; width: 100vw; height: 100dvh; border: 0; }
.stage.is-pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  margin: 0;
  max-width: none;
  border-radius: 0;
}
body.game-pseudo-fullscreen { overflow: hidden; }
.stage-fullscreen-controls {
  display: none; position: absolute; z-index: 40; top: max(0.75rem, env(safe-area-inset-top));
  left: max(0.75rem, env(safe-area-inset-left)); right: max(0.75rem, env(safe-area-inset-right));
  align-items: center; justify-content: space-between; gap: 0.75rem;
  pointer-events: none;
}
.stage.is-fullscreen .stage-fullscreen-controls,
.stage:fullscreen .stage-fullscreen-controls { display: flex; }
.stage-fullscreen-title {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #fff; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 0.42rem 0.7rem; border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px; background: rgba(10,14,22,.72); backdrop-filter: blur(12px);
  opacity: 0; transform: translateY(-5px); transition: opacity .18s, transform .18s;
}
.stage-exit-fullscreen {
  pointer-events: auto; border: 1px solid rgba(255,255,255,.24); border-radius: 999px;
  padding: 0.48rem 0.78rem; color: #fff; background: rgba(10,14,22,.82);
  font: 700 0.76rem/1 system-ui, sans-serif; cursor: pointer; backdrop-filter: blur(12px);
  opacity: .38; transition: opacity .15s, background .15s, transform .15s;
}
.stage.is-fullscreen:hover .stage-fullscreen-title,
.stage:fullscreen:hover .stage-fullscreen-title,
.stage-fullscreen-controls:focus-within .stage-fullscreen-title { opacity: 1; transform: none; }
.stage-exit-fullscreen:hover,
.stage-exit-fullscreen:focus-visible { opacity: 1; background: rgba(10,14,22,.96); transform: translateY(-1px); }
.stage.is-fullscreen .callroot,
.stage:fullscreen .callroot { z-index: 80; }

/* A per-title warning, above the stage. Deliberately not a dismissible
   toast: it is the kind of thing you want to read before you start, not
   something that vanishes while you are looking elsewhere. */
.notice {
  display: flex; align-items: flex-start; gap: 0.7rem;
  margin: 0 0 0.7rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
}
.notice[hidden] { display: none; }
.notice-mark {
  flex: none; width: 1.4rem; height: 1.4rem;
  display: grid; place-items: center;
  border: 1px solid var(--warn); color: var(--warn);
  font-family: var(--mono); font-weight: 700; font-size: 0.8rem;
}
.notice strong { display: block; font-size: 0.86rem; margin-bottom: 0.15rem; }
.notice p { margin: 0; font-size: 0.82rem; color: var(--ink-2); }

/* Large Unity builds take a while off a CDN — an unexplained black box reads
   as broken, so say what's happening. */
.stage-loading {
  position: absolute; inset: 0; z-index: 1;
  display: grid; place-content: center; justify-items: center; gap: 0.6rem;
  background: var(--paper);
  text-align: center; padding: 1.5rem;
}
.stage-loading[hidden] { display: none; }
.stage-loading p { margin: 0; color: var(--ink-3); max-width: 34ch; }

.spinner {
  width: 1.6rem; height: 1.6rem;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
html[data-lite="on"] .spinner { animation: none; border-top-color: var(--line-2); }

/* Quiet confirmation that game progress is being kept. */
.save-state {
  font-family: var(--mono); font-size: 0.66rem;
  letter-spacing: 0.06em; color: var(--ink-3);
  align-self: center; padding: 0 0.4rem;
}
.save-state.ok { color: var(--good); }
.save-state.warn { color: var(--warn); }

/* A title no host carries. Still listed, visibly not playable. */
.tile.is-gone .tile-art { filter: grayscale(1); opacity: 0.55; }
.tile.is-gone .tile-name { color: var(--ink-3); }

.curtain {
  position: absolute; inset: 0;
  display: grid; place-items: center; text-align: center;
  padding: 2rem 1.2rem;
  background: var(--paper);
}
.curtain[hidden] { display: none; }
.curtain .inner { max-width: 44ch; display: grid; gap: 0.7rem; justify-items: center; }
.curtain h2 { font-size: 1.2rem; }
.curtain p { color: var(--ink-2); margin: 0; font-size: 0.9rem; }
.curtain .alt {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 0.78rem; color: var(--ink-3);
  text-decoration: underline; text-underline-offset: 3px;
}
.curtain .alt:hover { color: var(--accent); }

.spec {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border: 1px solid var(--line); border-top: 0;
  background: var(--surface);
}
.spec div {
  padding: 0.7rem 0.85rem;
  border-right: 1px solid var(--line);
}
.spec div:last-child { border-right: 0; }
.spec dt {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.2rem;
}
.spec dd { margin: 0; font-size: 0.86rem; font-weight: 600; }

.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 1.1rem 1.2rem;
}

.stars { display: flex; gap: 0.1rem; }
.stars button {
  background: none; border: 0; cursor: pointer;
  font-size: 1.15rem; line-height: 1; padding: 0.1rem 0.15rem;
  color: var(--ink-3);
}
.stars button.on { color: var(--accent); }

/* --------------------------------------------------------------------------
   11 · METRICS
   -------------------------------------------------------------------------- */

.metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
}
.metric { background: var(--surface); padding: 1rem 1.1rem; }
.metric b {
  display: block; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em;
  line-height: 1.05; font-variant-numeric: tabular-nums;
}
.metric span {
  display: block; margin-top: 0.3rem;
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--ink-3);
}

.meters { display: flex; flex-direction: column; }
.meter {
  display: grid; grid-template-columns: 10rem 1fr 5rem;
  gap: 0.9rem; align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.meter:last-child { border-bottom: 0; }
.meter .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter .k a { color: var(--ink); }
.meter .track { height: 6px; background: var(--surface-3); }
.meter .fill { height: 100%; background: var(--accent); }
.meter .v { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3); text-align: right; }
@media (max-width: 620px) { .meter { grid-template-columns: 6.5rem 1fr 4.2rem; font-size: 0.78rem; } }

/* --------------------------------------------------------------------------
   12 · TOOLBAR / FILTERS
   -------------------------------------------------------------------------- */

.toolbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  padding: 0.7rem 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.1rem;
}
.toolbar .search { flex: 1 1 220px; min-width: 180px; }
.toolbar .seg { display: flex; }
.toolbar .seg .btn { border-radius: 0; margin-left: -1px; }
.toolbar .seg .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.toolbar .seg .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.toolbar select { width: auto; }
@media (max-width: 900px) { .toolbar { top: 3.5rem; } }

.pills { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1.1rem; }
.count-line {
  font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3);
  margin-bottom: 0.8rem;
}

/* --------------------------------------------------------------------------
   13 · EMPTY / MODAL / PALETTE / TOAST
   -------------------------------------------------------------------------- */

.void {
  grid-column: 1 / -1;
  background: var(--surface);
  padding: 3rem 1.5rem; text-align: center;
}
.void strong { display: block; font-size: 1.05rem; margin-bottom: 0.3rem; }
.void p { color: var(--ink-2); margin: 0 0 1rem; font-size: 0.88rem; }

.sheet[hidden], .finder[hidden] { display: none; }

.sheet {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, 0.62);
  display: grid; place-items: center; padding: 1.2rem;
}
.sheet-card {
  width: min(520px, 100%); max-height: 86dvh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line-2);
}
.sheet-head {
  position: sticky; top: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.sheet-body { padding: 0.4rem 1.1rem 1.1rem; }

.opt {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem 0; border-bottom: 1px solid var(--line);
}
.opt:last-child { border-bottom: 0; }
.opt .k { font-size: 0.88rem; font-weight: 600; }
.opt .d { font-size: 0.76rem; color: var(--ink-3); margin-top: 0.1rem; }

.skins { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.skin {
  width: 2.1rem; height: 2.1rem; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: var(--r);
  display: grid; grid-template-rows: 1fr 1fr;
  overflow: hidden; padding: 0;
}
.skin i { display: block; }
.skin[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }

.toggle { position: relative; width: 2.6rem; height: 1.4rem; flex: none; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.toggle i {
  position: absolute; inset: 0; border: 1px solid var(--line-2);
  border-radius: var(--r); background: var(--paper); pointer-events: none;
}
.toggle i::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: calc(1.4rem - 6px); height: calc(1.4rem - 6px);
  background: var(--ink-3); transition: transform 0.14s, background 0.14s;
}
.toggle input:checked + i { border-color: var(--accent); }
.toggle input:checked + i::after { background: var(--accent); transform: translateX(1.2rem); }

.finder {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(0, 0, 0, 0.62);
  padding: 8vh 1rem 1rem;
}
.finder-card {
  width: min(600px, 100%); margin-inline: auto;
  background: var(--surface); border: 1px solid var(--line-2);
}
.finder-card > input {
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  font-size: 0.98rem; padding: 0.9rem 1rem; background: var(--surface);
}
.finder-card > input:focus { border-color: var(--line); border-bottom-color: var(--accent); }
.hits { list-style: none; margin: 0; padding: 0; max-height: 54dvh; overflow: auto; }
.hits li a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.5rem 1rem; color: var(--ink); font-size: 0.88rem;
  border-left: 2px solid transparent;
}
.hits li a:hover, .hits li.on a {
  background: var(--sel); border-left-color: var(--accent); text-decoration: none;
}
.hits .sw { width: 2.2rem; height: 1.5rem; flex: none; overflow: hidden; }
.hits .sw svg { width: 100%; height: 100%; }
.hits .c { margin-left: auto; font-family: var(--mono); font-size: 0.66rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }
.finder-foot {
  border-top: 1px solid var(--line); padding: 0.5rem 1rem;
  display: flex; gap: 1rem; flex-wrap: wrap;
  font-family: var(--mono); font-size: 0.66rem; color: var(--ink-3);
}

kbd {
  font-family: var(--mono); font-size: 0.66rem;
  border: 1px solid var(--line-2); border-radius: 2px;
  padding: 0.05rem 0.3rem; color: var(--ink-2);
}

.toasts {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%);
  z-index: 120; display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  pointer-events: none;
}
@media (max-width: 900px) { .toasts { bottom: 5.2rem; } }
.toast {
  background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.04em;
  padding: 0.5rem 0.9rem;
  animation: rise 0.16s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* --------------------------------------------------------------------------
   14 · PROSE / ERROR / FOOTER
   -------------------------------------------------------------------------- */

.prose { max-width: 68ch; }
.prose h2 { margin: 2.2rem 0 0.7rem; }
.prose ul { padding-left: 1.1rem; margin: 0 0 1rem; }
.prose li { margin-bottom: 0.35rem; color: var(--ink-2); }
.prose li b, .prose li code { color: var(--ink); }
.prose pre {
  background: var(--surface); border: 1px solid var(--line);
  padding: 0.9rem 1rem; overflow-x: auto; font-size: 0.8rem;
}

.crash { padding: 5rem 0 3rem; }
.crash .code {
  font-family: var(--mono); font-size: clamp(3.5rem, 12vw, 7rem);
  font-weight: 700; letter-spacing: -0.04em; line-height: 1;
  color: var(--accent);
}
.crash h1 { margin: 0.4rem 0 0.6rem; }
.crash .acts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.2rem; }

.foot {
  margin-top: 4rem; padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between;
  font-family: var(--mono); font-size: 0.68rem; color: var(--ink-3);
}
.foot a { color: var(--ink-3); }
.foot a:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   15 · ACCOUNTS — avatars, identity, rail block
   -------------------------------------------------------------------------- */

.avatar {
  position: relative;
  width: 2rem; height: 2rem; flex: none;
  border: 1px solid var(--line);
  overflow: hidden;
}
.avatar svg { width: 100%; height: 100%; display: block; }
.avatar-lg { width: 4.5rem; height: 4.5rem; }
.avatar .dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 0.6rem; height: 0.6rem;
  background: var(--good);
  border: 2px solid var(--surface);
}

.names { display: flex; flex-direction: column; min-width: 0; }
.names .n1 {
  font-size: 0.88rem; font-weight: 650; letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.names .n2 {
  font-family: var(--mono); font-size: 0.68rem; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.role {
  display: inline-block; margin-left: 0.4rem;
  font-family: var(--mono); font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--accent); color: var(--accent);
  vertical-align: middle;
}
.role.bad { border-color: var(--bad); color: var(--bad); }
.role.plus {
  border-color: var(--accent); color: #111;
  background: var(--accent); border-radius: 999px;
  text-transform: none; letter-spacing: 0.02em;
}

.badge {
  min-width: 1.15rem; height: 1.15rem; padding: 0 0.3rem;
  display: inline-grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--mono); font-size: 0.62rem; font-weight: 700;
  border-radius: 999px; margin-left: auto;
}
.rail-nav a .badge { margin-left: auto; }
.rail-nav a .n + .badge { margin-left: 0.35rem; }

.badge.pop { animation: badge-pop 0.45s ease; }
@keyframes badge-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.45); }
  100% { transform: scale(1); }
}

/* The rail's sign-in entry earns a little more weight than a plain link. */
.rail-nav a.signin { color: var(--accent); font-weight: 650; }
.rail-nav a.signin .ico { color: var(--accent); }

/* Bell in the mobile topbar carries a corner badge rather than an inline one. */
.topbar .bell { position: relative; }
.topbar .bell .dot-badge {
  position: absolute; top: -0.3rem; right: -0.3rem;
  margin-left: 0;
  border: 1px solid var(--surface);
}

/* --------------------------------------------------------------------------
   21 · NOTIFICATION FEED
   -------------------------------------------------------------------------- */

.feed { border: 1px solid var(--line); background: var(--surface); }
.note {
  display: flex; align-items: flex-start; gap: 0.85rem;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.note:last-child { border-bottom: 0; }
.note:hover { background: var(--surface-2); }
.note.unread { background: var(--sel); }
.note.unread::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px; background: var(--accent);
}

.note-icon {
  width: 1.9rem; height: 1.9rem; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line-2);
  color: var(--ink-2); font-size: 0.85rem;
}
.note-icon.tone-good { border-color: var(--good); color: var(--good); }
.note-icon.tone-bad { border-color: var(--bad); color: var(--bad); }
.note-icon.tone-accent { border-color: var(--accent); color: var(--accent); }

.note-mid { flex: 1; min-width: 0; }
.note-body {
  margin: 0; font-size: 0.88rem; line-height: 1.4;
  overflow-wrap: anywhere;
}
.note.unread .note-body { font-weight: 600; }
.note-meta {
  margin: 0.2rem 0 0;
  font-family: var(--mono); font-size: 0.66rem; color: var(--ink-3);
}
.note-acts { display: flex; gap: 0.3rem; flex: none; align-items: center; }

@media (max-width: 560px) {
  .note { flex-wrap: wrap; }
  .note-acts { width: 100%; justify-content: flex-end; }
}

.rail-foot .whoami {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem; margin: 0 -0.5rem 0.2rem;
  color: var(--ink);
}
.rail-foot .whoami:hover { background: var(--surface-2); text-decoration: none; }
.rail-foot .names .n1 { font-size: 0.85rem; }

/* --------------------------------------------------------------------------
   16 · FORMS
   -------------------------------------------------------------------------- */

.gate { max-width: 460px; margin: 2.5rem auto 0; }

.form .field { margin-bottom: 1rem; }
.form label {
  display: block; margin-bottom: 0.3rem;
  font-family: var(--mono); font-size: 0.68rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}
.form .hint { margin: 0.35rem 0 0; font-size: 0.75rem; color: var(--ink-3); }
.form textarea { resize: vertical; min-height: 4rem; font-family: inherit; }

.form-error {
  margin: 0 0 0.9rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--bad);
  background: color-mix(in srgb, var(--bad) 12%, transparent);
  color: var(--bad);
  font-size: 0.82rem;
}
.form-error[hidden] { display: none; }

.strength { height: 4px; background: var(--surface-3); margin-top: 0.5rem; }
.strength i { display: block; height: 100%; width: 0; background: var(--bad); transition: width 0.15s, background 0.15s; }
.strength[data-score="2"] i { background: var(--warn); }
.strength[data-score="3"] i,
.strength[data-score="4"] i { background: var(--good); }

/* Password field with a show/hide toggle button riding inside it. */
.pw-field { position: relative; display: flex; }
.pw-field input { flex: 1; padding-right: 2.4rem; }
.pw-toggle {
  position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%);
  background: none; border: 0; cursor: pointer; font-size: 0.95rem;
  color: var(--ink-3); line-height: 1; padding: 0.3rem;
  opacity: 0.75;
}
.pw-toggle:hover { opacity: 1; color: var(--ink); }
.pw-toggle[aria-pressed="true"] { color: var(--accent); opacity: 1; }

.first-run { border-color: var(--accent); margin-bottom: 1rem; }
.carry { margin: 0 0 0.9rem; }

/* Site-wide announcement banner — inserted at the top of <body> on every
   page when staff have posted one. */
.site-announce {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.6rem 1rem; font-size: 0.85rem; line-height: 1.4;
  position: sticky; top: 0; z-index: 500;
  animation: announce-in 0.28s ease both;
}
@keyframes announce-in {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .site-announce { animation: none; } }
/* Sit beside the fixed rail rather than over its logo; on phones, just under
   the fixed top bar instead of on top of it. */
@media (min-width: 901px) { .site-announce { margin-left: var(--rail); } }
@media (max-width: 900px) { .site-announce { position: fixed; top: 3.5rem; left: 0; right: 0; z-index: 45; } }
.site-announce span:first-child { flex: 1; }
.site-announce-info { background: var(--accent); color: #fff; }
.site-announce-warning { background: #eab308; color: #1b1400; }
.site-announce-critical { background: #dc2626; color: #fff; }
.site-announce-close {
  background: none; border: 0; cursor: pointer; color: inherit;
  font-size: 1.1rem; line-height: 1; padding: 0.2rem 0.4rem; opacity: 0.85;
}
.site-announce-close:hover { opacity: 1; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.btn-danger { border-color: var(--bad); color: var(--bad); background: transparent; }
.btn-danger:hover { background: var(--bad); color: var(--paper); border-color: var(--bad); }
.panel.danger { border-color: var(--bad); }

/* --------------------------------------------------------------------------
   17 · PEOPLE LISTS
   -------------------------------------------------------------------------- */

.people { border: 1px solid var(--line); background: var(--surface); }
.people:empty { display: none; }
.person {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--line);
}
.person:last-child { border-bottom: 0; }
.person:hover { background: var(--surface-2); }
.person-main {
  display: flex; align-items: center; gap: 0.7rem;
  flex: 1; min-width: 0; color: var(--ink);
}
.person-main:hover { text-decoration: none; }
.person-main:hover .n1 { color: var(--accent); }
.person-note {
  font-family: var(--mono); font-size: 0.66rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
}
.person-acts { display: flex; gap: 0.35rem; flex-wrap: wrap; }
@media (max-width: 620px) {
  .person { flex-wrap: wrap; }
  .person-acts { width: 100%; }
}

.finder-row { margin-bottom: 0.8rem; }

/* --------------------------------------------------------------------------
   18 · PROFILE
   -------------------------------------------------------------------------- */

.profile-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1.2rem;
  padding: 2.2rem 0 1.3rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}
.profile-id { display: flex; align-items: center; gap: 1rem; flex: 1; min-width: 240px; }
.profile-id h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.profile-id .handle { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-2); margin: 0.25rem 0 0.15rem; }
.profile-acts { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.profile-bio {
  max-width: 68ch; margin: 0 0 1.5rem;
  padding-left: 0.9rem; border-left: 2px solid var(--accent);
  color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere;
}

/* Friend-list quick-jump tabs — were rendering as run-together text with no
   spacing ("Your friendsIncomingSent requestsBlocked"). */
.social-sections {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.4rem 0 1.4rem;
}
.social-sections a {
  padding: 0.35rem 0.85rem; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink-2); font-size: 0.82rem; font-weight: 600;
  text-decoration: none; transition: background .12s, color .12s, border-color .12s;
}
.social-sections a:hover {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
/* --------------------------------------------------------------------------
   20 · ADMIN
   -------------------------------------------------------------------------- */

/* A second-level shell inside .main: the site's own .rail already claims the left edge, so the console gets its… */
.admin-shell {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: 1.8rem;
  align-items: start;
}
.admin-nav {
  position: sticky; top: 1.4rem;
  display: flex; flex-direction: column; gap: 0.15rem;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.5rem;
}
.admin-nav-link {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.5rem 0.6rem;
  font: inherit; font-size: 0.84rem; font-weight: 600;
  color: var(--ink-2);
  background: none; border: 0; border-left: 2px solid transparent;
  cursor: pointer; text-align: left; width: 100%;
}
.admin-nav-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.admin-nav-link.on {
  background: var(--sel); color: var(--ink); border-left-color: var(--accent); font-weight: 700;
}
.admin-nav-link .ico { width: 1.05rem; text-align: center; flex: none; font-size: 0.92rem; }
.admin-nav-link .lbl { flex: 1; }
.admin-nav-foot { border-top: 1px solid var(--line); margin-top: 0.4rem; padding-top: 0.5rem; }
.admin-nav-foot .btn { width: 100%; }

.admin-main { min-width: 0; }
.admin-topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding-bottom: 1.2rem; margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--line);
}
.admin-topbar h1 { margin-bottom: 0.5rem; }

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; gap: 1rem; }
  .admin-nav {
    position: static;
    flex-direction: row; flex-wrap: nowrap;
    overflow-x: auto; overscroll-behavior-x: contain;
  }
  .admin-nav-link { border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
  .admin-nav-link.on { border-left-color: transparent; border-bottom-color: var(--accent); }
  .admin-nav-foot { display: none; }
}

/* Queue depth on the nav link itself. A moderation console whose whole
   purpose is showing what is waiting should not make you open each
   section to find out. */
.admin-nav-n {
  margin-left: auto;
  font-family: var(--mono); font-size: 0.64rem; line-height: 1;
  padding: 0.15rem 0.3rem; border: 1px solid var(--accent);
  color: var(--accent); border-radius: var(--r); flex: none;
}
.admin-nav-n[hidden] { display: none; }

/* Users tab: a clickable row that fills the detail pane beside it, rather
   than opening a full-screen sheet over the list you were just scanning. */
.user-row { cursor: pointer; }
.user-row.is-on { background: var(--sel); }
.user-detail-empty { padding: 2.2rem 1rem; text-align: center; color: var(--ink-3); font-size: 0.86rem; }

.admin-who { display: flex; align-items: center; gap: 0.6rem; min-width: 0; color: var(--ink); }
.admin-who:hover { text-decoration: none; }
.admin-acts { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.admin-acts select { width: auto; padding: 0.25rem 0.35rem; font-size: 0.76rem; }

/* The users list adapts to the device instead of forcing a spreadsheet.
   Wide: real columns. Narrow: each row becomes a stacked card with labels,
   so nothing overlaps and there's no sideways scrolling. */
#user-rows { min-width: 0; }
.rows-scroll { overflow: visible; }

@media (max-width: 760px) {
  /* Hide the column header; cards carry their own labels. */
  #user-rows .user-head { display: none; }

  #user-rows .user-row-grid {
    display: block;
    grid-template-columns: none !important;   /* override the inline grid */
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.6rem;
  }
  #user-rows .user-row-grid.is-on { background: var(--sel); border-color: var(--accent); }

  /* The account (avatar + name) sits on top as the card title. */
  #user-rows .user-row-grid .admin-who { margin-bottom: 0.55rem; }

  /* Each data cell becomes a labelled line. */
  #user-rows .user-row-grid .u-cell {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; padding: 0.22rem 0;
    font-size: 0.82rem; white-space: normal;
    border-top: 1px solid var(--line);
  }
  #user-rows .user-row-grid .u-cell::before {
    content: attr(data-label);
    color: var(--ink-3); font-weight: 600; font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.03em;
    flex: none;
  }
  #user-rows .user-row-grid .u-cell.flag { align-self: flex-start; }
  #user-rows .user-row-grid .admin-acts { justify-content: flex-end; margin-top: 0.35rem; }
}

.report {
  border: 1px solid var(--line); background: var(--surface);
  padding: 0.9rem 1rem; margin-bottom: 0.7rem;
}
.report-top { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.report-target { font-family: var(--mono); font-size: 0.8rem; color: var(--ink); }
.report-reason {
  margin: 0 0 0.8rem; font-size: 0.88rem; color: var(--ink-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* A staff reply, quoted back to whoever sent the feedback. */
.note-reply {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.7rem;
  border-left: 2px solid var(--accent);
  background: var(--sel);
  font-size: 0.84rem; color: var(--ink);
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* The queue tiles are buttons, because they take you to the work. */
.queue-metrics .metric {
  border: 0; font: inherit; text-align: left; cursor: pointer;
  width: 100%; color: inherit;
}
.queue-metrics .metric:hover { background: var(--surface-2); }
.queue-metrics .metric:hover b { color: var(--accent); }

/* Separates the three escalating things the manage sheet offers, so a rank
   change and a deletion never read as one block of buttons. */
.sheet-rule { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0 1rem; }

.btn.is-danger { color: var(--bad); border-color: var(--bad); }
.btn.is-danger:hover { background: var(--bad); color: var(--paper); }

/* --------------------------------------------------------------------------
   25 · SKIN GALLERY
   -------------------------------------------------------------------------- */

.skin-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 0.6rem;
  width: 100%;
}

.skin-card {
  display: flex; flex-direction: column;
  padding: 0; cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  overflow: hidden;
  font: inherit; color: inherit;
  transition: border-color 0.12s, transform 0.12s;
}
.skin-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.skin-card[aria-pressed="true"] {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

/* A miniature of the interface, painted in that skin's own colours. */
.skin-preview {
  position: relative; display: block;
  height: 62px; padding: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.skin-bar {
  display: block; height: 7px; width: 40%;
  border-radius: 2px; margin-bottom: 0.35rem;
}
.skin-line {
  display: block; height: 4px;
  border-radius: 2px; margin-bottom: 0.25rem;
}

.skin-foot {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.3rem; padding: 0.4rem 0.5rem;
}
.skin-name { font-size: 0.8rem; font-weight: 650; }

/* --------------------------------------------------------------------------
   26 · GAME DATA EDITOR
   -------------------------------------------------------------------------- */

.gd-card {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.7rem;
}
.gd-head {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.gd-key {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 600;
  color: var(--ink); overflow-wrap: anywhere;
}

.gd-fields {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.5rem;
}
.gd-field { display: flex; flex-direction: column; gap: 0.2rem; }
.gd-field-name {
  font-family: var(--mono); font-size: 0.66rem;
  letter-spacing: 0.06em; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gd-field input { font-family: var(--mono); font-size: 0.8rem; }

.gd-raw {
  width: 100%; resize: vertical;
  font-family: var(--mono); font-size: 0.78rem; line-height: 1.5;
  padding: 0.5rem 0.6rem;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r);
}
.skin-mode {
  font-family: var(--mono); font-size: 0.6rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3);
}

/* Lightbox for tapping a chat image. */
.shot-view {
  position: fixed; inset: 0; z-index: 800;
  background: rgba(0, 0, 0, 0.85);
  display: grid; place-items: center; padding: 1.5rem;
  cursor: zoom-out;
}
.shot-view img { max-width: 100%; max-height: 100%; border: 1px solid var(--line-2); border-radius: 0.5rem; }

/* --------------------------------------------------------------------------
   23 · CAMERA
   -------------------------------------------------------------------------- */

.cam-card { width: min(520px, 100%); }
.cam-view {
  display: block; width: 100%; max-height: 60vh;
  background: #000; object-fit: contain;
}
.cam-bar {
  display: flex; gap: 0.4rem; justify-content: center;
  padding: 0.8rem; border-top: 1px solid var(--line);
  background: var(--surface-2);
}

/* --------------------------------------------------------------------------
   24 · FRIEND CODE + SOCIAL REWORK
   -------------------------------------------------------------------------- */

.code-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
  border: 1px solid var(--accent);
  background: var(--sel);
  padding: 1rem 1.1rem;
}
.code-card .what { flex: 1; min-width: 180px; }
.code-card .what strong { display: block; font-size: 0.95rem; }
.code-card .what span { font-size: 0.78rem; color: var(--ink-2); }
.code-value {
  font-family: var(--mono); font-size: 1.5rem; font-weight: 700;
  letter-spacing: 0.18em; color: var(--accent);
  user-select: all;
}
.code-acts { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.add-row { display: grid; grid-template-columns: 1fr auto; gap: 0.4rem; }
@media (max-width: 520px) { .add-row { grid-template-columns: 1fr; } }

.seg-tabs { display: flex; gap: 0; margin-bottom: 0.9rem; }
.seg-tabs .btn { border-radius: 0; margin-left: -1px; }
.seg-tabs .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.seg-tabs .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }

.picker {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  padding: 0.6rem; border: 1px solid var(--line);
  background: var(--paper); min-height: 3rem;
  margin-bottom: 0.7rem;
}
.picker:empty::before {
  content: "Nobody picked yet"; color: var(--ink-3); font-size: 0.8rem;
}
.chip-person {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.4rem 0.2rem 0.2rem;
  border: 1px solid var(--line-2); background: var(--surface);
  border-radius: 999px;
  font-size: 0.78rem;
}
.chip-person .avatar { width: 1.3rem; height: 1.3rem; }
.chip-person button {
  background: none; border: 0; cursor: pointer; color: var(--ink-3);
  font-size: 0.8rem; line-height: 1; padding: 0 0.1rem;
}
.chip-person button:hover { color: var(--bad); }

/* --------------------------------------------------------------------------
   26 · SUPPORT TICKETS
   -------------------------------------------------------------------------- */

.ticket-row {
  display: flex; align-items: center; gap: 0.7rem; width: 100%;
  padding: 0.7rem 0.9rem; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
  color: var(--ink); font: inherit; cursor: pointer;
}
.ticket-row:hover, .ticket-row.is-on { background: var(--surface-2); border-left-color: var(--accent); }
.ticket-row .mid { flex: 1; min-width: 0; }
.ticket-row .subject {
  display: block; font-weight: 650; font-size: 0.88rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ticket-row .meta { display: block; font-size: 0.74rem; color: var(--ink-2); }

.pri { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0.1rem 0.35rem; border: 1px solid var(--line-2); flex: none; }
.pri[data-p="high"] { color: var(--bad); border-color: var(--bad); }
.pri[data-p="low"] { color: var(--ink-3); }
.state-tag { font-size: 0.7rem; padding: 0.1rem 0.4rem; border: 1px solid var(--line-2); flex: none; }
.state-tag[data-s="open"] { color: var(--accent); border-color: var(--accent); }
.state-tag[data-s="waiting"] { color: var(--warn, var(--ink-2)); }
.state-tag[data-s="closed"] { color: var(--ink-3); }

.ticket-thread { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.9rem;
  max-height: 52vh; overflow-y: auto; }
.tmsg { max-width: 88%; padding: 0.55rem 0.7rem; border: 1px solid var(--line-2);
  background: var(--surface-2); border-radius: var(--r); }
.tmsg.is-staff { align-self: flex-end; background: var(--sel); border-color: var(--accent); }
.tmsg .who { display: block; font-size: 0.72rem; color: var(--ink-2); margin-bottom: 0.2rem; }
.tmsg .body { font-size: 0.86rem; white-space: pre-wrap; word-break: break-word; }

/* --------------------------------------------------------------------------
   27 · CATALOG EDITOR (owner)
   -------------------------------------------------------------------------- */

.cat-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.cat-form .wide { grid-column: 1 / -1; }
@media (max-width: 700px) { .cat-form { grid-template-columns: 1fr; } }
.cat-preview {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.7rem; border: 1px dashed var(--line-2); background: var(--paper);
}
.cat-preview .shot { width: 5rem; aspect-ratio: 4/3; flex: none; overflow: hidden; }
.cat-preview .shot > * { width: 100%; height: 100%; }

/* A list beside a detail pane. Collapses to stacked on narrow screens, where
   side-by-side would leave both halves unusable. */
.two-col {
  display: grid; gap: 1.4rem;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  align-items: start;
}
.two-col > .block { margin: 0; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* The admin users tab needs the OPPOSITE ratio from the default two-col: the list itself now carries five… */
.two-col-list-wide {
  display: grid; gap: 1.4rem;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 22rem);
  align-items: start;
}
@media (max-width: 980px) { .two-col-list-wide { grid-template-columns: 1fr; } }

/* A panel whose children own their own padding (lists, threads). */
.panel-flush { padding: 0; overflow: hidden; }

/* Campus+ : responsive 16:9 video frame, and the little accent on the "+"
   in the page label so it reads as a distinct feature, not a typo. */
.plus-mark { color: var(--accent); font-weight: 700; }

/* --------------------------------------------------------------------------
   28 · ADMIN HELP
   -------------------------------------------------------------------------- */

.help-grid {
  display: grid; gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  align-items: start;
}
.help-h {
  font-size: 0.95rem; margin: 0 0 0.8rem;
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--line);
}

.help-list { margin: 0; }
.help-list dt {
  font-weight: 650; font-size: 0.85rem; color: var(--accent);
  margin-top: 0.9rem;
}
.help-list dt:first-child { margin-top: 0; }
.help-list dd {
  margin: 0.2rem 0 0; font-size: 0.83rem; line-height: 1.55; color: var(--ink-2);
}

.keys-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.keys-table th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-3); font-weight: 600;
  padding: 0 0.5rem 0.4rem 0; border-bottom: 1px solid var(--line);
}
.keys-table td {
  padding: 0.45rem 0.5rem 0.45rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.keys-table td:first-child { white-space: nowrap; }
.keys-table td:last-child { color: var(--ink-3); white-space: nowrap; }
.keys-table kbd {
  display: inline-block; font-family: var(--mono); font-size: 0.78rem;
  padding: 0.12rem 0.4rem; border: 1px solid var(--line-2);
  border-bottom-width: 2px; border-radius: 4px;
  background: var(--paper); color: var(--ink);
}

.help-notes { margin: 0; padding-left: 1.1rem; }
.help-notes li {
  font-size: 0.83rem; line-height: 1.6; color: var(--ink-2);
  margin-bottom: 0.6rem;
}
.help-notes li:last-child { margin-bottom: 0; }

@media (max-width: 620px) {
  .keys-table td:last-child, .keys-table th:last-child { display: none; }
}

/* --------------------------------------------------------------------------
   29 · SHORTCUT COMBO PICKER
   -------------------------------------------------------------------------- */

.combo-picker { display: flex; align-items: center; gap: 0.4rem; flex: none; }
.combo-picker .combo-mod {
  font-family: var(--mono); font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px;
  background: var(--paper); color: var(--ink);
}
.combo-picker .combo-plus { color: var(--ink-3); font-size: 0.85rem; }
.combo-picker select { width: auto; min-width: 8.5rem; }
.combo-picker select:disabled { opacity: 0.45; }

/* --------------------------------------------------------------------------
   30 · CATALOGUE MANAGER — the owner's Games tab
   -------------------------------------------------------------------------- */

.game-rows { display: flex; flex-direction: column; border: 1px solid var(--line); }
.game-rows:empty { display: none; }

.game-row {
  display: grid; align-items: center; gap: 0.75rem;
  grid-template-columns: 3.4rem minmax(0, 1fr) 7rem 6rem auto;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
}
.game-row:last-child { border-bottom: 0; }
.game-row:hover { background: var(--surface-2); }
.game-row[data-status="hidden"] { border-left-color: var(--ink-3); opacity: 0.72; }
.game-row[data-status="added"] { border-left-color: var(--accent); }
.game-row[data-status="gone"] { border-left-color: var(--bad); }

.game-row-shot {
  width: 3.4rem; aspect-ratio: 16 / 10; overflow: hidden;
  border: 1px solid var(--line-2); background: var(--paper);
}
.game-row-shot > * { width: 100%; height: 100%; display: block; }

.game-row-mid { min-width: 0; display: flex; flex-direction: column; }
.game-row-title {
  font-size: 0.88rem; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.game-row-where {
  font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.game-row-cat { font-size: 0.76rem; color: var(--ink-2); }

.game-row-tag {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.1rem 0.4rem; border: 1px solid var(--line-2); color: var(--ink-3);
  justify-self: start; white-space: nowrap;
}
.game-row-tag[data-s="added"] { color: var(--accent); border-color: var(--accent); }
.game-row-tag[data-s="hidden"] { color: var(--ink-3); }
.game-row-tag[data-s="gone"] { color: var(--bad); border-color: var(--bad); }

.game-row-acts { display: flex; gap: 0.3rem; flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 820px) {
  .game-row {
    grid-template-columns: 3.4rem minmax(0, 1fr) auto;
    row-gap: 0.4rem;
  }
  .game-row-cat { display: none; }
  .game-row-tag { grid-column: 2; justify-self: start; }
  .game-row-acts { grid-column: 1 / -1; justify-content: flex-start; }
}

/* Where a save entry lives, since that decides how it is written back. */
.gd-from {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.05rem 0.3rem; border: 1px solid var(--line-2); color: var(--ink-3);
}
.gd-from[data-from="cookie"] { color: var(--accent); border-color: var(--accent); }
.gd-card[data-from="cookie"] { border-left: 2px solid var(--accent); }

/* How a key was attributed to a game: watched, or guessed from its name. */
.gd-from[data-how="watched"] { color: var(--good, var(--accent)); border-color: currentColor; }
.gd-from[data-how="guessed"] { color: var(--ink-3); border-style: dashed; }

/* Clickteam INI saves — every FNAF title, and a good share of the other
   compiled games — get a field per value instead of one long line. */
.gd-ini-section {
  font-family: var(--mono); font-size: 0.78rem; color: var(--accent);
  margin: 0.9rem 0 0.4rem; padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--line);
}
.gd-ini-section:first-of-type { margin-top: 0; }

.gd-field {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto;
  gap: 0.4rem; align-items: center; margin-bottom: 0.35rem;
}
.gd-field-key {
  font-size: 0.8rem; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gd-field-input { font-family: var(--mono); font-size: 0.8rem; }
@media (max-width: 560px) {
  .gd-field { grid-template-columns: minmax(0, 1fr) auto; }
  .gd-field-key { grid-column: 1 / -1; }
}

/* ========================================================================== 30 · SVG ICON SYSTEM — legible… */

.svg-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1em; height: 1em; line-height: 0; flex: none;
}
.svg-ico svg { display: block; width: 1em; height: 1em; }

/* Any button that holds an icon + text label: space them, center them. */
.btn .svg-ico, .btn-call .svg-ico { margin-right: 0.4rem; }
.btn-sq .svg-ico, .btn .svg-ico:only-child { margin-right: 0; }
.btn-call {
  display: inline-flex; align-items: center;
  background: color-mix(in srgb, var(--good) 15%, transparent);
  color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 40%, transparent);
}
.btn-call:hover { background: var(--good); color: #fff; border-color: var(--good); }

/* ========================================================================== 31 · CAMPUS AI (BETA) Built-in… */

.nav-tag {
  margin-left: auto; font-family: var(--mono);
  font-size: 0.52rem; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.1rem 0.35rem; border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent); font-weight: 700;
}
.beta-pill {
  display: inline-block; vertical-align: middle;
  margin-left: 0.5rem; font-size: 0.55em; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.2rem 0.5rem; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent); font-family: var(--mono);
}

.ai-note {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border-radius: 12px; padding: 0.85rem 1rem; margin-bottom: 1.4rem;
  font-size: 0.86rem; color: var(--ink-2); line-height: 1.55;
}
.ai-note strong { color: var(--ink); }

.ai-shell {
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,0,0,0.14);
  min-height: min(60vh, 520px);
}
.ai-log {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 1.1rem; display: flex; flex-direction: column; gap: 0.7rem;
  scroll-behavior: smooth;
}

.ai-row { display: flex; }
.ai-row.ai-me { justify-content: flex-end; }
.ai-bubble {
  max-width: 82%; padding: 0.65rem 0.9rem; border-radius: 15px;
  font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}
.ai-ai .ai-bubble {
  background: var(--surface-2); color: var(--ink);
  border-radius: 15px 15px 15px 4px;
}
.ai-me .ai-bubble {
  background: var(--accent); color: var(--accent-ink);
  border-radius: 15px 15px 4px 15px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Typing dots. */
.ai-typing { display: inline-flex; gap: 4px; align-items: center; }
.ai-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-3); display: inline-block;
  animation: ai-dot 1.1s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.18s; }
.ai-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes ai-dot { 0%,60%,100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* Game recommendation cards. */
.ai-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem; margin: 0.1rem 0 0.3rem;
}
.ai-card {
  display: flex; flex-direction: column; border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; background: var(--paper);
  transition: transform .1s, border-color .12s, box-shadow .12s;
}
.ai-card:hover {
  transform: translateY(-2px); border-color: var(--accent);
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--accent) 50%, transparent);
  text-decoration: none;
}
.ai-card-cover { display: block; aspect-ratio: 16/10; background: var(--surface-3); }
.ai-card-cover .cover, .ai-card-cover canvas, .ai-card-cover img,
.ai-card-cover svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.ai-card-meta { padding: 0.5rem 0.6rem; display: flex; flex-direction: column; gap: 0.15rem; }
.ai-card-meta strong { font-size: 0.82rem; line-height: 1.25; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ai-card-cat { font-size: 0.68rem; color: var(--ink-3); font-family: var(--mono); }

/* Suggestion chips. */
.ai-suggests {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0.6rem 0.9rem; border-top: 1px solid var(--line);
  background: var(--paper);
}
.ai-chip {
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink-2); border-radius: 999px;
  padding: 0.35rem 0.75rem; font-size: 0.78rem; cursor: pointer;
  transition: background .1s, color .1s, border-color .1s;
}
.ai-chip:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Compose row. */
.ai-compose {
  display: flex; gap: 0.5rem; align-items: center;
  padding: 0.7rem 0.9rem; border-top: 1px solid var(--line);
  background: var(--surface);
}
.ai-compose textarea {
  flex: 1; resize: none; border-radius: 1.3rem;
  padding: 0.6rem 1rem; min-height: 2.6rem; max-height: 140px;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line-2); font: inherit;
  transition: border-color .12s, box-shadow .12s;
}
.ai-compose textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.ai-send {
  flex: none; width: 2.8rem; height: 2.8rem; border-radius: 50%;
  display: grid; place-items: center; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-size: 1.05rem;
  box-shadow: 0 3px 12px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform .1s, filter .12s;
}
.ai-send:hover { transform: scale(1.06); filter: brightness(1.05); }
.ai-send:active { transform: scale(0.94); }
.ai-send:disabled { opacity: 0.5; cursor: default; transform: none; }

@media (max-width: 620px) {
  .ai-bubble { max-width: 90%; }
  .ai-cards { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* Campus AI members-only gate */
.ai-gate {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 0.6rem; padding: 3rem 1.5rem; margin: auto; max-width: 30rem;
}
.ai-gate .svg-ico { font-size: 2.4rem; color: var(--ink-3); }
.ai-gate h2 { font-size: 1.15rem; }
.ai-gate p { color: var(--ink-2); font-size: 0.9rem; line-height: 1.55; }
.ai-gate-acts { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; margin-top: 0.5rem; }

/* ==========================================================================
   32 · AVATARS — uploaded profile pictures
   ========================================================================== */
.avatar { position: relative; overflow: hidden; }
.avatar .avatar-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: inherit;
}
.avatar svg { display: block; width: 100%; height: 100%; }

/* Editable avatar on your own profile: hover reveals a camera badge. */
.avatar-editable { cursor: pointer; }
.avatar-editable:hover { filter: brightness(1.05); }
.avatar-editable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar-edit-badge {
  position: absolute; right: 0; bottom: 0;
  width: 40%; height: 40%; min-width: 22px; min-height: 22px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 50%; border: 2px solid var(--surface);
  font-size: 0.8rem; opacity: 0; transform: scale(0.8);
  transition: opacity .12s, transform .12s;
}
.avatar-editable:hover .avatar-edit-badge,
.avatar-editable:focus-visible .avatar-edit-badge { opacity: 1; transform: scale(1); }
.avatar-busy { opacity: 0.5; pointer-events: none; }
.avatar-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-top-color: var(--accent); animation: av-spin .7s linear infinite;
}
@keyframes av-spin { to { transform: rotate(360deg); } }

/* Settings: profile-picture row */
.pfp-row { display: flex; align-items: center; gap: 1rem; }
.pfp-row .avatar-lg { width: 72px; height: 72px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px var(--line); }
.pfp-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; }

/* ==========================================================================
   40 · CHAT — floating dock + Messages page (one system, shared by both)
   ========================================================================== */

/* Avatars are round everywhere, and the online dot sits on the rim instead of
   being clipped by the square's overflow. */
.avatar { border-radius: 50%; overflow: visible; background: var(--surface-2); }
.avatar > svg, .avatar > .avatar-img { border-radius: 50%; overflow: hidden; }
.avatar .dot { border-radius: 50%; right: 0; bottom: 0; z-index: 1; }
.avatar-sm { width: 1.75rem; height: 1.75rem; }
.avatar-sm .dot { width: 0.5rem; height: 0.5rem; }
.avatar-lg .dot { width: 1rem; height: 1rem; right: 0.2rem; bottom: 0.2rem; }

.chat-group-av {
  width: 2.5rem; height: 2.5rem; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.15rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-2));
}
.chat-group-av.is-sm { width: 1.9rem; height: 1.9rem; font-size: 0.95rem; }
.chat-group-av.is-lg { width: 4.5rem; height: 4.5rem; font-size: 1.9rem; }

.chat-icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 2.35rem; height: 2.35rem; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--ink-2); font-size: 1.12rem;
  transition: background .12s, color .12s;
}
.chat-icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.chat-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chat-icon-btn[aria-pressed="true"] { background: var(--sel); color: var(--accent); }
.chat-icon-btn.is-call { color: var(--good); }
.chat-icon-btn.is-call:hover { background: color-mix(in srgb, var(--good) 16%, transparent); }

/* ---- search ---- */
.chat-search {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0 0.8rem; height: 2.4rem;
  border-radius: 999px; background: var(--surface-2);
  border: 1px solid transparent; color: var(--ink-3);
  transition: border-color .12s, background .12s;
}
.chat-search:focus-within { border-color: var(--accent); background: var(--paper); }
.chat-search input, .chat-search input:focus {
  flex: 1; height: auto; box-shadow: none; border-radius: 0; min-width: 0; border: 0; background: transparent; outline: none;
  color: var(--ink); font: inherit; font-size: 0.88rem; padding: 0;
}

/* ---- conversation rows ---- */
.chat-rows { display: flex; flex-direction: column; gap: 2px; padding: 0.25rem; }
.chat-row {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
  padding: 0.6rem 0.65rem; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink); text-align: left;
  cursor: pointer; font: inherit;
  transition: background .12s;
}
.chat-row:hover { background: var(--surface-2); }
.chat-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chat-row.is-active { background: var(--sel); }
.chat-row .avatar { width: 2.5rem; height: 2.5rem; }
.chat-row-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.12rem; }
.chat-row-top, .chat-row-bottom { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.chat-row-name {
  flex: 1; min-width: 0; font-weight: 600; font-size: 0.92rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-row-when { flex: none; font-size: 0.72rem; color: var(--ink-3); }
.chat-row-prev {
  flex: 1; min-width: 0; font-size: 0.82rem; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-row-prev.is-muted { font-style: italic; }
.chat-row.is-unread .chat-row-name { font-weight: 800; }
.chat-row.is-unread .chat-row-prev { color: var(--ink); font-weight: 600; }
.chat-row.is-unread .chat-row-when { color: var(--accent); font-weight: 700; }
.chat-unread {
  flex: none; min-width: 1.3rem; height: 1.3rem; padding: 0 0.4rem;
  display: inline-grid; place-items: center; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 0.7rem; font-weight: 800;
}

.chat-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 0.4rem; padding: 2.2rem 1.2rem; color: var(--ink-2);
}
.chat-empty strong { color: var(--ink); font-size: 1rem; }
.chat-empty p { margin: 0 0 0.6rem; font-size: 0.85rem; max-width: 26ch; }
.chat-empty.is-small { padding: 1.4rem 1rem; }
.chat-empty-art {
  width: 3.4rem; height: 3.4rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.6rem;
  color: var(--accent); background: var(--sel); margin-bottom: 0.3rem;
}
.chat-empty .btn { display: inline-flex; align-items: center; gap: 0.35rem; }
.chat-empty .btn .svg-ico { margin: 0; }

/* ---- skeletons ---- */
.chat-skel {
  display: block; border-radius: 999px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 300% 100%;
  animation: chat-shimmer 1.3s ease-in-out infinite;
}
@keyframes chat-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.chat-row.is-skel { cursor: default; }
.chat-row.is-skel:hover { background: transparent; }
.chat-skel-av { width: 2.5rem; height: 2.5rem; flex: none; }
.chat-skel-line { height: 0.7rem; width: 70%; }
.chat-skel-line.is-short { width: 45%; margin-top: 0.35rem; }
.chat-skeleton { display: flex; flex-direction: column; gap: 0.7rem; padding: 1rem 0; }
.chat-skel-row { display: flex; }
.chat-skel-row .chat-skel { height: 2.3rem; width: 55%; border-radius: 18px; }
.chat-skel-row.is-mine { justify-content: flex-end; }
.chat-skel-row.is-mine .chat-skel { width: 40%; }

/* ---- the conversation ---- */
.chat-convo {
  position: relative; display: flex; flex-direction: column;
  min-height: 0; height: 100%; background: var(--paper);
}
.chat-convo.is-drop::after {
  content: "Drop a picture to send it";
  position: absolute; inset: 0.5rem; z-index: 5;
  display: grid; place-items: center; border-radius: 14px;
  border: 2px dashed var(--accent); color: var(--accent); font-weight: 700;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
}
.chat-log {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column;
  padding: 0.75rem clamp(0.75rem, 2.5vw, 1.5rem) 0.5rem;
}
.chat-log:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.chat-log > :first-child { margin-top: auto; }

.chat-intro {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 0.35rem; padding: 1.5rem 1rem 1.2rem; color: var(--ink-2);
}
.chat-intro .avatar-lg, .chat-intro .chat-group-av { margin-bottom: 0.35rem; }
.chat-intro strong { color: var(--ink); font-size: 1.1rem; }
.chat-intro p { margin: 0; font-size: 0.84rem; max-width: 34ch; }

.chat-day {
  display: flex; justify-content: center; margin: 0.9rem 0 0.5rem;
}
.chat-day span {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em; color: var(--ink-2);
  padding: 0.22rem 0.7rem; border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.chat-msg {
  position: relative; display: flex; flex-direction: column; align-items: flex-start;
  max-width: min(78%, 34rem); margin-top: 0.55rem; align-self: flex-start;
}
.chat-msg.is-cont { margin-top: 0.15rem; }
.chat-msg.is-mine { align-self: flex-end; align-items: flex-end; }
.chat-msg-who { font-size: 0.72rem; font-weight: 700; color: var(--accent); margin: 0 0 0.2rem 0.7rem; }

.chat-bubble {
  position: relative; padding: 0.5rem 0.8rem 0.45rem;
  border-radius: 18px; background: var(--surface-2); color: var(--ink);
  font-size: 0.92rem; line-height: 1.42;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-msg:not(.is-mine) .chat-bubble { border-bottom-left-radius: 6px; }
.chat-msg.is-mine .chat-bubble {
  background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px;
}
.chat-msg.is-cont:not(.is-mine) .chat-bubble { border-top-left-radius: 6px; }
.chat-msg.is-cont.is-mine .chat-bubble { border-top-right-radius: 6px; }
.chat-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.chat-time {
  float: right; margin: 0.35rem 0 -0.15rem 0.6rem;
  font-size: 0.64rem; line-height: 1; opacity: 0.62; white-space: nowrap;
}
.chat-bubble.is-emoji { background: transparent !important; padding: 0 0.1rem; }
.chat-bubble.is-emoji .chat-text { font-size: 2.2rem; line-height: 1.15; }
.chat-bubble.is-emoji .chat-time { color: var(--ink-3); opacity: 1; }
.chat-bubble.is-gone {
  background: transparent !important; color: var(--ink-3) !important;
  border: 1px dashed var(--line-2); font-style: italic; font-size: 0.84rem;
}
.chat-bubble.has-img { padding: 0.25rem; }
.chat-bubble.has-img .chat-text { display: block; padding: 0.3rem 0.55rem 0; }
.chat-bubble.has-img .chat-time { margin: 0.3rem 0.5rem 0.25rem 0.6rem; }
.chat-img {
  display: block; max-width: min(100%, 300px); height: auto; max-height: 320px;
  border-radius: 14px; cursor: zoom-in; background: var(--surface-3); object-fit: cover;
}
.chat-img[data-loading] { min-width: 160px; min-height: 110px; }
.is-compact .chat-img { max-width: min(100%, 220px); max-height: 240px; }

.chat-msg.is-sending .chat-bubble { opacity: 0.6; }
.chat-msg.is-failed .chat-bubble { outline: 2px solid var(--bad); outline-offset: 1px; }
.chat-fail {
  display: flex; align-items: center; gap: 0.4rem; margin-top: 0.3rem;
  font-size: 0.74rem; color: var(--bad);
}
.chat-fail-btn {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.15rem 0.55rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 0.72rem; font-weight: 600;
}
.chat-fail-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Hover (or keyboard focus) reveals per-message actions beside the bubble. */
.chat-msg-acts {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: flex; gap: 2px; padding: 2px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.chat-msg:not(.is-mine) .chat-msg-acts { left: calc(100% + 0.35rem); }
.chat-msg.is-mine .chat-msg-acts { right: calc(100% + 0.35rem); }
.chat-msg:hover .chat-msg-acts, .chat-msg:focus-within .chat-msg-acts { opacity: 1; pointer-events: auto; }
.chat-msg.is-sending .chat-msg-acts, .chat-msg.is-failed .chat-msg-acts { display: none; }
.chat-act {
  display: grid; place-items: center; width: 1.8rem; height: 1.8rem;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-2);
  cursor: pointer; font-size: 0.9rem;
}
.chat-act:hover { background: var(--surface-2); color: var(--ink); }
@media (hover: none) {
  /* Touch: no hover, so keep the actions reachable but quiet under the bubble. */
  .chat-msg-acts { position: static; transform: none; opacity: 0.85; pointer-events: auto;
    box-shadow: none; border: 0; background: transparent; margin-top: 0.1rem; }
}

.chat-jump {
  position: absolute; left: 50%; bottom: 5.2rem; transform: translateX(-50%); z-index: 4;
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0.85rem; border-radius: 999px; cursor: pointer;
  border: 0; background: var(--accent); color: var(--accent-ink);
  font: inherit; font-size: 0.78rem; font-weight: 700;
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
}

.chat-typing {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0 clamp(0.75rem, 2.5vw, 1.5rem) 0.35rem;
  font-size: 0.75rem; color: var(--ink-3);
}
.chat-typing-dots { display: inline-flex; gap: 3px; padding: 0.4rem 0.55rem; border-radius: 999px; background: var(--surface-2); }
.chat-typing-dots i {
  width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3);
  animation: chat-dot 1.2s infinite ease-in-out;
}
.chat-typing-dots i:nth-child(2) { animation-delay: .15s; }
.chat-typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }

.chat-locked {
  margin: 0.5rem; padding: 0.8rem 1rem; border-radius: 12px; text-align: center;
  font-size: 0.84rem; color: var(--ink-2); background: var(--surface-2);
}

/* ---- composer ---- */
.chat-compose {
  padding: 0.5rem clamp(0.5rem, 2vw, 1rem) calc(0.6rem + env(safe-area-inset-bottom));
  background: var(--paper);
}
.chat-compose-bar {
  position: relative; display: flex; align-items: flex-end; gap: 0.35rem;
  padding: 0.3rem; border-radius: 24px;
  background: var(--surface-2); border: 1px solid var(--line);
  transition: border-color .12s;
}
.chat-compose-bar:focus-within { border-color: var(--accent); }
.chat-attach { width: 2.2rem; height: 2.2rem; }
.chat-compose-bar .chat-input {
  flex: 1; min-width: 0; min-height: 0; height: auto; resize: none; border: 0; outline: none; box-shadow: none; border-radius: 0;
  background: transparent; color: var(--ink);
  font: inherit; font-size: 0.93rem; line-height: 1.4;
  padding: 0.45rem 0.2rem; max-height: 170px;
}
.chat-compose-bar .chat-input:focus { border: 0; box-shadow: none; outline: none; }
.chat-input::placeholder { color: var(--ink-3); }
.chat-send {
  display: grid; place-items: center; flex: none;
  width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-size: 1rem;
  transition: transform .1s, opacity .12s;
}
.chat-send:hover:not(:disabled) { transform: scale(1.06); }
.chat-send:disabled { opacity: 0.35; cursor: default; }
.chat-counter { font-size: 0.7rem; color: var(--warn); text-align: right; padding: 0.25rem 0.6rem 0; }

.chat-attach-menu {
  position: absolute; left: 0; bottom: calc(100% + 0.4rem); z-index: 6;
  min-width: 190px; padding: 0.3rem; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}
.chat-attach-item {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  padding: 0.55rem 0.7rem; border: 0; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--ink); font: inherit; font-size: 0.86rem; text-align: left;
}
.chat-attach-item:hover, .chat-attach-item:focus-visible { background: var(--surface-2); outline: none; }
.chat-attach-item .svg-ico { color: var(--accent); font-size: 1.05rem; }

.chat-pending { position: relative; display: inline-block; margin: 0 0 0.45rem 0.3rem; }
.chat-pending img { display: block; max-height: 96px; max-width: 160px; border-radius: 12px; border: 1px solid var(--line-2); }
.chat-pending-x {
  position: absolute; top: -0.45rem; right: -0.45rem;
  width: 1.5rem; height: 1.5rem; display: grid; place-items: center;
  border-radius: 50%; border: 2px solid var(--paper); cursor: pointer;
  background: var(--ink); color: var(--paper); font-size: 0.7rem; padding: 0;
}

/* ---- dialogs ---- */
.chat-sheet { z-index: 700; }
.chat-sheet .sheet-card { border-radius: 18px; width: min(440px, 100%); box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6); }
.chat-sheet .sheet-head { background: var(--surface); border-bottom: 0; padding: 1rem 1rem 0.4rem 1.2rem; }
.chat-sheet .sheet-head .btn-sq { width: 2.2rem; min-height: 2.2rem; border-radius: 50%; border: 0; }
.chat-sheet-title { font-size: 1.05rem; }
.chat-sheet .sheet-body { padding: 0.4rem 1.2rem 1.2rem; }
.chat-ask { display: flex; flex-direction: column; gap: 0.8rem; }
.chat-ask-hint { margin: 0; font-size: 0.86rem; }
.chat-ask-input {
  width: 100%; box-sizing: border-box; padding: 0.65rem 0.85rem; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--paper); color: var(--ink);
  font: inherit; font-size: 0.92rem; resize: vertical;
}
.chat-ask-input:focus { outline: none; border-color: var(--accent); }
.chat-ask-row { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.2rem; }
.chat-sheet .btn { border-radius: 999px; }
.chat-group-name { margin-bottom: 0.6rem; }
.chat-pick-list {
  display: flex; flex-direction: column; gap: 2px; margin: 0.6rem 0 0.8rem;
  max-height: min(46dvh, 360px); overflow-y: auto;
}
.chat-pick {
  display: flex; align-items: center; gap: 0.7rem; width: 100%;
  padding: 0.5rem 0.55rem; border: 0; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--ink); font: inherit; text-align: left;
}
.chat-pick:hover { background: var(--surface-2); }
.chat-pick[aria-selected="true"] { background: var(--sel); }
.chat-pick .avatar { width: 2.3rem; height: 2.3rem; }
.chat-pick-names { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-pick-n1 { font-weight: 600; font-size: 0.9rem; }
.chat-pick-n2 { font-size: 0.76rem; color: var(--ink-3); }
.chat-pick-tick {
  width: 1.35rem; height: 1.35rem; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.8rem;
  border: 2px solid var(--line-2); color: transparent;
}
.chat-pick[aria-selected="true"] .chat-pick-tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chat-pick-empty { text-align: center; padding: 1rem; margin: 0; font-size: 0.85rem; }
.chat-pick-go { width: 100%; }

/* ==== floating dock ==== */
.cdock {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 70;
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.7rem;
  pointer-events: none;
}
.cdock > * { pointer-events: auto; }
.cdock-launch {
  position: relative; display: inline-flex; align-items: center; gap: 0.5rem;
  height: 3.2rem; padding: 0 1.25rem 0 1.05rem; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
  font: inherit; font-weight: 750; font-size: 0.92rem;
  box-shadow: 0 10px 28px -8px color-mix(in srgb, var(--accent) 65%, rgba(0,0,0,0.6));
  transition: transform .14s, box-shadow .14s;
}
.cdock-launch:hover { transform: translateY(-2px); }
.cdock-launch:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.cdock-launch-ico { font-size: 1.25rem; }
.cdock.is-open .cdock-launch { width: 3.2rem; padding: 0; justify-content: center; }
.cdock.is-open .cdock-launch-txt { display: none; }
.cdock-badge {
  position: absolute; top: -0.3rem; right: -0.3rem;
  min-width: 1.35rem; height: 1.35rem; padding: 0 0.35rem;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--bad); color: #fff; font-size: 0.7rem; font-weight: 800;
  border: 2px solid var(--paper);
}
.cdock.has-unread .cdock-launch { animation: cdock-nudge 2.4s ease-in-out infinite; }
@keyframes cdock-nudge { 0%, 88%, 100% { transform: none; } 92% { transform: rotate(-6deg); } 96% { transform: rotate(6deg); } }

.cdock-panel {
  display: flex; flex-direction: column; overflow: hidden;
  width: min(390px, calc(100vw - 1.5rem));
  height: min(600px, calc(100dvh - 6.5rem));
  border-radius: 20px; background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 28px 70px -18px rgba(0,0,0,0.6), 0 2px 10px rgba(0,0,0,0.25);
  animation: cdock-in .2s cubic-bezier(.2,.8,.2,1);
  transform-origin: bottom right;
}
@keyframes cdock-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.cdock-head {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.55rem 0.5rem 0.55rem 0.9rem; min-height: 3.4rem;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.cdock-back { margin-left: -0.45rem; }
.cdock-head-av { display: inline-flex; }
.cdock-head-av .avatar { width: 1.9rem; height: 1.9rem; }
.cdock-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: 0.2rem; }
.cdock-title { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cdock-sub { font-size: 0.72rem; color: var(--ink-3); }
.cdock-sub.is-online, .msgs-who-sub.is-online { color: var(--good); }
.cdock-icon {
  display: inline-grid; place-items: center; flex: none;
  width: 2.15rem; height: 2.15rem; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-2); cursor: pointer; font-size: 1.05rem;
}
.cdock-icon:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.cdock-icon.cdock-call { color: var(--good); }
.cdock-listview { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
.cdock-listview .chat-rows { flex: 1; overflow-y: auto; padding: 0.2rem 0.4rem 0.6rem; }
.cdock-tools { display: flex; align-items: center; gap: 0.4rem; padding: 0.6rem 0.7rem 0.4rem; }
.cdock-tools .chat-search { flex: 1; }
.cdock-new { background: var(--sel); color: var(--accent); }
.cdock-new:hover { background: var(--accent); color: var(--accent-ink); }
.cdock-convoview { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cdock-convoview .chat-convo { flex: 1; }
.chat-convo.is-compact .chat-msg { max-width: 84%; }
.chat-convo.is-compact .chat-bubble { font-size: 0.88rem; }
.chat-convo.is-compact .chat-intro { padding: 1rem 0.8rem 0.8rem; }
.chat-convo.is-compact .chat-intro .avatar-lg,
.chat-convo.is-compact .chat-intro .chat-group-av.is-lg { width: 3.4rem; height: 3.4rem; }

/* A live call panel shares the corner: move the dock left of it. */
body:has(.callroot:not([hidden])) .cdock { right: calc(min(340px, 100vw) + 2rem); }
body:has(.callbar.is-expanded:not([hidden])) .cdock { right: calc(min(440px, 100vw) + 2rem); }

@media (max-width: 900px) {
  .cdock { right: 0.8rem; bottom: calc(4.8rem + env(safe-area-inset-bottom)); }
  body:has(.callroot:not([hidden])) .cdock { right: 0.8rem; bottom: 11rem; }
  .cdock-launch { height: 3rem; width: 3rem; padding: 0; justify-content: center; }
  .cdock-launch-txt { display: none; }
}
@media (max-width: 560px) {
  /* Phones: the open dock becomes a full-height sheet. */
  .cdock.is-open { inset: 0; right: 0; bottom: 0; align-items: stretch; gap: 0; z-index: 600; }
  .cdock.is-open .cdock-panel { width: 100%; height: 100%; border-radius: 0; border: 0; }
  .cdock.is-open .cdock-launch { display: none; }
}

/* ==== Messages page ==== */
.messages-page .main { padding-bottom: 1rem; }
.messages-page [data-shell="foot"] { display: none; }
.msgs {
  display: grid; grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
  height: calc(100dvh - 2.5rem); min-height: 480px; margin-top: 1rem;
  border-radius: 20px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 10px 40px -20px rgba(0,0,0,0.45);
}
.msgs-side {
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line); background: var(--surface);
}
.msgs-side-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 1rem 1rem 0.6rem 1.1rem;
}
.msgs-side-head h2 { margin: 0; font-size: 1.35rem; letter-spacing: -0.01em; }
.msgs-new { border-radius: 999px; }
.msgs-search { margin: 0 0.8rem 0.4rem; }
.msgs-status {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem;
  margin: 0.5rem 0.8rem; padding: 0.8rem; border-radius: 12px;
  background: color-mix(in srgb, var(--bad) 10%, var(--surface-2));
  font-size: 0.84rem; color: var(--ink-2);
}
.msgs-rows { flex: 1; overflow-y: auto; padding: 0.2rem 0.5rem 0.8rem; }

.msgs-main { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--paper); }
.msgs-welcome {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.45rem; padding: 2rem; text-align: center; color: var(--ink-2);
}
.msgs-welcome .chat-empty-art { width: 4.4rem; height: 4.4rem; font-size: 2rem; }
.msgs-welcome strong { font-size: 1.25rem; color: var(--ink); }
.msgs-welcome p { margin: 0 0 0.6rem; }
.msgs-welcome .btn { border-radius: 999px; }
.msgs-open { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.msgs-head {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.8rem; min-height: 3.9rem;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.msgs-back { display: none; }
.msgs-who {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.7rem;
  color: var(--ink); padding: 0.25rem 0.4rem; border-radius: 12px;
}
a.msgs-who:hover { background: var(--surface-2); text-decoration: none; }
.msgs-who .avatar { width: 2.4rem; height: 2.4rem; }
.msgs-who-names { min-width: 0; display: flex; flex-direction: column; }
.msgs-who-names strong { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msgs-who-sub { font-size: 0.76rem; color: var(--ink-3); }
.msgs-head-acts { display: flex; gap: 0.15rem; }
.msgs-body { flex: 1; min-height: 0; display: flex; }
.msgs-convo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msgs-convo .chat-convo { flex: 1; }

.msgs-info {
  position: relative; width: 290px; flex: none; overflow-y: auto;
  border-left: 1px solid var(--line); background: var(--surface);
  padding: 1.4rem 1rem 1rem;
}
.msgs-info-x { position: absolute; top: 0.5rem; right: 0.5rem; }
.msgs-info-top { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; text-align: center; margin-bottom: 1rem; }
.msgs-info-top .avatar-lg, .msgs-info-top .chat-group-av { margin-bottom: 0.4rem; }
.msgs-info-top strong { font-size: 1.05rem; }
.msgs-info-acts { display: flex; flex-direction: column; gap: 2px; margin-bottom: 1rem; }
.msgs-info-act {
  display: flex; align-items: center; gap: 0.7rem; width: 100%;
  padding: 0.6rem 0.7rem; border: 0; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--ink); font: inherit; font-size: 0.88rem; text-align: left;
}
.msgs-info-act:hover { background: var(--surface-2); text-decoration: none; }
.msgs-info-act .svg-ico { color: var(--ink-2); font-size: 1.05rem; }
.msgs-info-act.is-danger, .msgs-info-act.is-danger .svg-ico { color: var(--bad); }
.msgs-info-label { display: block; margin: 0.4rem 0.3rem 0.5rem; }
.msgs-members { display: flex; flex-direction: column; gap: 2px; }
.msgs-member { display: flex; align-items: center; gap: 0.3rem; padding: 0.15rem; border-radius: 10px; }
.msgs-member:hover { background: var(--surface-2); }
.msgs-member-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.6rem; color: var(--ink); padding: 0.3rem 0.4rem; }
.msgs-member-link:hover { text-decoration: none; }
.msgs-member > .avatar { margin: 0.3rem 0.1rem 0.3rem 0.4rem; }
.msgs-member-name { font-size: 0.87rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msgs-member-x { width: 1.9rem; height: 1.9rem; font-size: 0.85rem; }
.msgs-member-x:hover { color: var(--bad); }

@media (max-width: 1100px) {
  .msgs-info { position: absolute; right: 0; top: 0; bottom: 0; z-index: 6; box-shadow: -12px 0 40px rgba(0,0,0,0.35); }
  .msgs-main { overflow: hidden; }
}
@media (max-width: 900px) {
  .msgs { height: calc(100dvh - 3.5rem - 5.2rem - 1rem); margin-top: 0.5rem; }
}
@media (max-width: 760px) {
  .messages-page .main { padding-left: 0; padding-right: 0; }
  .msgs {
    grid-template-columns: 1fr; position: relative;
    border-radius: 0; border-left: 0; border-right: 0; margin-top: 0;
    height: calc(100dvh - 3.5rem - 5.2rem);
  }
  .msgs-side { border-right: 0; }
  .msgs-main {
    position: absolute; inset: 0; z-index: 3;
    transform: translateX(100%); visibility: hidden;
    transition: transform .22s cubic-bezier(.2,.8,.2,1), visibility 0s linear .22s;
  }
  .msgs.is-viewing .msgs-main { transform: none; visibility: visible; transition: transform .22s cubic-bezier(.2,.8,.2,1); }
  .msgs.is-viewing .msgs-side { visibility: hidden; }
  .msgs-back { display: inline-grid; margin-left: -0.3rem; }
  .msgs-welcome { display: none; }
  .msgs-info { width: 100%; }
  .chat-msg { max-width: 86%; }
}
@media (prefers-reduced-motion: reduce) {
  .cdock-panel, .cdock.has-unread .cdock-launch, .chat-skel, .chat-typing-dots i { animation: none; }
  .msgs-main { transition: none !important; }
}

/* ==========================================================================
   41 · CAMPUS+ — watch page, queue, playlists
   ========================================================================== */
.cp-hero { padding: clamp(1.4rem, 4vw, 2.6rem) 0 1.2rem; }
.cp-hero h1 { margin: 0.35rem 0 0.5rem; font-size: clamp(1.7rem, 3.6vw, 2.5rem); letter-spacing: -0.02em; line-height: 1.1; }
.cp-hero p { margin: 0; max-width: 58ch; color: var(--ink-2); }
.cp-member {
  display: inline-flex; margin-top: 0.8rem !important; padding: 0.3rem 0.75rem; border-radius: 999px;
  background: var(--sel); color: var(--accent) !important; font-size: 0.8rem; font-weight: 700;
}
.cp-locked {
  max-width: 34rem; margin: 1rem auto 3rem; padding: 2.4rem 1.6rem; text-align: center;
  border-radius: 20px; background: var(--surface); border: 1px solid var(--line);
}
.cp-locked-ico {
  display: inline-grid; place-items: center; width: 4rem; height: 4rem; border-radius: 50%;
  background: var(--sel); color: var(--accent); font-size: 2.2rem; font-weight: 800; margin-bottom: 0.8rem;
}
.cp-locked h2 { margin: 0 0 0.5rem; }
.cp-locked p { margin: 0 auto 1.1rem; max-width: 30rem; color: var(--ink-2); }

.cp-paste {
  display: flex; gap: 0.5rem; padding: 0.4rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: 0 10px 30px -18px rgba(0,0,0,0.5);
  transition: border-color .12s, box-shadow .12s;
}
.cp-paste:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--sel); }
.cp-paste input, .cp-paste input:focus {
  flex: 1; min-width: 0; border: 0; background: transparent; box-shadow: none;
  padding: 0 1rem; font-size: 1rem; min-height: 2.9rem;
}
.cp-paste .btn { border-radius: 999px; padding-left: 1.5rem; padding-right: 1.5rem; }
.cp-note { min-height: 1.2rem; margin: 0.45rem 1rem 0.6rem; font-size: 0.8rem; color: var(--ink-3); }
.cp-note.is-bad { color: var(--warn); }

.cp-stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; margin: 0.4rem 0 2rem; }
.cp-stage.has-queue { grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); }
.cp-screen { min-width: 0; }
.cp-frame {
  position: relative; aspect-ratio: 16 / 9; width: 100%; overflow: hidden;
  border-radius: 18px; background: #000; box-shadow: 0 24px 60px -30px rgba(0,0,0,0.8);
}
.cp-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cp-now { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.8rem; padding: 0.9rem 0.2rem 0; }
.cp-now-text { min-width: 0; flex: 1 1 18rem; display: flex; flex-direction: column; gap: 0.15rem; }
.cp-now-text strong { font-size: 1.1rem; line-height: 1.3; }
.cp-now-text span { font-size: 0.85rem; }
.cp-now-acts { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.cp-now-acts .btn, .cp-detail .btn-row .btn { border-radius: 999px; display: inline-flex; align-items: center; gap: 0.35rem; }
.cp-now-acts .btn .svg-ico, .cp-detail .btn-row .btn .svg-ico { margin: 0; }

.cp-queue {
  display: flex; flex-direction: column; min-height: 0; max-height: min(70vh, 560px);
  border-radius: 18px; background: var(--surface); border: 1px solid var(--line); overflow: hidden;
}
.cp-queue-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.8rem 0.6rem 0.6rem 1rem; border-bottom: 1px solid var(--line); }
.cp-queue-title { display: flex; flex-direction: column; min-width: 0; }
.cp-queue-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-queue-title span { font-size: 0.75rem; }
.cp-queue-ctl { display: flex; }
.cp-queue-ctl .is-next .svg-ico { transform: rotate(-90deg); }
.cp-queue-ctl button:disabled { opacity: 0.35; cursor: default; }
.cp-queue-list { list-style: none; margin: 0; padding: 0.35rem; overflow-y: auto; }
.cp-qitem {
  display: flex; align-items: center; gap: 0.65rem; width: 100%;
  padding: 0.4rem; border: 0; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--ink); font: inherit; text-align: left;
}
.cp-qitem:hover { background: var(--surface-2); }
.cp-qitem.is-now { background: var(--sel); }
.cp-qitem img { width: 6.2rem; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface-3); }
.cp-qitem-title { font-size: 0.83rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cp-qitem.is-now .cp-qitem-title { font-weight: 700; color: var(--accent); }

.cp-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0.6rem 0 1rem; }
.cp-tabs .fill { flex: 1; }
.cp-tablist { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.cp-tab {
  padding: 0.5rem 1rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2);
  font: inherit; font-size: 0.86rem; font-weight: 650;
}
.cp-tab:hover { color: var(--ink); border-color: var(--ink-3); }
.cp-tab[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.cp-tabs .btn { border-radius: 999px; }
.cp-search { margin-bottom: 1rem; max-width: 26rem; }
.cp-search input { border-radius: 999px; padding-left: 1rem; }

.cp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1.1rem 1rem; margin-bottom: 2.5rem; }
.cp-grid[aria-busy="true"] { min-height: 8rem; opacity: 0.6; }
.cp-card {
  display: flex; flex-direction: column; gap: 0.2rem; padding: 0; border: 0; cursor: pointer;
  background: transparent; color: var(--ink); font: inherit; text-align: left;
}
.cp-card-art {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; width: 100%;
  border-radius: 14px; overflow: hidden; background: var(--surface-2); margin-bottom: 0.4rem;
  transition: transform .15s, box-shadow .15s;
}
.cp-card-art img { width: 100%; height: 100%; object-fit: cover; }
.cp-card-art.is-empty { color: var(--ink-3); font-size: 2rem; }
.cp-card:hover .cp-card-art, .cp-card:focus-visible .cp-card-art { transform: translateY(-3px); box-shadow: 0 16px 30px -18px rgba(0,0,0,0.7); }
.cp-card:focus-visible { outline: none; }
.cp-card:focus-visible .cp-card-art { outline: 2px solid var(--accent); outline-offset: 2px; }
.cp-card-badge {
  position: absolute; right: 0.5rem; bottom: 0.5rem; padding: 0.15rem 0.5rem; border-radius: 6px;
  background: rgba(0,0,0,0.75); color: #fff; font-size: 0.72rem; font-weight: 700;
}
.cp-card-title { font-weight: 650; font-size: 0.92rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cp-card-sub { font-size: 0.78rem; color: var(--ink-3); }
.cp-empty {
  grid-column: 1 / -1; padding: 2.4rem 1rem; text-align: center; color: var(--ink-2);
  border: 1px dashed var(--line-2); border-radius: 18px;
}
.cp-empty strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: 0.3rem; }
.cp-empty p { margin: 0 0 0.9rem; font-size: 0.88rem; }
.cp-empty .btn { border-radius: 999px; }
.cp-clear { grid-column: 1 / -1; justify-self: start; }

.cp-detail { margin-bottom: 2.5rem; }
.cp-back { display: inline-flex; align-items: center; gap: 0.35rem; border-radius: 999px; margin-bottom: 0.9rem; }
.cp-back .svg-ico { margin: 0; }
.cp-detail-head { display: flex; flex-wrap: wrap; gap: 1.3rem; align-items: flex-end; margin-bottom: 1.3rem; }
.cp-detail-art {
  width: min(320px, 100%); aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; flex: none;
  display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); font-size: 2.4rem;
}
.cp-detail-art img { width: 100%; height: 100%; object-fit: cover; }
.cp-detail-info { flex: 1 1 18rem; min-width: 0; }
.cp-detail-info h2 { margin: 0.25rem 0 0.3rem; font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -0.015em; }
.cp-detail-info p { margin: 0 0 0.9rem; }
.cp-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cp-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.4rem; border-radius: 12px; }
.cp-item:hover { background: var(--surface); }
.cp-item-n { width: 1.6rem; text-align: center; flex: none; font-size: 0.8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cp-item-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.8rem; padding: 0.25rem;
  border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; border-radius: 10px;
}
.cp-item-main img { width: 7.5rem; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface-2); }
.cp-item-title { font-size: 0.9rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cp-item-tools { display: flex; flex: none; opacity: 0.55; transition: opacity .12s; }
.cp-item:hover .cp-item-tools, .cp-item:focus-within .cp-item-tools { opacity: 1; }
.cp-item-tools .is-up .svg-ico { transform: rotate(90deg); }
.cp-item-tools .is-down .svg-ico { transform: rotate(-90deg); }
.cp-item-tools button:disabled { opacity: 0.3; cursor: default; }

.cp-save-list { display: flex; flex-direction: column; gap: 2px; margin: 0.2rem 0 0.9rem; max-height: 50dvh; overflow-y: auto; }
.cp-save-row {
  display: flex; align-items: center; gap: 0.75rem; width: 100%; padding: 0.55rem; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.cp-save-row:hover { background: var(--surface-2); }
.cp-save-art { width: 2.6rem; height: 2.6rem; border-radius: 10px; display: grid; place-items: center; background: var(--sel); color: var(--accent); flex: none; }
.cp-save-names { display: flex; flex-direction: column; min-width: 0; }
.cp-save-names span { font-size: 0.78rem; }
.cp-save-new { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; }
.cp-save-new .svg-ico { margin: 0; }

@media (max-width: 900px) {
  .cp-stage.has-queue { grid-template-columns: minmax(0, 1fr); }
  .cp-queue { max-height: 360px; }
}
@media (max-width: 560px) {
  .cp-paste { border-radius: 16px; flex-direction: column; }
  .cp-paste .btn { width: 100%; }
  .cp-frame { border-radius: 12px; margin: 0 calc(var(--gutter) * -1); width: calc(100% + var(--gutter) * 2); border-radius: 0; }
  .cp-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .cp-item-main img { width: 5.5rem; }
  .cp-item-n { display: none; }
}

/* ========================================================================== 42 · CONSISTENCY PASS — one corner… */
.panel, .void, .people, .rows, .sheet-card, .code-card, .opt-group { border-radius: var(--r); }
.people, .rows { overflow: hidden; }
.sheet-card { box-shadow: 0 30px 80px -24px rgba(0,0,0,0.6); }
.toast { border-radius: 999px; font-family: var(--font); font-size: 0.86rem; letter-spacing: 0; padding: 0.6rem 1.1rem; box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5); }

/* ==========================================================================
   43 · RANK TAGS — Owner / Admin / Mod / Campus+ beside a name
   ========================================================================== */
.utag {
  display: inline-flex; align-items: center; gap: 0.25rem; flex: none;
  margin-left: 0.4rem; padding: 0.12rem 0.45rem 0.12rem 0.35rem;
  border-radius: 999px; vertical-align: middle;
  font-family: var(--font); font-size: 0.66rem; font-weight: 800; line-height: 1.2;
  letter-spacing: 0.02em; text-transform: none; white-space: nowrap;
  color: var(--tag-ink); background: color-mix(in srgb, var(--tag-ink) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--tag-ink) 35%, transparent);
}
.utag + .utag { margin-left: 0.25rem; }
.utag .svg-ico { font-size: 0.8rem; margin: 0; }
.utag.is-owner { --tag-ink: #f5b93a; }
.utag.is-admin { --tag-ink: #ff6b81; }
.utag.is-mod   { --tag-ink: #3ddc97; }
.utag.is-plus  { --tag-ink: var(--accent); }
.utag.is-bad   { --tag-ink: var(--bad); }
html[data-skin="paper"] .utag.is-owner, html[data-skin="linen"] .utag.is-owner { --tag-ink: #a86b00; }
html[data-skin="paper"] .utag.is-mod, html[data-skin="linen"] .utag.is-mod { --tag-ink: #0f8a5f; }
html[data-skin="paper"] .utag.is-admin, html[data-skin="linen"] .utag.is-admin { --tag-ink: #c42a45; }
/* Icon-only form in tight spots (lists, headers). */
.utag:not(:has(.utag-l)) { padding: 0.15rem; margin-left: 0.3rem; }
.utag:not(:has(.utag-l)) .svg-ico { font-size: 0.72rem; }

/* Profile header: tags ride on the name line, sized to match. */
.profile-name-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.3rem; }
.profile-name-line h1 { margin: 0; }
.profile-name-line .utag { font-size: 0.78rem; padding: 0.22rem 0.65rem 0.22rem 0.5rem; margin-left: 0.2rem; }
.profile-name-line .utag .svg-ico { font-size: 0.92rem; }

.chat-row-name { display: flex; align-items: center; }
.chat-row-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chat-pick-n1, .msgs-member-name, .msgs-who-name, .cdock-title { display: inline-flex; align-items: center; }

/* ==========================================================================
   44 · SETTINGS — side menu + one pane at a time
   ========================================================================== */
.set-head { padding: clamp(1.4rem, 4vw, 2.4rem) 0 1.2rem; }
.set-head h1 { margin: 0 0 0.3rem; font-size: clamp(1.8rem, 3.6vw, 2.4rem); letter-spacing: -0.02em; }
.set-head p { margin: 0; }
.set-callout {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.3rem; margin-bottom: 1.4rem; border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
}
.set-callout > div:first-child { flex: 1 1 22rem; }
.set-callout strong { font-size: 1rem; }
.set-callout p { margin: 0.25rem 0 0; color: var(--ink-2); font-size: 0.88rem; }
.set-callout .btn { border-radius: 999px; }

.set { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 2rem; align-items: start; margin-bottom: 3rem; }
.set-nav { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 2px; }
.set-me {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.75rem; margin-bottom: 0.6rem;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
}
.set-me .avatar { width: 2.6rem; height: 2.6rem; }
.set-me-names { min-width: 0; display: flex; flex-direction: column; }
.set-me-names strong { display: flex; align-items: center; font-size: 0.92rem; white-space: nowrap; }
.set-me-names span { font-size: 0.74rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-link {
  display: flex; align-items: center; width: 100%; padding: 0.6rem 0.85rem; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink-2); font: inherit; font-size: 0.9rem; font-weight: 600; text-align: left; cursor: pointer;
  transition: background .12s, color .12s;
}
.set-link:hover { background: var(--surface); color: var(--ink); }
.set-link.is-active { background: var(--sel); color: var(--accent); }
.set-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.set-pane h2 { margin: 0 0 0.25rem; font-size: 1.45rem; letter-spacing: -0.01em; }
.set-pane h2:focus { outline: none; }
.set-sub { margin: 0 0 1.2rem; color: var(--ink-2); font-size: 0.9rem; }
.set-card {
  padding: 1.15rem 1.25rem; margin-bottom: 1rem; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 0.75rem;
}
.set-card.is-danger { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.set-card.is-danger .set-card-title { color: var(--bad); }
.set-card-title { font-size: 1rem; }
.set-card > .set-hint:first-of-type { margin-top: -0.4rem; }
.set-hint { display: block; margin: 0; font-size: 0.8rem; color: var(--ink-3); line-height: 1.45; }
.set-hint.is-warn { color: var(--warn); }
.set-hint:empty { display: none; }
.set-rows { gap: 0; padding-top: 0.3rem; padding-bottom: 0.3rem; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 0; }
.set-rows .set-row + .set-row { border-top: 1px solid var(--line); }
.set-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.set-text strong { font-size: 0.93rem; }
.set-row > .toggle, .set-row > .set-seg, .set-row > .set-select, .set-row > .combo-picker, .set-row > .btn, .set-row > .set-pill { flex: none; }

.set-field { display: flex; flex-direction: column; gap: 0.35rem; }
.set-field label { font-size: 0.84rem; font-weight: 700; }
.set-field input, .set-field textarea { border-radius: 10px; }
.set-count { text-align: right; }
.set-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.set-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; }
.set-card .btn { border-radius: 999px; }
.set-code { width: 8.5rem !important; letter-spacing: 0.35rem; text-align: center; font-family: var(--mono); }
.set-delete { display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; }
.set-delete .set-field { width: min(22rem, 100%); }

.set-pfp { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.set-pfp .avatar-lg { width: 5rem; height: 5rem; }
.set-pfp > div { display: flex; flex-direction: column; gap: 0.45rem; }

.set-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.set-seg button {
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  font: inherit; font-size: 0.82rem; font-weight: 650; padding: 0.35rem 0.85rem; border-radius: 999px;
}
.set-seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.set-select { width: auto !important; min-height: 2.3rem !important; border-radius: 10px; padding-right: 2rem; }

.set-pill { font-size: 0.72rem; font-weight: 800; padding: 0.2rem 0.6rem; border-radius: 999px; }
.set-pill.is-good { color: var(--good); background: color-mix(in srgb, var(--good) 15%, transparent); }
.set-pill.is-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }

.set-list { display: flex; flex-direction: column; gap: 2px; }
.set-list:empty { display: none; }
.set-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.4rem; border-radius: 10px; }
.set-item:hover { background: var(--surface-2); }
.set-item-ico { width: 2rem; height: 2rem; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); }
.set-item.is-good .set-item-ico { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.set-item.is-bad .set-item-ico { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.set-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-item-text strong { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-item-text span { font-size: 0.76rem; color: var(--ink-3); }
.set-item.is-bad .set-item-text span { color: var(--bad); }
.set-links { gap: 0; padding: 0.4rem; }
.set-links a { padding: 0.65rem 0.8rem; border-radius: 10px; color: var(--ink); font-weight: 600; font-size: 0.9rem; }
.set-links a:hover { background: var(--surface-2); text-decoration: none; }
.set-links a::after { content: " →"; color: var(--ink-3); }
.set-auto-note { display: none; }

@media (max-width: 760px) {
  .set { grid-template-columns: 1fr; gap: 1rem; }
  .set-nav {
    position: sticky; top: 3.5rem; z-index: 5; flex-direction: row; overflow-x: auto; gap: 0.35rem;
    margin: 0 calc(var(--gutter) * -1); padding: 0.5rem var(--gutter); background: var(--paper);
    scrollbar-width: none;
  }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-me { display: none; }
  .set-link { width: auto; flex: none; white-space: nowrap; border: 1px solid var(--line-2); border-radius: 999px; padding: 0.45rem 0.9rem; font-size: 0.84rem; }
  .set-link.is-active { border-color: var(--accent); }
  .set-grid2 { grid-template-columns: 1fr; }
  .set-row { align-items: flex-start; }
  .set-card { padding: 1rem; }
}
/* Pill switch: filled track when on, round knob, visible keyboard focus. */
.toggle { width: 2.75rem; height: 1.55rem; }
.toggle i { border-radius: 999px; background: var(--surface-3); border-color: transparent; transition: background .15s; }
.toggle i::after { top: 3px; left: 3px; width: calc(1.55rem - 6px); height: calc(1.55rem - 6px); border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.toggle input:checked + i { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + i::after { background: #fff; transform: translateX(1.2rem); }
.toggle input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle input:disabled + i { opacity: 0.45; }

/* ==========================================================================
   45 · CALLS — floating call card, video stage, incoming-call card
   ========================================================================== */
.callroot {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 80;
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.7rem;
}
.callroot[hidden] { display: none; }

/* ---- incoming ---- */
.ring {
  width: min(320px, calc(100vw - 1.6rem));
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.35rem;
  padding: 1.4rem 1.2rem 1.1rem; border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line-2);
  box-shadow: 0 30px 70px -20px rgba(0,0,0,0.7);
  backdrop-filter: blur(14px);
  animation: ring-in .28s cubic-bezier(.2,.9,.2,1.2);
}
@keyframes ring-in { from { opacity: 0; transform: translateY(16px) scale(.94); } }
.ring-face { position: relative; margin-bottom: 0.4rem; }
.ring-face .avatar, .ring-face > svg { width: 4.6rem; height: 4.6rem; border-radius: 50%; }
.ring-face::before, .ring-face::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--good); animation: ring-pulse 1.8s ease-out infinite; pointer-events: none;
}
.ring-face::after { animation-delay: .9s; }
@keyframes ring-pulse { from { transform: scale(1); opacity: .8; } to { transform: scale(1.6); opacity: 0; } }
.ring-text { display: flex; flex-direction: column; gap: 0.1rem; }
.ring-text strong { font-size: 1.15rem; }
.ring-kind { font-size: 0.82rem; color: var(--ink-3); }
.ring-acts { display: flex; justify-content: center; gap: 1.4rem; margin-top: 0.9rem; }
.ring-act { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; font-size: 0.72rem; color: var(--ink-2); font-weight: 600; }
.ring-btn {
  width: 3.4rem; height: 3.4rem; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; font-size: 1.35rem; color: #fff;
  transition: transform .12s, filter .12s;
}
.ring-btn:hover { transform: scale(1.07); filter: brightness(1.08); }
.ring-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 3px; }
.ring-answer { background: #22c55e; animation: ring-bob 1.2s ease-in-out infinite; }
.ring-decline { background: #ef4444; }
.ring-decline .svg-ico { transform: rotate(135deg); }
.ring-audio { background: var(--surface-3); color: var(--ink); }
@keyframes ring-bob { 50% { transform: translateY(-3px); } }

/* ---- live call card ---- */
.callbar {
  width: min(340px, calc(100vw - 1.6rem));
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 22px; color: #f4f6fb;
  background: linear-gradient(160deg, #1b2230, #11151d);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 28px 70px -22px rgba(0,0,0,0.75);
  animation: ring-in .22s ease-out;
}
.callbar[hidden] { display: none; }
.callbar-head { display: flex; align-items: center; gap: 0.65rem; padding: 0.75rem 0.6rem 0.4rem 0.85rem; }
.callbar-who { display: flex; flex: none; }
.callbar-face { display: inline-flex; border-radius: 50%; box-shadow: 0 0 0 2px #151a24; }
.callbar-face + .callbar-face { margin-left: -0.7rem; }
.callbar-face .avatar, .callbar-face > svg { width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 0; }
.callbar-face .avatar .dot { display: none; }
.callbar-face.is-empty { width: 2.4rem; height: 2.4rem; background: rgba(255,255,255,0.1); }
.callbar-headtext { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.callbar-title { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.callbar-line { font-size: 0.75rem; color: #9aa6b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.callbar-btn {
  width: 2.1rem; height: 2.1rem; flex: none; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: #c5cedb; font-size: 1rem;
}
.callbar-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.callbar-big { display: none; }
.callbar.is-expanded .callbar-big { display: grid; }

.calltiles { display: none; gap: 6px; padding: 0 0.6rem; }
.callbar.is-expanded .calltiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.calltile {
  position: relative; aspect-ratio: 16 / 10; border-radius: 14px; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #2a3547, #161b25);
  display: grid; place-items: center;
}
.calltile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; background: #000; }
.calltile.has-video video { display: block; }
.calltile.is-screen video { object-fit: contain; }
.calltile.has-video .calltile-face { display: none; }
.calltile audio { display: none; }
.calltile-face .avatar, .calltile-face > svg { width: 3.4rem; height: 3.4rem; border-radius: 50%; border: 0; }
.calltile-face .avatar .dot { display: none; }
.calltile-name {
  position: absolute; left: 0.45rem; bottom: 0.45rem; max-width: calc(100% - 0.9rem);
  padding: 0.12rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 700;
  background: rgba(0,0,0,0.55); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.calltile.is-failed::after {
  content: "Connection lost"; position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,0.55); color: #ffb4b4; font-size: 0.78rem; font-weight: 700;
}

.callbar-deck { display: flex; justify-content: center; gap: 0.55rem; padding: 0.55rem 0.7rem 0.8rem; }
.callbtn {
  position: relative; display: grid; place-items: center; width: 2.9rem; height: 2.9rem; flex: none;
  border: 0; border-radius: 50%; cursor: pointer; font-size: 1.15rem;
  background: rgba(255,255,255,0.1); color: #fff;
  transition: background .12s, transform .1s;
}
.callbtn:hover { background: rgba(255,255,255,0.18); }
.callbtn:active { transform: scale(.95); }
.callbtn:focus-visible { outline: 2px solid #8fb4ff; outline-offset: 2px; }
.callbtn-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.callbtn.is-on { background: #fff; color: #11151d; }
.callbtn[data-act="mute"].is-on { background: #ef4444; color: #fff; }
.callbtn.is-end { width: auto; padding: 0 1.2rem; border-radius: 999px; background: #ef4444; display: inline-flex; gap: 0.4rem; }
.callbtn.is-end .callbtn-lbl { position: static; width: auto; height: auto; clip: auto; font-size: 0.85rem; font-weight: 800; }
.callbtn.is-end .svg-ico { transform: rotate(135deg); }
.callbtn.is-end:hover { background: #dc2626; }
.callbtn-secondary { display: none; }
.callbar.is-expanded .callbtn-secondary { display: grid; }

/* Expanded: a wider card with room for video. */
.callbar.is-expanded { width: min(440px, calc(100vw - 1.6rem)); }

/* Big: fills the screen, video first. */
.callroot.is-big { inset: 0; right: 0; bottom: 0; align-items: stretch; background: rgba(5,7,12,0.92); padding: 1rem; }
.callroot.is-big .callbar { width: 100%; height: 100%; border-radius: 20px; }
.callroot.is-big .calltiles { flex: 1; min-height: 0; align-content: center; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); padding: 0 1rem; }
.callroot.is-big .calltile { max-height: 100%; }
.callroot.is-big .callbar-deck { padding: 1rem; gap: 0.8rem; }
.callroot.is-big .callbtn { width: 3.4rem; height: 3.4rem; font-size: 1.3rem; }
.callroot.is-big .callbar-big .svg-ico { transform: rotate(180deg); }

@media (max-width: 900px) {
  .callroot { right: 0.75rem; left: 0.75rem; bottom: calc(4.8rem + env(safe-area-inset-bottom)); align-items: stretch; }
  .callbar, .callbar.is-expanded, .ring { width: 100%; }
  .callroot.is-big { left: 0; bottom: 0; padding: 0; }
  .callroot.is-big .callbar { border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ring, .callbar, .ring-answer, .ring-face::before, .ring-face::after { animation: none; }
}
/* Pin the avatar boxes so the pulse rings and faces can't stretch to the card. */
.ring-face { width: 4.6rem; height: 4.6rem; flex: none; }
.ring-face > *, .ring-face svg { width: 100% !important; height: 100% !important; }
.calltile-face { width: 3.4rem; height: 3.4rem; }
.calltile-face > *, .calltile-face svg { width: 100% !important; height: 100% !important; }
.callbar-face { width: 2.4rem; height: 2.4rem; }
.callbar-face > *, .callbar-face svg { width: 100% !important; height: 100% !important; }
.ring-face svg, .calltile-face svg, .callbar-face svg { border-radius: 50%; }
.ring-face > *, .calltile-face > *, .callbar-face > * { display: block; }
.callroot.is-big .callbtn.is-end { width: auto; padding: 0 1.5rem; }
.callroot.is-big .calltile-face { width: 6rem; height: 6rem; }

/* ==========================================================================
   46 · ADMIN CONSOLE — grouped menu, top bar, people list
   ========================================================================== */
.admin-shell { grid-template-columns: 14.5rem minmax(0, 1fr); gap: 2rem; padding-top: 1.4rem; }
.admin-nav { top: 1rem; border-radius: 16px; padding: 0.6rem; gap: 1px; max-height: calc(100dvh - 2rem); overflow-y: auto; }
.admin-nav-label {
  display: block; padding: 0.8rem 0.65rem 0.3rem; font-size: 0.66rem; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
}
.admin-nav-label:first-child { padding-top: 0.3rem; }
.admin-nav-link { border-left: 0; border-radius: 10px; padding: 0.5rem 0.65rem; font-size: 0.87rem; gap: 0.65rem; }
.admin-nav-link.on { background: var(--sel); color: var(--accent); }
.admin-nav-link .svg-ico.ico { width: 1.1rem; font-size: 1.05rem; color: var(--ink-3); }
.admin-nav-link.on .svg-ico.ico, .admin-nav-link:hover .svg-ico.ico { color: inherit; }
.admin-nav-n {
  border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-family: var(--font); font-weight: 800; font-size: 0.68rem; padding: 0.15rem 0.45rem;
}
.admin-nav-link[data-tab="reports"] .admin-nav-n { background: var(--bad); color: #fff; }
.admin-nav-foot { border-top: 1px solid var(--line); margin-top: 0.5rem; padding-top: 0.6rem; }
.admin-nav-foot .btn { border-radius: 999px; }

.admin-topbar { align-items: center; padding-bottom: 1.1rem; margin-bottom: 1.4rem; }
.admin-title { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem 1rem; }
.admin-title h1 { margin: 0; font-size: clamp(1.7rem, 3.2vw, 2.2rem); letter-spacing: -0.02em; }
.admin-you {
  display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.25rem 0.6rem 0.25rem 0.3rem;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 0.84rem; font-weight: 600;
}
.admin-you:empty { display: none; }
.admin-you .avatar { width: 1.6rem; height: 1.6rem; }
.admin-you .avatar .dot { display: none; }
.admin-stats { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.admin-stat {
  padding: 0.35rem 0.8rem; border-radius: 999px; font-size: 0.8rem; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line);
}
.admin-stat b { color: var(--good); }
.admin-stat.is-warn b { color: var(--bad); }

/* Metric tiles: rounded cards with a gap rather than one hairline sheet. */
#console .metrics { gap: 0.7rem; background: transparent; border: 0; }
#console .metric { border-radius: 14px; border: 1px solid var(--line); }
#console .metric b { font-family: var(--font); }
#console .metric span { font-family: var(--font); letter-spacing: 0; text-transform: none; font-size: 0.78rem; }
#console button.metric { cursor: pointer; text-align: left; transition: border-color .12s, transform .12s; }
#console button.metric:hover { border-color: var(--accent); transform: translateY(-2px); }
#console .block-head h2 { font-size: 1.15rem; }
.admin-ann-row { gap: 0.5rem; align-items: center; }
.admin-ann-row select { width: auto; min-height: 2.3rem; border-radius: 10px; }
.admin-ann .btn { border-radius: 999px; }

/* People list: adapts to whatever width the pane leaves it. */
#user-rows { display: flex; flex-direction: column; gap: 2px; padding: 0.35rem; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.admin-urow {
  display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 0.65rem; border-radius: 12px; cursor: pointer;
  transition: background .12s;
}
.admin-urow:hover { background: var(--surface-2); }
.admin-urow.is-on { background: var(--sel); }
.admin-urow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.admin-urow-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.7rem; color: var(--ink); }
.admin-urow-who:hover { text-decoration: none; }
.admin-urow-who .avatar { width: 2.4rem; height: 2.4rem; }
.admin-urow-names { min-width: 0; display: flex; flex-direction: column; }
.admin-urow-n1 { display: flex; align-items: center; min-width: 0; }
.admin-urow-name { font-weight: 700; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-urow-n2 { font-size: 0.76rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-urow-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; flex: none; }
.admin-urow-stats { font-size: 0.72rem; color: var(--ink-3); white-space: nowrap; }
.admin-urow-stats.is-bad { color: var(--bad); }
.admin-urow .admin-acts { flex: none; color: var(--ink-3); font-size: 0.75rem; }
.admin-chev { transform: rotate(180deg); }
.admin-pill {
  font-size: 0.7rem; font-weight: 800; padding: 0.15rem 0.55rem; border-radius: 999px; text-transform: capitalize;
}
.admin-pill.is-good { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.admin-pill.is-bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.admin-empty { padding: 1.5rem; text-align: center; margin: 0; }
.admin-detail-head { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.9rem; }
.admin-detail-head > div { min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.admin-detail-head strong { display: flex; flex-wrap: wrap; align-items: center; font-size: 1.1rem; }
.admin-detail-head .dim { font-size: 0.8rem; overflow-wrap: anywhere; }
#user-detail { border-radius: 16px; }

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; padding-top: 0.6rem; }
  .admin-nav { max-height: none; flex-direction: row; border-radius: 14px; }
  .admin-nav-label { display: none; }
  .admin-nav-link { width: auto; flex: none; }
  .admin-urow-stats { display: none; }
}
#console .report, #console .panel, #console .ticket, #console .fb { border-radius: 14px; }
#console .report .btn, #console .panel .btn { border-radius: 999px; }

/* Call entries in a conversation's history. */
.chat-call {
  align-self: center; display: inline-flex; align-items: center; gap: 0.5rem;
  margin: 0.7rem 0 0.3rem; padding: 0.4rem 0.8rem 0.4rem 0.45rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 0.8rem; color: var(--ink-2);
  max-width: 100%;
}
.chat-call-ico {
  width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good);
}
.chat-call-text { font-weight: 650; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-call-time { font-size: 0.7rem; color: var(--ink-3); }
.chat-call.is-missed .chat-call-ico { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.chat-call.is-missed .chat-call-text { color: var(--bad); }
.chat-call.is-none .chat-call-ico { background: var(--surface-3); color: var(--ink-3); }
.chat-call.is-live { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.chat-call.is-live .chat-call-ico { animation: chat-call-pulse 1.6s ease-in-out infinite; }
@keyframes chat-call-pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--good) 20%, transparent); } }
@media (prefers-reduced-motion: reduce) { .chat-call.is-live .chat-call-ico { animation: none; } }

/* ==========================================================================
   47 · CAMPUS+ MOD MENU
   ========================================================================== */
.mod-btn { display: inline-flex; align-items: center; gap: 0.35rem; }
.mod-btn .svg-ico { margin: 0; color: var(--accent); }
.mod-btn.is-locked { opacity: 0.6; }
.mod-panel {
  position: absolute; top: 0.8rem; right: 0.8rem; z-index: 30;
  width: min(300px, calc(100% - 1.6rem)); max-height: calc(100% - 1.6rem); overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.6rem; padding: 0.9rem;
  border-radius: 18px; background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line-2); box-shadow: 0 24px 60px -20px rgba(0,0,0,0.7);
  backdrop-filter: blur(12px); color: var(--ink);
}
.mod-head { display: flex; align-items: center; gap: 0.5rem; }
.mod-head strong { font-size: 1rem; }
.mod-tag { font-size: 0.66rem; font-weight: 800; padding: 0.12rem 0.5rem; border-radius: 999px; background: var(--sel); color: var(--accent); }
.mod-x { margin-left: auto; width: 2rem; height: 2rem; }
.mod-label { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin-top: 0.2rem; }
.mod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; }
.mod-chip {
  padding: 0.45rem 0.5rem; border-radius: 10px; cursor: pointer; font: inherit; font-size: 0.8rem; font-weight: 650;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2); text-align: center;
}
.mod-chip:hover { color: var(--ink); border-color: var(--ink-3); }
.mod-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.mod-slider { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; }
.mod-slider-top { display: flex; justify-content: space-between; }
.mod-slider b { color: var(--accent); font-variant-numeric: tabular-nums; }
.mod-slider input { width: 100%; min-height: 0; padding: 0; border: 0; background: transparent; accent-color: var(--accent); }
.mod-note { margin: 0; font-size: 0.78rem; color: var(--ink-3); line-height: 1.45; }
.mod-pause, .mod-reset { border-radius: 999px; }
.stage.mod-zoomed { overflow: hidden; }
@keyframes mod-hue { to { filter: hue-rotate(360deg); } }
@keyframes mod-wobble { 25% { rotate: -2deg; } 75% { rotate: 2deg; } }
@keyframes mod-spin { to { rotate: 360deg; } }
iframe.mod-rainbow { animation: mod-hue 3s linear infinite; }
iframe.mod-wobble { animation: mod-wobble 1.6s ease-in-out infinite; }
iframe.mod-spin { animation: mod-spin 40s linear infinite; }
iframe.mod-rainbow.mod-wobble { animation: mod-hue 3s linear infinite, mod-wobble 1.6s ease-in-out infinite; }
iframe.mod-rainbow.mod-spin { animation: mod-hue 3s linear infinite, mod-spin 40s linear infinite; }

/* ==========================================================================
   48 · CAMPUS+ HUB + mod menu extras
   ========================================================================== */
.home-shortcuts a.home-plus { color: var(--accent); font-weight: 700; }
.plus-hero { display: flex; align-items: center; gap: 1.1rem; padding: clamp(1.4rem, 4vw, 2.6rem) 0 1.4rem; }
.plus-hero h1 { margin: 0 0 0.25rem; font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -0.02em; }
.plus-hero p { margin: 0; max-width: 56ch; }
.plus-badge {
  width: 4rem; height: 4rem; flex: none; border-radius: 18px; display: grid; place-items: center;
  font-size: 2.4rem; font-weight: 900; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #c084fc));
  box-shadow: 0 12px 30px -12px color-mix(in srgb, var(--accent) 70%, transparent);
}
.plus-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 2.4rem; }
.plus-card {
  display: flex; flex-direction: column; gap: 0.45rem; padding: 1.3rem; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.plus-card:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 18px 40px -24px rgba(0,0,0,0.7); }
.plus-card strong { font-size: 1.1rem; }
.plus-card > span:not(.plus-card-ico):not(.plus-card-go) { color: var(--ink-2); font-size: 0.88rem; line-height: 1.45; flex: 1; }
.plus-card-ico { width: 2.8rem; height: 2.8rem; border-radius: 14px; display: grid; place-items: center; font-size: 1.35rem; background: var(--sel); color: var(--accent); }
.plus-card-go { margin-top: 0.4rem; font-weight: 700; font-size: 0.86rem; color: var(--accent); }
.plus-card-go::after { content: " →"; }
.plus-mods { margin-bottom: 3rem; scroll-margin-top: 1rem; }
.plus-mods-head h2 { margin: 0 0 0.3rem; font-size: 1.4rem; }
.plus-mods-head p { margin: 0 0 1.1rem; }
.plus-effects { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.4rem; }
.mod-presets { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.mod-preset { flex: 0 1 auto; }
.mod-foot { display: flex; gap: 0.4rem; }
.mod-foot .btn { flex: 1; border-radius: 999px; justify-content: center; }
.mod-panel.is-left { right: auto; left: 0.8rem; }

/* ---- mod menu v2: tabs, cheats, cleaner card ---- */
.mod-panel {
  width: min(340px, calc(100% - 1.6rem)); padding: 0; gap: 0; overflow: hidden;
  display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-radius: 20px;
}
.mod-head { padding: 0.85rem 0.7rem 0.6rem 0.9rem; gap: 0.65rem; }
.mod-logo {
  width: 2.2rem; height: 2.2rem; flex: none; border-radius: 12px; display: grid; place-items: center;
  font-weight: 900; font-size: 1.3rem; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #c084fc));
}
.mod-titles { min-width: 0; display: flex; flex-direction: column; }
.mod-titles strong { font-size: 0.98rem; }
.mod-titles span { font-size: 0.74rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-tabs { display: flex; gap: 3px; margin: 0 0.8rem 0.2rem; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.mod-tab {
  flex: 1; border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  font: inherit; font-size: 0.82rem; font-weight: 700; padding: 0.4rem 0; border-radius: 999px;
}
.mod-tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.mod-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mod-body { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.6rem 0.9rem 0.9rem; overflow-y: auto; min-height: 0; }
.mod-panel { max-height: calc(100% - 1.6rem); }
.mod-chip { transition: background .12s, border-color .12s, color .12s; }
.mod-link { font-size: 0.8rem; font-weight: 650; color: var(--accent); text-align: center; }
.mod-fine { font-size: 0.72rem; }
.mod-cheats { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; margin: 0 -0.3rem; padding: 0 0.3rem; }
.mod-cheat { display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem auto auto; align-items: center; gap: 0.3rem; padding: 0.3rem 0.35rem; border-radius: 10px; }
.mod-cheat:hover { background: var(--surface-2); }
.mod-cheat.is-key .mod-cheat-name { color: var(--ink); font-weight: 700; }
.mod-cheat-name { font-size: 0.78rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-cheat input { min-height: 2rem; height: 2rem; padding: 0 0.45rem; font-size: 0.8rem; border-radius: 8px; width: 100%; }
.mod-cheat .btn { min-height: 2rem; padding: 0 0.6rem; font-size: 0.74rem; }
.mod-btn:not(.is-locked) { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
.plus-perks { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: -0.4rem 0 1.4rem; padding: 0; }
.plus-perks li { padding: 0.4rem 0.85rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 0.84rem; color: var(--ink-2); }
.plus-perks b { color: var(--accent); }
.plus-try { border-radius: 999px; margin: 0 0 1.1rem; display: inline-flex; }
body:not(.is-plus-member) .plus-try { display: none; }

/* ============================================================
   49. Mod menu — live game cheats
   ============================================================ */
.mod-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.mod-chips .mod-chip { flex: 0 1 auto; }
.mod-chip.is-action { border-style: dashed; }
.mod-chip.is-action:active { background: var(--sel); }
.mod-sub { font-size: 0.72rem; font-weight: 700; color: var(--ink-2); margin: 0.1rem 0 -0.25rem; }
.mod-cheat.is-text { grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr) auto; }
/* A long cheat list scrolls the panel; nothing in it gets squashed. */
.mod-body > * { flex-shrink: 0; }

/* ============================================================
   50. Campus+ — games with in-game cheats
   ============================================================ */
.plus-modlist-tools { display: flex; align-items: center; gap: 0.8rem; margin: 0.6rem 0 1rem; }
.plus-modlist-tools input { max-width: 320px; flex: 1; }
#modlist { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.plus-modgroup { display: flex; flex-direction: column; gap: 0.4rem; margin: 0; }
.plus-modgroup-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.plus-modgroup-n { font-size: 0.74rem; font-weight: 800; padding: 0.12rem 0.55rem; border-radius: 999px; background: var(--sel); color: var(--accent); }
.plus-modgames { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; max-height: 220px; overflow-y: auto; }
.plus-modgame { padding: 0.3rem 0.7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: 0.82rem; font-weight: 600; }
.plus-modgame:hover { text-decoration: none; color: var(--ink); border-color: var(--accent); }
.plus-modlist-foot { margin-top: 1rem; max-width: 70ch; }
@media (max-width: 520px) { #modlist { grid-template-columns: 1fr; } }

/* ============================================================
   51. Sign in with the main site's account (mirror domains)
   ============================================================ */
.sso-box { margin-bottom: 1.1rem; }
.sso-btn { width: 100%; justify-content: center; flex-wrap: wrap; gap: 0.3ch; }
.sso-btn b { color: var(--accent); }
.sso-or { display: flex; align-items: center; gap: 0.7rem; margin: 1rem 0 0; }
.sso-or::before, .sso-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
#sso-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ============================================================
   52. Mod menu on phones: a sheet above the tab bar, not a box
       squeezed into the small game frame
   ============================================================ */
@media (max-width: 720px) {
  .stage:not(.is-fullscreen) .mod-panel {
    position: fixed; top: auto; left: 0.5rem; right: 0.5rem;
    bottom: calc(3.6rem + env(safe-area-inset-bottom) + 0.5rem);
    width: auto; max-height: min(70dvh, 560px); z-index: 80;
  }
  .stage.is-fullscreen .mod-panel { width: calc(100% - 1rem); right: 0.5rem; left: 0.5rem; max-height: calc(100% - 1rem); }
}
