/* friendslop */
:root {
  --bg: #f2f4f5;
  --surface: #ffffff;
  --surface-2: #e8eaed;
  --surface-3: #d9dce0;
  --line: #dcdfe3;
  --text: #1d1e22;
  --muted: #5c5f66;
  --faint: #8b8e96;
  --primary: #335fff;
  --primary-hi: #2449d8;
  --primary-soft: #e3e9ff;
  --play: #00a862;
  --play-hi: #00924f;
  --good: #0f8a55;
  --warn: #a86b00;
  --bad: #d63031;
  --bad-soft: #fde8e8;
  --gold: #e0a500;
  --online: #00a2ff;
  --shadow: 0 1px 2px rgba(16, 18, 24, .06), 0 4px 16px rgba(16, 18, 24, .06);
  --radius: 8px;
  --top: 60px;
  --side: 224px;
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #111216;
  --surface: #1b1d21;
  --surface-2: #26282d;
  --surface-3: #33363c;
  --line: #2c2f35;
  --text: #f7f7f8;
  --muted: #b3b5bb;
  --faint: #7d8088;
  --primary: #335fff;
  --primary-hi: #4d74ff;
  --primary-soft: #1d2440;
  --play: #00b06f;
  --play-hi: #00c47c;
  --good: #3fd08d;
  --warn: #f2b01e;
  --bad: #ff5a5a;
  --bad-soft: #3a1d20;
  --gold: #f5c518;
  --online: #2fb5ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { transition: none !important; animation: none !important; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
b, strong { font-weight: 700; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.link { color: var(--primary); font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.muted { color: var(--muted); }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); border-radius: var(--radius); height: 38px; padding: 0 16px; cursor: pointer;
  font-weight: 700; font-size: 14px; white-space: nowrap;
  background: var(--surface-2); color: var(--text);
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hi); border-color: var(--primary-hi); }
.btn.play { background: var(--play); border-color: var(--play); color: #fff; }
.btn.play:hover { background: var(--play-hi); border-color: var(--play-hi); }
.btn.secondary { background: transparent; }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 16px; }
.btn.block { width: 100%; height: 44px; font-size: 15px; }
.btn svg { width: 18px; height: 18px; }
.btn .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: var(--radius); border: 0; background: transparent;
  color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.dot-badge {
  position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.side-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 800; line-height: 20px; text-align: center; }

/* ------------------------------------------------------------ forms */
.field { display: block; margin-bottom: 16px; }
.field > span, .field-label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
input, textarea, select {
  display: block; width: 100%; height: 42px; padding: 0 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--surface-3); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
:root[data-theme='dark'] input, :root[data-theme='dark'] textarea, :root[data-theme='dark'] select { background: var(--bg); border-color: var(--surface-3); }
textarea { resize: vertical; min-height: 92px; padding: 10px 12px; height: auto; line-height: 1.45; }
select { padding-right: 34px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
input.invalid, select.invalid { border-color: var(--bad); }
input[type='checkbox'], input[type='radio'], input[type='range'], input[type='color'] { height: auto; width: auto; box-shadow: none; }
.hint { display: block; margin-top: 6px; font-size: 13px; color: var(--faint); }
.hint.bad { color: var(--bad); }
.hint.good { color: var(--good); }
.form-msg { font-size: 14px; color: var(--bad); margin: 0 0 12px; }
.form-msg:empty { display: none; }
.form-msg.ok { color: var(--good); }
.form-error { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: var(--bad-soft); color: var(--bad); font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.form-error:empty { display: none; }
.dob { display: grid; grid-template-columns: 1.5fr 1fr 1.2fr; gap: 8px; }
.pw { position: relative; }
.pw input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); cursor: pointer; margin: 4px 0 18px; line-height: 1.45; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--primary); cursor: pointer; }
.check a { color: var(--primary); font-weight: 600; }
.check a:hover { text-decoration: underline; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 12px; background: var(--surface-3); cursor: pointer; transition: background .15s; }
.switch span::before { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ------------------------------------------------------------ logo */
.logo { font-weight: 800; font-size: 21px; letter-spacing: -0.03em; display: inline-flex; align-items: center; gap: 9px; }
.logo-mark { width: 22px; height: 22px; border-radius: 5px; background: currentColor; transform: rotate(-12deg); position: relative; flex: none; }
.logo-mark::after { content: ''; position: absolute; left: 7px; top: 7px; width: 8px; height: 8px; border-radius: 2px; background: var(--bg); }
.gate .logo-mark::after { background: #0c0d10; }

/* ------------------------------------------------------------ gate (logged out) */
.gate { min-height: 100vh; display: flex; flex-direction: column; position: relative; color: #f7f7f8; background: #0c0d10; isolation: isolate; }
.gate-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; }
.gate::before { content: ''; position: fixed; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(12,13,16,.72), rgba(12,13,16,.86) 60%, rgba(12,13,16,.95)); }
.gate-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 28px; }
.gate-top .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.14); color: #fff; }
.gate-top .btn:hover { background: rgba(255,255,255,.18); }
.gate-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px 48px; }
.gate-card {
  --surface: #1b1d21; --surface-2: #26282d; --surface-3: #3a3d44; --text: #f7f7f8; --muted: #b3b5bb; --faint: #8a8d95;
  --bad: #ff6b6b; --bad-soft: rgba(255, 90, 90, .12); --good: #3fd08d; --bg: #111216;
  width: 100%; max-width: 420px; background: rgba(27, 29, 33, .96); border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px; padding: 30px 30px 26px; box-shadow: 0 24px 60px rgba(0,0,0,.45); color: var(--text);
}
.gate-card input, .gate-card select { background: #111216; border-color: #3a3d44; color: #f7f7f8; }
.gate-card h1 { font-size: 26px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.gate-sub { color: var(--muted); margin: 0 0 22px; text-align: center; font-size: 15px; }
.gate-card .form-top { margin-top: 20px; }
.gate-alt { text-align: center; color: var(--muted); font-size: 14px; margin: 18px 0 0; }
.gate-alt a, .gate-alt button { color: #7d9bff; font-weight: 700; }
.gate-alt a:hover, .gate-alt button:hover { text-decoration: underline; text-underline-offset: 3px; }
.gate-divider { height: 1px; background: rgba(255,255,255,.08); margin: 20px -30px 0; }
.gate-card .check a { color: #7d9bff; }
.gate-foot { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; padding: 18px 16px 24px; font-size: 13px; color: rgba(255,255,255,.55); }
.gate-foot a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.gate-note { text-align: center; }
.gate-note .big-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; background: rgba(51, 95, 255, .16); color: #7d9bff; }
.gate-note .big-icon.ok { background: rgba(0, 176, 111, .16); color: #3fd08d; }
.gate-note .big-icon.bad { background: rgba(255, 90, 90, .14); color: #ff6b6b; }
.gate-note .big-icon svg { width: 28px; height: 28px; }
.gate-note p { color: var(--muted); margin: 0 0 20px; }
.gate-note p b { color: var(--text); }
.forgot-row { display: flex; justify-content: center; margin-top: 14px; }
.forgot-row a { font-size: 14px; color: #7d9bff; font-weight: 600; }
.forgot-row a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------ shell */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top); z-index: 40;
  display: flex; align-items: center; gap: 6px; padding: 0 14px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
:root[data-theme='dark'] .topbar { background: #16171b; }
.topbar .logo { margin: 0 6px; }
.top-nav { display: flex; gap: 2px; margin-left: 14px; }
.top-nav a { padding: 8px 12px; border-radius: var(--radius); font-size: 15px; font-weight: 700; color: var(--muted); }
.top-nav a:hover { color: var(--text); background: var(--surface-2); }
.top-nav a.on { color: var(--text); }
.search { position: relative; flex: 1; max-width: 480px; margin: 0 auto; display: flex; align-items: center; }
.search > svg { position: absolute; left: 12px; color: var(--faint); width: 18px; height: 18px; pointer-events: none; }
.search input { padding-left: 40px; height: 40px; border-radius: 20px; background: var(--surface-2); border-color: transparent; }
:root[data-theme='dark'] .search input { background: var(--surface-2); border-color: transparent; }
.search input:focus { background: var(--surface); }
.search-pop {
  position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; max-height: 440px; overflow: auto; z-index: 60;
}
.search-pop .sp-head { font-size: 12px; font-weight: 800; color: var(--faint); padding: 8px 10px 4px; letter-spacing: .04em; }
.search-pop a { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 6px; }
.search-pop a:hover, .search-pop a.sel { background: var(--surface-2); }
.search-pop .mini-thumb { width: 36px; height: 36px; border-radius: 6px; overflow: hidden; flex: none; }
.search-pop small { color: var(--muted); display: block; font-size: 12px; }
.top-right { display: flex; align-items: center; gap: 2px; }
.menu-wrap { position: relative; }
.dropdown {
  position: absolute; right: 0; top: 46px; min-width: 200px; padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); z-index: 60;
}
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 6px; border: 0; background: none; cursor: pointer; font-size: 14px; font-weight: 600; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); }
.me-chip { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border-radius: 20px; font-size: 14px; margin-left: 4px; }
.me-chip:hover { background: var(--surface-2); }
.me-chip b { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar {
  position: fixed; top: var(--top); bottom: 0; left: 0; width: var(--side); z-index: 35;
  background: var(--bg); padding: 14px 10px; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto; transition: transform .18s;
}
:root[data-theme='dark'] .sidebar { background: #16171b; }
.side-me { display: flex; align-items: center; gap: 10px; padding: 6px 10px 14px; margin-bottom: 8px; font-weight: 700; border-bottom: 1px solid var(--line); }
.side-me .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar nav a { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: var(--radius); font-size: 15px; font-weight: 600; color: var(--muted); }
.sidebar nav a:hover { background: var(--surface-2); color: var(--text); }
.sidebar nav a.on { background: var(--surface-2); color: var(--text); font-weight: 700; }
.side-foot { margin-top: auto; font-size: 13px; color: var(--faint); padding: 12px; display: flex; align-items: center; gap: 8px; }
.side-foot i { width: 8px; height: 8px; border-radius: 50%; background: var(--play); display: inline-block; }
.scrim { position: fixed; inset: var(--top) 0 0 0; background: rgba(0,0,0,.4); z-index: 34; }
.notice { position: fixed; top: var(--top); left: 0; right: 0; z-index: 30; padding: 9px 16px; text-align: center; font-size: 14px; font-weight: 600; background: var(--primary-soft); color: var(--text); border-bottom: 1px solid var(--line); }
.notice button { margin-left: 8px; }
body.has-notice .main { padding-top: calc(var(--top) + 70px); }

.main { padding: calc(var(--top) + 28px) 40px 40px calc(var(--side) + 40px); max-width: calc(1360px + var(--side)); min-height: calc(100vh - 60px); }
.app-foot { margin-left: var(--side); padding: 22px 40px 32px; border-top: 1px solid var(--line); display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--faint); }
.app-foot a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
body.side-closed .sidebar { transform: translateX(-100%); }
body.side-closed .main { padding-left: 40px; }
body.side-closed .app-foot { margin-left: 0; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.page-head .head-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.home-head { display: flex; align-items: center; gap: 16px; margin-bottom: 30px; }
.home-head h1 { font-size: 30px; font-weight: 800; }
.home-head .handle { color: var(--muted); font-weight: 600; }
.section { margin-bottom: 38px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.section-head h2 { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.section-head h2 small { color: var(--muted); font-weight: 600; font-size: 15px; }
.section-head a { font-size: 14px; font-weight: 700; color: var(--muted); display: inline-flex; align-items: center; gap: 2px; }
.section-head a:hover { color: var(--text); }
.section-head a svg { width: 16px; height: 16px; }
.empty { color: var(--muted); padding: 40px 20px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* ------------------------------------------------------------ avatars */
.av { position: relative; display: inline-block; width: var(--s, 32px); height: var(--s, 32px); flex: none; }
.av canvas { width: 100%; height: 100%; border-radius: 50%; display: block; background: var(--surface-3); }
.av .st { position: absolute; right: 2%; bottom: 2%; width: 26%; height: 26%; min-width: 10px; min-height: 10px; border-radius: 50%; box-shadow: 0 0 0 2.5px var(--bg); }
.st.online { background: var(--online); }
.st.playing { background: var(--play); }
.st.offline { display: none; }

/* ------------------------------------------------------------ featured banner */
.banner { position: relative; display: block; border-radius: 12px; overflow: hidden; margin-bottom: 38px; background: var(--surface-2); }
.banner .cover { aspect-ratio: 21 / 8; }
.banner-body { position: absolute; inset: auto 0 0 0; padding: 28px 30px; background: linear-gradient(0deg, rgba(0,0,0,.78), rgba(0,0,0,0)); color: #fff; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.banner-body .label { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; opacity: .8; }
.banner-body h2 { font-size: 30px; font-weight: 800; margin: 2px 0 4px; }
.banner-body p { margin: 0; opacity: .88; max-width: 560px; }
.banner-body .meta { display: flex; gap: 16px; font-size: 14px; font-weight: 600; margin-top: 8px; opacity: .9; }
.banner-body .meta span { display: inline-flex; gap: 6px; align-items: center; }
.banner-body .meta svg { width: 16px; height: 16px; }

/* ------------------------------------------------------------ cover art */
.cover { position: relative; overflow: hidden; background: var(--surface-3); }
.cover canvas, .cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

/* ------------------------------------------------------------ game tiles */
.row-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(160px, 182px); gap: 18px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 24px 18px; }
.tile { display: block; min-width: 0; }
.tile .thumb { position: relative; }
.tile .cover { aspect-ratio: 1; border-radius: 10px; transition: transform .15s, box-shadow .15s; }
.tile:hover .cover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0,0,0,.22); }
.tile .t-title { font-weight: 700; margin-top: 9px; font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .t-meta { display: flex; gap: 12px; margin-top: 3px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tile .t-meta span { display: inline-flex; align-items: center; gap: 4px; }
.tile .t-meta svg { width: 14px; height: 14px; }
.tile .flag { position: absolute; top: 8px; left: 8px; z-index: 1; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 6px; background: rgba(0,0,0,.72); color: #fff; }
.tile .flag.live { background: var(--play); }
.tile .friends-in { position: absolute; bottom: 8px; left: 8px; z-index: 1; display: flex; }
.tile .friends-in .av { margin-right: -7px; }
.tile .friends-in .av canvas { box-shadow: 0 0 0 2px #fff; }

/* ------------------------------------------------------------ friends row */
.friend-row { display: flex; gap: 16px; overflow-x: auto; padding: 2px 2px 8px; }
.friend-bubble { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 84px; flex: none; text-align: center; }
.friend-bubble b { font-size: 13px; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-bubble small { font-size: 12px; font-weight: 600; color: var(--play); width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -5px; }
.friend-bubble:hover b { text-decoration: underline; text-underline-offset: 3px; }
.add-bubble { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.friend-bubble:hover .add-bubble { color: var(--text); background: var(--surface-3); }
.add-bubble svg { width: 28px; height: 28px; }

/* ------------------------------------------------------------ game page */
.game-top { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 32px; margin-bottom: 30px; }
.game-top .cover { aspect-ratio: 16 / 9; border-radius: 12px; }
.game-info h1 { font-size: 32px; font-weight: 800; line-height: 1.12; letter-spacing: -0.02em; }
.game-by { color: var(--muted); margin: 8px 0 12px; font-size: 15px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.game-by b { color: var(--text); }
.game-tagline { color: var(--muted); margin: 0 0 22px; }
.play-big { width: 100%; height: 58px; border-radius: 10px; }
.play-big svg { width: 30px; height: 30px; }
.game-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.vote-box { flex: 1; display: flex; align-items: center; gap: 4px; }
.vote-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: var(--radius); border: 0; background: var(--surface-2); cursor: pointer; font-size: 14px; font-weight: 700; color: var(--muted); }
.vote-btn:hover { color: var(--text); background: var(--surface-3); }
.vote-btn.on { color: #fff; background: var(--play); }
.vote-btn.on.down { background: var(--bad); }
.vote-btn svg { width: 17px; height: 17px; }
.vote-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin: 0 6px; min-width: 40px; }
.vote-bar i { display: block; height: 100%; background: var(--play); }
.fav-btn { background: var(--surface-2); }
.fav-btn.on { color: var(--gold); }
.fav-btn.on svg { fill: currentColor; }
.label-sm { font-size: 14px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { padding: 12px 16px; font-size: 15px; font-weight: 700; color: var(--muted); border: 0; background: none; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs .on { color: var(--text); border-bottom-color: var(--text); }
.desc { white-space: pre-wrap; max-width: 760px; line-height: 1.6; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 20px; margin-top: 30px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.stat-grid small { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-grid b { font-size: 17px; }

/* ------------------------------------------------------------ lists / cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.card + .card { margin-top: 16px; }
.card h3 { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.card .sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.person { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.person .who { flex: 1; min-width: 0; }
.person .who b, .person .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .who b:hover { text-decoration: underline; text-underline-offset: 3px; }
.person .who span { font-size: 13px; color: var(--muted); }
.person .who span.playing { color: var(--play); font-weight: 600; }
.person .acts { display: flex; gap: 6px; flex: none; }
.server { flex-direction: column; align-items: stretch; }
.server-head { display: flex; justify-content: space-between; align-items: center; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.chip { height: 34px; padding: 0 14px; border-radius: 17px; border: 0; background: var(--surface-2); font-size: 14px; font-weight: 700; cursor: pointer; color: var(--muted); }
.chip:hover { color: var(--text); background: var(--surface-3); }
.chip.on { background: var(--text); color: var(--bg); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 6px; vertical-align: middle; background: var(--surface-2); color: var(--muted); }
.badge.admin { background: var(--primary-soft); color: var(--primary); }
:root[data-theme='dark'] .badge.admin { color: #8ba5ff; }
.badge.banned { background: var(--bad-soft); color: var(--bad); }
.badge.hidden-g { color: var(--warn); }
.badge.live { background: color-mix(in srgb, var(--play) 16%, transparent); color: var(--play); }
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.badge svg { width: 12px; height: 12px; }
select.inline { width: auto; min-width: 170px; }

/* ------------------------------------------------------------ profile */
.profile-head { display: flex; gap: 24px; align-items: center; margin-bottom: 32px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.profile-head .who { flex: 1; min-width: 200px; }
.profile-head h1 { font-size: 30px; font-weight: 800; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-head .handle { color: var(--muted); font-weight: 600; }
.profile-stats { display: flex; gap: 24px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.profile-stats b { color: var(--text); margin-right: 4px; }
.presence-line { font-size: 14px; font-weight: 700; margin-top: 2px; }
.presence-line.playing { color: var(--play); }
.presence-line.online { color: var(--online); }
.presence-line.offline { color: var(--faint); }
.lock-note { display: flex; align-items: center; gap: 10px; color: var(--muted); }

/* ------------------------------------------------------------ settings */
.settings { display: grid; grid-template-columns: 210px minmax(0, 700px); gap: 36px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--top) + 28px); }
.settings-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); font-size: 15px; font-weight: 600; color: var(--muted); }
.settings-nav a:hover { background: var(--surface-2); color: var(--text); }
.settings-nav a.on { background: var(--surface-2); color: var(--text); font-weight: 700; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0; border-top: 1px solid var(--line); }
.opt:first-of-type { border-top: 0; }
.opt .o-text b { display: block; font-size: 15px; }
.opt .o-text small { color: var(--muted); font-size: 14px; }
.opt select { width: auto; min-width: 150px; }
.kv { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); font-size: 15px; }
.kv:first-of-type { border-top: 0; }
.kv > span { color: var(--muted); font-weight: 600; }
.kv > b { overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kv .acts { display: flex; gap: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); font-weight: 400; }
.avatar-editor { display: flex; gap: 22px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.avatar-editor .controls { flex: 1; min-width: 200px; }
.avatar-editor .controls .field-label { margin-top: 14px; }
.hue { -webkit-appearance: none; appearance: none; width: 100%; height: 10px; padding: 0; border-radius: 5px; border: 0;
  background: linear-gradient(90deg, hsl(0 50% 60%), hsl(60 50% 60%), hsl(120 50% 60%), hsl(180 50% 60%), hsl(240 50% 60%), hsl(300 50% 60%), hsl(359 50% 60%)); }
.hue::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 1px 3px rgba(0,0,0,.3); cursor: pointer; }
.hue::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 1px solid rgba(0,0,0,.25); cursor: pointer; }
.session { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 15px; }
.session:first-of-type { border-top: 0; }
.session .who { flex: 1; min-width: 0; }
.session small { display: block; color: var(--muted); font-size: 13px; }
.session .here { color: var(--play); font-size: 13px; font-weight: 700; }
.danger-card h3 { color: var(--bad); }
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 4px; }
.theme-pick button { border: 2px solid var(--line); border-radius: 10px; padding: 0; overflow: hidden; cursor: pointer; background: none; text-align: left; }
.theme-pick button.on { border-color: var(--primary); }
.theme-pick .sw { height: 64px; display: flex; gap: 6px; padding: 10px; }
.theme-pick .sw i { flex: 1; border-radius: 5px; }
.theme-pick b { display: block; padding: 8px 12px; font-size: 14px; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------ admin */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 30px; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.stat-tile small { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-tile b { display: block; font-size: 26px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.checks { list-style: none; margin: 0 0 30px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.checks li { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-top: 1px solid var(--line); font-size: 14px; }
.checks li:first-child { border-top: 0; }
.checks li i { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 800; color: #fff; margin-top: 1px; }
.checks li.ok i { background: var(--play); }
.checks li.todo i { background: var(--warn); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 800; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.cell-user small { display: block; color: var(--muted); }
.cell-game { display: flex; align-items: center; gap: 12px; min-width: 230px; }
.cell-game .cover { width: 60px; height: 34px; border-radius: 5px; flex: none; }
.row-acts { display: flex; gap: 2px; justify-content: flex-end; flex-wrap: nowrap; }
.row-acts .icon-btn { width: 32px; height: 32px; }
.row-acts .icon-btn svg { width: 17px; height: 17px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input { max-width: 360px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.seg label { display: block; cursor: pointer; border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.seg label:hover { border-color: var(--surface-3); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, transparent); }
.seg b { display: block; font-size: 14px; }
.seg small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 2px; }
.src-panel { background: var(--surface-2); border-radius: 10px; padding: 16px 16px 2px; margin-bottom: 16px; }
.src-panel .field input, .src-panel .field select { background: var(--surface); }
:root[data-theme='dark'] .src-panel .field input, :root[data-theme='dark'] .src-panel .field select { background: var(--bg); }
.help { font-size: 13px; color: var(--muted); margin: -4px 0 14px; line-height: 1.5; }
.help code, .kv code, .checks code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; color: var(--text); }
.folder-row { display: flex; gap: 8px; align-items: flex-start; }
.folder-row select { flex: 1; }
.link-box { display: flex; gap: 8px; margin-top: 12px; }
.link-box input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* ------------------------------------------------------------ modal */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; animation: fade .12s; }
.modal { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.modal.wide { width: min(880px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h3 { font-size: 18px; font-weight: 800; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.game-form { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 24px; }
.game-form .preview { position: sticky; top: 76px; align-self: start; }
.check-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type='color'] { width: 44px; height: 42px; padding: 3px; flex: none; border-radius: var(--radius); border: 1px solid var(--surface-3); background: var(--surface); cursor: pointer; }
@keyframes fade { from { opacity: 0; } }

/* ------------------------------------------------------------ toasts */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { background: #26282d; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; animation: fade .15s; max-width: 380px; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.toast.bad { background: var(--bad); }
.toast.good { background: var(--play); }

.skeleton { background: var(--surface-2); border-radius: var(--radius); }

/* ------------------------------------------------------------ legal pages */
.legal { background: var(--bg); }
.legal-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; }
:root[data-theme='dark'] .legal-top { background: #16171b; }
.legal-top nav { display: flex; gap: 4px; }
.legal-top nav a { padding: 8px 12px; border-radius: var(--radius); font-weight: 700; color: var(--muted); }
.legal-top nav a:hover, .legal-top nav a.on { color: var(--text); background: var(--surface-2); }
.legal-body { max-width: 760px; margin: 0 auto; padding: 44px 24px 24px; line-height: 1.65; font-size: 16px; }
.legal-body h1 { font-size: 36px; font-weight: 800; }
.legal-date { color: var(--muted); margin: 6px 0 26px; }
.legal-body h2 { font-size: 21px; font-weight: 800; margin: 36px 0 8px; scroll-margin-top: 80px; }
.legal-body ul { padding-left: 22px; }
.legal-body li { margin-bottom: 6px; }
.legal-body a { color: var(--primary); font-weight: 600; }
.toc { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin: 24px 0 8px; font-size: 15px; }
.toc a { color: var(--text) !important; font-weight: 600; }
.toc a:hover { color: var(--primary) !important; }
.legal-foot { max-width: 760px; margin: 0 auto; padding: 24px 24px 48px; display: flex; gap: 10px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
.legal-foot a:hover { color: var(--text); text-decoration: underline; }

/* ------------------------------------------------------------ compact */
.compact .grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 18px 12px; }
.compact .row-scroll { grid-auto-columns: minmax(128px, 146px); }
.compact .section { margin-bottom: 28px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .sidebar { transform: translateX(-100%); }
  body.side-open .sidebar { transform: none; box-shadow: 0 0 30px rgba(0,0,0,.3); }
  .main { padding-left: 28px; padding-right: 28px; }
  body.side-closed .main { padding-left: 28px; }
  .app-foot { margin-left: 0; padding-left: 28px; }
  .game-top { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .top-nav, .me-chip b { display: none; }
  .settings { grid-template-columns: 1fr; gap: 20px; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .settings-nav a { white-space: nowrap; }
  .game-form { grid-template-columns: 1fr; }
  .game-form .preview { position: static; max-width: 190px; }
  .banner .cover { aspect-ratio: 16 / 9; }
  .seg { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --top: 56px; }
  .topbar { gap: 2px; padding: 0 6px; }
  .topbar .logo { font-size: 0; gap: 0; margin: 0 8px; }
  .main { padding: calc(var(--top) + 20px) 16px 40px; }
  body.side-closed .main { padding-left: 16px; }
  .app-foot { padding: 20px 16px 28px; }
  .gate-top { padding: 12px 16px; }
  .gate-card { padding: 24px 20px 22px; }
  .gate-divider { margin: 20px -20px 0; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr auto; }
  .kv > span { grid-column: 1 / -1; margin-bottom: -8px; }
  .opt { flex-wrap: wrap; }
  .people { grid-template-columns: 1fr; }
  .toasts { left: 16px; right: 16px; align-items: stretch; }
  .top-right a[href='#/friends/requests'] { display: none; }
  .page-head h1, .home-head h1, .profile-head h1 { font-size: 24px; }
  .banner-body { padding: 18px; }
  .banner-body h2 { font-size: 22px; }
  .banner-body p { display: none; }
  .toc { grid-template-columns: 1fr; }
  .legal-body h1 { font-size: 28px; }
  .legal-top { padding: 12px 16px; }
}

/* ranks a game keeps on the account (written by game servers only) */
.rank-list { display: flex; flex-wrap: wrap; gap: 12px; }
.rank-card { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; min-width: 200px; border-left: 3px solid var(--accent); }
.rank-card .rank-num { font-size: 22px; font-weight: 700; color: var(--accent); }
.rank-card small { opacity: 0.7; }
