@font-face {
  font-family: "Chakra Petch";
  src: url("/fonts/chakra/chakra-petch-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Chakra Petch";
  src: url("/fonts/chakra/chakra-petch-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope/manrope-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  /* Deep indigo night, lit from the corners in violet and cobalt */
  --ground: #0d0b1a;
  --surface: #15122a;
  --raised: #1f1a3a;
  --line: #2c2650;
  --line-hi: #3d3570;
  --text: #ece9ff;
  --muted: #a29dc4;
  --faint: #6c6690;
  --violet: #8b5cf6;
  --violet-hi: #a78bfa;
  --cobalt: #3b82f6;
  --cobalt-hi: #60a5fa;
  /* Accent colors (the host picks a theme on the Admin page) */
  --a1: #7c3aed; --a2: #2563eb;
  --tint: #c4b5fd; --tint-2: #d8ccff; --tint-3: #bfdbfe;
  --a1-rgb: 124, 58, 237; --a2-rgb: 37, 99, 235; --mid-rgb: 91, 70, 240;
  --violet-rgb: 139, 92, 246; --violet-hi-rgb: 167, 139, 250;
  --cobalt-rgb: 59, 130, 246; --cobalt-hi-rgb: 96, 165, 250;
  --grad: linear-gradient(120deg, var(--a1), var(--a2));
  --grad-hi: linear-gradient(120deg, var(--violet), var(--cobalt));
  --card-min: 170px;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --display: "Chakra Petch", "Rajdhani", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --body: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --radius: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
/* ---------------------------------------------------------------- color themes */
:root[data-theme-preset="crimson"] {
  --a1: #e11d48; --a2: #f97316; --violet: #f43f5e; --violet-hi: #fb7185; --cobalt: #fb923c; --cobalt-hi: #fdba74;
  --tint: #fecdd3; --tint-2: #ffe4e6; --tint-3: #fed7aa;
  --a1-rgb: 225, 29, 72; --a2-rgb: 249, 115, 22; --mid-rgb: 236, 72, 60;
  --violet-rgb: 244, 63, 94; --violet-hi-rgb: 251, 113, 133; --cobalt-rgb: 251, 146, 60; --cobalt-hi-rgb: 253, 186, 116;
}
:root[data-theme-preset="emerald"] {
  --a1: #059669; --a2: #0891b2; --violet: #10b981; --violet-hi: #34d399; --cobalt: #06b6d4; --cobalt-hi: #67e8f9;
  --tint: #a7f3d0; --tint-2: #d1fae5; --tint-3: #a5f3fc;
  --a1-rgb: 5, 150, 105; --a2-rgb: 8, 145, 178; --mid-rgb: 6, 148, 140;
  --violet-rgb: 16, 185, 129; --violet-hi-rgb: 52, 211, 153; --cobalt-rgb: 6, 182, 212; --cobalt-hi-rgb: 103, 232, 249;
}
:root[data-theme-preset="sunset"] {
  --a1: #db2777; --a2: #d97706; --violet: #ec4899; --violet-hi: #f472b6; --cobalt: #f59e0b; --cobalt-hi: #fcd34d;
  --tint: #fbcfe8; --tint-2: #fce7f3; --tint-3: #fde68a;
  --a1-rgb: 219, 39, 119; --a2-rgb: 217, 119, 6; --mid-rgb: 230, 80, 70;
  --violet-rgb: 236, 72, 153; --violet-hi-rgb: 244, 114, 182; --cobalt-rgb: 245, 158, 11; --cobalt-hi-rgb: 252, 211, 77;
}
.grid[data-size="compact"] { --card-min: 132px; }
.grid[data-size="large"] { --card-min: 230px; }


* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(900px 600px at 0% -10%, rgba(var(--a1-rgb), .22), transparent 70%),
    radial-gradient(900px 700px at 110% 110%, rgba(var(--a2-rgb), .2), transparent 70%),
    var(--ground);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
button, select { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--violet-hi); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code { background: var(--raised); padding: 2px 7px; border-radius: 6px; font-size: .9em; }

/* ---------------------------------------------------------------- brand */
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-logo { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 6px 20px rgba(var(--a1-rgb), .45); }
.wordmark {
  font-family: var(--display); font-weight: 700;
  font-size: 21px; letter-spacing: .16em; text-transform: uppercase; line-height: 1;
  background: linear-gradient(90deg, #f5f3ff, var(--tint) 60%, var(--tint-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border-radius: 999px; border: 1px solid transparent;
  padding: 10px 22px; font-weight: 700; font-size: 15px; letter-spacing: .01em;
  transition: filter .15s, transform .15s var(--ease), background .15s, border-color .15s, box-shadow .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; filter: saturate(.5); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-launch { background: var(--grad); color: #fff; box-shadow: 0 8px 24px rgba(var(--mid-rgb), .35), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-launch:not(:disabled):hover { background: var(--grad-hi); box-shadow: 0 10px 30px rgba(var(--mid-rgb), .55), inset 0 1px 0 rgba(255,255,255,.22); }
.btn-outline { background: rgba(31, 26, 58, .5); border-color: var(--line-hi); color: var(--text); }
.btn-outline:hover { border-color: var(--violet); background: rgba(var(--violet-rgb), .12); }
.btn-block { width: 100%; }

.icon-btn {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: transparent; border: 1px solid transparent; color: var(--text); transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--raised); border-color: var(--line); }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; padding-inline: var(--gutter); }
.login-backdrop { display: none; }
.login-top { padding-block: 24px; }
.login-card {
  align-self: center; justify-self: center; width: min(420px, 100%); margin-block: 24px 64px;
  background: linear-gradient(180deg, rgba(31, 26, 58, .85), rgba(21, 18, 42, .92));
  border: 1px solid var(--line); border-radius: 18px;
  padding: 28px clamp(20px, 5vw, 36px) 24px;
  backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(4, 2, 16, .6), 0 0 0 1px rgba(var(--violet-rgb), .06);
  display: grid; gap: 18px;
  position: relative;
}
.login-card { overflow: hidden; }
.login-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px;
  background: var(--grad);
}
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--ground); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tab { border: 0; background: transparent; padding: 8px; border-radius: 999px; font-weight: 700; color: var(--muted); }
.tab.is-active { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-hi); }
#login-form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field input {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  background: var(--ground); border: 1px solid var(--line); color: var(--text); font: 16px var(--body);
}
.field input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(var(--violet-rgb), .25); }
.check { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; cursor: pointer; }
.check input { accent-color: var(--violet); width: 16px; height: 16px; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(248, 113, 113, .12); border: 1px solid rgba(248, 113, 113, .25); color: #fecaca; font-size: 14px; }
.login-note { margin: 0; color: var(--faint); font-size: 13px; }
.login-note b { color: var(--muted); }

/* ---------------------------------------------------------------- top bar */
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 12px var(--gutter) 0;
  padding: 10px 12px 10px 12px;
  background: rgba(21, 18, 42, .72);
  border: 1px solid var(--line); border-radius: 16px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transition: box-shadow .3s, background .3s;
}
.nav.is-solid { background: rgba(21, 18, 42, .94); box-shadow: 0 14px 40px rgba(4, 2, 16, .55); }
.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; border: 0; padding: 0; background: var(--raised); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--violet); }
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 12px); min-width: 230px; padding: 6px;
  background: rgba(21, 18, 42, .98); border: 1px solid var(--line-hi); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(4, 2, 16, .7);
  display: grid; transform-origin: top right; animation: pop .16s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: scale(.95) translateY(-4px); } }
.menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; color: var(--muted); font-size: 13px; }
.menu-head img { width: 28px; height: 28px; border-radius: 50%; }
.menu button, .menu a { display: flex; align-items: center; gap: 12px; text-align: left; background: transparent; border: 0; padding: 10px 12px; border-radius: 9px; font-weight: 600; }
.menu button:hover, .menu button:focus-visible, .menu a:hover, .menu a:focus-visible { background: var(--raised); outline: none; }
.menu button:hover svg, .menu a:hover svg { color: var(--violet-hi); }
.menu svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; transition: color .15s; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; width: calc(100% - 8px); }
.menu a { color: var(--text); text-decoration: none; }
.menu .menu-admin { color: var(--tint); }
.menu .menu-quiet { color: var(--muted); font-weight: 500; }

/* ---------------------------------------------------------------- layout */
.library > *, .toolbar, .chips, .spot-text { min-width: 0; }
.library { padding: 22px var(--gutter) 80px; display: grid; gap: clamp(18px, 2.4vw, 26px); max-width: 1500px; margin-inline: auto; }

/* ---------------------------------------------------------------- spotlight */
.spotlight {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; gap: clamp(20px, 4vw, 48px);
  padding: clamp(20px, 3.4vw, 40px);
  background: linear-gradient(135deg, rgba(31, 26, 58, .75), rgba(21, 18, 42, .55));
  border: 1px solid var(--line); border-radius: 22px;
  position: relative; overflow: hidden;
  scroll-margin-top: 96px;
  animation: rise .35s var(--ease) both;
}
.spot-close { position: absolute; top: 14px; right: 14px; z-index: 3; border-radius: 50%; background: rgba(13, 11, 26, .55); border-color: var(--line); }
.spot-close:hover { border-color: var(--violet); }
.muted { color: var(--faint); font-size: 14px; }
.spotlight .admin-row { grid-column: 1 / -1; position: relative; z-index: 1; align-items: center; }
.spotlight .admin-row .log { flex-basis: 100%; }
.admin-label { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--warn); padding: 3px 9px; border: 1px solid rgba(251, 191, 36, .35); border-radius: 999px; }
.admin-port { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; font-size: 14px; margin-right: auto; }
.btn-small { padding: 7px 16px; font-size: 13px; }
.spotlight::before {
  content: ""; position: absolute; width: 520px; height: 520px; right: -140px; top: -220px; z-index: 0;
  background: radial-gradient(closest-side, rgba(var(--cobalt-hi-rgb), .18), transparent); pointer-events: none;
}
@keyframes rise { from { opacity: .001; transform: translateY(10px); } }
.spot-text { display: grid; gap: 14px; position: relative; z-index: 1; min-width: 0; }
.kicker {
  justify-self: start; display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 10px; border-radius: 999px;
  background: rgba(var(--violet-rgb), .14); border: 1px solid rgba(var(--violet-rgb), .35);
  color: var(--tint-2); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.kicker::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--cobalt-hi); box-shadow: 0 0 10px var(--cobalt-hi); }
.spot-title { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(34px, 4.6vw, 60px); line-height: 1.02; letter-spacing: .01em; text-wrap: balance; overflow-wrap: anywhere; }
.spot-desc { margin: 0; color: #cfcae8; font-size: clamp(15px, 1.25vw, 17px); max-width: 52ch; }
.spot-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.spot-actions .btn { padding: 12px 26px; font-size: 16px; }
.spot-art {
  position: relative; z-index: 1; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 16px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(4, 2, 16, .6), 0 0 0 1px rgba(var(--violet-hi-rgb), .25), 0 0 60px rgba(var(--a1-rgb), .25);
  transform: perspective(1200px) rotateY(-5deg);
}
.spot-art > img, .spot-art > .art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.spot-empty { display: grid; place-items: center; background: var(--ground); transform: none; }
.spot-empty img { width: 30%; opacity: .9; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 14px; color: var(--muted); }
.tag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-hi); color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.status.ready { color: var(--good); }
.status.starting, .status.installing { color: var(--warn); }
.status.starting::before, .status.installing::before { animation: blink 1s ease-in-out infinite; }
.status.error { color: var(--bad); }
@keyframes blink { 50% { opacity: .25; } }

/* ---------------------------------------------------------------- home: Games and Apps tiles */
.home, .section-view { display: grid; gap: clamp(18px, 2.4vw, 26px); min-width: 0; }
.home { gap: clamp(26px, 3.4vw, 40px); }
.home-row { display: grid; gap: 14px; min-width: 0; }
.row-title { margin: 0; font: 700 13px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); gap: clamp(14px, 2vw, 24px); }
.tile {
  position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; isolation: isolate;
  color: #fff; text-decoration: none; background: var(--surface);
  box-shadow: 0 14px 34px rgba(4, 2, 16, .5), 0 0 0 1px rgba(var(--violet-hi-rgb), .12);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.tile:hover, .tile:focus-visible {
  transform: translateY(-5px); outline: none;
  box-shadow: 0 24px 48px rgba(4, 2, 16, .6), 0 0 0 2px var(--violet), 0 0 36px rgba(var(--a1-rgb), .45);
}
.tile-bg { position: absolute; inset: 0; z-index: -2; }
.tile-bg > img { width: 100%; height: 100%; object-fit: cover; }
/* No picture set: the section's own covers, side by side */
.tile-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; height: 100%; gap: 3px; background: var(--ground); }
.tile-strip > * { position: relative; overflow: hidden; }
.tile-strip img, .tile-strip .art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-strip .art-title { display: none; }
.tile-strip .art-glyph { font-size: min(70cqi, 150px); left: 50%; right: auto; top: 50%; transform: translate(-50%, -55%); }
/* Nothing in it yet: a soft gradient with the section's icon */
.tile-empty {
  height: 100%; display: grid; place-items: center;
  background:
    radial-gradient(80% 90% at 85% 10%, rgba(var(--a2-rgb), .45), transparent 60%),
    radial-gradient(90% 90% at 10% 100%, rgba(var(--a1-rgb), .5), transparent 65%),
    var(--raised);
}
.tile-empty svg { width: 30%; max-width: 150px; opacity: .22; transform: translate(18%, -12%); }
.tile::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgba(10, 8, 22, .92) 0%, rgba(10, 8, 22, .45) 45%, rgba(10, 8, 22, .1) 100%);
}
.tile-text { position: absolute; left: 0; right: 0; bottom: 0; padding: clamp(16px, 2.4vw, 26px); display: grid; gap: 4px; }
.tile-name { display: flex; align-items: center; gap: 12px; font: 700 clamp(26px, 3.4vw, 38px)/1 var(--display); letter-spacing: .02em; }
.tile-name svg { width: .9em; height: .9em; flex: none; fill: none; stroke: var(--tint); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tile-count { color: #d6d1f2; font-weight: 700; font-size: 14px; }
.tile-flag {
  position: absolute; top: 14px; left: 14px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; background: rgba(13, 11, 26, .8); color: var(--warn);
}
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(118px, 13vw, 160px); gap: clamp(12px, 1.6vw, 20px); overflow-x: auto; padding: 8px 2px 14px; scrollbar-width: thin; }
.rail .card-art { aspect-ratio: 3 / 4; }

/* ---------------------------------------------------------------- an opened section */
.section-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.back-btn {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  color: var(--text); background: rgba(21, 18, 42, .7); border: 1px solid var(--line); transition: .15s;
}
.back-btn:hover { border-color: var(--line-hi); background: var(--raised); }
.section-title { margin: 0; font: 700 clamp(26px, 3.6vw, 36px)/1.1 var(--display); letter-spacing: .02em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-count { color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap; }
.section-empty { grid-column: 1 / -1; color: var(--muted); padding: 24px 2px; margin: 0; }

/* ---------------------------------------------------------------- toolbar (filters + sort, left aligned) */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 10px; min-width: 0; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(21, 18, 42, .6);
  color: var(--muted); font-weight: 700; font-size: 13px; transition: .15s;
}
.chip:hover { color: var(--text); border-color: var(--line-hi); }
.chip[aria-selected="true"] { color: #fff; border-color: transparent; background: var(--grad); }
.sort select {
  appearance: none; -webkit-appearance: none;
  padding: 7px 34px 7px 14px; border-radius: 999px; border: 1px solid var(--line); font-weight: 700; font-size: 13px; color: var(--text);
  background: rgba(21, 18, 42, .6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='%23a29dc4' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 10px center / 16px no-repeat;
}
.sort select:focus-visible { outline: 2px solid var(--violet-hi); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--card-min), 42vw), 1fr)); gap: clamp(14px, 1.8vw, 24px); }

/* ---------------------------------------------------------------- cards (poster + caption) */
.card { display: grid; gap: 10px; cursor: pointer; border-radius: var(--radius); outline: none; }
.card-art {
  position: relative; aspect-ratio: 3 / 4; max-width: 100%; border-radius: var(--radius); overflow: hidden; background: var(--surface);
  box-shadow: 0 10px 26px rgba(4, 2, 16, .45), 0 0 0 1px rgba(var(--violet-hi-rgb), .1);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.card-art > img, .card-art > .art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-art::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(to top, rgba(13, 11, 26, .55), transparent 45%);
  opacity: 0; transition: opacity .25s;
}
.card:hover .card-art, .card:focus-visible .card-art {
  transform: translateY(-6px);
  box-shadow: 0 22px 44px rgba(4, 2, 16, .6), 0 0 0 2px var(--violet), 0 0 32px rgba(var(--a1-rgb), .45);
}
.card:hover .card-art::after, .card:focus-visible .card-art::after { opacity: 1; }
.card.is-selected .card-art { transform: translateY(-6px); box-shadow: 0 22px 44px rgba(4, 2, 16, .6), 0 0 0 3px var(--cobalt-hi), 0 0 36px rgba(var(--cobalt-rgb), .5); }
.card.is-selected .card-name { color: var(--tint-3); }
.card-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  background: rgba(13, 11, 26, .78); backdrop-filter: blur(4px); color: var(--muted);
}
.card-badge.new { background: var(--cobalt); color: #fff; box-shadow: 0 0 14px rgba(var(--cobalt-rgb), .6); }
.card.is-down .card-art > img, .card.is-down .card-art > .art { filter: grayscale(.8) brightness(.55); }
.card-body { display: grid; gap: 3px; padding-inline: 2px; min-width: 0; }
.card-name { font-weight: 800; font-size: 15px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card:hover .card-name { color: var(--tint-2); }
.card-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--muted); }

/* Generated cover art for games without a cover image (kept in the violet–blue family) */
.art {
  --h: 260;
  position: relative; overflow: hidden;
  background:
    radial-gradient(110% 80% at 100% 0%, hsl(calc(var(--h) + 30) 80% 60% / .55), transparent 60%),
    radial-gradient(100% 90% at 0% 100%, hsl(var(--h) 75% 32%), transparent 70%),
    linear-gradient(160deg, hsl(var(--h) 55% 20%), hsl(calc(var(--h) + 25) 60% 9%));
  display: flex; align-items: flex-end;
  container-type: inline-size;
}
.art::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 12cqi 12cqi;
  mask-image: radial-gradient(90% 70% at 70% 20%, #000, transparent 75%);
}
.art-glyph {
  position: absolute; right: 6cqi; top: 4cqi;
  font-family: var(--display); font-weight: 700; font-size: 58cqi; line-height: 1;
  color: transparent; -webkit-text-stroke: .6cqi rgba(255, 255, 255, .22);
  pointer-events: none;
}
.art-title {
  position: relative; margin: 0; padding: 8cqi;
  font-family: var(--display); font-weight: 700; font-size: 13cqi; line-height: 1.02;
  color: #fff; text-shadow: 0 2px 14px rgba(0, 0, 0, .45); overflow-wrap: anywhere;
}
.spot-art .art-glyph { font-size: 44cqi; top: -2cqi; }
.spot-art .art-title, .card-art .art-title { display: none; }
.card-art .art-glyph { font-size: 78cqi; right: auto; left: 50%; top: 50%; transform: translate(-50%, -55%); }
.spot-art .art-glyph { right: 50%; transform: translateX(50%); top: 6cqi; }

/* ---------------------------------------------------------------- modal */
.modal-layer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal-scrim { position: absolute; inset: 0; background: rgba(6, 4, 18, .7); backdrop-filter: blur(8px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal {
  position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: linear-gradient(180deg, #1c1736, var(--surface) 140px);
  border: 1px solid var(--line-hi); border-radius: 20px;
  box-shadow: 0 40px 100px rgba(4, 2, 16, .75), 0 0 80px rgba(var(--a1-rgb), .12);
  padding: 28px clamp(18px, 4vw, 32px) 28px;
  animation: modal-in .24s var(--ease);
}
.modal.wide { width: min(760px, 100%); padding: 0; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-close { position: absolute; top: 14px; right: 14px; z-index: 2; background: rgba(13, 11, 26, .5); border-radius: 50%; }
.modal h2 { margin: 0 0 4px; font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: .03em; line-height: 1.1; }
.modal h3 { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.modal .lede { margin: 0; color: var(--muted); }
.modal-stack { display: grid; gap: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* account */
.avatar-current { display: flex; align-items: center; gap: 18px; }
.avatar-current img { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; background: var(--raised); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--violet), 0 10px 30px rgba(var(--a1-rgb), .35); }
.avatar-current .who { display: grid; gap: 2px; }
.avatar-current .who b { font-size: 20px; }
.avatar-current .who span { color: var(--muted); font-size: 13px; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 12px; }
.avatar-opt {
  position: relative; aspect-ratio: 1; max-width: 100%; padding: 0; border: 0; border-radius: 50%; overflow: hidden; background: var(--raised);
  transition: transform .15s var(--ease), box-shadow .15s;
}
.avatar-opt img { width: 100%; height: 100%; object-fit: cover; }
.avatar-opt:hover { transform: translateY(-2px); }
.avatar-opt[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--cobalt-hi); }
.avatar-opt.upload { display: grid; place-items: center; align-content: center; border: 1.5px dashed var(--line-hi); background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1.2; }
.avatar-opt.upload svg { width: 20px; height: 20px; margin: 0 auto 3px; }
.avatar-opt.upload:hover { color: var(--text); border-color: var(--violet); }
.invite { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--ground); border: 1px solid var(--line); border-radius: 14px; flex-wrap: wrap; }
.invite code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 18px; letter-spacing: .12em; background: none; padding: 0; color: var(--tint); }
.invite small { display: block; color: var(--faint); font-size: 12px; }

/* settings */
.slider { display: grid; gap: 10px; padding: 16px; border-radius: 14px; background: rgba(13, 11, 26, .5); border: 1px solid var(--line); }
.slider-head { display: flex; justify-content: space-between; align-items: baseline; }
.slider-head label { font-weight: 700; font-size: 16px; }
.slider-head output { font-variant-numeric: tabular-nums; color: var(--tint); font-weight: 800; min-width: 4ch; text-align: right; }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row svg { width: 22px; height: 22px; flex: none; color: var(--muted); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
input[type="range"] { --pct: 50%; flex: 1; min-width: 0; height: 28px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--a1), var(--cobalt)) 0 0 / var(--pct) 100% no-repeat, #2c2650; }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: #2c2650; }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--a1), var(--cobalt)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #f5f3ff; margin-top: -6px; box-shadow: 0 0 0 4px rgba(var(--violet-rgb), .3), 0 2px 6px rgba(0,0,0,.5); transition: transform .12s; }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #f5f3ff; box-shadow: 0 0 0 4px rgba(var(--violet-rgb), .3); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
.saved-note { font-size: 13px; color: var(--faint); min-height: 20px; }

/* details */
.details-art { position: relative; aspect-ratio: 16 / 7; max-width: 100%; overflow: hidden; }
.details-art > img, .details-art > .art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.details-art .art-title { display: none; }
.details-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--surface), transparent 65%); }
.details-body { padding: 0 clamp(18px, 4vw, 32px) 28px; margin-top: -34px; position: relative; display: grid; gap: 14px; }
.details-body h2 { font-size: clamp(30px, 5vw, 44px); }
.details-body p { margin: 0; color: #d4cfee; max-width: 62ch; }
.log { max-height: 260px; overflow: auto; background: #090714; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: 12px/1.5 ui-monospace, Menlo, monospace; color: #cfc9ee; white-space: pre-wrap; margin: 0; }
.admin-row { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 200;
  background: var(--raised); color: var(--text); border: 1px solid var(--line-hi);
  padding: 10px 18px; border-radius: 999px; font-weight: 700; box-shadow: 0 10px 30px rgba(4, 2, 16, .6);
  animation: rise .25s var(--ease);
}

@media (max-width: 760px) {
  .spotlight { grid-template-columns: 1fr; }
  .spot-art { order: -1; transform: none; }
  .wordmark { font-size: 17px; letter-spacing: .12em; }
  .brand-logo { width: 34px; height: 34px; border-radius: 10px; }
  .toolbar { flex-wrap: nowrap; }
  .chips { flex: 1; }
  .spot-close { top: 10px; right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* empty library */
.empty { grid-column: 1 / -1; justify-self: center; text-align: center; max-width: 520px; display: grid; justify-items: center; gap: 12px; padding: 60px 0; }
.empty img { width: 72px; border-radius: 18px; box-shadow: 0 10px 30px rgba(var(--a1-rgb), .45); }
.empty h1 { margin: 0; font-family: var(--display); font-size: 32px; }
.empty p { margin: 0; color: var(--muted); }
.card-badge.hidden-badge { background: rgba(251, 191, 36, .9); color: #1a1405; }

/* ================================================================= admin page */
.admin-body .nav { margin-bottom: 0; }
.admin-chip {
  font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--warn); padding: 5px 11px; border: 1px solid rgba(251, 191, 36, .4); border-radius: 999px;
}
.admin { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; padding: 22px var(--gutter) 80px; max-width: 1500px; margin-inline: auto; align-items: start; }
.admin-tabs { display: grid; gap: 4px; position: sticky; top: 96px; }
.admin-tabs button {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: var(--muted); font-weight: 700; text-align: left;
}
.admin-tabs button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.admin-tabs button:hover { color: var(--text); background: rgba(31, 26, 58, .5); }
.admin-tabs button[aria-selected="true"] { color: var(--text); background: var(--raised); border-color: var(--line-hi); }
.admin-tabs button[aria-selected="true"] svg { color: var(--violet-hi); }
.admin-main { min-width: 0; }
.admin-h1 { margin: 0 0 6px; font-family: var(--display); font-weight: 700; font-size: 28px; letter-spacing: .03em; display: flex; align-items: baseline; gap: 10px; }
.admin-h2 { margin: 0 0 6px; font-family: var(--display); font-weight: 700; font-size: 26px; line-height: 1.1; }
.admin-panel {
  background: linear-gradient(180deg, rgba(31, 26, 58, .7), rgba(21, 18, 42, .6));
  border: 1px solid var(--line); border-radius: 18px; padding: clamp(18px, 2.6vw, 28px); min-width: 0;
  display: grid; gap: 18px; align-content: start;
}
.admin-panel .lede { margin: -6px 0 0; color: var(--muted); max-width: 70ch; }
.admin-split { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-list { display: grid; gap: 10px; position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow: auto; padding-right: 4px; }
.admin-list-items { display: grid; gap: 6px; }
.admin-row-btn {
  display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; text-align: left;
  border: 1px solid var(--line); background: rgba(21, 18, 42, .6); color: var(--text); transition: border-color .15s, background .15s;
}
.admin-row-btn:hover { border-color: var(--line-hi); }
.admin-row-btn[aria-current="true"] { border-color: var(--violet); background: rgba(var(--violet-rgb), .12); }
.admin-thumb { position: relative; width: 42px; aspect-ratio: 3 / 4; border-radius: 7px; overflow: hidden; flex: none; background: var(--surface); }
.admin-thumb > img, .admin-thumb > .art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.admin-thumb .art-title { display: none; }
.admin-thumb .art-glyph { font-size: 80cqi; left: 50%; right: auto; top: 50%; transform: translate(-50%, -55%); }
.admin-row-text { display: grid; gap: 3px; min-width: 0; }
.admin-row-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-row-text > span { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mini-badge { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--raised); color: var(--muted); }
.mini-badge.warn { background: rgba(251, 191, 36, .15); color: var(--warn); }
.settings-row { border-style: dashed; }
.settings-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; flex: none; background: var(--grad); }
.settings-icon svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; }
.settings-row .admin-row-text > span { font-size: 12px; }
.list-empty { margin: 4px 2px; font-size: 13px; }
.image-editors.one { grid-template-columns: minmax(0, 520px); }
.tile-preview .tile-strip, .tile-preview .tile-empty { position: absolute; inset: 0; }

.editor-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.editor-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-form { display: grid; gap: 18px; }
.admin-form .field input, .admin-form textarea, .inline-add input, .tag-name {
  width: 100%; padding: 11px 13px; border-radius: 10px; background: var(--ground); border: 1px solid var(--line); color: var(--text); font: 15px/1.5 var(--body);
}
.admin-form textarea { resize: vertical; min-height: 110px; }
.admin-form .field input:focus, .admin-form textarea:focus, .inline-add input:focus, .tag-name:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(var(--violet-rgb), .25); }
.field-narrow { max-width: 360px; }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hint { color: var(--faint); font-size: 12.5px; }
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-toggle[aria-pressed="true"] { color: #fff; border-color: transparent; background: var(--grad); }
.tag-toggle[aria-pressed="true"]::before { content: "✓ "; }
.inline-add { display: flex; gap: 8px; max-width: 420px; margin-top: 10px; }
.inline-add input { padding: 8px 12px; font-size: 14px; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.form-actions .saved-note { margin-right: auto; min-height: 0; }
.btn.is-armed { border-color: var(--bad); color: #fecaca; background: rgba(248, 113, 113, .12); }

/* switches */
.switch-row { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--line); transition: background .2s; margin-top: 1px; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #f5f3ff; transition: transform .2s var(--ease); }
.switch-row input:checked + .switch { background: var(--grad); }
.switch-row input:checked + .switch::after { transform: translateX(18px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--violet-hi); outline-offset: 2px; }
.switch-row > span:last-child { display: grid; gap: 2px; }
.switch-row small { color: var(--faint); font-size: 12.5px; }
.switch-row.compact { align-items: center; font-size: 13px; color: var(--muted); font-weight: 700; }

/* images */
.image-editors { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.image-editor { display: grid; gap: 8px; align-content: start; min-width: 0; }
.image-editor h3 { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.image-preview { position: relative; border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: 0 0 0 1px var(--line); max-width: 100%; }
.image-preview.cover { aspect-ratio: 3 / 4; max-width: 220px; }
.image-preview.banner { aspect-ratio: 16 / 9; }
.image-preview > img, .image-preview > .art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.image-preview.cover .art-title { display: none; }
.image-preview.cover .art-glyph { font-size: 78cqi; left: 50%; right: auto; top: 50%; transform: translate(-50%, -55%); }
.image-preview.banner .art-title { font-size: 8cqi; padding: 6cqi; }
.image-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.file-btn { cursor: pointer; }
.file-btn:focus-within { outline: 2px solid var(--violet-hi); outline-offset: 2px; }

/* tags tab */
.tag-rows { display: grid; gap: 8px; }
.tag-row { display: grid; grid-template-columns: auto minmax(120px, 1fr) auto auto auto; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(13, 11, 26, .45); }
.tag-name { padding: 8px 11px; }
.tag-usage { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 62px; }
.order-btns { display: flex; flex-direction: column; }
.icon-btn.small { width: 26px; height: 20px; border-radius: 6px; }
.icon-btn.small svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:disabled { opacity: .3; cursor: default; }

/* appearance */
.theme-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.theme-card { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: rgba(13, 11, 26, .45); cursor: pointer; }
.theme-card input { position: absolute; opacity: 0; }
.theme-card:has(input:checked) { border-color: var(--violet); box-shadow: 0 0 0 1px var(--violet); }
.theme-card:has(input:focus-visible) { outline: 2px solid var(--violet-hi); outline-offset: 2px; }
.theme-swatch { width: 44px; height: 44px; border-radius: 12px; flex: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
.theme-text { display: grid; }
.theme-text small { color: var(--faint); font-size: 12px; }
.segmented { display: inline-flex; flex-wrap: wrap; padding: 4px; gap: 2px; border-radius: 999px; background: var(--ground); border: 1px solid var(--line); }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: 7px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--grad); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--violet-hi); }
.invite.big code { font-size: 24px; display: block; margin-top: 4px; }

@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .admin-tabs { position: static; display: flex; overflow-x: auto; scrollbar-width: none; }
  .admin-tabs button { flex: none; }
  .admin-split { grid-template-columns: 1fr; }
  .admin-list { position: static; max-height: 300px; }
  .image-editors { grid-template-columns: 1fr; }
  .tag-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .tag-row .tag-usage { display: none; }
  .tag-row .switch-row, .tag-row .tag-del { grid-column: 2 / -1; justify-self: start; }
}

/* small fixes */
a.btn { text-decoration: none; }
.btn { white-space: nowrap; }
.segmented { width: fit-content; max-width: 100%; }
.switch { background: var(--line-hi); }
@media (max-width: 480px) {
  .admin-body .wordmark { display: none; }
}

/* ================================================================= friends & presence */
:root { --st-online: #22c55e; --st-away: #f59e0b; --st-dnd: #ef4444; --st-offline: #6b7280; }
.presence-dot {
  position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--st-offline); box-shadow: 0 0 0 2.5px var(--surface);
}
.presence-dot.online { background: var(--st-online); }
.presence-dot.away { background: var(--st-away); }
.presence-dot.dnd { background: var(--st-dnd); }
.presence-dot.dnd::after { content: ""; position: absolute; left: 25%; right: 25%; top: 45%; height: 10%; min-height: 2px; background: var(--surface); border-radius: 2px; }
.presence-dot.offline { background: var(--surface); box-shadow: inset 0 0 0 2.5px var(--st-offline), 0 0 0 2.5px var(--surface); }
.nav-avatar { position: relative; overflow: visible; }
.nav-avatar img { border-radius: 50%; }
.nav-avatar .presence-dot { right: -3px; bottom: -3px; box-shadow: 0 0 0 2.5px #15122a; }
.nav-avatar .presence-dot.offline { box-shadow: inset 0 0 0 2.5px var(--st-offline), 0 0 0 2.5px #15122a; }

.friends-btn { position: relative; }
.friends-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.count-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--st-dnd); color: #fff; font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1;
}
.friends-btn .count-badge { position: absolute; top: 2px; right: 0; box-shadow: 0 0 0 2px #15122a; }

/* sign-up: name + tag */
.name-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.name-row .field:only-child, .name-row .field:first-child:last-child { grid-column: 1 / -1; }
.tag-input { display: flex; align-items: center; border-radius: 10px; background: var(--ground); border: 1px solid var(--line); padding-left: 12px; }
.tag-input b { color: var(--faint); font-weight: 700; }
.tag-input input { border: 0 !important; background: transparent !important; box-shadow: none !important; width: 74px !important; padding: 12px 12px 12px 4px !important; font: 16px var(--body); color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.tag-input:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(var(--violet-rgb), .25); }
.tag-input.small input { width: 58px !important; padding: 8px 10px 8px 3px !important; font-size: 14px; }
.tag-input.small { padding-left: 10px; }
.login .hint { margin: -4px 0 0; font-size: 12.5px; color: var(--faint); }
.fp-tag { color: var(--faint); font-weight: 600; margin-left: 3px; font-variant-numeric: tabular-nums; }
.tag-edit-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* panel */
.friends-panel {
  position: fixed; z-index: 60; top: calc(80px + env(safe-area-inset-top, 0px)); right: var(--gutter); bottom: 16px;
  width: min(380px, calc(100vw - 32px));
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #1c1736, var(--surface) 160px);
  border: 1px solid var(--line-hi); border-radius: 18px;
  box-shadow: 0 30px 80px rgba(4, 2, 16, .7), 0 0 60px rgba(var(--a1-rgb), .12);
  overflow: hidden; animation: pop .18s var(--ease);
}
.fp-head { position: relative; display: flex; align-items: center; gap: 8px; padding: 12px 10px 12px 12px; border-bottom: 1px solid var(--line); }
.fp-me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--text); text-align: left; }
.fp-me:hover, .fp-me[aria-expanded="true"] { background: var(--raised); border-color: var(--line); }
.fp-me-text { display: grid; min-width: 0; }
.fp-me-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-me-text small { color: var(--muted); font-size: 12.5px; }
.fp-status-menu {
  position: absolute; z-index: 5; top: calc(100% - 6px); left: 12px; width: 260px; padding: 6px; display: grid;
  background: #1a1532; border: 1px solid var(--line-hi); border-radius: 14px; box-shadow: 0 20px 50px rgba(4, 2, 16, .7); animation: pop .14s var(--ease);
}
.fp-status-menu button { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; border: 0; background: transparent; color: var(--text); text-align: left; }
.fp-status-menu button:hover, .fp-status-menu button:focus-visible { background: var(--raised); outline: none; }
.fp-status-menu button[aria-checked="true"] { background: rgba(var(--violet-rgb), .14); }
.fp-status-menu .presence-dot { position: relative; right: auto; bottom: auto; flex: none; box-shadow: none; }
.fp-status-menu .presence-dot.offline { box-shadow: inset 0 0 0 2.5px var(--st-offline); background: transparent; }
.fp-status-menu span:last-child { display: grid; }
.fp-status-menu small { color: var(--faint); font-size: 12px; }
.fp-body { overflow-y: auto; padding: 6px 12px 16px; display: grid; gap: 4px; align-content: start; flex: 1; }
.fp-section { display: grid; gap: 6px; padding-top: 10px; }
.fp-section h3 { margin: 6px 0 2px; font-size: 11.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.fp-add { display: flex; gap: 6px; align-items: center; }
.fp-add > input { flex: 1; min-width: 0; padding: 8px 11px; border-radius: 10px; background: var(--ground); border: 1px solid var(--line); color: var(--text); font: 14px var(--body); }
.fp-add > input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(var(--violet-rgb), .25); }
.fp-msg { margin: 0; font-size: 13px; min-height: 0; }
.fp-msg:empty { display: none; }
.fp-msg.good { color: var(--good); }
.fp-msg.bad { color: #fca5a5; }
.fp-body .hint { margin: 0; font-size: 12.5px; color: var(--faint); }
.fp-friend, .fp-request { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 12px; border: 0; background: transparent; color: var(--text); text-align: left; width: 100%; }
.fp-friend:hover, .fp-friend:focus-visible { background: var(--raised); outline: none; }
.fp-request { background: rgba(13, 11, 26, .45); border: 1px solid var(--line); }
.fp-friend-text { flex: 1; min-width: 0; display: grid; }
.fp-friend-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; }
.fp-friend-text small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-friend-text small.playing { color: var(--good); }
.fp-avatar { position: relative; flex: none; width: 38px; height: 38px; }
.fp-avatar.sm { width: 32px; height: 32px; }
.fp-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--raised); }
.fp-avatar.is-offline img { filter: grayscale(1); opacity: .5; }
.fp-avatar .presence-dot { box-shadow: 0 0 0 2.5px #1a1532; }
.fp-avatar .presence-dot.offline { box-shadow: inset 0 0 0 2.5px var(--st-offline), 0 0 0 2.5px #1a1532; background: #1a1532; }
.fp-friend:hover .presence-dot, .fp-friend:focus-visible .presence-dot { box-shadow: 0 0 0 2.5px var(--raised); }
.icon-btn.small-x { width: 30px; height: 30px; border-radius: 50%; }

/* chat */
.fp-head.chat { gap: 6px; }
.fp-chat-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.fp-messages { flex: 1; overflow-y: auto; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 4px; }
.fp-time { align-self: center; margin: 10px 0 4px; font-size: 11.5px; color: var(--faint); font-weight: 700; }
.fp-bubble { max-width: 82%; padding: 8px 12px; border-radius: 16px; font-size: 14.5px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.fp-bubble.theirs { align-self: flex-start; background: var(--raised); border-bottom-left-radius: 6px; }
.fp-bubble.mine { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 6px; }
.fp-messages .hint.center, .hint.center { text-align: center; margin: auto 10px; color: var(--faint); font-size: 13px; }
.fp-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.fp-compose textarea { flex: 1; min-width: 0; resize: none; max-height: 140px; padding: 9px 12px; border-radius: 12px; background: var(--ground); border: 1px solid var(--line); color: var(--text); font: 14.5px/1.4 var(--body); }
.fp-compose textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(var(--violet-rgb), .25); }

/* new message pop-up (games page) */
.dm-pop {
  position: fixed; z-index: 70; top: calc(84px + env(safe-area-inset-top, 0px)); right: var(--gutter); width: min(360px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px;
  background: #1c1736; border: 1px solid var(--line-hi); border-radius: 16px; box-shadow: 0 20px 50px rgba(4, 2, 16, .7);
  animation: rise .22s var(--ease);
}
.dm-pop-text { flex: 1; min-width: 0; display: grid; }
.dm-pop-text span { color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 700px) {
  .friends-panel { inset: 0; width: auto; top: 0; bottom: 0; right: 0; border-radius: 0; border: 0; padding-top: env(safe-area-inset-top, 0px); }
}

/* account window */
.modal-stack.account { gap: 16px; }
.acct-section { display: grid; gap: 8px; padding: 14px; border-radius: 14px; background: rgba(13, 11, 26, .5); border: 1px solid var(--line); }
.acct-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.acct-row.two > input { flex: 1 1 160px; }
.acct-row.end { justify-content: flex-end; }
.acct-input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; background: var(--ground); border: 1px solid var(--line); color: var(--text); font: 15px var(--body); }
.acct-input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(var(--violet-rgb), .25); }
.acct-section .tag-input input { padding-block: 10px !important; }
.acct-msg { margin: 0; font-size: 13px; }
.acct-msg:empty { display: none; }
.acct-msg.good { color: var(--good); }
.acct-msg.bad { color: #fca5a5; }
.invite small a { color: var(--tint); }

/* the tag box shows one rounded focus ring on the whole box, not a square one on the inner field */
.tag-input input:focus, .tag-input input:focus-visible { outline: none !important; }
.tag-input { transition: border-color .15s, box-shadow .15s; }

/* friends panel: + Add Friend, section close, ⋮ menu */
.tip-wrap { position: relative; display: inline-flex; }
.tip {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%) translateY(-2px);
  padding: 5px 10px; border-radius: 8px; background: #2a2450; border: 1px solid var(--line-hi); color: var(--text);
  font-size: 12px; font-weight: 700; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s, transform .12s; z-index: 6;
}
/* Only while the pointer is over the button (not when it has focus, e.g. right after the panel opens),
   and only on devices with a real hover, so a tap on a phone doesn't leave it stuck on screen. */
@media (hover: hover) { .tip-wrap:hover .tip { opacity: 1; transform: translateX(-50%); } }
.fp-plus { border-radius: 50%; border: 1px solid var(--line-hi); width: 34px; height: 34px; }
.fp-plus:hover, .fp-plus[aria-expanded="true"] { background: var(--grad); border-color: transparent; color: #fff; }
.fp-add-section { position: relative; margin-top: 8px; padding: 12px; border-radius: 14px; background: rgba(13, 11, 26, .5); border: 1px solid var(--line); animation: rise .18s var(--ease); }
.fp-add-section h3 { margin-top: 0; }
.fp-section-close { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; }
.kebab-wrap { position: relative; }
.kebab-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 6; min-width: 220px; padding: 6px;
  background: #1a1532; border: 1px solid var(--line-hi); border-radius: 12px; box-shadow: 0 18px 44px rgba(4, 2, 16, .7); animation: pop .14s var(--ease);
}
.kebab-menu button { width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; border: 0; background: transparent; color: var(--text); font-weight: 600; font-size: 14px; }
.kebab-menu button:hover, .kebab-menu button:focus-visible { background: var(--raised); outline: none; }
.kebab-menu button.danger { color: #fca5a5; }
.kebab-menu button.danger[data-armed="1"] { background: rgba(248, 113, 113, .14); }
.fp-body > * { min-width: 0; }
.fp-add > input { flex: 1 1 0; width: 0; }
.switch-row.new-games { margin: 2px 0 6px; font-size: 12.5px; }

/* game invites */
.menu-label { padding: 6px 12px 4px; font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.invite-menu { max-height: 280px; overflow-y: auto; }
.mini-hidden { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--warn); margin-left: 6px; }
.fp-invite-card { display: flex; align-items: center; gap: 10px; max-width: 92%; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line-hi); background: rgba(var(--violet-rgb), .1); font-size: 14px; }
.fp-invite-card.mine { align-self: flex-end; }
.fp-invite-card.theirs { align-self: flex-start; }
.fp-invite-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--grad); color: #fff; }
.fp-invite-text { flex: 1; min-width: 0; color: #d4cfee; }
.fp-invite-text b { color: var(--text); }
.fp-invite-label { color: var(--muted, #a59fc9); font-size: .92em; }
.invite-pop { border-color: var(--violet); box-shadow: 0 20px 50px rgba(4, 2, 16, .7), 0 0 0 1px var(--violet), 0 0 40px rgba(var(--a1-rgb), .35); }
.invite-pop .dm-pop-text span { -webkit-line-clamp: 3; }
.link-btn { border: 0; padding: 0; background: none; color: var(--tint); font: inherit; text-decoration: underline; cursor: pointer; }
/* keep pop-ups beside the Friends panel instead of on top of it */
@media (min-width: 701px) {
  body:has(.friends-panel:not([hidden])) .dm-pop { right: calc(var(--gutter) + min(380px, 100vw - 32px) + 12px); }
}
