:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #0a0a0a;
  --surface-2: #121212;
  --surface-3: #1a1a1a;
  --sunken: #050505;
  --line: #242424;
  --line-strong: #333333;
  --line-soft: #1b1b1b;
  --ink: #ededed;
  --ink-2: #a1a1a1;
  --ink-3: #7d7d7d;
  --red: #bd1529;
  --red-bright: #e1263d;
  --green: #199e70;
  --amber: #c98500;
  --blue: #3987e5;
  --role-admin: #f07886;
  --role-mod: #c46bc4;
  --role-valvoja: #e9a8e9;
  --role-harkka: #d4843d;
  --role-tournament-broadcaster: #72c9ee;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 44px;

  --text-xs: 11px;
  --text-sm: 12px;
  --text-md: 13px;
  --text-lg: 15px;
  --text-xl: 18px;
  --text-2xl: 22px;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --z-sticky: 10;
  --z-drawer-backdrop: 30;
  --z-drawer: 40;
  --z-tooltip: 50;
  --z-toast: 60;

  --ease: cubic-bezier(.32, .72, 0, 1);
  --speed: 150ms;

  font-family: Inter, Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-size: var(--text-md); line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.console-visible { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { transition: border-color var(--speed) var(--ease), background-color var(--speed) var(--ease), color var(--speed) var(--ease), opacity var(--speed) var(--ease); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--red-bright); outline-offset: 2px; border-radius: var(--radius-sm); }
:where(h1, h2, h3) { text-wrap: balance; }
button:disabled { opacity: .4; cursor: not-allowed; }

.shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: var(--s5) var(--s3) var(--s4); background: var(--bg); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: var(--s3); min-height: 44px; padding: 0 var(--s2) var(--s5); margin-bottom: var(--s3); }
.brand-logo { width: 32px; height: 32px; object-fit: contain; flex: 0 0 auto; }
.brand strong, .brand small { display: block; }
.brand strong { color: var(--ink); font-size: var(--text-md); font-weight: 600; letter-spacing: -.01em; }
.brand small { margin-top: 1px; color: var(--ink-3); font-size: var(--text-xs); }
.sidebar nav { display: grid; align-content: start; flex: 1; min-height: 0; overflow-y: auto; gap: var(--s3); scrollbar-width: thin; }
.sidebar nav button { display: flex; align-items: center; min-height: 34px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); text-align: left; padding: var(--s2) var(--s3); cursor: pointer; font-size: var(--text-md); font-weight: 450; }
.sidebar nav button:hover { background: var(--surface-2); color: var(--ink); }
.sidebar nav button.active { background: var(--surface-3); color: var(--ink); font-weight: 550; }
.nav-group { min-width: 0; }
nav .nav-group-toggle { justify-content: space-between; width: 100%; color: var(--ink-3); font-size: var(--text-xs); font-weight: 650; letter-spacing: .02em; }
.nav-chevron { font-size: var(--text-md); transition: transform var(--speed) var(--ease); }
.nav-group-toggle[aria-expanded="false"] .nav-chevron { transform: rotate(-90deg); }
.nav-group-items { display: grid; gap: 1px; margin-left: var(--s2); padding-left: var(--s2); border-left: 1px solid var(--line); }
.nav-group-items .nav-page { width: 100%; }
.nav-page-wrap { min-width: 0; }
.profile { margin-top: auto; padding: var(--s4) var(--s2) 0; border-top: 1px solid var(--line); }
.profile-row { display: flex; gap: var(--s3); align-items: center; }
.profile img, .avatar { border-radius: 50%; background: var(--surface-3); object-fit: cover; }
.profile img { width: 32px; height: 32px; }
.profile-name { max-width: 140px; overflow: hidden; color: var(--ink); font-size: var(--text-sm); font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.profile-role { margin-top: 1px; font-size: var(--text-xs); font-weight: 600; }
.profile-role.ADMIN { color: var(--role-admin); }
.profile-role.MOD { color: var(--role-mod); }
.profile-role.VALVOJA { color: var(--role-valvoja); }
.profile-role.HARKKA { color: var(--role-harkka); }
.profile-role.TOURNAMENT_BROADCASTER { color: var(--role-tournament-broadcaster); }
.logout { min-height: 30px; border: 0; background: transparent; color: var(--ink-3); font-size: var(--text-xs); padding: var(--s3) 0 0; cursor: pointer; text-align: left; }
.logout:hover { color: var(--ink); }

.content { min-width: 0; padding: var(--s6) var(--s7) 72px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s5); padding-bottom: var(--s4); margin-bottom: var(--s5); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; color: var(--ink); font-size: var(--text-2xl); font-weight: 600; letter-spacing: -.022em; }
.topbar p { margin: var(--s1) 0 0; color: var(--ink-2); font-size: var(--text-md); max-width: 68ch; }
.topbar-actions { display: flex; align-items: center; gap: var(--s2); flex-shrink: 0; }
#topbar-slot { display: flex; align-items: center; gap: var(--s2); }
#topbar-slot:empty { display: none; }
.eyebrow { margin: 0; color: var(--ink-3); font-size: var(--text-sm); font-weight: 500; }

.icon-button, .console-open { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.icon-button:hover, .console-open:hover { border-color: var(--line-strong); background: var(--surface-2); color: var(--ink); }
.icon-button:active, .console-open:active { background: var(--sunken); }
.console-open svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.profiler-results { display: grid; gap: 16px; max-height: 65vh; overflow: auto; }
.profiler-result { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: var(--surface-2); }
.profiler-result h3 { margin: 0; }
.profiler-output { max-height: 320px; margin: 12px 0 0; overflow: auto; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--sunken); color: var(--ink-2); font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.error-text { color: var(--role-admin); }

.segmented { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.segment { min-height: 28px; padding: 0 var(--s3); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-3); font-size: var(--text-sm); font-weight: 500; cursor: pointer; white-space: nowrap; }
.segment:hover { color: var(--ink); }
.segment.is-active { background: var(--surface-3); color: var(--ink); }

.view { display: grid; gap: var(--s4); }
.view > *, #analytics-content > *, .panel, .table-wrap { min-width: 0; }
.content.wiki-page { padding-top: 44px; }
.wiki-shell { width: min(100%, 880px); margin: 0 auto; }
.wiki-breadcrumb { display: flex; align-items: center; gap: 9px; margin-bottom: 21px; color: var(--ink-3); font-size: var(--text-sm); }
.wiki-breadcrumb a { color: var(--ink-2); text-decoration: none; }
.wiki-breadcrumb a:hover { color: var(--ink); text-decoration: underline; }
.wiki-home-header { margin-bottom: 30px; }
.wiki-home-header h1, .wiki-article .wiki-title { margin: 0 0 10px; color: var(--ink); font-size: clamp(28px, 3vw, 34px); line-height: 1.2; font-weight: 650; letter-spacing: -.03em; }
.wiki-home-header p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.6; }
.wiki-home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.wiki-topic { display: grid; align-content: start; gap: 10px; min-height: 162px; padding: 19px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; }
.wiki-topic:hover { border-color: #6b3a43; background: var(--surface-2); }
.wiki-topic-number { color: var(--red-bright); font-size: var(--text-xs); font-weight: 700; letter-spacing: .08em; }
.wiki-topic-title { display: flex; justify-content: space-between; gap: 8px; font-size: 17px; font-weight: 620; line-height: 1.3; }
.wiki-topic-title span { color: var(--ink-3); font-size: 16px; font-weight: 400; }
.wiki-topic-description { color: var(--ink-2); font-size: var(--text-md); line-height: 1.5; }
.wiki-article { color: #d5d5d5; font-size: 15px; line-height: 1.75; overflow-wrap: anywhere; }
.wiki-article h1, .wiki-article h2 { color: var(--ink); scroll-margin-top: 24px; }
.wiki-article h1:focus, .wiki-article h2:focus { outline: none; }
.wiki-article h2 { margin: 36px 0 13px; padding-top: 29px; border-top: 1px solid var(--line-strong); font-size: 22px; line-height: 1.3; font-weight: 620; letter-spacing: -.015em; }
.wiki-meta { margin: 0 0 var(--s5); color: var(--ink-3); font-size: var(--text-sm); }
.wiki-callout {
  --wiki-callout-accent: var(--blue);
  --wiki-callout-bg: #111b29;
  --wiki-callout-label: #a9cbfa;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: var(--s3);
  padding: 13px 16px;
  margin: 18px 0 23px;
  border-left: 3px solid var(--wiki-callout-accent);
  border-radius: 4px;
  background: var(--wiki-callout-bg);
  color: #e3e6eb;
}
.wiki-callout--check { --wiki-callout-accent: #e0a839; --wiki-callout-bg: #231e14; --wiki-callout-label: #f0c46c; }
.wiki-callout--escalate { --wiki-callout-accent: var(--red-bright); --wiki-callout-bg: #29191d; --wiki-callout-label: #f08b97; }
.wiki-callout--done { --wiki-callout-accent: #42b889; --wiki-callout-bg: #14251d; --wiki-callout-label: #83d1af; }
.wiki-callout-icon { display: grid; width: 18px; height: 18px; place-items: center; margin-top: 1px; color: var(--wiki-callout-accent); }
.wiki-callout-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.wiki-callout-body { min-width: 0; }
.wiki-callout-label { display: block; margin: 0 0 2px; color: var(--wiki-callout-label); font-size: var(--text-xs); font-weight: 650; letter-spacing: .035em; }
.wiki-callout p { max-width: none; margin: 0; }
.wiki-content p { margin: 0 0 17px; }
.wiki-content ul, .wiki-content ol { margin: 0 0 22px; padding-left: 24px; }
.wiki-content li { padding-left: 2px; margin: 6px 0; }
.wiki-content strong { color: #f3f3f3; font-weight: 620; }
.wiki-content code { padding: 1px 5px; border-radius: var(--radius-sm); background: var(--surface-3); color: #fff; font-family: var(--mono); font-size: .92em; }
.wiki-steps li::marker { color: #f08b97; font-weight: 700; }
.wiki-table-wrap { max-width: 100%; margin: 17px 0 24px; overflow-x: auto; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.wiki-table { width: 100%; min-width: 590px; border-collapse: separate; border-spacing: 0; }
.wiki-table-wrap--compact { display: inline-block; width: auto; max-width: 100%; margin: 12px 0 13px; vertical-align: top; }
.wiki-table--compact { width: auto; min-width: 0; }
.wiki-table--compact th, .wiki-table--compact td { padding: 7px 10px; line-height: 1.4; }
.wiki-table--compact th { color: var(--ink-3); font-weight: 500; }
.wiki-table--compact th:first-child, .wiki-table--compact td:first-child { min-width: 0; }
.wiki-table--compact td { color: var(--ink); font-weight: 550; }
.wiki-table th { padding: 9px 12px; border-bottom: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); font-size: var(--text-md); font-weight: 600; text-align: left; }
.wiki-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); color: #d2d2d2; font-size: var(--text-md); line-height: 1.55; vertical-align: top; }
.wiki-table th:first-child, .wiki-table td:first-child { min-width: 92px; white-space: nowrap; }
.wiki-table tr:last-child td { border-bottom: 0; }
.wiki-table td:first-child { color: var(--ink); font-weight: 600; }

.toolbar { display: flex; gap: var(--s3); align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.toolbar .group { display: flex; gap: var(--s2); align-items: flex-end; flex-wrap: wrap; }
.field { display: grid; gap: 5px; }
.field > span { color: var(--ink-3); font-size: var(--text-xs); font-weight: 500; }
.input, select, textarea { min-height: 32px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); padding: var(--s2) var(--s3); outline: none; }
.input::placeholder, textarea::placeholder { color: var(--ink-3); }
.input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
.input:focus, select:focus, textarea:focus { border-color: #4a4a4a; background: var(--surface-2); }
.input { min-width: 260px; }
select { min-width: 150px; cursor: pointer; }

.button, .secondary-button, .discord-button { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: var(--s2) var(--s4); color: #fff; font-size: var(--text-sm); font-weight: 550; text-decoration: none; cursor: pointer; white-space: nowrap; }
.button { background: var(--red); }
.button:hover { background: #d21b32; }
.button:active { background: #a81124; }
.button.danger { border-color: #6d222d; background: #3d1119; color: #f5a4ad; }
.button.danger:hover { background: #4d151f; }
.button.small, .secondary-button.small { min-height: 26px; padding: 0 var(--s2); font-size: var(--text-xs); }
.secondary-button { border-color: var(--line); background: var(--surface); color: var(--ink-2); }
.secondary-button:hover { border-color: var(--line-strong); background: var(--surface-2); color: var(--ink); }
.secondary-button:active { background: var(--sunken); }
.link-button { border: 0; background: transparent; padding: 0; color: var(--ink); font-size: inherit; font-weight: 550; text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.link-button:hover { text-decoration-color: var(--red-bright); }
.discord-button { width: 100%; margin-top: var(--s5); padding: var(--s3) var(--s5); background: #5865f2; }
.discord-button:hover { background: #6874f5; }

.table-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.table-pagination { display: flex; align-items: center; justify-content: center; gap: var(--s3); padding: var(--s4); color: var(--ink-3); font-size: var(--text-sm); }
table { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; }
th { position: sticky; top: 0; z-index: var(--z-sticky); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); background: var(--surface); color: var(--ink-3); text-align: left; font-size: var(--text-xs); font-weight: 550; white-space: nowrap; }
td { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line-soft); font-size: var(--text-md); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.numeric, th.numeric { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { min-width: 220px; max-width: 420px; overflow-wrap: anywhere; white-space: normal; }
.user-cell { display: flex; gap: var(--s3); align-items: center; }
.avatar { width: 28px; height: 28px; flex: 0 0 auto; }
.primary { color: var(--ink); font-weight: 550; }
.subtle { display: block; margin-top: 1px; color: var(--ink-3); font-size: var(--text-xs); }
.subtle.mono { font-family: var(--mono); letter-spacing: -.02em; }
.badge { display: inline-flex; align-items: center; padding: 2px var(--s2); border: 1px solid; border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 550; white-space: nowrap; }
.badge.ADMIN { border-color: #5e2830; background: #261417; color: var(--role-admin); }
.badge.MOD { border-color: #5f2f5f; background: #221022; color: var(--role-mod); }
.badge.VALVOJA { border-color: #6d526d; background: #251b25; color: var(--role-valvoja); }
.badge.HARKKA { border-color: #694322; background: #281a0e; color: var(--role-harkka); }
.badge.TOURNAMENT_BROADCASTER { border-color: #285469; background: #10212a; color: var(--role-tournament-broadcaster); }
.badge.danger { border-color: #642029; background: #241216; color: #ef909b; }
.badge.ok { border-color: #245040; background: #0e1d18; color: #6fcda5; }
.badge.info { border-color: #24486b; background: #0d1720; color: #7fbbe6; }
.badge.admin { border-color: #5a4a26; background: #1c170e; color: #ddb96a; }
.badge.neutral { border-color: var(--line-strong); background: var(--surface-2); color: var(--ink-2); }
.badge.source-discord { border-color: #3c45a0; background: #14162c; color: #aab2ff; }
.badge.source-minecraft { border-color: #2f5c3a; background: #101d14; color: #86ca93; }
.status { display: inline-flex; align-items: center; color: var(--ink); white-space: nowrap; }
.status.off { color: var(--ink-3); }
.actions { display: flex; gap: var(--s1); white-space: nowrap; }

.panel { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: var(--s5); }
.overlay-frame-shell { overflow: hidden; height: calc(100vh - 150px); min-height: 560px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #050508; }
.overlay-frame { display: block; width: 100%; height: 100%; border: 0; background: #050508; }
.panel h2 { margin: 0; color: var(--ink); font-size: var(--text-lg); font-weight: 600; letter-spacing: -.01em; }
.panel p.caption { margin: var(--s1) 0 0; color: var(--ink-3); font-size: var(--text-xs); }
.empty { padding: 56px var(--s4); color: var(--ink-2); text-align: center; }
.empty strong { display: block; margin-bottom: var(--s2); color: var(--ink); font-size: var(--text-md); font-weight: 550; }
.empty.compact { padding: var(--s5) var(--s3); }

.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.stat { display: grid; align-content: start; gap: var(--s2); padding: var(--s4) var(--s5); background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.stat-label { display: flex; align-items: center; gap: var(--s2); color: var(--ink-2); font-size: var(--text-xs); font-weight: 500; }
.stat-value { color: var(--ink); font-size: var(--text-2xl); font-weight: 600; line-height: 1.1; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.stat-caption { color: var(--ink-3); font-size: var(--text-xs); }
.status-now { display: grid; gap: var(--s2); }
.status-now .caption { margin: 0; color: var(--ink-3); font-size: var(--text-xs); font-weight: 500; }
.stat-strip.is-compact .stat { padding: var(--s3) var(--s4); gap: var(--s1); }
.stat-strip.is-compact .stat-value { font-size: var(--text-lg); }

.skeleton { display: grid; gap: var(--s3); padding: var(--s5); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.skeleton i { display: block; height: 12px; border-radius: var(--radius-sm); background: linear-gradient(90deg, #151515, #212121, #151515); background-size: 200% 100%; animation: shimmer 1400ms linear infinite; }
.skeleton i:nth-child(1) { width: 40%; }
.skeleton i:nth-child(3) { width: 78%; }
.skeleton i:nth-child(4) { width: 62%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.is-refreshing { opacity: .45; pointer-events: none; transition: opacity var(--speed) var(--ease); }

#notice { position: fixed; right: var(--s5); bottom: var(--s5); z-index: var(--z-toast); max-width: min(400px, calc(100vw - 48px)); }
.notice { padding: var(--s3) var(--s4); border: 1px solid #2c5544; border-radius: var(--radius); background: #0d1a15; color: #9ed6ba; font-size: var(--text-md); box-shadow: 0 12px 32px #000c; animation: toast-in 200ms var(--ease); }
.notice.error { border-color: #5e2a32; background: #1d1013; color: #f2a3ac; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

dialog { min-width: min(440px, calc(100vw - 30px)); padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 24px 70px #000c; color: var(--ink); }
dialog::backdrop { background: #000000c9; }
#dialog-content { padding: var(--s5); }
#dialog-content h2 { margin: 0 0 var(--s4); color: var(--ink); font-size: var(--text-xl); font-weight: 600; letter-spacing: -.015em; }
.form-grid { display: grid; gap: var(--s3); }
.form-grid label { display: grid; gap: 5px; color: var(--ink-3); font-size: var(--text-xs); font-weight: 500; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s5); }

.console-backdrop { position: fixed; inset: 0; z-index: var(--z-drawer-backdrop); background: #000000b3; }
.console-drawer { position: fixed; top: 0; right: 0; z-index: var(--z-drawer); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: min(720px, 92vw); height: 100vh; border-left: 1px solid var(--line-strong); background: var(--surface); transform: translateX(0); transition: transform 240ms var(--ease); }
.console-drawer[aria-hidden="true"] { pointer-events: none; transform: translateX(100%); }
.console-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); padding: var(--s5) var(--s5) var(--s4); border-bottom: 1px solid var(--line); }
.console-header h2 { margin: 0 0 var(--s1); color: var(--ink); font-size: var(--text-xl); font-weight: 600; letter-spacing: -.015em; }
#console-status { color: var(--ink-3); font-size: var(--text-xs); }
#console-status.online { color: #6fcda5; }
#console-status.error { color: #f2a3ac; }
.console-lines { overflow: auto; padding: var(--s4) var(--s5); background: var(--sunken); color: #c8c8c8; font-family: var(--mono); font-size: var(--text-sm); line-height: 1.7; }
.console-line { min-height: 18px; overflow-wrap: anywhere; white-space: pre-wrap; }
.console-line + .console-line { border-top: 1px solid #131313; }
.console-empty { display: grid; min-height: 100%; place-items: center; color: var(--ink-3); text-align: center; }
.console-prompt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; border-top: 1px solid var(--line); background: var(--surface-2); }
.console-prompt > span { padding-left: var(--s4); color: var(--red-bright); font-family: var(--mono); font-size: 15px; font-weight: 700; }
.console-prompt input { min-width: 0; padding: var(--s4) var(--s3); border: 0; outline: 0; background: transparent; color: var(--ink); font-family: var(--mono); font-size: var(--text-md); }
.console-prompt input:focus-visible { outline: 0; }
.console-prompt button { align-self: stretch; padding: 0 var(--s5); border: 0; border-left: 1px solid var(--line); background: var(--red); color: #fff; cursor: pointer; font-size: var(--text-xs); font-weight: 600; }
.console-prompt button:hover { background: #d21b32; }

#analytics-content { display: grid; gap: var(--s6); }
.analytics-group { display: grid; gap: var(--s3); min-width: 0; }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.group-title { margin: 0; color: var(--ink); font-size: var(--text-lg); font-weight: 600; letter-spacing: -.012em; }
.field.inline { grid-auto-flow: column; align-items: center; gap: var(--s2); }
.field.inline > span { font-size: var(--text-xs); }

.chart-card { padding: 0; overflow: hidden; }
.chart-head { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.metric-tabs { display: flex; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.metric-tabs::-webkit-scrollbar { display: none; }
.chart-head-action { flex: 0 0 auto; margin: 0 var(--s5); }
.metric-tab { display: grid; gap: var(--s2); flex: 0 0 auto; min-width: 132px; padding: var(--s4) var(--s5); border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--ink-3); text-align: left; cursor: pointer; }
.metric-tab:hover { background: var(--surface-2); color: var(--ink-2); }
.metric-tab.is-active { border-bottom-color: var(--tab-color); background: var(--surface-2); color: var(--ink-2); }
.metric-tab + .metric-tab { border-left: 1px solid var(--line-soft); }
.metric-tab-label { font-size: var(--text-xs); font-weight: 500; }
.metric-tab-value { color: var(--ink); font-size: var(--text-xl); font-weight: 600; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric-tab:not(.is-active) .metric-tab-value { color: var(--ink-2); }
.chart-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; padding: var(--s3) var(--s5); border-top: 1px solid var(--line); }
.chart-context { margin: 0; color: var(--ink-3); font-size: var(--text-xs); }
.chart-aside { display: flex; gap: var(--s5); margin: 0; }
.chart-aside div { display: flex; align-items: baseline; gap: var(--s2); }
.chart-aside dt { color: var(--ink-3); font-size: var(--text-xs); }
.chart-aside dd { margin: 0; color: var(--ink-2); font-size: var(--text-xs); font-weight: 550; font-variant-numeric: tabular-nums; }

.retention-card { display: grid; gap: var(--s3); padding: var(--s5) var(--s5) var(--s3); }
.retention-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.retention-lede { display: grid; gap: var(--s1); }
.retention-headline { margin: 0; color: var(--ink); font-size: var(--text-2xl); font-weight: 600; line-height: 1.1; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.panel-note { max-width: 72ch; margin: 0; color: var(--ink-3); font-size: var(--text-xs); line-height: 1.6; }
.chart-legend { display: flex; gap: var(--s4); flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: var(--s2); color: var(--ink-2); font-size: var(--text-xs); }
.legend-bar { width: 8px; height: 12px; border-radius: 2px; }
.legend-line { width: 14px; height: 3px; border-radius: 2px; }
.retention-card .chart-shell { padding: var(--s2) 0 0; }
.cohort-bar { pointer-events: none; }
.chart-shell { position: relative; min-width: 0; padding: var(--s5) var(--s4) var(--s2); }
.chart-scroll { overflow-x: auto; }
.chart-canvas { min-width: 560px; }
.line-chart { display: block; width: 100%; height: auto; overflow: visible; }
.line-chart .grid { stroke: var(--line-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.line-chart text { fill: var(--ink-3); font-family: inherit; font-size: 11px; font-variant-numeric: tabular-nums; }
.line-chart .y-label { text-anchor: end; }
.line-chart .y-label.is-right { text-anchor: start; }
.line-chart .x-label { text-anchor: middle; }
.line-chart .x-label.start { text-anchor: start; }
.line-chart .x-label.end { text-anchor: end; }
.area { pointer-events: none; }
.series, .series-halo { pointer-events: none; }
.chart-point { pointer-events: none; }
.chart-marker { display: none; pointer-events: none; stroke: var(--surface); stroke-width: 2; }
.chart-marker.visible { display: block; }
.chart-hover-target { fill: transparent; cursor: crosshair; outline: none; }
.chart-hover-target:focus-visible { fill: rgb(255 255 255 / .05); }
.chart-crosshair { display: none; stroke: var(--line-strong); stroke-width: 1; pointer-events: none; vector-effect: non-scaling-stroke; }
.chart-crosshair.visible { display: block; }
.chart-tooltip { position: absolute; z-index: var(--z-tooltip); min-width: 190px; padding: var(--s3); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); box-shadow: 0 10px 28px rgb(0 0 0 / .6); color: var(--ink-2); pointer-events: none; }
.chart-tooltip > strong { display: block; margin-bottom: var(--s2); color: var(--ink); font-size: var(--text-xs); font-weight: 550; white-space: nowrap; }
.chart-tooltip span { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: var(--s2); color: var(--ink-3); font-size: var(--text-xs); }
.chart-tooltip i { width: 8px; height: 8px; border-radius: 2px; }
.chart-tooltip b { color: var(--ink); font-size: var(--text-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-empty { min-height: 220px; }
.distribution { display: grid; grid-template-columns: minmax(220px, 320px) minmax(240px, 1fr); align-items: center; gap: var(--s6); min-height: 340px; padding: var(--s5); }
.distribution-canvas { position: relative; }
.distribution-size-reference { visibility: hidden; }
.distribution-shell .distribution { position: absolute; inset: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--s6); width: 100%; height: 100%; min-height: 0; overflow: hidden; padding: 0; }
.donut { display: block; width: 100%; max-width: 300px; max-height: 100%; margin: auto; transform: rotate(-90deg); }
.donut text { fill: var(--ink-3); font-family: inherit; font-size: 9px; transform: rotate(90deg); transform-origin: 70px 70px; }
.donut .donut-total { fill: var(--ink); font-size: 15px; font-weight: 650; }
.distribution-legend { display: grid; gap: 1px; max-height: 300px; overflow: auto; padding: 0; margin: 0; list-style: none; }
.distribution-shell .donut { width: auto; height: clamp(220px, 82%, 360px); max-width: 100%; }
.distribution-shell .distribution-legend { align-self: center; height: clamp(220px, 82%, 360px); min-height: 0; max-height: 100%; }
.distribution-shell .chart-empty { position: absolute; inset: 0; height: auto; min-height: 0; }
.distribution-legend li { display: grid; grid-template-columns: 10px minmax(100px, 1fr) auto 54px; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line-soft); color: var(--ink-2); font-size: var(--text-sm); }
.distribution-legend i { width: 10px; height: 10px; border-radius: 2px; }
.distribution-legend strong, .distribution-legend small { font-variant-numeric: tabular-nums; text-align: right; }
.distribution-legend strong { color: var(--ink); font-weight: 600; }
.distribution-legend small { color: var(--ink-3); }
.distribution-dialog { width: min(720px, calc(100vw - 62px)); }
.distribution-dialog .distribution { padding: 0; }

#dialog:has(.player-detail) { width: min(760px, calc(100vw - 30px)); }
.player-detail h3 { margin: var(--s5) 0 var(--s3); color: var(--ink); font-size: var(--text-md); font-weight: 600; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.detail-grid > div { min-width: 0; padding: var(--s3); background: var(--sunken); }
.detail-grid span, .session-row span { display: block; color: var(--ink-3); font-size: var(--text-xs); }
.detail-grid strong { display: block; overflow-wrap: anywhere; margin-top: var(--s1); color: var(--ink); font-size: var(--text-md); font-weight: 550; }
.session-list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.session-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); padding: var(--s3); border-bottom: 1px solid var(--line-soft); background: var(--sunken); }
.session-row:last-child { border-bottom: 0; }
.session-row > div:last-child { text-align: right; }
.session-row strong { display: block; margin-bottom: 1px; color: var(--ink); font-size: var(--text-sm); font-weight: 550; }

.auth-body { display: grid; place-items: center; padding: var(--s5); background: var(--bg); }
.auth-box { width: min(390px, 100%); padding: var(--s6); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); text-align: center; }
.auth-logo { display: block; width: 96px; height: 92px; object-fit: contain; margin: 0 auto var(--s5); }
.auth-box h1 { margin: var(--s1) 0 var(--s3); color: var(--ink); font-size: var(--text-2xl); font-weight: 600; letter-spacing: -.022em; }
.muted, .auth-note { color: var(--ink-2); font-size: var(--text-md); line-height: 1.6; }
.auth-note { margin: var(--s4) 0 0; font-size: var(--text-xs); color: var(--ink-3); }
.denied-icon { display: grid; width: 44px; height: 44px; place-items: center; margin: 0 auto var(--s5); border: 1px solid #5e2a32; border-radius: 50%; background: #1d1013; color: #ef909b; font-size: 24px; }

@media (max-width: 1100px) {
  .content { padding: var(--s5) var(--s5) 64px; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: max-content minmax(0, 1fr); }
  .sidebar { position: relative; height: auto; padding: var(--s3); border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { min-height: 40px; padding: 0 var(--s2) var(--s3); margin-bottom: var(--s2); }
  .brand-logo { width: 28px; height: 28px; }
  .sidebar nav { flex: none; overflow: visible; gap: var(--s2); }
  .nav-group-items { display: flex; overflow-x: auto; gap: var(--s1); margin-left: 0; padding: 0 0 var(--s1); border-left: 0; scrollbar-width: thin; }
  .nav-group-items .nav-page { flex: 0 0 auto; width: auto; min-height: 40px; }
  .nav-page-wrap { flex: 0 0 auto; }
  .nav-group-toggle { min-height: 40px; }
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .topbar-actions { width: 100%; }
  #topbar-slot { flex: 1; min-width: 0; }
  .segmented { flex: 1; justify-content: space-between; }
  .segment { flex: 1; min-height: 36px; }
  .profile { position: absolute; top: var(--s3); right: var(--s3); padding: 0; margin: 0; border: 0; }
  .profile-row > div, .logout { display: none; }
  .content { padding: var(--s5) var(--s4) 56px; }
  .table-wrap { max-height: none; }
  .button, .secondary-button, .icon-button, .console-open, select, .input { min-height: 40px; }
  .button.small, .secondary-button.small { min-height: 32px; }
  .metric-tab { min-width: 118px; padding: var(--s3) var(--s4); }
  .chart-shell { padding: var(--s4) var(--s2) var(--s2); }
  .profile img { width: 28px; height: 28px; }
  #notice { right: var(--s4); left: var(--s4); bottom: var(--s4); max-width: none; }
}

@media (max-width: 620px) {
  .console-drawer { width: 100vw; }
  .content.wiki-page { padding-top: var(--s5); }
  .wiki-home-grid { grid-template-columns: 1fr; }
  .wiki-topic { min-height: 0; }
  .wiki-article { font-size: 14px; }
  .wiki-article .wiki-title { font-size: 27px; }
  .wiki-callout { padding: var(--s3); }
  .wiki-article h2 { margin-top: 29px; padding-top: 22px; font-size: 20px; }
  .wiki-table { min-width: 540px; }
  .wiki-table--compact { min-width: 0; }
  .console-header { padding: var(--s4); }
  .console-lines { padding: var(--s3); }
  .console-prompt > span { padding-left: var(--s3); }
  .console-prompt button { padding: 0 var(--s3); }
  .toolbar, .toolbar .group { align-items: stretch; flex-direction: column; }
  .input, select { width: 100%; min-width: 0; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  .chart-foot { align-items: flex-start; flex-direction: column; gap: var(--s2); }
  .chart-aside { gap: var(--s4); }
  .chart-head { align-items: stretch; flex-direction: column; }
  .chart-head-action { align-self: flex-end; margin: var(--s3) var(--s4); }
  .distribution { grid-template-columns: 1fr; gap: var(--s4); min-height: 340px; padding: var(--s4); }
  .donut { max-width: 230px; }
  .distribution-dialog { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .console-drawer { transition: none; }
}

.application-answer{margin:20px 0}.application-answer h3{font-size:14px;margin:0 0 8px}.application-answer p{margin:0 0 8px;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6}.application-answers{max-height:55vh;overflow:auto;padding-right:12px}
