:root {
  --bg: #000;
  --bg-elev: #0a0a0a;
  --bg-hover: #111;
  --line: #1c1c1c;
  --line-strong: #2a2a2a;
  --text: #ededed;
  --muted: #8a8a8a;
  --faint: #555;
  --white: #fff;
  --blue: #0070f3;
  --radius: 8px;
  --nav: 232px;
  --header: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #app { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #222; border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

.mono { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Layout */
.shell { min-height: 100%; display: flex; flex-direction: column; }
.header {
  height: var(--header);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(0,0,0,0.82);
  backdrop-filter: saturate(180%) blur(12px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}
.mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--white);
  color: #000;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: -0.04em;
}
.brand-name { font-weight: 600; letter-spacing: -0.03em; }
.brand-sub { color: var(--muted); font-size: 12px; margin-left: 2px; }
.header-search {
  flex: 1;
  max-width: 420px;
  position: relative;
}
.header-search input {
  width: 100%;
  height: 34px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px 0 34px;
  outline: none;
  color: var(--text);
}
.header-search input:focus { border-color: var(--line-strong); }
.header-search svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--faint);
}
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.chip {
  height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  font-size: 12px;
  color: var(--muted);
}
.chip b { color: var(--text); font-weight: 500; }
.ghost {
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}
.ghost:hover { background: var(--bg-hover); color: var(--text); }

.body { display: flex; flex: 1; min-height: 0; }
.nav {
  width: var(--nav);
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  overflow: auto;
}
.nav-label {
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 10px 6px;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: #111; color: var(--white); }
.nav-count { font-size: 11px; color: var(--faint); font-family: "IBM Plex Mono", ui-monospace, monospace; }
.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.nav-left svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .nav-left svg { opacity: 1; }

.main { flex: 1; min-width: 0; overflow: auto; }
.page { padding: 28px 32px 80px; max-width: 1280px; }
.page.wide { max-width: none; }

.kicker { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.h1 { font-size: 28px; letter-spacing: -0.045em; font-weight: 600; line-height: 1.15; }
.lede { margin-top: 8px; color: var(--muted); max-width: 52ch; }

.toolbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin: 20px 0 18px;
}
.select {
  height: 32px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  color: var(--text);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin: 22px 0 28px;
}
.stat {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value {
  margin-top: 6px;
  font-size: 24px;
  letter-spacing: -0.04em;
  font-weight: 600;
}
.stat-value.sm { font-size: 15px; font-weight: 500; }
.section {
  margin: 32px 0 12px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.rank-row { display: flex; gap: 8px; overflow: auto; padding-bottom: 4px; }
.season {
  min-width: 72px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--bg-elev);
}
.season-k { font-size: 11px; color: var(--faint); }
.season-v { font-size: 13px; margin-top: 4px; }

.match {
  display: flex; gap: 24px; flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--bg-elev);
}
.match .k { font-size: 11px; color: var(--faint); }
.match .v { margin-top: 2px; }
.win { color: #3ecf8e; }
.loss { color: #ff6369; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 16px 14px;
}
.grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
}
.group {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.group:first-child { border-top: 0; padding-top: 0; }
.group b { font-weight: 500; letter-spacing: -0.02em; }
.group span { color: var(--muted); font-size: 12px; }

.card {
  background: transparent;
  border: 0;
  text-align: left;
  width: 100%;
}
.card-media {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  overflow: hidden;
  background: #0d0d0d;
  border: 1px solid var(--line);
}
.card:hover .card-media { border-color: var(--line-strong); }
.card-media.rarity-kTranscendent { border-color: #f4c874; }
.card-media.rarity-kExalted { border-color: #e8a0a0; }
.card-media.rarity-kUltimate { border-color: #f0abfc; }
.card-media.rarity-kMythic { border-color: #c084fc; }
.card-media.rarity-kLegendary { border-color: #fbbf24; }
.card-media.rarity-kEpic { border-color: #7dd3fc; }
.card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top center;
}
.badge {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,0.72);
  border: 1px solid rgba(255,255,255,0.08);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
}
.badge.border-badge {
  left: 8px;
  right: auto;
  background: rgba(244, 200, 116, 0.92);
  color: #111;
  border-color: transparent;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card-media img.skin-border {
  position: absolute;
  inset: 0;
  object-fit: contain;
  pointer-events: none;
  background: transparent;
}
.card-meta { padding: 8px 2px 0; }
.card-name {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-sub {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.rarity { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }

.item {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elev);
}
.item img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #111; }
.item .n {
  padding: 7px 8px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid var(--line);
}
.item.dim { opacity: 0.28; }
.item.count { position: relative; }
.item .qty {
  position: absolute; bottom: 34px; right: 6px;
  background: #000; border: 1px solid var(--line);
  font-size: 11px; padding: 0 5px; border-radius: 4px;
}
.item.chroma-item { position: relative; }
.item.chroma-item .swatches {
  position: absolute;
  left: 6px;
  bottom: 36px;
  display: flex;
  gap: 3px;
}
.item.chroma-item .swatches i {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,0.3);
  display: block;
}

.profile-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.banner-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elev);
}
.banner-card > img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  object-position: center;
  background: #16120c;
}
.banner-card .n {
  padding: 7px 8px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid var(--line);
}
.border-preview {
  position: relative;
  aspect-ratio: 3 / 4;
  background: #0d0d0d;
}
.border-preview img.skin {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}
.border-preview img.frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.splash-wrap { position: relative; background: #111; }
.splash-wrap .splash {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  object-position: top;
}
.splash-wrap .splash-border {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.mastery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.mcard-art {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  overflow: hidden;
  background: #0d0d0d;
  border: 1px solid var(--line);
}
.mcard-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.mcard-art .mlvl {
  position: absolute;
  left: 8px;
  bottom: 8px;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.78);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 12px;
  font-weight: 600;
}
.mcard-name {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mcard-pts {
  font-size: 12px;
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}
.rarity-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 8px;
}

.mastery { display: flex; flex-direction: column; gap: 6px; }
.mrow {
  display: grid;
  grid-template-columns: 28px 36px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
}
.mrow img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.midx { color: var(--faint); font-size: 12px; text-align: right; }
.mpts { color: var(--muted); font-size: 12px; font-family: "IBM Plex Mono", ui-monospace, monospace; }
.mlvl {
  width: 28px; height: 28px; border-radius: 6px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  font-size: 12px; font-weight: 600;
}

.empty {
  padding: 64px 0;
  text-align: center;
  color: var(--faint);
}
.loot-cat { margin-bottom: 28px; }
.loot-cat h3 {
  font-size: 13px; font-weight: 500; margin-bottom: 10px;
  display: flex; gap: 8px; align-items: baseline;
}
.loot-cat h3 span { color: var(--muted); font-weight: 400; }

.modal {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,0.72);
  display: grid; place-items: center;
  padding: 24px;
}
.modal-card {
  width: min(640px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #0a0a0a;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}
.modal-card img.splash {
  width: 100%; max-height: 280px; object-fit: cover; object-position: top;
  background: #111;
}
.modal-body { padding: 18px 20px 22px; }
.modal-top { display: flex; justify-content: space-between; gap: 12px; }
.close {
  border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1;
}
.chroma-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chroma-row img {
  width: 40px; height: 40px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line);
}
.chroma-row img.off { opacity: 0.25; }

.gate, .boot {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px;
}
.panel {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 28px;
}
.panel h1 { font-size: 22px; letter-spacing: -0.04em; font-weight: 600; }
.panel p { color: var(--muted); margin: 10px 0 18px; }
.drop {
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  margin-bottom: 14px;
}
.drop.hot { border-color: #fff; color: var(--text); }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.primary {
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 0; background: #fff; color: #000; font-weight: 500;
}
.primary:hover { background: #e4e4e4; }
.err { color: #ff6369; font-size: 13px; margin-top: 10px; }
.sample-note {
  font-size: 12px; color: var(--faint);
  margin-top: 14px;
}

.hidden { display: none !important; }

@media (max-width: 860px) {
  .body { flex-direction: column; }
  .nav {
    width: 100%;
    display: flex;
    gap: 4px;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px;
  }
  .nav-label { display: none; }
  .nav-item { width: auto; flex: 0 0 auto; }
  .nav-count { display: none; }
  .page { padding: 20px 16px 72px; }
  .header { padding: 0 12px; height: auto; min-height: var(--header); flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .header-search { display: block; order: 3; flex: 1 1 100%; max-width: none; margin-top: 4px; }
  .brand-sub { display: none; }
}
