/* tbhvalue — pixel-art RPG companion UI.
   Direction: dungeon loot vault. Dark backdrop, ornate gold 9-slice frames,
   crimson plaque banner, pixel display type, rarity glows. Motion is
   transform/opacity only and gated behind prefers-reduced-motion. */

/* ------------------------------------------------------------------ tokens */
:root {
  --gold: #d9a441;
  --gold-hi: #ffe39a;
  --bronze: #8a5e22;
  --crimson: #c8342b;
  --crimson-dk: #6e1411;
  --panel: #1a1622;
  --slot: #0f0c14;
  --ink: #120e18;
  --text: #f4ead6;
  --muted: #b9a98f;

  /* rarity */
  --r-common: #9aa0a6;
  --r-uncommon: #4caf50;
  --r-rare: #3b82f6;
  --r-legendary: #f0a93b;
  --r-immortal: #e0524b;
  --r-arcana: #b15adf;
  --r-beyond: #29c4c9;
  --r-celestial: #f5d76e;
  --r-divine: #ff8fb3;
  --r-cosmic: #c66bff;

  --pixel: "Pixelify Sans", "Silkscreen", monospace;
  --body: "Sora", system-ui, -apple-system, sans-serif;

  --shadow-deep: 0 18px 48px -12px rgba(0, 0, 0, 0.75);
  --ring: 0 0 0 1px rgba(217, 164, 65, 0.25);

  --ease-pop: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.22, 0.61, 0.36, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  color: var(--text);
  background-color: var(--ink);
  /* fixed dungeon backdrop + darkening overlay so content stays legible */
  background-image:
    linear-gradient(180deg, rgba(8, 6, 12, 0.82) 0%, rgba(8, 6, 12, 0.9) 55%, rgba(8, 6, 12, 0.96) 100%),
    url(/assets/bg.png);
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
  background-repeat: no-repeat;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--crimson); color: var(--gold-hi); }

/* thin gold scrollbar to keep the vault feel */
* { scrollbar-width: thin; scrollbar-color: var(--bronze) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--bronze), var(--crimson-dk));
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

img { display: block; max-width: 100%; }
button { font-family: inherit; }
a { color: var(--gold); text-decoration: none; }

/* ------------------------------------------------------------------ layout */
.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 96px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--gold);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 6px;
  font-family: var(--pixel);
  z-index: 100;
}
.skip-link:focus { left: 16px; }

/* ------------------------------------------------------- top bar / wordmark */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}
.brand__crest {
  width: 46px;
  height: 46px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6));
  animation: crest-bob 4.5s var(--ease-soft) infinite;
}
.brand__word {
  font-family: var(--pixel);
  font-weight: 600;
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem);
  letter-spacing: 0.5px;
  color: var(--gold-hi);
  text-shadow: 0 2px 0 var(--bronze), 0 4px 10px rgba(0, 0, 0, 0.6);
}
.brand__word b { color: var(--crimson); -webkit-text-stroke: 0; }

@keyframes crest-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(-1.5deg); }
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* nav tabs */
.nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ko-fi header action */
.kofi-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--pixel);
  font-size: 0.8rem;
  color: var(--gold-hi);
  background: linear-gradient(180deg, rgba(40, 32, 22, 0.7), rgba(15, 12, 20, 0.85));
  border: 1px solid rgba(217, 164, 65, 0.35);
  border-radius: 8px;
  padding: 8px 11px;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.16s, border-color 0.16s, transform 0.12s var(--ease-pop);
  flex-shrink: 0;
}
.kofi-btn:hover {
  color: #fff;
  border-color: var(--gold);
  transform: translateY(-2px);
}
.kofi-btn:active { transform: scale(0.97); }
.kofi-btn:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
/* on narrow screens: icon only */
@media (max-width: 560px) {
  .kofi-btn { font-size: 0; padding: 8px 9px; }
  .kofi-btn::before { content: "☕"; font-size: 1rem; }
}

/* language switcher */
.langswitch {
  display: inline-flex;
  border: 1px solid rgba(217, 164, 65, 0.3);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(15, 12, 20, 0.7);
}
.lang {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--pixel);
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  padding: 8px 11px;
  cursor: pointer;
  transition: color 0.16s, background-color 0.16s;
  border-right: 1px solid rgba(217, 164, 65, 0.18);
}
.lang:last-child { border-right: 0; }
.lang:hover { color: var(--gold-hi); }
.lang[aria-pressed="true"] {
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
}
.lang:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: -2px; }
.nav__tab {
  appearance: none;
  border: 1px solid rgba(217, 164, 65, 0.3);
  background: linear-gradient(180deg, rgba(40, 32, 22, 0.6), rgba(15, 12, 20, 0.8));
  color: var(--muted);
  font-family: var(--pixel);
  font-size: 0.95rem;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s, transform 0.12s var(--ease-pop), box-shadow 0.18s;
}
.nav__tab:hover {
  color: var(--gold-hi);
  border-color: var(--gold);
  transform: translateY(-2px);
}
.nav__tab[aria-current="page"] {
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  border-color: var(--gold-hi);
  box-shadow: 0 4px 14px -4px rgba(217, 164, 65, 0.6);
}
.nav__tab:active { transform: translateY(0) scale(0.97); }
.nav__tab:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------- panel */
/* Pure-CSS vault panel. No border-image, no stretched frame art. A dark,
   slightly translucent surface with a metallic gold hairline (border + outer
   bevel), an inner top-light highlight, and a tinted outer shadow for depth.
   Small gold corner flourishes are added sparingly via ::before/::after. */
.panel {
  position: relative;
  border-radius: 14px;
  padding: 1px; /* hosts the metallic gradient border */
  background:
    linear-gradient(160deg, rgba(217, 164, 65, 0.55), rgba(138, 94, 34, 0.25) 28%, rgba(20, 16, 26, 0.4) 60%, rgba(217, 164, 65, 0.32));
  box-shadow:
    0 24px 60px -20px rgba(0, 0, 0, 0.85),
    0 2px 0 rgba(255, 227, 154, 0.06);
}
.panel > .panel__pad {
  position: relative;
  border-radius: 13px;
  background:
    radial-gradient(130% 80% at 50% -10%, rgba(217, 164, 65, 0.12), transparent 55%),
    linear-gradient(180deg, #211a2c 0%, var(--panel) 22%, #15111c 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 227, 154, 0.14),
    inset 0 0 0 1px rgba(8, 6, 12, 0.6),
    inset 0 -24px 48px -28px rgba(0, 0, 0, 0.8);
  /* generous breathing room so titles/controls never touch an edge */
  padding: 30px 32px;
  overflow: hidden;
}
/* tasteful gold corner flourishes — small, never a full frame */
.panel > .panel__pad::before,
.panel > .panel__pad::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
  opacity: 0.7;
  border-color: var(--gold);
  border-style: solid;
}
.panel > .panel__pad::before {
  top: 12px;
  left: 12px;
  border-width: 2px 0 0 2px;
  border-top-left-radius: 7px;
}
.panel > .panel__pad::after {
  bottom: 12px;
  right: 12px;
  border-width: 0 2px 2px 0;
  border-bottom-right-radius: 7px;
}

/* lighter sub-panel for inner sections (no frame to avoid card-in-card) */
.slab {
  background: linear-gradient(180deg, rgba(15, 12, 20, 0.7), rgba(10, 8, 14, 0.85));
  border: 1px solid rgba(217, 164, 65, 0.18);
  border-radius: 10px;
  padding: 18px;
}

/* section heading style */
.eyebrow {
  font-family: var(--pixel);
  font-size: 0.78rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 5px;
  opacity: 0.92;
}
.h-pixel {
  font-family: var(--pixel);
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);
  letter-spacing: 0.5px;
  color: var(--gold-hi);
  text-shadow: 0 2px 0 var(--bronze), 0 4px 14px rgba(0, 0, 0, 0.4);
  margin: 0;
  line-height: 1.1;
}

/* ----------------------------------------------------------------- hero banner */
/* banner.png is a transparent crimson scroll: gold dragon end-caps, a winged
   crest on the top edge, and an EMPTY red middle band (~center 52% wide, and
   vertically below the crest). The wordmark must live strictly inside that red
   field at every viewport. We use container-relative sizing (cqw) so it scales
   with the banner, never the raw viewport, and can never overflow the caps. */
.banner {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 10px auto 30px;
  aspect-ratio: 1584 / 672;
  background: url(/assets/banner.png) center / contain no-repeat;
  container-type: inline-size;
  filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.6));
}
.banner__inner {
  position: absolute;
  /* the red field: horizontally the central band, vertically below the crest */
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%);
  width: 50%;            /* stay clear of the gold dragon end-caps */
  text-align: center;
}
.banner__title {
  font-family: var(--pixel);
  font-weight: 700;
  /* sized to the banner width, clamped so it always fits the red middle */
  font-size: clamp(1.15rem, 9cqw, 3.3rem);
  line-height: 1;
  margin: 0;
  white-space: nowrap;   /* keep "tbhvalue" on one line inside the field */
  color: var(--gold-hi);
  text-shadow: 0 2px 0 var(--crimson-dk), 0 4px 10px rgba(0, 0, 0, 0.65);
}
.banner__title b { color: #fff; }
.banner__tag {
  margin: 10px 0 0;
  font-size: clamp(0.78rem, 0.6rem + 0.6vw, 1rem);
  color: var(--parchment, #f4ead6);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  font-weight: 600;
}

/* ----------------------------------------------------------------- dropzone */
.drop {
  position: relative;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 14px;
  padding: 44px 24px;
  border: 2px dashed rgba(217, 164, 65, 0.45);
  border-radius: 12px;
  background:
    repeating-linear-gradient(45deg, rgba(217, 164, 65, 0.03) 0 12px, transparent 12px 24px),
    var(--slot);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.2s var(--ease-pop), box-shadow 0.2s;
}
.drop:hover,
.drop:focus-within {
  border-color: var(--gold);
  box-shadow: inset 0 0 40px rgba(217, 164, 65, 0.08), 0 0 0 1px rgba(217, 164, 65, 0.3);
}
.drop.is-drag {
  border-color: var(--gold-hi);
  border-style: solid;
  transform: scale(1.012);
  box-shadow: inset 0 0 60px rgba(217, 164, 65, 0.18), 0 0 30px rgba(217, 164, 65, 0.3);
}
.drop__rune {
  font-size: 2.4rem;
  filter: drop-shadow(0 0 12px rgba(217, 164, 65, 0.5));
  animation: rune-float 3.4s var(--ease-soft) infinite;
}
@keyframes rune-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.drop__title {
  font-family: var(--pixel);
  font-size: 1.3rem;
  color: var(--gold-hi);
  margin: 0;
}
.drop__sub { margin: 0; color: var(--muted); font-size: 0.92rem; }
.drop input[type="file"] { display: none; }

/* ------------------------------------------------------------------ buttons */
.btn {
  appearance: none;
  cursor: pointer;
  font-family: var(--pixel);
  font-size: 0.98rem;
  letter-spacing: 0.3px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  border: 1px solid var(--gold-hi);
  border-radius: 9px;
  padding: 11px 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 0 var(--bronze), 0 8px 16px -6px rgba(0, 0, 0, 0.6);
  transition: transform 0.1s var(--ease-pop), box-shadow 0.1s, filter 0.15s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--bronze); }
.btn:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }
.btn--ghost {
  color: var(--gold-hi);
  background: linear-gradient(180deg, rgba(40, 32, 22, 0.7), rgba(15, 12, 20, 0.85));
  border: 1px solid rgba(217, 164, 65, 0.4);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4);
}
.btn--ghost:hover { border-color: var(--gold); }
.btn--crimson {
  color: var(--gold-hi);
  background: linear-gradient(180deg, var(--crimson), var(--crimson-dk));
  border-color: var(--crimson);
  box-shadow: 0 4px 0 #4a0d0a, 0 8px 16px -6px rgba(0, 0, 0, 0.6);
}
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; filter: grayscale(0.3); }

.btnrow {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* trust + howto lines */
.trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.86rem;
}
.trust b { color: var(--gold); }
.howto {
  text-align: center;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}
.howto code {
  font-family: var(--pixel);
  color: var(--gold-hi);
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-all;
}

/* warning callout — "close the game first" must be impossible to miss.
   Full border + a leading icon chip (no lazy side-stripe). */
.callout {
  display: flex;
  align-items: center;
  gap: 13px;
  max-width: 460px;
  margin: 18px auto 2px;
  padding: 13px 18px 13px 14px;
  border-radius: 12px;
  border: 1px solid rgba(217, 164, 65, 0.5);
  background:
    linear-gradient(180deg, rgba(217, 164, 65, 0.16), rgba(138, 94, 34, 0.07));
  box-shadow: inset 0 1px 0 rgba(255, 227, 154, 0.14), 0 6px 18px -10px rgba(0, 0, 0, 0.7);
  color: var(--text);
  text-align: left;
}
.callout__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 9px;
  background: radial-gradient(120% 120% at 50% 20%, rgba(217, 164, 65, 0.3), rgba(8, 6, 12, 0.55));
  border: 1px solid rgba(217, 164, 65, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 227, 154, 0.18);
}
.callout__text {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.45;
}

/* ------------------------------------------------------------ total value pill */
.total {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 4px auto 22px;
  padding: 22px 40px;
  width: fit-content;
  max-width: 100%;
  border-radius: 16px;
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(217, 164, 65, 0.22), transparent 60%),
    linear-gradient(180deg, rgba(40, 31, 22, 0.7), rgba(15, 12, 20, 0.9));
  border: 1px solid rgba(217, 164, 65, 0.4);
  box-shadow: 0 0 40px -10px rgba(217, 164, 65, 0.35), var(--shadow-deep);
}
.total__label {
  font-family: var(--pixel);
  font-size: 0.82rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
}
.total__amount {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--pixel);
  font-size: clamp(2.2rem, 1rem + 5vw, 4rem);
  line-height: 1;
  color: var(--gold-hi);
  text-shadow: 0 3px 0 var(--bronze), 0 6px 18px rgba(217, 164, 65, 0.3);
}
.total__coin {
  width: clamp(40px, 8vw, 64px);
  height: clamp(40px, 8vw, 64px);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
  animation: coin-spin-idle 6s linear infinite;
}
@keyframes coin-spin-idle {
  0%, 80%, 100% { transform: rotateY(0deg); }
  90% { transform: rotateY(180deg); }
}
.total__sub { color: var(--muted); font-size: 0.82rem; }
.total__sub b { color: var(--text); }

/* odometer */
.odometer {
  display: inline-flex;
  font-variant-numeric: tabular-nums;
}
.odo-digit {
  position: relative;
  display: inline-block;
  height: 1em;
  overflow: hidden;
  width: 0.62em;
}
.odo-digit.is-sym { width: auto; }
.odo-strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}
.odo-strip span { height: 1em; line-height: 1; text-align: center; }

/* ----------------------------------------------------------------- controls */
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}
.controls__group {
  display: flex;
  gap: 6px;
  align-items: center;
}
.controls__label {
  font-family: var(--pixel);
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.chip {
  appearance: none;
  cursor: pointer;
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--muted);
  background: rgba(15, 12, 20, 0.7);
  border: 1px solid rgba(217, 164, 65, 0.22);
  border-radius: 20px;
  padding: 6px 13px;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s, transform 0.1s var(--ease-pop);
}
.chip:hover { color: var(--gold-hi); transform: translateY(-1px); }
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] {
  color: var(--ink);
  background: var(--gold);
  border-color: var(--gold-hi);
}
.chip:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.controls__spacer { flex: 1; }

select.chip {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 28px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 14px) center, calc(100% - 9px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* ----------------------------------------------------------------- item grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
}

.item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(26, 22, 34, 0.92), rgba(12, 10, 16, 0.95));
  border: 1px solid var(--rarity, var(--r-common));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 0 0 var(--rarity, transparent);
  transition: transform 0.16s var(--ease-pop), box-shadow 0.2s;
  contain: layout style;
}
.item::before {
  /* rarity glow halo */
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 9px;
  pointer-events: none;
  box-shadow: 0 0 14px -2px var(--rarity, transparent);
  opacity: 0.5;
  transition: opacity 0.2s;
}
.item:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 26px -10px rgba(0, 0, 0, 0.7), 0 0 18px -2px var(--rarity, transparent);
  z-index: 5;
}
.item:hover::before { opacity: 1; }
.item--locked { filter: grayscale(0.55) brightness(0.82); }

.item__slot {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  background:
    radial-gradient(80% 80% at 50% 35%, rgba(217, 164, 65, 0.08), transparent 70%),
    var(--slot);
  border: 1px solid rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.item__icon {
  width: 78%;
  height: 78%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5));
}
.item__icon--missing {
  font-family: var(--pixel);
  color: var(--muted);
  font-size: 1.6rem;
}
.item__qty {
  position: absolute;
  right: 5px;
  bottom: 5px;
  font-family: var(--pixel);
  font-size: 0.78rem;
  color: var(--gold-hi);
  background: rgba(8, 6, 12, 0.92);
  border: 1px solid var(--rarity, var(--gold));
  border-radius: 6px;
  padding: 1px 7px;
  line-height: 1.4;
}
.item__lock {
  position: absolute;
  left: 5px;
  top: 5px;
  font-size: 0.9rem;
  background: rgba(8, 6, 12, 0.92);
  border-radius: 6px;
  padding: 1px 5px;
  border: 1px solid var(--rarity, var(--muted));
}
.item__name {
  font-weight: 600;
  font-size: 0.76rem;
  color: var(--text);
  line-height: 1.2;
  /* clamp to 2 lines, no overflow */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2em;
}
.item__grade {
  font-family: var(--pixel);
  font-size: 0.58rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--rarity, var(--muted));
}
.item__prices {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-top: 1px solid rgba(217, 164, 65, 0.14);
  padding-top: 5px;
}
.item__unit { font-size: 0.68rem; color: var(--muted); }
.item__unit b { color: var(--text); font-weight: 600; }
.item__line {
  font-family: var(--pixel);
  font-size: 0.82rem;
  color: var(--gold-hi);
}
.item__untradable {
  font-size: 0.72rem;
  color: var(--muted);
  font-style: italic;
}

/* shimmer/skeleton for loading prices */
.skel {
  display: inline-block;
  height: 0.85em;
  width: 56px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(217, 164, 65, 0.08) 25%, rgba(217, 164, 65, 0.22) 50%, rgba(217, 164, 65, 0.08) 75%);
  background-size: 200% 100%;
  animation: skel-sweep 1.3s linear infinite;
  vertical-align: middle;
}
.skel--wide { width: 84px; }
@keyframes skel-sweep {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* shimmer sweep for LEGENDARY+ items */
.item--shine .item__slot::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 227, 154, 0.35) 48%, transparent 62%);
  transform: translateX(-130%);
  animation: shine-sweep 4.5s var(--ease-soft) infinite;
  pointer-events: none;
}
@keyframes shine-sweep {
  0%, 70% { transform: translateX(-130%); }
  85%, 100% { transform: translateX(130%); }
}

/* enter reveal — set by JS via .reveal then .reveal-in (so reduced-motion can skip) */
.reveal { opacity: 0; transform: translateY(16px); }
.reveal-in {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s var(--ease-soft), transform 0.5s var(--ease-pop);
}

/* tooltip on hover */
.tip {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  background: rgba(8, 6, 12, 0.97);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.8rem;
  color: var(--text);
  box-shadow: var(--shadow-deep);
  max-width: 240px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.14s, transform 0.14s var(--ease-pop);
}
.tip.is-on { opacity: 1; transform: translateY(0); }
.tip__title { font-family: var(--pixel); color: var(--gold-hi); margin-bottom: 4px; }
.tip__row { display: flex; justify-content: space-between; gap: 16px; }
.tip__row span:last-child { color: var(--gold); }

/* ------------------------------------------------------------------ heroes/builds */
.heroes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.herocard {
  background: linear-gradient(180deg, rgba(26, 22, 34, 0.92), rgba(12, 10, 16, 0.95));
  border: 1px solid rgba(217, 164, 65, 0.25);
  border-radius: 12px;
  padding: 14px;
  transition: transform 0.16s var(--ease-pop), border-color 0.18s;
}
.herocard:hover { transform: translateY(-3px); border-color: var(--gold); }
.herocard__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.herocard__name { font-family: var(--pixel); color: var(--gold-hi); font-size: 1.05rem; }
.herocard__value { font-family: var(--pixel); color: var(--gold); font-size: 0.92rem; }
.herocard__slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px;
}
.herocard__slot {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--slot);
  border: 1px solid var(--rarity, rgba(217, 164, 65, 0.2));
  display: grid;
  place-items: center;
  box-shadow: 0 0 8px -3px var(--rarity, transparent);
}
.herocard__slot img { width: 80%; height: 80%; object-fit: contain; image-rendering: pixelated; }
.herocard__slot--empty { opacity: 0.4; }
.herocard__empty { color: var(--muted); font-size: 0.85rem; font-style: italic; }

/* ------------------------------------------------------------------ ranking */
.lb {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lbrow {
  display: grid;
  grid-template-columns: 56px 52px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(26, 22, 34, 0.8), rgba(12, 10, 16, 0.9));
  border: 1px solid rgba(217, 164, 65, 0.16);
  transition: transform 0.14s var(--ease-pop), border-color 0.18s;
}
.lbrow:hover { transform: translateX(4px); border-color: var(--gold); }
.lbrow__rank {
  font-family: var(--pixel);
  font-size: 1.2rem;
  color: var(--muted);
  text-align: center;
}
.lbrow__avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(217, 164, 65, 0.3);
  object-fit: cover;
  background: var(--slot);
}
.lbrow__persona { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbrow__count { color: var(--muted); font-size: 0.85rem; text-align: right; }
.lbrow__value {
  font-family: var(--pixel);
  color: var(--gold-hi);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
.lbrow__value img { width: 20px; height: 20px; }

.lbrow--1, .lbrow--2, .lbrow--3 { padding: 15px 16px; }
.lbrow--1 {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(60, 46, 20, 0.6), rgba(20, 15, 10, 0.92));
  box-shadow: 0 0 24px -8px rgba(217, 164, 65, 0.5);
}
.lbrow--1 .lbrow__rank { color: var(--gold-hi); }
.lbrow--2 { border-color: #c9d1d9; box-shadow: 0 0 18px -8px rgba(201, 209, 217, 0.4); }
.lbrow--2 .lbrow__rank { color: #e3e9ee; }
.lbrow--3 { border-color: #cd7f32; box-shadow: 0 0 18px -8px rgba(205, 127, 50, 0.45); }
.lbrow--3 .lbrow__rank { color: #e0a55e; }
.lbrow__medal { font-size: 1.3rem; }

/* ----------------------------------------------------------------- mercado */
.mkt {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.mkt__col { display: flex; flex-direction: column; gap: 8px; }
.mkt__title {
  font-family: var(--pixel);
  color: var(--gold-hi);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
}
.mktrow {
  display: grid;
  grid-template-columns: 28px 40px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(15, 12, 20, 0.7);
  border: 1px solid rgba(217, 164, 65, 0.12);
  transition: transform 0.12s var(--ease-pop), border-color 0.16s;
}
.mktrow:hover { transform: translateX(3px); border-color: var(--gold); }
.mktrow__rank { font-family: var(--pixel); color: var(--gold); font-size: 0.9rem; text-align: center; }
.mktrow__icon { width: 36px; height: 36px; object-fit: contain; image-rendering: pixelated; background: var(--slot); border-radius: 6px; }
.mktrow__name { font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mktrow__name small { display: block; color: var(--muted); font-size: 0.74rem; }
.mktrow__price { font-family: var(--pixel); color: var(--gold-hi); font-size: 0.92rem; text-align: right; }
.mkt__stamp { color: var(--muted); font-size: 0.78rem; margin-top: 14px; text-align: center; }

/* ------------------------------------------------------------------ donation */
.donate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(15, 12, 20, 0.5);
  border: 1px dashed rgba(217, 164, 65, 0.22);
}
.donate__text { color: var(--muted); font-size: 0.86rem; }

/* ------------------------------------------------------------------ modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 4, 10, 0.78);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
}
.modal.is-open { opacity: 1; pointer-events: auto; }
.modal__box {
  position: relative;
  width: min(420px, 100%);
  border-radius: 14px;
  padding: 27px 25px 25px;
  background:
    radial-gradient(130% 80% at 50% -10%, rgba(217, 164, 65, 0.12), transparent 55%),
    linear-gradient(180deg, #211a2c, var(--panel) 30%, #15111c);
  box-shadow:
    inset 0 1px 0 rgba(255, 227, 154, 0.14),
    inset 0 0 0 1px rgba(8, 6, 12, 0.6),
    0 30px 70px -22px rgba(0, 0, 0, 0.9);
  text-align: center;
  transform: scale(0.92) translateY(10px);
  transition: transform 0.26s var(--ease-pop);
}
/* metallic hairline ring drawn just outside the box (mask-composite cutout) */
.modal__box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background:
    linear-gradient(160deg, rgba(217, 164, 65, 0.6), rgba(138, 94, 34, 0.25) 30%, rgba(20, 16, 26, 0.4) 60%, rgba(217, 164, 65, 0.35));
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
}
.modal.is-open .modal__box { transform: scale(1) translateY(0); }
.modal__title { font-family: var(--pixel); color: var(--gold-hi); margin: 0 0 6px; }
.modal__pix {
  font-family: var(--pixel);
  color: var(--gold-hi);
  font-size: 1.1rem;
  background: var(--slot);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 12px;
  margin: 14px 0;
  word-break: break-all;
}
.modal__close {
  position: relative;
  margin-top: 8px;
}

/* ------------------------------------------------------------------ toast */
.toaster {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 350;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(40, 31, 22, 0.96), rgba(15, 12, 20, 0.98));
  border: 1px solid var(--gold);
  box-shadow: 0 0 30px -8px rgba(217, 164, 65, 0.5), var(--shadow-deep);
  color: var(--text);
  font-weight: 600;
  transform: translateY(20px);
  opacity: 0;
  animation: toast-in 0.4s var(--ease-pop) forwards;
}
.toast img { width: 28px; height: 28px; }
.toast b { font-family: var(--pixel); color: var(--gold-hi); }
.toast--err { border-color: var(--crimson); }
@keyframes toast-in {
  to { transform: translateY(0); opacity: 1; }
}

/* coin burst */
.burst {
  position: fixed;
  z-index: 360;
  width: 26px;
  height: 26px;
  pointer-events: none;
  will-change: transform, opacity;
}

/* ------------------------------------------------------------ lore / FAQ */
.lore {
  max-width: 760px;
  margin: 30px auto 0;
}
.lore__title { font-size: 1.5rem; margin: 0 0 10px; }
.lore__body {
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.7;
  margin: 0 0 24px;
}
.lore__faqhead { margin: 0 0 12px; }

.faq { display: flex; flex-direction: column; gap: 8px; }
.faq__item {
  border: 1px solid rgba(217, 164, 65, 0.2);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(26, 22, 34, 0.8), rgba(12, 10, 16, 0.9));
  overflow: hidden;
  transition: border-color 0.18s;
}
.faq__item[open] { border-color: var(--gold); }
.faq__q {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-family: var(--pixel);
  font-size: 1rem;
  color: var(--gold-hi);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: color 0.16s;
}
.faq__q::-webkit-details-marker { display: none; }
.faq__q::before {
  content: "▸";
  color: var(--gold);
  font-size: 0.9rem;
  transition: transform 0.2s var(--ease-pop);
  flex: none;
}
.faq__item[open] .faq__q::before { transform: rotate(90deg); }
.faq__q:hover { color: #fff; }
.faq__a {
  margin: 0;
  padding: 0 16px 16px 40px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

/* ------------------------------------------------------------------ states */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty__rune { font-size: 2.6rem; opacity: 0.6; margin-bottom: 10px; }
.empty__title { font-family: var(--pixel); color: var(--gold); font-size: 1.2rem; margin: 0 0 6px; }

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 36px;
  color: var(--muted);
  font-family: var(--pixel);
}
.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(217, 164, 65, 0.25);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.banner-error {
  margin: 14px auto;
  max-width: 560px;
  text-align: center;
  padding: 16px;
  border-radius: 10px;
  background: rgba(110, 20, 17, 0.3);
  border: 1px solid var(--crimson);
  color: var(--text);
}
.banner-error b { font-family: var(--pixel); color: var(--crimson); }

/* view routing */
.view { display: none; }
.view.is-active { display: block; animation: view-in 0.4s var(--ease-soft); }
@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel + .section,
.section + .section { margin-top: 30px; }
.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(217, 164, 65, 0.16);
}

.hint { color: var(--muted); font-size: 0.82rem; }

/* visually hidden but screen-reader available */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 720px) {
  .shell { padding: 20px 14px 80px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .nav { justify-content: center; }
  .lbrow {
    grid-template-columns: 40px 44px 1fr auto;
    gap: 10px;
  }
  .lbrow__count { display: none; }
  .panel > .panel__pad { padding: 22px 18px; }
  .panel > .panel__pad::before { top: 9px; left: 9px; }
  .panel > .panel__pad::after { bottom: 9px; right: 9px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 7px; }
}

@media (max-width: 440px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .total { padding: 18px 22px; }
}

/* ------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .brand__crest, .drop__rune, .total__coin { animation: none; }
  .item--shine .item__slot::after { display: none; }
}
