:root {
  --ink: #f4efe6; --muted: #c3bad0; --dim: #8f86a3;
  --panel: rgba(28, 22, 44, .62); --panel-2: rgba(255, 255, 255, .06); --line: rgba(255, 255, 255, .1);
  --accent: #ffb47a; --accent-2: #f28fb0; --snow: #cfe3ff;
  --epic: #5b8def; --ikon: #f2c14e;
  --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #1b1730; color: var(--ink); }
body { font: 15px/1.45 Nunito, ui-rounded, system-ui, -apple-system, Segoe UI, sans-serif; -webkit-font-smoothing: antialiased; }
#scene { position: fixed; inset: 0; z-index: 0; display: block; }
.vignette { position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(10, 6, 20, .55)); }
a { color: var(--accent); }
button, select, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap { position: relative; z-index: 2; max-width: 980px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 16px calc(env(safe-area-inset-bottom, 0px) + 96px); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 12px; text-shadow: 0 2px 12px rgba(0, 0, 0, .5); }
.logo { font-size: 30px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px;
  background: linear-gradient(135deg, #f28fb0, #ffb47a); color: #2b2140; box-shadow: 0 6px 18px rgba(242, 143, 176, .35); }
h1 { font: 400 40px/1 VT323, ui-monospace, monospace; margin: 0; letter-spacing: .5px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.topnav { display: flex; gap: 8px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-weight: 700; backdrop-filter: blur(10px); cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(135deg, #f28fb0, #ffb47a); color: #2b1a2a; border: 0; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; backdrop-filter: blur(10px); }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; cursor: pointer; font-weight: 700; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #2b2140; }

.controls { padding: 14px; display: grid; gap: 10px; margin-bottom: 14px; }
#q { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .25); outline: none; }
#q:focus { border-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--panel-2); padding: 6px 13px; border-radius: 999px; cursor: pointer; font-weight: 700; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); color: #2b2140; border-color: var(--ink); }
.chip.epic[aria-pressed="true"] { background: var(--epic); color: #fff; border-color: var(--epic); }
.chip.ikon[aria-pressed="true"] { background: var(--ikon); color: #2b2140; border-color: var(--ikon); }
.chip.fav[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.row2 { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13px; }
.row2 label { display: inline-flex; align-items: center; gap: 6px; }
select { background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.check input { accent-color: var(--accent); }

.list { padding: 6px 6px 12px; }
.thead, .row { display: grid; grid-template-columns: minmax(0, 1fr) 62px 56px 62px 104px 70px; gap: 8px; align-items: center; padding: 8px 12px; }
.thead { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.num { text-align: right; }
.row { border-radius: 12px; cursor: pointer; border: 1px solid transparent; }
.row:hover, .row:focus-visible { background: var(--panel-2); border-color: var(--line); outline: none; }
.group-h { padding: 14px 12px 4px; font: 400 22px VT323, monospace; color: var(--accent); }
.m-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.m-name b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-name small { display: block; color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-name .txt { min-width: 0; }
.star { border: 0; background: none; cursor: pointer; color: var(--dim); font-size: 16px; padding: 2px; line-height: 1; }
.star[aria-pressed="true"] { color: var(--accent); }
.badge { font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 6px; letter-spacing: .04em; flex: none; }
.badge.epic { background: var(--epic); color: #fff; }
.badge.ikon { background: var(--ikon); color: #2b2140; }
.v { font: 400 21px/1 VT323, ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.v.zero { color: var(--dim); }
.v.hot { color: var(--snow); text-shadow: 0 0 12px rgba(160, 200, 255, .7); }
.v.deep { color: #fff; text-shadow: 0 0 14px rgba(242, 143, 176, .9); }
.past { color: var(--muted); }
.spread { display: block; height: 4px; margin-top: 5px; border-radius: 2px; background: rgba(255, 255, 255, .08); position: relative; }
.spread i { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); opacity: .8; }
.spread b { position: absolute; top: -2px; width: 2px; height: 8px; background: #fff; }
.empty { color: var(--muted); padding: 20px 12px; }
.foot { color: var(--dim); font-size: 12px; padding: 8px 12px 0; margin: 0; }

.drawer { position: fixed; inset: 0; z-index: 5; display: flex; justify-content: flex-end; background: rgba(10, 6, 20, .35); }
.drawer-card { position: relative; width: min(560px, 100%); height: 100%; overflow-y: auto; border-radius: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 22px) 20px calc(env(safe-area-inset-bottom, 0px) + 96px); background: rgba(28, 22, 44, .85); }
.drawer h2 { font: 400 34px/1 VT323, monospace; margin: 0 40px 4px 0; }
.close { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 16px); right: 16px; border: 1px solid var(--line); background: var(--panel-2);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; }
.totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.tot { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.tot .v { font-size: 30px; display: block; }
.tot small { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.tot .rng { color: var(--muted); font-size: 11px; display: block; }
.chart { overflow-x: auto; }
.chart svg { display: block; min-width: 520px; }
.chart text { fill: var(--muted); font: 11px Nunito, sans-serif; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); margin: 8px 0 12px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
table.models { width: 100%; border-collapse: collapse; font-size: 13px; }
table.models th, table.models td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
table.models th:first-child, table.models td:first-child { text-align: left; }
table.models th { color: var(--dim); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }

.radio { position: fixed; z-index: 6; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 999px; max-width: calc(100% - 32px); }
.radio button { border: 0; background: none; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; font-size: 15px; flex: none; }
.radio button:hover { background: var(--panel-2); }
.radio button[aria-pressed="true"] { background: var(--ink); }
.np { display: flex; align-items: center; gap: 8px; padding: 0 8px; min-width: 0; }
.np-text { font: 400 19px VT323, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.np-text b { color: var(--ink); font-weight: 400; }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; flex: none; }
.eq i { width: 3px; background: var(--accent); border-radius: 1px; animation: eq 1.1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; } .eq i:nth-child(4) { animation-delay: -.9s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 14px; } }

/* alerts page */
.panel { padding: 18px; margin-bottom: 14px; }
.panel h2 { font: 400 28px/1 VT323, monospace; margin: 0 0 10px; }
.form { display: grid; gap: 12px; }
.form .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 700; }
.form input[type=text], .form input[type=number], .form select { width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); }
.picker { border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, .2); }
.picker input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 9px 10px; outline: none; }
.picker .opts { max-height: 220px; overflow-y: auto; padding: 4px; }
.picker .opt { display: flex; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.picker .opt:hover { background: var(--panel-2); }
.picker .opt small { color: var(--dim); }
.selected { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; }
.selected .tag { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 13px; cursor: pointer; }
.selected .tag:hover { border-color: var(--accent-2); text-decoration: line-through; }
.alert-item { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); margin-bottom: 10px; }
.alert-item header { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.alert-item h3 { margin: 0; font-size: 17px; }
.alert-item .acts { display: flex; gap: 6px; }
.alert-item .acts button { padding: 5px 11px; font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }
.notice { padding: 14px 16px; border-radius: 14px; border: 1px solid rgba(255, 180, 122, .4); background: rgba(255, 180, 122, .1); }
.toast { position: fixed; z-index: 9; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 16px); padding: 10px 16px; border-radius: 12px; background: var(--ink); color: #2b2140; font-weight: 700; }

@media (max-width: 640px) {
  h1 { font-size: 32px; }
  .thead, .row { grid-template-columns: minmax(0, 1fr) 46px 54px 86px; padding: 8px; gap: 6px; }
  .hide-sm, .thead > :nth-child(2), .row > :nth-child(2) { display: none; }
  .totals { grid-template-columns: repeat(2, 1fr); }
  .np-text { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { .eq i { animation: none; height: 8px; } }
