/* Devil Steps owner dashboard. The game's own look: warm near-black, bone text, the red 3-D buttons, Fredoka for words,
   Silkscreen for the small pixel labels, and the app's pixel icons. */
@font-face { font-family: Fredoka; src: url(/admin/fonts/Fredoka-Medium.ttf) format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: Fredoka; src: url(/admin/fonts/Fredoka-SemiBold.ttf) format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: Fredoka; src: url(/admin/fonts/Fredoka-Bold.ttf) format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: Silkscreen; src: url(/admin/fonts/Silkscreen-Regular.ttf) format('truetype'); font-weight: 400; font-display: swap; }

:root {
  --ink: #0b0709;
  --ink-2: #110a0d;
  --panel: #170f13;
  --panel-2: #1f151a;
  --panel-3: #2a1c22;
  --line: #3a2a30;
  --line-soft: #2a1d23;
  --bone: #f3ead8;
  --bone-dim: #b3a692;
  --bone-faint: #7d7064;
  --devil: #ff4d3a;
  --devil-soft: #ff7a6a;
  --amber: #ffb347;
  --gold: #ffcf3f;
  --green: #8fdc5a;
  --blue: #a9b8ff;
  --red-1: #b23c28;
  --red-2: #8e1d10;
  --red-3: #4a0b05;
  --r: 18px;
  --r-s: 12px;
  --side-w: 252px;
  --pixel: Silkscreen, ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(1100px 520px at 78% -260px, rgba(255, 77, 58, 0.07), transparent 70%), var(--ink);
  background-attachment: fixed;
  color: var(--bone);
  font: 500 15px/1.45 Fredoka, ui-rounded, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--bone-faint); }
.bad { color: var(--devil-soft); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; word-break: break-all; }
.center { display: flex; justify-content: center; padding-top: 14px; }
.grow { flex: 1; }
.link { color: var(--amber); display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 13.5px; }
.link:hover { color: var(--gold); }
.link .ln { width: 15px; height: 15px; }

/* icons */
.px { width: 18px; height: 18px; flex: none; display: block; }
.px-x { fill: currentColor; }
.px-b { fill: var(--ink); opacity: 0.35; }
.px-k { fill: var(--ink); }
.ln { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 18px;
  padding: 20px 14px 16px; background: var(--ink-2); border-right: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 4px; }
.brand img { border-radius: 11px; box-shadow: 0 0 0 1px var(--line); }
.brand b { display: block; font-size: 18px; font-weight: 700; line-height: 1.1; }
.brand small { display: block; font: 9px/1.2 var(--pixel); color: var(--bone-faint); text-transform: uppercase; margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 16px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-head { font: 10px var(--pixel); color: var(--bone-faint); text-transform: uppercase; padding: 0 10px 5px; letter-spacing: 0.04em; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 11px; color: var(--bone-dim); font-size: 15px; }
.nav-link .px { width: 17px; height: 17px; color: var(--bone-faint); }
.nav-link:hover { background: var(--panel); color: var(--bone); }
.nav-link.on { background: var(--panel-2); color: var(--bone); box-shadow: inset 0 0 0 1px var(--line-soft); }
.nav-link.on .px { color: var(--gold); }
.side-live {
  margin-top: auto; position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 14px 14px 13px;
  border-radius: 16px; background: linear-gradient(160deg, #2a1218, #170c10 70%); border: 1px solid var(--line-soft);
}
.side-live:hover { border-color: var(--line); }
.side-live-devil { position: absolute; right: -10px; bottom: -8px; width: 82px; height: 82px; object-fit: contain; opacity: 0.85; }
.side-live-head { display: flex; align-items: center; gap: 7px; font: 9.5px var(--pixel); text-transform: uppercase; color: var(--bone-dim); }
.side-live b { font-size: 34px; font-weight: 700; line-height: 1.1; margin-top: 6px; }
.side-live-sub { font-size: 12.5px; color: var(--bone-faint); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--bone-faint); flex: none; display: inline-block; }
.someone-online .dot-live, .live-hero.on .dot-live { background: var(--green); box-shadow: 0 0 0 0 rgba(143, 220, 90, 0.5); animation: ping 1.8s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 7px rgba(143, 220, 90, 0); } 100% { box-shadow: 0 0 0 0 rgba(143, 220, 90, 0); } }

.page { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 32px;
  background: rgba(11, 7, 9, 0.82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-soft);
}
.top-search { flex: 1; max-width: 460px; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.updated { font-size: 12.5px; color: var(--bone-faint); white-space: nowrap; }
.round {
  width: 38px; height: 38px; border-radius: 12px; display: inline-grid; place-items: center; flex: none;
  background: var(--panel-2); border: 1px solid var(--line-soft); color: var(--bone-dim);
}
.round:hover { color: var(--bone); border-color: var(--line); }
.menu-btn { display: none; }
.live-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line-soft); font-size: 13.5px; color: var(--bone-dim);
}
.live-pill b { color: var(--bone); font-weight: 700; }
.main { padding: 26px 32px 60px; width: 100%; max-width: 1480px; }
.crumb:not(:empty) { margin-bottom: 8px; }
.crumb a { display: inline-flex; align-items: center; gap: 3px; color: var(--bone-faint); font-size: 13.5px; }
.crumb a:hover { color: var(--bone); }
.crumb .ln { width: 15px; height: 15px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 14px; }
.head h1 { font-size: 30px; font-weight: 700; line-height: 1.1; }
.sub { color: var(--bone-dim); margin-top: 4px; font-size: 15px; }
.head-end { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dates { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--bone-faint); }
.dates input { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 10px; padding: 6px 8px; color-scheme: dark; }
.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0 18px; border-bottom: 1px solid var(--line-soft); margin-bottom: 22px; }
.filterbar[hidden] { display: none; }
.view { min-height: 40vh; }

/* ---------- controls ---------- */
.chips { display: inline-flex; gap: 2px; padding: 3px; border-radius: 13px; background: var(--panel-2); border: 1px solid var(--line-soft); max-width: 100%; }
.chips.scroll { overflow-x: auto; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--bone-dim);
  padding: 6px 11px; border-radius: 10px; font-size: 13.5px; white-space: nowrap;
}
.chip .px { width: 14px; height: 14px; }
.chip:hover { color: var(--bone); background: var(--panel-3); }
.chip.on {
  color: var(--bone); background: linear-gradient(var(--red-1), var(--red-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 2px 0 var(--red-3);
}
.chip.on .px { color: var(--gold); }
.select {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 4px 0 11px; border-radius: 13px;
  background: var(--panel-2); border: 1px solid var(--line-soft); font-size: 13.5px; max-width: 100%;
}
.select:hover { border-color: var(--line); }
.select-label { color: var(--bone-faint); font-size: 12.5px; }
.select select {
  appearance: none; border: 0; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b3a692' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 6px center / 16px;
  padding: 0 28px 0 0; height: 36px; color: var(--bone); max-width: 260px; text-overflow: ellipsis; cursor: pointer;
}
.select select:focus-visible { outline: none; }
.select:focus-within { outline: 2px solid var(--amber); outline-offset: 2px; }
.select option, .select optgroup { background: #1f151a; color: var(--bone); }
.toggle {
  display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 13px 0 9px; border-radius: 13px;
  background: var(--panel-2); border: 1px solid var(--line-soft); color: var(--bone-dim); font-size: 13.5px; white-space: nowrap;
}
.toggle i { width: 30px; height: 18px; border-radius: 9px; background: var(--line); position: relative; flex: none; transition: background 0.15s; }
.toggle i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--bone-dim); transition: transform 0.15s; }
.toggle.on { color: var(--bone); }
.toggle.on i { background: var(--red-1); }
.toggle.on i::after { transform: translateX(12px); background: var(--bone); }
.search {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 13px;
  background: var(--panel-2); border: 1px solid var(--line-soft); color: var(--bone-faint); min-width: 0;
}
.search:focus-within { border-color: var(--line); outline: 2px solid var(--amber); outline-offset: 2px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--bone); font-size: 14px; }
.search input::placeholder { color: var(--bone-faint); }
.search kbd { font: 11px var(--pixel); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--bone-faint); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 12px;
  padding: 8px 14px; font-weight: 600; font-size: 14px; white-space: nowrap; background: var(--panel-2); color: var(--bone);
}
.btn .ln { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.ghost { border-color: var(--line-soft); }
.btn.ghost:hover:not(:disabled) { border-color: var(--line); background: var(--panel-3); }
.btn.red {
  background: linear-gradient(var(--red-1), var(--red-2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 3px 0 var(--red-3);
  margin-bottom: 3px;
}
.btn.red:hover:not(:disabled) { filter: brightness(1.08); }
.btn.red:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 0 var(--red-3); }
.btn.danger { background: transparent; border-color: rgba(255, 77, 58, 0.45); color: var(--devil-soft); }
.btn.danger:hover { background: rgba(255, 77, 58, 0.1); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 10px; }
.btn.big { padding: 12px 18px; font-size: 16px; width: 100%; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 220px; max-width: 360px; }

/* ---------- cards and tiles ---------- */
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.grid { display: grid; gap: 18px; align-items: start; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 18px 20px 20px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.card-title h2 { font-size: 16.5px; }
.card-title small { color: var(--bone-faint); font-size: 13px; }
.card-right { display: flex; align-items: center; gap: 8px; }
.info { position: relative; display: inline-flex; color: var(--bone-faint); cursor: help; }
.info .ln { width: 15px; height: 15px; }
.info:hover, .info:focus { color: var(--bone-dim); }
.info-pop {
  position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(calc(-50% + var(--dx, 0px))); z-index: 30; width: max-content; max-width: min(280px, calc(100vw - 24px));
  padding: 10px 12px; border-radius: 12px; background: #2a1c22; border: 1px solid var(--line); color: var(--bone);
  font-size: 13px; font-weight: 500; line-height: 1.45; box-shadow: 0 14px 30px -12px #000; display: none; pointer-events: none;
  text-transform: none; letter-spacing: 0; white-space: normal; text-align: left;
}
.info:hover .info-pop, .info:focus .info-pop { display: block; }
.tiles { --cols: 4; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 14px; }
.tiles:has(> :nth-child(5):last-child) { --cols: 5; }
.tiles:has(> :nth-child(3):last-child), .tiles:has(> :nth-child(6):last-child) { --cols: 3; }
.tiles:has(> :nth-child(2):last-child) { --cols: 2; }
.tile {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 16px; padding: 14px 16px 13px;
  display: flex; flex-direction: column; gap: 4px; min-width: 0; position: relative;
}
.tile-top { display: flex; align-items: center; gap: 8px; color: var(--bone-dim); font-size: 13.5px; }
.tile-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--panel-2); color: var(--gold); flex: none; }
.tile-ico .px { width: 15px; height: 15px; }
.tile-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-mid { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.tile-value { font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; }
.tile-foot { color: var(--bone-faint); font-size: 12.5px; line-height: 1.35; }
.tile .spark { margin: 4px 0 2px; }
.chg { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 600; padding: 1px 7px 1px 4px; border-radius: 8px; }
.chg .ln { width: 13px; height: 13px; stroke-width: 2.6; }
.chg.good { color: var(--green); background: rgba(143, 220, 90, 0.1); }
.chg.bad { color: var(--devil-soft); background: rgba(255, 77, 58, 0.11); }
.chg.flat { color: var(--bone-faint); background: var(--panel-2); padding-left: 7px; }
.spark { width: 100%; height: 26px; display: block; }
.spark-line { fill: none; stroke: var(--amber); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spark-area { fill: rgba(255, 179, 71, 0.1); }
.spark.red .spark-line { stroke: var(--devil); }
.spark.red .spark-area { fill: rgba(255, 77, 58, 0.1); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 12px; text-align: center; color: var(--bone-dim); }
.empty b { font-weight: 600; }
.empty small { color: var(--bone-faint); }
.empty-ico { width: 30px; height: 30px; color: var(--line); margin-bottom: 4px; }
.tag { display: inline-flex; align-items: center; font: 9px/1 var(--pixel); text-transform: uppercase; padding: 3px 6px 2px; border-radius: 6px; background: var(--panel-3); color: var(--bone-dim); margin-left: 6px; vertical-align: 2px; letter-spacing: 0.02em; }
.tag-test { color: var(--amber); box-shadow: inset 0 0 0 1px rgba(255, 179, 71, 0.35); background: transparent; }
.tag-boss { color: var(--devil-soft); }
.kv { margin: 0; display: grid; gap: 9px; }
.kv div { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 12px; font-size: 14px; }
.kv dt { color: var(--bone-faint); }
.kv dd { margin: 0; min-width: 0; }
.with-ico { display: inline-flex; align-items: center; gap: 8px; }

/* skeleton */
.loading { display: flex; flex-direction: column; gap: 18px; }
.sk { min-height: 118px; background: linear-gradient(100deg, var(--panel) 30%, var(--panel-2) 50%, var(--panel) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s infinite linear; }
.sk.tall { min-height: 320px; }
@keyframes shimmer { to { background-position: -150% 0; } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -6px; }
.table-wrap.scroll-y { max-height: 460px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { font: 9.5px var(--pixel); text-transform: uppercase; color: var(--bone-faint); text-align: left; padding: 6px 8px 9px; white-space: nowrap; letter-spacing: 0.03em; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.table td { padding: 9px 8px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.table .r { text-align: right; white-space: nowrap; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td, .table tr.click:focus-visible td { background: var(--panel-2); }
.table tr.click:focus-visible { outline: none; }
.table td.rank { color: var(--bone-faint); width: 28px; font-weight: 600; }
.table.dense td, .dense .table td { padding: 7px 8px; }
.cohorts .table td { padding: 7px 6px; }
.heat-cell { display: inline-block; min-width: 50px; padding: 3px 7px; border-radius: 7px; background: rgba(255, 179, 71, calc(var(--a) * 0.55)); color: var(--bone); }
.heat-cell.partial { opacity: 0.55; }

/* ---------- people and steps ---------- */
.avatar {
  --size: 34px; width: var(--size); height: var(--size); border-radius: 10px; flex: none; display: inline-grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 70%, color-mix(in srgb, var(--body, #f3ead8) 22%, transparent), transparent 70%), var(--panel-3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.avatar img { width: 88%; height: 88%; object-fit: contain; image-rendering: auto; }
.avatar.sm { --size: 26px; border-radius: 8px; }
.avatar.lg { --size: 48px; border-radius: 13px; }
.avatar.xl { --size: 78px; border-radius: 20px; }
.who { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
a.who:hover b { color: var(--amber); }
.who-text { display: flex; flex-direction: column; min-width: 0; }
.who-text b { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text small { color: var(--bone-faint); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.on-now { color: var(--green); }
.step-chip { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.step-chip i, .step-link i { width: 9px; height: 9px; border-radius: 3px; background: var(--tc); transform: rotate(45deg); flex: none; }
.step-chip b { font-weight: 600; font-size: 14px; }
.step-chip small { font: 9px var(--pixel); color: var(--accent); text-transform: uppercase; opacity: 0.9; }
.step-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--bone); }
.step-link:hover { color: var(--amber); }
.flames { display: inline-flex; gap: 1px; vertical-align: -2px; margin-left: 6px; }
.flames .px { width: 13px; height: 13px; }
.flames.small .px { width: 11px; height: 11px; }
.flames .lit { color: var(--amber); }
.flames .unlit { color: var(--line); }
.flag { font-size: 16px; line-height: 1; }

/* activity */
.acts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.act { display: grid; grid-template-columns: 28px minmax(130px, 200px) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.act:first-child { border-top: 0; }
.acts .act:not(:has(.who)) { grid-template-columns: 28px minmax(0, 1fr) auto; }
.act-ico { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--panel-2); color: var(--bone-dim); }
.act-ico .px { width: 14px; height: 14px; }
.k-clear .act-ico { color: var(--green); }
.k-quit .act-ico { color: var(--devil-soft); }
.k-start .act-ico { color: var(--bone-dim); }
.k-unl .act-ico { color: var(--blue); }
.k-install .act-ico { color: var(--gold); }
.k-reset .act-ico { color: var(--amber); }
.act-what { min-width: 0; color: var(--bone-dim); }
.act-what .step-link { margin: 0 1px; }
.act time { color: var(--bone-faint); font-size: 12.5px; white-space: nowrap; }

/* ---------- charts ---------- */
.chart { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr); margin-top: 6px; }
.chart-empty { padding: 40px 0; text-align: center; color: var(--bone-faint); }
.y-labels { position: relative; }
.y-labels span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--bone-faint); white-space: nowrap; }
.plot-col { min-width: 0; }
.plot { position: relative; touch-action: pan-y; cursor: crosshair; }
.plot-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.grid-line { fill: none; stroke: var(--line-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.line { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.line.s1 { stroke: var(--amber); }
.line.s2 { stroke: var(--devil); }
.line.s0 { stroke: var(--bone-faint); stroke-width: 1.6; }
.line.dashed { stroke-dasharray: 5 5; }
.area.s1 { fill: rgba(255, 179, 71, 0.11); }
.area.s2 { fill: rgba(255, 77, 58, 0.1); }
.bar { shape-rendering: crispEdges; }
.bar.s1 { fill: var(--amber); }
.bar.s2 { fill: var(--devil); }
.bar.s0, .bar.ghost { fill: var(--bone-faint); opacity: 0.45; }
.bar.android { fill: var(--green); }
.bar.ios { fill: var(--blue); }
.x-ticks { position: relative; height: 22px; }
.x-ticks span { position: absolute; top: 6px; transform: translateX(-50%); font-size: 11px; color: var(--bone-faint); white-space: nowrap; }
.x-ticks span:first-child { transform: none; }
.x-ticks span:last-child { transform: translateX(-100%); }
.guide { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(243, 234, 216, 0.22); pointer-events: none; }
.dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; transform: translate(-50%, -50%); border: 2px solid var(--ink); pointer-events: none; background: var(--amber); }
.dot.s2 { background: var(--devil); }
.dot.s0 { background: var(--bone-faint); }
.tip {
  position: absolute; top: 4px; z-index: 6; min-width: 170px; max-width: 280px; padding: 10px 12px; border-radius: 12px; pointer-events: none;
  background: #2a1c22; border: 1px solid var(--line); box-shadow: 0 16px 34px -14px #000; font-size: 13px;
}
.tip > b { display: block; font-weight: 600; margin-bottom: 4px; }
.tip-sub { display: block; font: 9.5px var(--pixel); text-transform: uppercase; color: var(--tc, var(--bone-faint)); margin: -2px 0 6px; }
.tip-row { display: flex; align-items: center; gap: 8px; color: var(--bone-dim); padding: 1px 0; }
.tip-row span { flex: 1; }
.tip-row b { color: var(--bone); font-weight: 600; }
.tip-row.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 5px; }
.key { width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--c, var(--amber)); display: inline-block; }
.key.s1 { background: var(--amber); }
.key.s2 { background: var(--devil); }
.key.s0 { background: transparent; border: 1.5px dashed var(--bone-faint); }
.key.android { background: var(--green); }
.key.ios { background: var(--blue); }
.key.other { background: var(--bone-faint); }
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.hbars li { display: flex; flex-direction: column; gap: 5px; }
.hbars li.click { cursor: pointer; border-radius: 8px; }
.hbars li.click:hover .hb-label { color: var(--amber); }
.hb-text { display: flex; align-items: baseline; gap: 8px; font-size: 14px; min-width: 0; }
.hb-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-text small { color: var(--bone-faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-text b { margin-left: auto; font-weight: 600; }
.hb-share { color: var(--bone-faint); font-size: 12.5px; min-width: 40px; text-align: right; }
.hb-text .px { width: 14px; height: 14px; color: var(--gold); align-self: center; }
.hb-track { height: 7px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.hb-track i { display: block; height: 100%; border-radius: 4px; background: var(--c, var(--amber)); }
.hb-track i.android { background: var(--green); }
.hb-track i.ios { background: var(--blue); }
.hbars.chapters .hb-label { font: 11px var(--pixel); text-transform: uppercase; color: var(--bone-dim); }
.split { display: flex; flex-direction: column; gap: 12px; }
.split-bar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; background: var(--panel-2); gap: 2px; }
.split-bar i { display: block; height: 100%; background: var(--c, var(--amber)); }
.split-keys { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; }
.split-keys li { display: inline-flex; align-items: center; gap: 7px; }
.split-keys b { font-weight: 600; }
.split-keys small { color: var(--bone-faint); }
.split .android, .split-keys .android { --c: var(--green); }
.split .ios, .split-keys .ios { --c: var(--blue); }
.split .other { --c: var(--bone-faint); }
.f1 { --c: #7a5a3a; } .f2 { --c: var(--amber); } .f3 { --c: var(--gold); }
.v0 { --c: #6b4a3a; } .v1 { --c: #b9773a; } .v2 { --c: var(--amber); }
.split-group { display: grid; gap: 8px; margin-top: 18px; }
.split-group > small { color: var(--bone-faint); font-size: 12.5px; margin-top: 6px; }
.heat { display: flex; flex-direction: column; gap: 3px; overflow-x: auto; }
.heat-row, .heat-hours { display: grid; grid-template-columns: 34px repeat(24, minmax(14px, 1fr)); gap: 3px; min-width: 460px; }
.heat-hours span { font-size: 10.5px; color: var(--bone-faint); }
.heat-day { font-size: 12px; color: var(--bone-faint); align-self: center; }
.heat-row i { aspect-ratio: 1; border-radius: 4px; background: var(--panel-2); position: relative; overflow: hidden; }
.heat-row i::after { content: ''; position: absolute; inset: 0; background: var(--amber); opacity: var(--a); }
.cal { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; }
.cal-col { display: flex; flex-direction: column; gap: 3px; }
.cal i { width: 12px; height: 12px; border-radius: 3px; background: var(--panel-2); }
.cal i.on { background: var(--amber); }
.cal i.out { background: transparent; }

/* ---------- overview ---------- */
.funnel { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.funnel li { position: relative; display: grid; grid-template-columns: 28px 1fr auto 48px; align-items: center; gap: 10px; padding: 9px 12px 9px 8px; border-radius: 12px; overflow: hidden; }
.funnel-bar { position: absolute; inset: 0 auto 0 0; width: var(--w); background: linear-gradient(90deg, rgba(255, 77, 58, 0.22), rgba(255, 179, 71, 0.16)); border-radius: 12px; z-index: 0; }
.funnel li > *:not(.funnel-bar) { position: relative; z-index: 1; }
.funnel-ico { color: var(--gold); display: grid; place-items: center; }
.funnel-ico .px { width: 15px; height: 15px; }
.funnel b { font-weight: 600; }
.funnel small { color: var(--bone-dim); text-align: right; }
.life { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 12px; }
.life-stat { display: flex; flex-direction: column; gap: 2px; }
.life-stat .px { width: 20px; height: 20px; color: var(--gold); margin-bottom: 4px; }
.life-stat b { font-size: 21px; font-weight: 600; }
.life-stat small { color: var(--bone-faint); font-size: 12.5px; }

/* ---------- live ---------- */
.live-hero { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 22px; align-items: start; }
.live-count { display: flex; flex-direction: column; gap: 2px; }
.live-count b { font-size: 64px; font-weight: 700; line-height: 1; margin-top: 10px; }
.live-count span { font-size: 16px; color: var(--bone-dim); }
.live-count small { color: var(--bone-faint); font-size: 12.5px; margin-top: 8px; max-width: 260px; }
.dot-live.big { width: 12px; height: 12px; }
.live-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; }
.live-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.live-list li:first-child { border-top: 0; }
.live-time { display: flex; flex-direction: column; align-items: flex-end; }
.live-time small { color: var(--bone-faint); font-size: 12px; }
.live-none { align-self: center; padding: 20px 0; }

/* ---------- players ---------- */
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.pcard {
  display: flex; flex-direction: column; gap: 11px; padding: 14px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line-soft);
  transition: border-color 0.12s, transform 0.12s;
}
.pcard:hover { border-color: rgba(255, 179, 71, 0.4); transform: translateY(-1px); }
.pcard.on { box-shadow: inset 3px 0 0 var(--green); }
.pcard-top { display: flex; align-items: center; gap: 11px; min-width: 0; }
.pcard-name { display: flex; flex-direction: column; min-width: 0; }
.pcard-name b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-name small { color: var(--bone-faint); font-size: 12.5px; }
.pcard-stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 6px; font-size: 13px; color: var(--bone-dim); }
.pcard-stats span { display: inline-flex; align-items: center; gap: 5px; }
.pcard-stats .px { width: 13px; height: 13px; color: var(--bone-faint); }
.pcard-phone { color: var(--bone-faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; font-size: 13.5px; }
.pager-btns { display: flex; gap: 8px; margin-left: auto; }
.phead { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.phead h2 { font-size: 22px; font-weight: 700; }
.phead-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.phead-text p { color: var(--bone-dim); font-size: 14px; }
.phead-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.ranks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ranks li { display: grid; grid-template-columns: 20px 1fr auto 70px; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.ranks li:first-child { border-top: 0; }
.ranks .px { width: 16px; height: 16px; color: var(--gold); }
.ranks b { font-size: 17px; font-weight: 600; }
.ranks small { color: var(--bone-faint); text-align: right; }

/* ---------- the Descent ---------- */
.descent { position: relative; }
.descent-scroll { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
.descent-svg { display: block; width: 100%; min-width: 780px; height: auto; }
.band-bg { fill: var(--bg); fill-opacity: 0.5; stroke: var(--accent); stroke-opacity: 0.1; }
.band-name { font: 13px var(--pixel); fill: var(--accent); text-transform: uppercase; letter-spacing: 0.02em; }
.band-count { font: 600 12.5px Fredoka, sans-serif; fill: var(--bone-dim); }
.seg { fill: none; stroke-linecap: round; stroke-width: var(--w); }
.seg.lit { stroke: var(--accent); stroke-opacity: 0.75; }
.seg.dim { stroke: var(--line); stroke-opacity: 0.8; }
.node { fill: var(--tc); fill-opacity: var(--op, 1); stroke: var(--ink); stroke-width: 1.5; }
.node.boss { stroke: var(--bone); stroke-width: 1.5; stroke-opacity: 0.7; }
.node.done { fill-opacity: 1; }
.node.gold { fill: var(--gold); fill-opacity: 1; stroke: #6b4a10; }
.node.open { fill: var(--ink); stroke: var(--tc); stroke-width: 1.6; }
.node.locked { fill: var(--line); fill-opacity: 0.6; }
.here-ring { fill: none; stroke: var(--bone); stroke-width: 2; stroke-dasharray: 4 3; animation: spin 6s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }
.pin-play { stroke: var(--amber); stroke-width: 3.2; stroke-linecap: round; }
.pin-gone { stroke: var(--devil); stroke-width: 3.2; stroke-linecap: round; }
.wall-label { font: 600 11.5px Fredoka, sans-serif; fill: var(--devil-soft); paint-order: stroke; stroke: var(--ink); stroke-width: 3px; }
.hit { fill: transparent; cursor: pointer; }
.descent-tip { top: 0; }
.descent-more { color: var(--bone-faint); font-size: 13.5px; text-align: center; padding: 12px 0 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: -4px 0 12px; font-size: 12.5px; color: var(--bone-dim); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; flex: none; }
.lg-road { width: 22px; height: 6px; border-radius: 3px; background: var(--amber); opacity: 0.75; }
.lg-gone { width: 3px; height: 14px; border-radius: 2px; background: var(--devil); }
.lg-play { width: 3px; height: 14px; border-radius: 2px; background: var(--amber); }
.lg-room { width: 8px; height: 8px; border-radius: 1.5px; background: var(--bone-dim); transform: rotate(45deg); }
.lg-tier i { width: 8px; height: 8px; border-radius: 50%; background: var(--tc); }
.level-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.level-badge {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 86px; height: 86px; border-radius: 26px;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--tc) 30%, transparent), transparent 70%), var(--panel-2);
  border: 2px solid var(--tc); box-shadow: 0 4px 0 color-mix(in srgb, var(--tc) 35%, #000);
}
.level-badge b { font-size: 30px; font-weight: 700; line-height: 1; }
.level-badge small { font: 8.5px var(--pixel); text-transform: uppercase; color: var(--tc); margin-top: 6px; }

/* ---------- habits ---------- */
.devils { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px; }
.devils li { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.devils b { font-size: 13px; font-weight: 600; text-transform: capitalize; }
.devils small { color: var(--bone-faint); font-size: 12px; }
.settings-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.settings-bars li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 14px; }
.settings-bars b { font-weight: 600; }
.sb-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; display: block; }
.sb-track i { display: block; height: 100%; background: var(--amber); border-radius: 3px; }

/* ---------- leaderboards ---------- */
.boards-pick { margin-bottom: 18px; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; max-width: 640px; margin: 8px auto 22px; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.pod b { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod:hover b { color: var(--amber); }
.pod-score { display: inline-flex; align-items: center; gap: 5px; color: var(--bone-dim); font-weight: 600; }
.pod-score .px { width: 14px; height: 14px; color: var(--gold); }
.pod-step {
  width: 100%; display: grid; place-items: center; font-style: normal; font: 22px var(--pixel); color: var(--bone);
  border-radius: 14px 14px 6px 6px; background: linear-gradient(var(--red-1), var(--red-2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 4px 0 var(--red-3);
}
.pod-1 .pod-step { height: 92px; background: linear-gradient(#e0a32a, #b8780f); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 0 #5a3a05; color: #2a1505; }
.pod-2 .pod-step { height: 66px; }
.pod-3 .pod-step { height: 48px; }

/* ---------- stores ---------- */
.conns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.conn { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line-soft); }
.conn b { display: block; font-weight: 600; }
.conn small { color: var(--bone-faint); font-size: 13px; }
.conn-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-3); color: var(--bone-faint); flex: none; }
.conn.ok .conn-ico { color: var(--green); }
.conn.err .conn-ico { color: var(--devil); }
.conn.err small { color: var(--devil-soft); }
.setup { margin: 0; padding: 0 0 0 20px; display: flex; flex-direction: column; gap: 12px; font-size: 14px; color: var(--bone-dim); }
.setup li { padding-left: 4px; }
.setup code { display: inline-block; font: 10px var(--pixel); color: var(--amber); background: var(--panel-2); border: 1px solid var(--line-soft); padding: 3px 6px 2px; border-radius: 6px; margin: 0 6px 4px 0; }

/* ---------- dialogs and toasts ---------- */
.dlg { padding: 0; border: 0; background: transparent; color: var(--bone); max-width: min(480px, calc(100vw - 32px)); width: 100%; }
.dlg::backdrop { background: rgba(5, 2, 3, 0.7); backdrop-filter: blur(3px); }
.dlg-in { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 60px -20px #000; }
.dlg-in header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dlg-in h2 { font-size: 19px; }
.dlg-body { color: var(--bone-dim); font-size: 14.5px; display: flex; flex-direction: column; gap: 12px; }
.dlg-in footer { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--bone-dim); }
.field input {
  height: 44px; padding: 0 13px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); color: var(--bone); font-size: 15px;
}
.field input:focus { outline: 2px solid var(--amber); outline-offset: 1px; border-color: transparent; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; padding: 11px 16px; border-radius: 13px;
  background: #2a1c22; border: 1px solid var(--line); box-shadow: 0 16px 34px -12px #000; font-size: 14px; transition: opacity 0.4s, transform 0.4s;
}
.toast.bad { border-color: rgba(255, 77, 58, 0.5); color: var(--devil-soft); }
.toast.out { opacity: 0; transform: translate(-50%, 8px); }

/* ---------- sign in ---------- */
.login-body { display: grid; place-items: center; padding: 24px 16px; }
.login { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 400px; }
.login-devil { width: 150px; height: 150px; object-fit: contain; margin-bottom: -22px; position: relative; z-index: 1; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.6)); }
.login-card { width: 100%; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 24px; padding: 30px 24px 22px; display: flex; flex-direction: column; gap: 14px; }
.login-brand { display: flex; align-items: center; gap: 11px; }
.login-brand img { border-radius: 12px; }
.login-brand b { display: block; font-size: 18px; font-weight: 700; }
.login-brand small { display: block; font: 9px var(--pixel); text-transform: uppercase; color: var(--bone-faint); margin-top: 2px; }
.login-card h1 { font-size: 26px; font-weight: 700; margin-top: 4px; }
.login-note { font-size: 13.5px; color: var(--amber); background: rgba(255, 179, 71, 0.08); border: 1px solid rgba(255, 179, 71, 0.25); border-radius: 12px; padding: 10px 12px; }
.login-error { color: var(--devil-soft); font-size: 13.5px; }
.login-foot { color: var(--bone-faint); font-size: 12.5px; text-align: center; }
[hidden] { display: none !important; }

/* ---------- smaller screens ---------- */
@media (max-width: 1180px) {
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles:has(> :nth-child(5):last-child) { --cols: 3; }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(280px, 84vw); z-index: 50; transform: translateX(-102%); transition: transform 0.2s ease; }
  .menu-open .side { transform: none; box-shadow: 20px 0 50px rgba(0, 0, 0, 0.6); }
  .scrim { position: fixed; inset: 0; z-index: 40; background: rgba(5, 2, 3, 0.6); }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .main { padding: 18px 16px 48px; }
  .grid.two, .grid.three { grid-template-columns: minmax(0, 1fr); }
  .updated { display: none; }
  .live-hero { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}
@media (max-width: 640px) {
  .head h1 { font-size: 25px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px; }
  .tile-value { font-size: 22px; }
  .card { padding: 15px 14px 16px; }
  .live-pill span, .top-search kbd { display: none; }
  .act { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .act .who { grid-column: 2 / 4; }
  .act .act-what { grid-column: 2 / 3; }
  .phead { grid-template-columns: auto minmax(0, 1fr); }
  .phead-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .life { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .live-list .step-chip { display: none; }
  .kv div { grid-template-columns: minmax(90px, 40%) 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.phead-text .tag { margin-left: 0; }
.scroll-box { max-height: 460px; overflow-y: auto; margin-right: -8px; padding-right: 8px; }
.scroll-box, .table-wrap.scroll-y, .live-list { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.chart-keys { grid-column: 1 / -1; list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--bone-dim); }
.chart-keys li { display: inline-flex; align-items: center; gap: 6px; }
.key.dashed { background: transparent; border: 1.5px dashed var(--bone-faint); }
.wall-lead { fill: none; stroke: var(--devil-soft); stroke-width: 1; stroke-opacity: 0.45; stroke-dasharray: 2 2; }
