/* =====================================================================
   Hoenkie SMP Stats - theme lifted straight from the logo:
   navy outline, orange->amber letter faces, yellow bevel highlight,
   deep-red block extrusion, and silver for the secondary "SMP" text.
   ===================================================================== */

:root {
  color-scheme: dark;

  --bg: #03101f;
  --navy: #021935;          /* logo outline */
  --panel: #07203f;
  --card: #0b2a50;
  --card-hi: #11355f;
  --line: #1a4070;
  --edge: #010a16;          /* hard "block edge" shadow */

  --text: #eef2f6;
  --muted: #93a7be;
  --dim: #5f7894;

  --orange-top: #e9612a;    /* letter face, top */
  --orange: #f08a2b;
  --orange-bottom: #f6ab2f; /* letter face, bottom */
  --yellow: #ffe066;        /* bevel highlight */
  --ember: #8e231d;         /* extrusion side */
  --ember-deep: #5f1413;
  --silver: #b7c1c8;
  --silver-hi: #e9edf0;

  --gold: #ffd23f;
  --bronze: #d98a45;
  --online: #5fdc6b;

  --face: linear-gradient(180deg, var(--orange-top), var(--orange-bottom));
  --radius: 6px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Same family as --font, kept distinct so numeric displays can opt into tabular-nums */
  --font-num: "Inter", system-ui, sans-serif;

  --topbar-h: 58px;
  --bottombar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  overflow-x: clip;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* faint block grid + an ember glow behind the header, like the sky behind a title screen */
  background-image:
    radial-gradient(ellipse 80% 45% at 50% -8%, rgba(240, 138, 43, 0.16), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; }
code {
  font-family: ui-monospace, Consolas, monospace;
  color: var(--orange-bottom);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 3px;
}
.hidden { display: none !important; }

:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   Shell
--------------------------------------------------------------------- */

.app-shell {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  max-width: 1480px;
  margin: 0 auto;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  position: sticky;
  top: 14px;
  height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 4px 0 var(--edge);
  padding: 14px 10px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 40;
}

.sidebar-brand {
  display: block;
  padding: 4px 8px 16px;
}
.brand-logo {
  width: 100%;
  max-width: 200px;
  height: auto;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.35));
  transition: transform 0.15s ease;
}
.sidebar-brand:hover .brand-logo { transform: translateY(-2px) rotate(-1deg); }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 11px;
  margin-bottom: 12px;
  background: var(--bg);
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  color: var(--dim);
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.search-trigger span { flex: 1; }
.search-trigger:hover { color: var(--muted); border-color: var(--line); }
kbd {
  font-family: var(--font-num);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 6px;
  border-radius: 3px;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  color: var(--muted);
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  border: 2px solid transparent;
  transition: background 0.1s ease, color 0.1s ease;
}
.nav-item .nav-ico {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  image-rendering: pixelated;
  opacity: 0.75;
  transition: opacity 0.1s ease, transform 0.15s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav-item:hover .nav-ico { opacity: 1; transform: scale(1.1); }
.nav-item.active {
  color: #fff;
  background: var(--face);
  border-color: var(--edge);
  box-shadow: inset 0 2px 0 rgba(255, 224, 102, 0.8), 0 3px 0 var(--ember-deep);
  text-shadow: 0 1px 0 var(--ember);
  font-weight: 600;
}
.nav-item.active .nav-ico { opacity: 1; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35)); }

.sidebar-footer {
  margin-top: 12px;
  padding: 12px 10px 4px;
  border-top: 2px solid var(--edge);
  font-size: 0.78rem;
  color: var(--dim);
  line-height: 1.6;
}
.sidebar-footer strong { color: var(--muted); font-weight: 600; }

.main-content {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 4px 0 var(--edge);
  padding: 28px 32px 44px;
  min-height: calc(100vh - 28px);
}

/* ---------------------------------------------------------------------
   Page header
--------------------------------------------------------------------- */

.content-header { margin-bottom: 24px; }
.header-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.header-text { flex: 1; min-width: 0; }
.content-header h1 {
  margin: 0;
  font-weight: 800;
  font-size: 1.7rem;
  line-height: 1.15;
  color: #fff;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.content-subtitle { margin: 8px 0 0; font-size: 0.88rem; color: var(--muted); }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.section-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--card);
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.06), 0 3px 0 var(--edge);
}
.section-icon .item-icon { width: 36px; height: 36px; background: none; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 6px 10px 6px 6px;
  background: none;
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.back-link:hover { color: var(--orange-bottom); background: rgba(255, 255, 255, 0.04); }

/* ---------------------------------------------------------------------
   Building blocks
--------------------------------------------------------------------- */

.card {
  background: var(--card);
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 3px 0 var(--edge);
}

.section { margin-top: 30px; }
.section:first-child { margin-top: 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--orange-bottom);
}
.section-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.section-link:hover { color: var(--yellow); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--edge);
  background: var(--card-hi);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.1), 0 3px 0 var(--edge);
  color: var(--text);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease, filter 0.1s ease;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.1), 0 0 0 var(--edge); }
.btn-primary {
  background: var(--face);
  color: #fff;
  text-shadow: 0 1px 0 var(--ember);
  box-shadow: inset 0 2px 0 rgba(255, 224, 102, 0.85), 0 3px 0 var(--ember-deep);
}
.btn-primary:active { box-shadow: inset 0 2px 0 rgba(255, 224, 102, 0.85), 0 0 0 var(--ember-deep); }

.pill-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 2px 6px;
  margin: 0 -2px 10px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.pill-row::-webkit-scrollbar { display: none; }
.pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 2px solid var(--edge);
  background: var(--card);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  scroll-snap-align: start;
  white-space: nowrap;
}
.pill:hover { color: var(--text); background: var(--card-hi); }
.pill.active {
  background: var(--face);
  color: #fff;
  text-shadow: 0 1px 0 var(--ember);
  box-shadow: inset 0 2px 0 rgba(255, 224, 102, 0.8), 0 2px 0 var(--ember-deep);
}
.pill .count { font-size: 0.75rem; opacity: 0.7; font-weight: 500; }

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  background: var(--bg);
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  color: var(--dim);
}
.field:focus-within { border-color: var(--orange); }
.field input, .field select {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 16px; /* >=16px stops iOS Safari from zooming on focus */
  padding: 8px 0;
}
.field input::placeholder { color: var(--dim); }
.field select { cursor: pointer; appearance: none; }
.field select option { background: var(--panel); }
.field-label { font-size: 0.78rem; font-weight: 600; color: var(--dim); white-space: nowrap; }
.field.compact { flex: 0 1 auto; }

.item-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  image-rendering: pixelated;
  object-fit: contain;
  border-radius: 3px;
}
span.item-icon {
  display: inline-grid;
  place-items: center;
  background: var(--card-hi);
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 0.8rem;
  font-weight: 700;
}
.icon-slot {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.28);
  border: 2px solid var(--edge);
  border-radius: 4px;
  /* inventory-slot bevel */
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.35), inset -2px -2px 0 rgba(255, 255, 255, 0.06);
}

.avatar {
  flex-shrink: 0;
  image-rendering: pixelated;
  border-radius: 4px;
  background: var(--card-hi);
  box-shadow: 0 2px 0 var(--edge);
}

.rank {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.25);
  border: 2px solid var(--edge);
}
.rank.r1 { background: linear-gradient(180deg, #ffe987, var(--gold)); color: #4a3200; box-shadow: 0 2px 0 #8a6100; }
.rank.r2 { background: linear-gradient(180deg, #f4f7f9, var(--silver)); color: #2a3440; box-shadow: 0 2px 0 #5d6a74; }
.rank.r3 { background: linear-gradient(180deg, #f2b27a, var(--bronze)); color: #4a2200; box-shadow: 0 2px 0 #7a3f12; }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--dim);
  flex-shrink: 0;
}
.dot.online { background: var(--online); box-shadow: 0 0 0 3px rgba(95, 220, 107, 0.2); }
.dot.recent { background: var(--orange-bottom); }

.muted { color: var(--muted); }
.dim { color: var(--dim); }

/* ---------------------------------------------------------------------
   Overview
--------------------------------------------------------------------- */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.metric {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  min-width: 0;
}
.metric-body { min-width: 0; }
.metric-label {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric-value {
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric-value small { font-size: 0.6em; color: var(--muted); font-weight: 500; margin-left: 2px; }

/* Podium - top 3 by playtime, with full-body skins standing on blocks */
.podium {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  align-items: end;
  gap: 12px;
  padding: 22px 16px 0;
  overflow: hidden;
}
.podium-spot { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.podium-spot img.skin {
  width: auto;
  height: 150px;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35));
  transition: transform 0.15s ease;
}
.podium-spot.p1 img.skin { height: 180px; }
.podium-spot:hover img.skin { transform: translateY(-4px); }
.podium-name {
  margin-top: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.podium-value { font-size: 0.8rem; color: var(--muted); margin-bottom: 8px; }
.podium-block {
  width: 100%;
  display: grid;
  place-items: center;
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 1.7rem;
  color: #fff;
  text-shadow: 0 2px 0 var(--ember);
  background: var(--face);
  border: 2px solid var(--edge);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  box-shadow: inset 0 3px 0 rgba(255, 224, 102, 0.85), inset 0 -14px 0 var(--ember);
}
.p1 .podium-block { height: 96px; }
.p2 .podium-block {
  height: 70px;
  background: linear-gradient(180deg, #dfe5ea, #9aa6b0);
  text-shadow: 0 3px 0 #4b5661;
  box-shadow: inset 0 3px 0 #f6f8fa, inset 0 -14px 0 #56626d;
}
.p3 .podium-block {
  height: 54px;
  background: linear-gradient(180deg, #e39a55, #b8652b);
  text-shadow: 0 3px 0 #5a2a0c;
  box-shadow: inset 0 3px 0 #f5c08c, inset 0 -14px 0 #6e3512;
}

.recent-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 2px 6px;
  -webkit-overflow-scrolling: touch;
}
.recent-strip::-webkit-scrollbar { display: none; }
.recent-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 8px 14px 8px 8px;
}
.recent-chip:hover { background: var(--card-hi); }
.recent-chip .name { font-weight: 600; font-size: 0.9rem; }
.recent-chip .when { display: flex; align-items: center; gap: 6px; font-size: 0.76rem; color: var(--muted); }

.lb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.lb-card { padding: 14px 14px 8px; min-width: 0; }
.lb-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lb-card-head .item-icon { width: 26px; height: 26px; }
.lb-card-head h3 { margin: 0; flex: 1; font-size: 0.95rem; font-weight: 700; }
.lb-card-head a { font-size: 0.78rem; font-weight: 600; color: var(--dim); }
.lb-card-head a:hover { color: var(--yellow); }

/* ---------------------------------------------------------------------
   Row lists - used by leaderboards, categories, player stats, stat pages.
   One flexible layout for every screen size: no horizontal table scroll.
--------------------------------------------------------------------- */

.list { overflow: hidden; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 9px 14px;
  border-bottom: 2px solid rgba(1, 10, 22, 0.55);
  transition: background 0.08s ease;
}
.row:last-child { border-bottom: none; }
a.row:hover, .row.clickable:hover { background: rgba(255, 255, 255, 0.045); }
a.row:active { background: rgba(255, 255, 255, 0.08); }
.row-main { flex: 1; min-width: 0; }
.row-title {
  font-weight: 600;
  font-size: 0.93rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--muted);
  min-width: 0;
}
.row-sub span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-value {
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.05rem;
  text-align: right;
  white-space: nowrap;
  color: var(--text);
}
.row-value .share { display: block; font-family: var(--font); font-size: 0.72rem; font-weight: 500; color: var(--dim); }
.row.zero { opacity: 0.45; }
.row.me { background: rgba(240, 138, 43, 0.1); }

.list.compact .row { min-height: 44px; padding: 6px 4px; border-bottom-color: rgba(1, 10, 22, 0.35); }
.list.compact .rank { width: 24px; height: 24px; font-size: 0.8rem; }
.list.compact .row-value { font-size: 0.95rem; }

.list-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 2px solid var(--edge);
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--dim);
}

.show-more {
  display: block;
  width: 100%;
  padding: 14px;
  background: rgba(0, 0, 0, 0.18);
  border: none;
  border-top: 2px solid var(--edge);
  color: var(--orange-bottom);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}
.show-more:hover { background: rgba(0, 0, 0, 0.3); color: var(--yellow); }

.empty-row { padding: 28px 16px; text-align: center; color: var(--dim); font-size: 0.9rem; }

/* ---------------------------------------------------------------------
   Players grid
--------------------------------------------------------------------- */

.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.pcard {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  transition: transform 0.1s ease, background 0.1s ease;
}
.pcard:hover { transform: translateY(-2px); background: var(--card-hi); }
.pcard-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pcard-name { font-weight: 700; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-seen { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.pcard-rank { margin-left: auto; }
.pcard-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.pcard-stat {
  padding: 7px 8px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 4px;
  min-width: 0;
}
.pcard-stat .k { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--dim); }
.pcard-stat .v { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-stat.hl { background: rgba(240, 138, 43, 0.16); }
.pcard-stat.hl .k { color: var(--orange-bottom); }

/* ---------------------------------------------------------------------
   Player profile
--------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 22px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 95px 60%, rgba(240, 138, 43, 0.22), transparent 55%);
  pointer-events: none;
}
.hero-skin {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.hero-skin img {
  height: 240px;
  width: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 0 rgba(0, 0, 0, 0.35));
}
.hero-info { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 0.85rem; color: var(--muted); }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 5px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid var(--edge);
}
.badge .item-icon { width: 20px; height: 20px; }
.badge.gold { background: linear-gradient(180deg, rgba(255, 210, 63, 0.3), rgba(255, 210, 63, 0.12)); color: #ffe38a; }
.badge.silver { background: rgba(183, 193, 200, 0.16); color: var(--silver-hi); }
.badge.bronze { background: rgba(217, 138, 69, 0.18); color: #f2b27a; }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 4px;
  min-width: 0;
}
.tile .item-icon { width: 26px; height: 26px; }
.tile-body { min-width: 0; }
.tile .k { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .v { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .r { font-family: var(--font); font-size: 0.7rem; font-weight: 700; color: var(--orange-bottom); margin-left: 4px; }

.highlight-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.highlight {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 16px 10px 14px;
  min-width: 0;
  transition: transform 0.1s ease, background 0.1s ease;
}
.highlight:hover { transform: translateY(-2px); background: var(--card-hi); }
.highlight .icon-slot { width: 52px; height: 52px; }
.highlight .icon-slot .item-icon { width: 34px; height: 34px; }
.highlight .k { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--orange-bottom); }
.highlight .n { font-weight: 700; font-size: 0.9rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.highlight .v { font-size: 0.78rem; color: var(--muted); }

/* ---------------------------------------------------------------------
   Compare
--------------------------------------------------------------------- */

.vs-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; padding: 16px 12px; }
.vs-side img.skin { height: 150px; width: auto; image-rendering: pixelated; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)); }
.vs-side:hover img.skin { transform: translateY(-3px); }
.vs-side img.skin { transition: transform 0.15s ease; }
.vs-pickers {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.vs-pickers .field { flex: none; }
.vs-pickers .field select { text-overflow: ellipsis; }
.vs-score { font-size: 0.85rem; font-weight: 600; text-align: center; color: var(--muted); }
.vs-score b { display: block; font-family: var(--font-num); font-weight: 800; font-size: 2rem; color: #fff; }
.vs-badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 8px;
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  background: var(--face);
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: inset 0 3px 0 rgba(255, 224, 102, 0.85), 0 4px 0 var(--ember-deep);
}

.vs-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 2px solid rgba(1, 10, 22, 0.55);
}
.vs-row:last-child { border-bottom: none; }
.vs-label { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.vs-label .item-icon { width: 24px; height: 24px; }
.vs-val { min-width: 0; }
.vs-val .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.vs-val.left { text-align: right; }
.vs-val.win .num { color: var(--yellow); }
.vs-val.win .num::after { content: " \2605"; font-size: 0.8em; }
.vs-val.left.win .num::after { content: ""; }
.vs-val.left.win .num::before { content: "\2605  "; font-size: 0.8em; }

/* ---------------------------------------------------------------------
   Search palette
--------------------------------------------------------------------- */

.palette {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 10vh 16px 16px;
  background: rgba(1, 8, 18, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.palette-box {
  width: 100%;
  max-width: 620px;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: 0 6px 0 var(--edge), 0 30px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: pop 0.14s ease-out;
}
@keyframes pop { from { transform: translateY(-8px) scale(0.98); opacity: 0; } }
.palette-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 16px;
  border-bottom: 2px solid var(--edge);
  color: var(--dim);
}
.palette-input input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 17px;
  padding: 12px 0;
}
.palette-input input::-webkit-search-cancel-button { display: none; }
.palette-close {
  padding: 6px 10px;
  background: var(--card);
  border: 2px solid var(--edge);
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.palette-results { overflow-y: auto; overscroll-behavior: contain; padding: 6px; }
.palette-group {
  padding: 10px 10px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dim);
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.palette-item .row-main { min-width: 0; }
.palette-item.sel { background: var(--face); color: #fff; }
.palette-item.sel .row-sub { color: rgba(255, 255, 255, 0.85); }
.palette-hint { padding: 26px 16px; text-align: center; color: var(--dim); font-size: 0.88rem; }

/* ---------------------------------------------------------------------
   States
--------------------------------------------------------------------- */

.state-message { text-align: center; padding: 6rem 1rem; color: var(--muted); }
.state-title { font-size: 1.05rem; color: var(--text); margin-bottom: 6px; }
.block-loader { display: inline-flex; gap: 6px; margin-bottom: 14px; }
.block-loader span {
  width: 14px;
  height: 14px;
  background: var(--face);
  border: 2px solid var(--edge);
  box-shadow: inset 0 2px 0 rgba(255, 224, 102, 0.8);
  animation: hop 0.9s ease-in-out infinite;
}
.block-loader span:nth-child(2) { animation-delay: 0.15s; }
.block-loader span:nth-child(3) { animation-delay: 0.3s; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-10px); } }

.skeleton {
  height: 56px;
  border-bottom: 2px solid rgba(1, 10, 22, 0.55);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.view-enter { animation: fadein 0.18s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; border: 2px solid var(--panel); }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* Mobile-only chrome is hidden on desktop */
.topbar, .bottombar, .scrim { display: none; }

/* ---------------------------------------------------------------------
   Responsive
--------------------------------------------------------------------- */

@media (max-width: 1200px) {
  .lb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .highlight-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tablet & phone: sidebar becomes an off-canvas drawer, with a top bar and a
   thumb-reachable bottom tab bar for the most used destinations. */
@media (max-width: 960px) {
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 50;
    height: calc(var(--topbar-h) + var(--safe-top));
    padding: var(--safe-top) 8px 0;
    background: rgba(2, 25, 53, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--edge);
  }
  .topbar-logo img { height: 36px; width: auto; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35)); }
  .icon-btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    background: none;
    border: none;
    border-radius: var(--radius);
    color: var(--silver-hi);
    cursor: pointer;
  }
  .icon-btn:active { background: rgba(255, 255, 255, 0.08); }

  .app-shell { display: block; padding: 10px 10px calc(var(--bottombar-h) + var(--safe-bottom) + 16px); }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: auto;
    width: min(300px, 84vw);
    border-radius: 0 var(--radius) var(--radius) 0;
    border-left: none;
    padding-top: calc(16px + var(--safe-top));
    padding-bottom: calc(10px + var(--safe-bottom));
    transform: translateX(-105%);
    transition: transform 0.22s cubic-bezier(.2, .8, .2, 1);
    z-index: 70;
  }
  body.drawer-open .sidebar { transform: none; box-shadow: 8px 0 40px rgba(0, 0, 0, 0.5); }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(1, 8, 18, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  body.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  body.drawer-open { overflow: hidden; }
  .nav-item { min-height: 46px; }

  .main-content { padding: 20px 16px 28px; min-height: 0; }

  .bottombar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    height: calc(var(--bottombar-h) + var(--safe-bottom));
    padding: 6px 6px calc(6px + var(--safe-bottom));
    background: rgba(2, 25, 53, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 2px solid var(--edge);
  }
  .tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
  }
  .tab-btn .nav-ico { width: 24px; height: 24px; image-rendering: pixelated; opacity: 0.7; transition: transform 0.15s ease; }
  .tab-btn.active { color: var(--yellow); }
  .tab-btn.active .nav-ico { opacity: 1; transform: translateY(-2px) scale(1.12); }
  .tab-btn:active { background: rgba(255, 255, 255, 0.06); }

  .content-header h1 { font-size: 1.65rem; }
  .hero { grid-template-columns: 1fr; text-align: center; padding: 16px; }
  .hero::before { background: radial-gradient(circle at 50% 22%, rgba(240, 138, 43, 0.22), transparent 55%); }
  .hero-skin img { height: 200px; }
  .hero-meta, .badges { justify-content: center; }
  .hero .header-actions { justify-content: center; }
  .tile { text-align: left; }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .main-content { padding: 18px 12px 24px; border-radius: var(--radius); }
  .app-shell { padding-left: 8px; padding-right: 8px; }
  .content-header { margin-bottom: 18px; }
  .content-header h1 { font-size: 1.45rem; }
  .section-icon { width: 48px; height: 48px; }
  .section-icon .item-icon { width: 30px; height: 30px; }
  .header-actions { width: 100%; }
  .header-actions .btn { flex: 1; }

  .metric-grid { gap: 8px; }
  .metric { padding: 10px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .metric .icon-slot { width: 34px; height: 34px; }
  .metric .icon-slot .item-icon { width: 22px; height: 22px; }
  .metric-value { font-size: 1.3rem; }
  .metric-label { font-size: 0.66rem; }

  .podium { gap: 6px; padding: 16px 8px 0; }
  .podium-spot img.skin { height: 104px; }
  .podium-spot.p1 img.skin { height: 124px; }
  .podium-name { font-size: 0.82rem; }
  .podium-value { font-size: 0.72rem; }
  .p1 .podium-block { height: 70px; }
  .p2 .podium-block { height: 52px; }
  .p3 .podium-block { height: 40px; }
  .podium-block { font-size: 1.5rem; }

  .lb-grid { grid-template-columns: 1fr; }
  .highlight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .highlight:last-child:nth-child(odd) { grid-column: span 2; }
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { align-items: flex-start; }
  .tile .v { white-space: normal; font-size: 1rem; line-height: 1.25; }
  .player-grid { grid-template-columns: 1fr; }

  .row { gap: 10px; padding: 8px 10px; }
  .row .icon-slot { width: 36px; height: 36px; }
  .row .icon-slot .item-icon { width: 24px; height: 24px; }
  .row-value { font-size: 0.98rem; }

  .vs-head { gap: 6px; }
  .vs-side { padding: 12px 8px; }
  .vs-side img.skin { height: 110px; }
  .vs-badge { width: 44px; height: 44px; font-size: 1.1rem; }
  .vs-score b { font-size: 1.7rem; }
  .vs-row { grid-template-columns: minmax(0, 1fr) 84px minmax(0, 1fr); gap: 8px; padding: 10px; }
  .vs-val .num { font-size: 0.92rem; }
  .vs-label { font-size: 0.62rem; }

  .palette { padding: 0; align-items: stretch; }
  .palette-box { max-width: none; max-height: none; height: 100%; border-radius: 0; border: none; padding-top: var(--safe-top); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
