:root {
  --bg: #0B0F17; --panel: #121826; --panel2: #182033; --inset: #0E131E; --line: #243049; --line2: #2E3B58;
  --text: #E8EDF7; --soft: #C9D2E3; --muted: #9AA6BF; --faint: #6B7894;
  --accent: #4CC2FF; --accent-ink: #06121C; --ok: #4FD1A5; --warn: #FFB547; --bad: #FF7A7A; --violet: #B794F6;
  --bad-bg: #3A1A20; --warn-bg: #2A2213; --ok-bg: #12291F; --acc-bg: #10273A; --vio-bg: #251C3A;
  --r: 12px; --r-sm: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- layout */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: #0D121C; border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: baseline; gap: 10px; padding: 4px 10px 18px; }
.logo { font-weight: 800; font-size: 26px; letter-spacing: .5px; }
.logo span { color: var(--accent); }
.brand small { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; font-size: 11px; }
.nav-h { color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--soft); font-weight: 500; }
.nav a:hover { background: var(--panel); text-decoration: none; }
.nav a.on { background: var(--panel2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav a svg { flex: none; opacity: .85; }
.nav .count { margin-left: auto; background: var(--warn); color: #1d1405; font-size: 11px; font-weight: 800; border-radius: 10px; padding: 1px 7px; }
.nav .count.bad { background: var(--bad); color: #250a0d; }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; flex-direction: column; gap: 8px; }
.side-foot b { color: var(--text); }
.main { padding: 26px 32px 60px; min-width: 0; }
.page-h { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-h h1 { font-size: 24px; margin: 0; letter-spacing: -.2px; }
.page-h .sub { color: var(--muted); }
.page-h .grow { flex: 1; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ---------- surfaces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card + .card { margin-top: 14px; }
.card h2 { margin: 0 0 12px; font-size: 15px; letter-spacing: .2px; }
.card h2 .sub { color: var(--muted); font-weight: 500; margin-left: 6px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.pre { white-space: pre-wrap; word-break: break-word; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; color: var(--text); }
a.stat:hover { border-color: var(--line2); text-decoration: none; }
.stat .k { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat .v { font-size: 26px; font-weight: 750; letter-spacing: -.4px; }
.stat .d { color: var(--muted); font-size: 12.5px; }
.stat.hot { border-color: #5a4515; background: linear-gradient(var(--warn-bg), var(--panel)); }
.stat.hot .v { color: var(--warn); }
.stat.alarm { border-color: #5c262e; background: linear-gradient(var(--bad-bg), var(--panel)); }
.stat.alarm .v { color: var(--bad); }

/* ---------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3c4c70; background: #1d2740; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--bad-bg); border-color: #6b2b35; color: #ffb3b3; }
.btn.danger:hover { background: #4a1f27; }
.btn.solid-danger { background: var(--bad); border-color: var(--bad); color: #2a0b10; }
.btn.ok { background: var(--ok-bg); border-color: #24563f; color: #9ff0cf; }
.btn.warn { background: var(--warn-bg); border-color: #5a4515; color: #ffd38a; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--soft); }
.btn.ghost:hover { background: var(--panel2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.input, select.input, textarea.input { width: 100%; height: 38px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line2); background: var(--inset); }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px #4cc2ff26; }
label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--soft); }
label.f .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
label.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }
label.check.disabled { opacity: .5; cursor: not-allowed; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 520px; }
.search svg { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.search .input { padding-left: 36px; }
.seg { display: inline-flex; background: var(--inset); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); font-weight: 600; padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--panel2); color: var(--text); box-shadow: 0 1px 0 #0006; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line2); border-radius: 12px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(20px); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 650; background: var(--panel2); color: var(--soft); border: 1px solid var(--line); white-space: nowrap; }
.chip.bad { background: var(--bad-bg); color: #ffb3b3; border-color: #5c262e; }
.chip.warn { background: var(--warn-bg); color: #ffd38a; border-color: #5a4515; }
.chip.ok { background: var(--ok-bg); color: #9ff0cf; border-color: #24563f; }
.chip.acc { background: var(--acc-bg); color: #9edcff; border-color: #1f4b6b; }
.chip.vio { background: var(--vio-bg); color: #d8c3ff; border-color: #4a3874; }
button.chip { cursor: pointer; }
button.chip.on { background: var(--acc-bg); color: #9edcff; border-color: #2c6a95; }

/* ---------- lists & tables */
.list { display: flex; flex-direction: column; }
.item { display: flex; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.item:last-child { border-bottom: 0; }
a.item { color: var(--text); }
a.item:hover { background: #ffffff05; text-decoration: none; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 650; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item .text { color: var(--soft); margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.item .meta { color: var(--muted); font-size: 12.5px; margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.item.dim .text { color: var(--muted); }
.thumb { width: 96px; height: 54px; border-radius: 6px; object-fit: cover; background: var(--inset); flex: none; border: 1px solid var(--line); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #ffffff05; }
.empty { text-align: center; color: var(--muted); padding: 42px 16px; }
.empty b { display: block; color: var(--soft); font-size: 15px; margin-bottom: 4px; }
.more { display: flex; justify-content: center; padding: 14px 0 0; }

/* ---------- avatars */
.av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #0b0f17; flex: none; overflow: hidden; background: #6C7BFF; font-size: 14px; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.lg { width: 84px; height: 84px; font-size: 32px; border: 4px solid var(--bg); }
.av.sm { width: 26px; height: 26px; font-size: 11px; }

/* ---------- player header */
.phead { border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); overflow: hidden; margin-bottom: 16px; }
.phead .banner { height: 120px; background: repeating-linear-gradient(135deg, #141B2B 0 16px, #18213A 16px 32px); background-size: cover; background-position: center; }
.phead .inner { padding: 0 20px 18px; display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; margin-top: -42px; }
.phead .who { flex: 1; min-width: 220px; padding-bottom: 4px; }
.phead h1 { margin: 0; font-size: 24px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; color: var(--muted); font-weight: 650; padding: 10px 14px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs button .n { color: var(--faint); margin-left: 4px; font-weight: 600; }

/* ---------- content preview */
.quote { background: var(--inset); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.55; }
.evidence { border-radius: 10px; border: 1px solid var(--line); max-height: 420px; width: auto; margin-top: 10px; cursor: zoom-in; }
.thread { border-left: 2px solid var(--line); padding-left: 12px; display: flex; flex-direction: column; gap: 8px; }
.thread .c { color: var(--soft); }
.thread .c.me { background: var(--warn-bg); border-radius: 8px; padding: 6px 10px; margin-left: -6px; border: 1px solid #5a4515; }
.thread .c b { color: var(--text); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }

/* ---------- media grid */
.media { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.tile button.pic { border: 0; padding: 0; background: var(--inset); cursor: zoom-in; aspect-ratio: 16 / 10; }
.tile button.pic img { width: 100%; height: 100%; object-fit: cover; }
.tile.removed button.pic img { opacity: .35; filter: grayscale(1); }
.tile .cap { padding: 8px 10px; display: flex; gap: 8px; align-items: center; font-size: 12.5px; }

/* ---------- chart */
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; height: 120px; padding-top: 8px; }
.bars .b { display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; justify-content: flex-start; position: relative; }
.bars .seg1 { background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.bars .seg2 { background: #2b6c93; border-radius: 3px 3px 0 0; }
.bars .seg3 { background: var(--warn); border-radius: 3px; }
.bars-x { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; color: var(--faint); font-size: 11px; text-align: center; margin-top: 6px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12.5px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- overlays */
.toast-wrap { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 36px); }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 4px solid var(--accent); border-radius: 10px; padding: 11px 16px; box-shadow: 0 10px 30px #0008; animation: pop .16s ease-out; max-width: 420px; }
.toast.bad { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.scrim { position: fixed; inset: 0; background: #04070dcc; display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; box-shadow: 0 30px 80px #000a; }
.modal.wide { width: min(980px, 100%); }
.modal .mh { padding: 18px 20px 0; display: flex; align-items: flex-start; gap: 12px; }
.modal .mh h3 { margin: 0; font-size: 18px; flex: 1; }
.modal .mh p { margin: 4px 0 0; color: var(--muted); }
.modal .mb { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal .mf { padding: 14px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal img.full { width: 100%; border-radius: 10px; }
.secret { font-family: var(--mono); font-size: 18px; letter-spacing: 1px; background: var(--inset); border: 1px dashed var(--line2); border-radius: 10px; padding: 14px; text-align: center; word-break: break-all; user-select: all; }
.callout { border: 1px solid #1f4b6b; background: var(--acc-bg); border-radius: 10px; padding: 12px 14px; color: #cfeaff; }
.callout.warn { border-color: #5a4515; background: var(--warn-bg); color: #ffe2b0; }
.callout.bad { border-color: #5c262e; background: var(--bad-bg); color: #ffd0d0; }
ol.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--soft); }
ol.steps b { color: var(--text); }

/* ---------- auth screens */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 500px at 50% -10%, #12304a 0%, transparent 60%), var(--bg); }
.auth .card { width: min(420px, 100%); padding: 28px; }
.auth .logo { font-size: 34px; text-align: center; }
.auth p.lead { color: var(--muted); text-align: center; margin: 4px 0 22px; }
.auth form { display: flex; flex-direction: column; gap: 14px; }
.err { color: #ffb3b3; background: var(--bad-bg); border: 1px solid #5c262e; padding: 9px 12px; border-radius: 8px; }
.loading { display: grid; place-items: center; padding: 60px; color: var(--muted); }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
mark { background: #4cc2ff40; color: var(--text); border-radius: 3px; padding: 0 2px; }

/* ---------- mobile */
.topbar { display: none; }
@media (max-width: 960px) {
  .split { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 40; transform: translateX(-100%); transition: transform .18s; box-shadow: 20px 0 60px #000a; }
  .app.nav-open .side { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: #0009; z-index: 30; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: #0d121ceb; backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 10px 16px; }
  .topbar .logo { font-size: 20px; }
  .main { padding: 18px 16px 60px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .page-h h1 { font-size: 20px; }
  .item { gap: 10px; }
  .thumb { width: 72px; height: 44px; }
  .hide-sm { display: none !important; }
}

/* ---------- badges (same colours as the PS3 app) */
.badge-owner { background: #3a2a0a; color: #ffd36b; border-color: #6b5214; }
.badge-admin { background: #3a1420; color: #ff9db1; border-color: #6b2639; }
.badge-donator { background: #102c22; color: #7fe8bf; border-color: #1f5a44; }
.badge-promoter { background: #2a1840; color: #d2b0ff; border-color: #4f3478; }
.badge-beta { background: #0f2638; color: #8fd3ff; border-color: #1e4a6b; }
