/* ---------- fonts (self-hosted, variable weight 400-700) ---------- */
@font-face {
  font-family: "Geist"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/Geist-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/Geist-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Geist Mono"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/GeistMono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist Mono"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/GeistMono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- theme: neutral graphite, single mint accent ---------- */
:root {
  --bg: #09090b;
  --bg-1: #0f0f11;
  --bg-2: #161618;
  --bg-3: #1d1d20;
  --bg-4: #252529;
  --border: #232327;
  --border-2: #303036;
  --fg: #ededef;
  --fg-2: #b4b4bb;
  --fg-muted: #7c7c85;
  --fg-faint: #4d4d55;
  --accent: #5fd3b3;
  --accent-2: #8fe3cc;
  --mark: #f5c451;
  --sel: rgba(255, 255, 255, 0.055);
  --sel-strong: rgba(255, 255, 255, 0.09);
  --danger: #f27474;
  --mono: "Geist Mono", ui-monospace, "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI Variable", "Segoe UI", Roboto, sans-serif;
  --row-h: 30px;
  --r: 8px;
  --t-bool: #5ad08a;
  --t-float: #f0a062;
  --t-int: #6fb1e6;
  --t-ptr: #bf9af0;
  --t-struct: #5fd3b3;
  --t-delegate: #ec85b4;
  --t-enum: #e9c75a;
  --t-string: #b3d96a;
  --t-other: #9a9aa3;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 13.5px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
a { color: var(--accent-2); text-decoration: none; }
code, kbd, .mono { font-family: var(--mono); }
code { background: var(--bg-3); padding: 1px 6px; border-radius: 5px; font-size: 12px; color: var(--fg-2); }
kbd {
  display: inline-block; min-width: 18px; padding: 0 5px; text-align: center;
  font-size: 11px; line-height: 18px; border-radius: 5px;
  background: var(--bg-3); border: 1px solid var(--border-2); border-bottom-width: 2px; color: var(--fg-2);
}
.muted { color: var(--fg-muted); }
.hidden { display: none !important; }
::selection { background: rgba(95, 211, 179, .3); }

/* ---------- header ---------- */
#top {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 16px; background: var(--bg-1); border-bottom: 1px solid var(--border);
  position: relative; z-index: 20;
}
.brand { font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.logo {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(180deg, #2a2a2f, #1a1a1e); color: var(--accent); font: 600 12px var(--mono);
  border: 1px solid var(--border-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.logo.big { width: 64px; height: 64px; font-size: 26px; border-radius: 18px; margin: 0 auto 18px; }
.search-wrap { flex: 1; position: relative; max-width: 820px; }
#search {
  width: 100%; height: 36px; padding: 0 36px 0 14px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--border-2); color: var(--fg); font: 13.5px var(--sans); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
#search::placeholder { color: var(--fg-muted); }
#search:focus { border-color: var(--accent); background: var(--bg-1); box-shadow: 0 0 0 3px rgba(95,211,179,.15); }
.search-kbd { position: absolute; right: 10px; top: 9px; pointer-events: none; }
.stats { white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
.build {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 11px; border-radius: 14px; white-space: nowrap;
  background: var(--bg-2); border: 1px solid var(--border-2);
  font: 12px var(--mono); color: var(--fg-2);
}
.build .ver { font-weight: 600; color: var(--accent); }
.build .sep { opacity: .4; }
.build .ago { color: var(--fg-muted); font-family: var(--sans); }
.build .ago.stale { color: var(--t-float); }
.build-line { font-family: var(--mono); font-size: 12.5px; color: var(--fg-2); margin: 0 0 10px; }
.build-line span { margin: 0 3px; }
.build-line .ver { color: var(--accent); font-weight: 600; }
.build-line .ago { color: var(--fg-muted); font-family: var(--sans); }
.actions { display: flex; gap: 6px; margin-left: auto; }

.btn {
  height: 30px; padding: 0 12px; border-radius: var(--r); cursor: pointer; white-space: nowrap;
  background: var(--bg-2); border: 1px solid var(--border-2); color: var(--fg-2); font: 500 12.5px var(--sans);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--bg-3); border-color: #3a3a41; color: var(--fg); }
.btn:active { background: var(--bg-4); }
.btn.small { height: 24px; padding: 0 8px; font-size: 11.5px; border-radius: 6px; }
.btn.active { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .35; cursor: default; }

/* ---------- search results ---------- */
.results {
  position: absolute; left: 0; top: 42px; width: min(820px, calc(100vw - 32px)); max-height: min(70vh, 720px); overflow: auto;
  background: var(--bg-1); border: 1px solid var(--border-2); border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,.6), 0 0 0 1px rgba(0,0,0,.4);
}
.results .group { padding: 8px 12px 4px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-muted); position: sticky; top: 0; background: var(--bg-1); z-index: 1; }
.results .meta-line { padding: 8px 12px; font-size: 12px; color: var(--fg-muted); border-top: 1px solid var(--border); }
.result { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 7px 12px; cursor: pointer; border-left: 2px solid transparent; }
.result:hover, .result.active { background: var(--sel-strong); border-left-color: var(--accent); }
.result .title { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .title .cls { color: var(--fg-muted); }
.result .title .sep { color: var(--fg-faint); margin: 0 5px; }
.result .right { font-family: var(--mono); font-size: 12px; color: var(--accent); text-align: right; white-space: nowrap; }
.result .preview { grid-column: 1 / -1; font-family: var(--mono); font-size: 11.5px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .preview .ln { color: var(--fg-faint); margin-right: 8px; }
mark { background: transparent; color: var(--mark); font-weight: 600; }

/* ---------- layout ---------- */
main { flex: 1; display: grid; grid-template-columns: 340px 1fr; min-height: 0; }
#sidebar { background: var(--bg-1); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.side-tools { padding: 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.side-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.side-row #class-count { margin-left: auto; font-variant-numeric: tabular-nums; }
input[type=search], select {
  height: 30px; padding: 0 10px; border-radius: var(--r);
  background: var(--bg-2); border: 1px solid var(--border-2); color: var(--fg); font: 13px var(--sans); outline: none;
  transition: border-color .15s;
}
input[type=search]::placeholder { color: var(--fg-muted); }
input[type=search]:focus, select:focus { border-color: var(--accent); }
input[type=search]::-webkit-search-cancel-button { filter: invert(.6); cursor: pointer; }
select { color: var(--fg-2); }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; white-space: nowrap; color: var(--fg-2); }
.chk input { accent-color: var(--accent); margin: 0; }

/* virtual list */
.vlist { flex: 1; overflow: auto; position: relative; outline: none; }
.vlist-spacer { width: 1px; }
.vlist-items { position: absolute; top: 0; left: 0; right: 0; }
.vrow {
  height: var(--row-h); display: flex; align-items: center; gap: 8px; padding: 0 12px; cursor: pointer;
  font-family: var(--mono); font-size: 12px; white-space: nowrap; border-left: 2px solid transparent; color: var(--fg-2);
}
.vrow:hover { background: var(--sel); color: var(--fg); }
.vrow.active { background: var(--sel-strong); border-left-color: var(--accent); color: var(--fg); }
.vrow .nm { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.vrow .cnt { color: var(--fg-muted); font-size: 11px; min-width: 2.5em; text-align: right; font-variant-numeric: tabular-nums; }
.vrow.empty .nm { color: var(--fg-muted); }

/* important offsets */
.star { color: var(--mark); }
.vrow.pin { border-bottom: 1px solid var(--border); background: var(--bg-1); flex: none; font-weight: 600; color: var(--fg); }
.vrow.pin .star { font-size: 12px; }
.vrow.pin:hover { background: var(--sel); }
.vrow.pin.active { background: var(--sel-strong); border-left-color: var(--mark); }
#important-view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
#important-view h1 { margin: 0; font: 600 19px var(--mono); letter-spacing: -.01em; }
#important-filter { width: 280px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 24px; padding: 0 10px; border-radius: 12px; cursor: pointer; font-size: 11.5px; font-family: var(--mono);
  background: var(--bg-2); border: 1px solid var(--border-2); color: var(--fg-muted); display: inline-flex; align-items: center; gap: 6px;
  transition: background .12s, border-color .12s, color .12s;
}
.chip:hover { color: var(--fg); border-color: #3a3a41; }
.chip.on { background: color-mix(in srgb, var(--mark) 14%, transparent); border-color: color-mix(in srgb, var(--mark) 45%, transparent); color: var(--mark); }
.chip .n { opacity: .6; }
#important-table tr.grp td {
  height: 36px; padding-top: 12px; background: var(--bg); color: var(--mark); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--border); font-family: var(--sans);
}
#important-table tr.grp td .btn { text-transform: none; letter-spacing: 0; margin-left: 10px; font-weight: 500; }
#important-table tr.grp:hover td { background: var(--bg); }
#important-table td.grp-cell { color: var(--fg-muted); }
.banner { margin: 10px 18px 0; padding: 10px 14px; border-radius: var(--r); background: rgba(242,116,116,.1); border: 1px solid rgba(242,116,116,.35); color: #f5a3a3; font-size: 12.5px; font-family: var(--mono); white-space: pre-wrap; }
.imp-empty { padding: 32px 18px; text-align: center; line-height: 1.8; }

/* code snippets */
.code-section { padding: 18px 20px 28px; display: flex; flex-direction: column; gap: 14px; }
.code-section .sec-title { font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--mark); margin: 0 0 -4px; }
.code-card { background: var(--bg-1); border: 1px solid var(--border-2); border-radius: 12px; overflow: hidden; }
.code-card.flash { animation: cardflash 1.6s ease-out; }
@keyframes cardflash { 0% { box-shadow: 0 0 0 2px var(--mark); } 100% { box-shadow: 0 0 0 0 transparent; } }
.code-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px 9px 14px; border-bottom: 1px solid var(--border); background: var(--bg-2); }
.code-head .title { font: 600 13px var(--mono); color: var(--fg); }
.code-head .lang { font: 10.5px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--fg-muted); }
.code-head .for { font: 11.5px var(--mono); color: var(--accent); cursor: pointer; padding: 1px 8px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.code-head .for:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.code-head .btn { margin-left: auto; }
.code-note { padding: 10px 14px 0; font-size: 12.5px; color: var(--fg-2); line-height: 1.55; }
.code-card pre { margin: 0; padding: 12px 14px 14px; overflow-x: auto; font: 12.5px/1.65 var(--mono); color: var(--fg-2); tab-size: 4; }
.code-card pre code { background: none; padding: 0; border-radius: 0; font: inherit; color: inherit; }
.code-card pre .k { color: #c792ea; }
.code-card pre .t { color: var(--t-struct); }
.code-card pre .n { color: var(--t-float); }
.code-card pre .s { color: var(--t-string); }
.code-card pre .c { color: var(--fg-muted); font-style: italic; }
.code-card pre .f { color: #82aaff; }
.code-card pre .p { color: var(--fg-muted); }
.btn.code-btn { font-family: var(--mono); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); visibility: visible !important; }
.results .result.imp .title::before { content: "★ "; color: var(--mark); }

/* ---------- content ---------- */
#content { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
#empty-state { margin: auto; text-align: center; max-width: 520px; padding: 24px; }
#empty-state h2 { font-weight: 600; letter-spacing: -.02em; font-size: 20px; margin: 0 0 8px; }
#class-view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.class-header { display: flex; align-items: flex-start; gap: 16px; padding: 16px 20px 12px; border-bottom: 1px solid var(--border); }
.class-title { min-width: 0; flex: 1; }
#class-name { margin: 0; font: 600 19px var(--mono); letter-spacing: -.01em; word-break: break-all; }
#class-meta { font-size: 12px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.class-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.table-tools { display: flex; align-items: center; gap: 10px; padding: 8px 20px; border-bottom: 1px solid var(--border); font-size: 12px; }
.table-tools #field-filter { width: 280px; }
.table-tools #type-filter { max-width: 260px; }
.table-tools #field-count { margin-left: auto; font-variant-numeric: tabular-nums; }

.table-wrap { flex: 1; overflow: auto; min-height: 0; }
table { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: 12.5px; }
thead th {
  position: sticky; top: 0; background: var(--bg-1); z-index: 2; text-align: left; font-weight: 600;
  color: var(--fg-muted); font: 600 10.5px/1 var(--sans); text-transform: uppercase; letter-spacing: .08em;
  padding: 10px 10px; border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; white-space: nowrap;
}
thead th:hover { color: var(--fg); }
thead th.sorted { color: var(--accent); }
thead th.sorted::after { content: " ▲"; font-size: 8px; }
thead th.sorted.desc::after { content: " ▼"; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody td { padding: 0 10px; height: var(--row-h); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:hover { background: var(--sel); }
tbody tr.selected { background: var(--sel-strong); box-shadow: inset 2px 0 0 var(--accent); }
tbody tr.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { background: rgba(245,196,81,.35); } 100% { background: var(--sel-strong); } }
td.idx { color: var(--fg-faint); width: 1%; }
td.name { font-weight: 500; cursor: copy; }
td.name:hover, td.offset:hover { color: var(--accent-2); }
td.offset { color: var(--accent); cursor: copy; width: 1%; }
td.dec { color: var(--fg-muted); width: 1%; }
td.tcell { width: 1%; }
td.gap { color: var(--fg-muted); width: 1%; }
td.gap.odd { color: var(--t-enum); }
td.act { width: 1%; }
td.act button { visibility: hidden; }
tr:hover td.act button { visibility: visible; }
.hide-dec .col-dec, .hide-dec td.dec { display: none; }
.hide-gap .col-gap, .hide-gap td.gap { display: none; }
tbody td:first-child, thead th:first-child { padding-left: 20px; }

.type {
  display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11.5px; cursor: pointer;
  background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 25%, transparent);
  max-width: 420px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
  transition: background .12s;
}
.type:hover { background: color-mix(in srgb, var(--c) 24%, transparent); }
.t-bool { --c: var(--t-bool); }
.t-float { --c: var(--t-float); }
.t-int { --c: var(--t-int); }
.t-ptr { --c: var(--t-ptr); }
.t-struct { --c: var(--t-struct); }
.t-delegate { --c: var(--t-delegate); }
.t-enum { --c: var(--t-enum); }
.t-string { --c: var(--t-string); }
.t-other { --c: var(--t-other); }

/* source */
#source-view { position: absolute; inset: 0; background: var(--bg); display: flex; flex-direction: column; z-index: 5; }
.source-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 20px; border-bottom: 1px solid var(--border); font-size: 12px; }
#source-pre { margin: 0; flex: 1; overflow: auto; padding: 10px 0; font: 12.5px/1.65 var(--mono); color: var(--fg-2); }
#source-pre .sl { display: flex; padding: 0 20px; }
#source-pre .sl .ln { color: var(--fg-faint); width: 7ch; flex: none; text-align: right; margin-right: 18px; user-select: none; }
#source-pre .sl.hl { background: var(--sel-strong); box-shadow: inset 2px 0 0 var(--mark); color: var(--fg); }
#source-pre .sl.field { cursor: pointer; }
#source-pre .sl.field:hover { background: var(--sel); color: var(--fg); }

/* modal + toast */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; }
.modal-box { background: var(--bg-1); border: 1px solid var(--border-2); border-radius: 14px; padding: 18px 20px; width: min(680px, 92vw); max-height: 86vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
table.help { font-family: var(--sans); font-size: 13px; margin: 8px 0 14px; }
table.help td { padding: 4px 10px 4px 0; vertical-align: top; border: 0; height: auto; white-space: normal; color: var(--fg-2); }
table.help td:first-child { white-space: nowrap; }
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--bg-3); border: 1px solid var(--border-2); color: var(--fg); padding: 8px 14px; border-radius: 10px; font-size: 12.5px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2a2f; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #38383f; }
* { scrollbar-color: #2a2a2f transparent; scrollbar-width: thin; }

@media (max-width: 900px) {
  main { grid-template-columns: 240px 1fr; }
  .stats { display: none; }
}
