/* ============================================================
   site.css — the chrome that is NOT the game.

   Two pages link this file: the landing (index.html, where the
   header floats over a live 3D cinematic) and the standalone
   site pages like /leaderboards (a normal scrolling document).
   Everything above the "page shell" divider is shared by both;
   everything below is scoped to `body.page` so linking this from
   the game client costs the landing nothing but the header.

   It is a static file rather than a Vite-bundled import on
   purpose: the landing's header must be painted on first paint,
   and a bundled stylesheet arrives with the JS chunk. Served
   from /ui/ it goes out in parallel with the font request.

   The vocabulary here is the one index.html already speaks —
   Baloo 2 for anything carved or stamped, Quicksand for prose,
   wood frame + moss slab for a container, the triple-ring tile
   for a painted icon, and a lift with a brightening gold
   hairline for hover. No new colours were invented.
   ============================================================ */

/* The house reset, which until now lived inline in index.html and so
   did not exist for any page that was not the game. Without it a
   standalone page's `width: 100%` header adds its padding on top of
   the viewport and the whole document scrolls sideways by exactly the
   padding (measured: 1552px of document in a 1512px window, with the
   right-hand button hanging off the edge). index.html declares the
   same rule inline afterwards, so nothing there changes. */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ---------------- shared header ---------------------------- */

/* The bar itself is deliberately weightless: no background, no
   border. Over the landing it would otherwise slice the sky in
   half, and hordes' opaque strip works there because their menu
   sits on a flat scene, not a painted one. The legibility comes
   from .topscrim instead, which each page places behind it. */
.sitehead {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.6vw, 22px);
  width: 100%;
  padding: 10px clamp(12px, 2vw, 24px);
  padding-top: calc(10px + env(safe-area-inset-top));
  padding-left: calc(clamp(12px, 2vw, 24px) + env(safe-area-inset-left));
  padding-right: calc(clamp(12px, 2vw, 24px) + env(safe-area-inset-right));
}

/* The chick mark, free-standing — NO tile.
   It is a cut-out, not full-bleed square art: 48% of the png is fully
   transparent and all four corners are alpha 0 (measured). The painted-icon
   frame this app puts around square art therefore rendered as a black box
   sitting behind the mascot. index.html's own rule settles it — a cut-out
   gets `contain` and no frame (see img.uiic), a full-bleed square gets
   `cover` and the triple ring. The drop shadow now does the tile's real
   job: keeping the mark legible against a bright noon sky. */
.sitehead .crest {
  flex: none;
  display: block;
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.75));
  transition: transform 0.18s cubic-bezier(0.2, 1.3, 0.5, 1), filter 0.18s;
}
.sitehead .crest img {
  display: block;
  width: 100%;
  height: 100%;
  /* contain, never cover: cropping a cut-out clips the mascot's edges */
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.sitehead .crest:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.7))
          drop-shadow(0 0 8px rgba(255, 205, 108, 0.45));
}

.sitehead nav {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.4vw, 20px);
  min-width: 0;
  /* the nav is the one thing allowed to scroll sideways on a
     narrow phone — five items will not wrap onto a second row
     without pushing the composition down, and this codebase has
     no hamburger anywhere to be consistent with */
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.sitehead nav::-webkit-scrollbar { display: none; }

.sitehead nav a,
.sitehead nav .on,
.sitehead nav .soon {
  position: relative;
  flex: none;
  padding: 4px 2px;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: clamp(13.5px, 1.05vw, 15.5px);
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  color: #f0c878;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  transition: color 0.14s, transform 0.14s cubic-bezier(0.2, 1.3, 0.5, 1);
}
.sitehead nav a:hover { color: #ffe6a8; transform: translateY(-1px); }
.sitehead nav a:focus-visible {
  outline: 2px solid rgba(255, 231, 154, 0.8);
  outline-offset: 3px;
  border-radius: 4px;
}

/* the page you are on: white-warm instead of gold, with the
   hairline rule from .tagline turned into an underline.
   `.on` rather than `a.on`: /leaderboards is not linked from any nav
   while the board is held back, so its own entry is a span. Matched on
   the class alone, the marker survives that. */
.sitehead nav .on { color: #fff4dc; }
.sitehead nav .on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #ffd977, #dd9727);
}

/* Clans / PvP / Items / Skills have no page yet. They are shown
   because the shape of the site is the promise — but they are
   not links, so nobody tabs into a dead end or lands on a 404.
   The badge says why they do not respond to a click. */
.sitehead nav .soon {
  color: #8c9a84;
  cursor: default;
  text-shadow: none;
}
.sitehead nav .soon:hover { color: #a8b79e; transform: none; }
/* a `soon` entry never doubles as the current page; if it ever did, the
   you-are-here colour is the one that should win */
.sitehead nav .soon.on { color: #fff4dc; }
/* A whisper, not a badge. Four outlined pills in a five-item nav
   read as the loudest thing on the landing — louder than the one
   link that actually works. Lowercase, unboxed and dim says the
   same thing and lets the eye skip it. */
.sitehead nav .soon::after {
  content: "soon";
  margin-left: 5px;
  font-family: "Quicksand", system-ui, sans-serif;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  vertical-align: 1.5px;
  color: #6f7d68;
}

.sitehead .headright {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

/* the quiet sibling of button.gold — same lift, no fill, so a
   secondary action never competes with Connect Wallet */
.ghost {
  display: inline-block;
  padding: 8px 16px;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: 14.5px;
  text-decoration: none;
  white-space: nowrap;
  color: #f2dfa9;
  background: rgba(12, 18, 14, 0.62);
  backdrop-filter: blur(4px);
  box-shadow:
    inset 0 0 0 1px rgba(210, 190, 130, 0.28),
    0 4px 14px rgba(0, 0, 0, 0.36);
  transition: transform 0.18s cubic-bezier(0.2, 1.3, 0.5, 1), box-shadow 0.18s,
    background 0.18s, color 0.18s;
}
.ghost:hover {
  transform: translateY(-2px);
  color: #fff4dc;
  background: rgba(18, 26, 18, 0.8);
  box-shadow:
    inset 0 0 0 1px rgba(245, 231, 154, 0.5),
    0 9px 22px rgba(0, 0, 0, 0.46);
}
.ghost:active { transform: translateY(0); }
.ghost:focus-visible {
  outline: 3px solid rgba(255, 231, 154, 0.8);
  outline-offset: 3px;
}

/* Reads the nav over whatever is behind it. On the landing that
   is a live sky; on a site page it is the hero band. Same device
   as #landing's own floor scrim, pointing the other way. */
.topscrim {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 132px;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 12, 16, 0.72) 0%, rgba(8, 12, 16, 0) 100%);
}

/* ---------------- page shell (site pages only) -------------- */
/* Everything below is scoped to body.page. index.html links this
   file but never carries that class, so the game client cannot
   accidentally inherit a scrolling body or a page background. */

body.page {
  min-height: 100dvh;
  font-family: "Quicksand", system-ui, sans-serif;
  color: #e8eadf;
  /* the same key art the landing boots on, pushed to the top and
     drowned — /leaderboards should feel like the same world seen
     from indoors, not a different website. The image is already
     in cache from the landing, so it costs nothing on arrival. */
  background:
    linear-gradient(180deg, rgba(20, 27, 19, 0.9) 0%, rgba(20, 27, 19, 0.985) 30%, #141b13 48%),
    url("/ui/hero.webp") top center / 1600px auto no-repeat,
    #141b13;
}

body.page .sitehead {
  position: relative;
  z-index: 2;
}

body.page .wrap {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: clamp(18px, 3.4vh, 34px) 0 64px;
}

/* --- the tab row (hordes' category buttons, in our palette) --- */
.tabrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: clamp(18px, 3vh, 30px);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px 7px 8px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #f2dfa9;
  background: rgba(12, 18, 14, 0.66);
  box-shadow:
    inset 0 0 0 1px rgba(210, 190, 130, 0.2),
    0 4px 14px rgba(0, 0, 0, 0.36);
  transition: transform 0.18s cubic-bezier(0.2, 1.3, 0.5, 1), box-shadow 0.18s,
    background 0.18s, color 0.18s;
}
.tab:hover {
  transform: translateY(-3px);
  background: rgba(18, 26, 18, 0.8);
  box-shadow:
    inset 0 0 0 1px rgba(245, 231, 154, 0.48),
    0 9px 22px rgba(0, 0, 0, 0.46);
}
.tab:focus-visible {
  outline: 3px solid rgba(255, 231, 154, 0.8);
  outline-offset: 3px;
}
/* the selected tab is the only gold-filled thing on the page
   besides the level pills, which is what makes it findable */
.tab.on {
  color: #3a2208;
  background: linear-gradient(180deg, #ffd977 0%, #f0b43c 60%, #dd9727 100%);
  box-shadow: 0 3px 0 #8a5410, 0 6px 16px rgba(0, 0, 0, 0.4);
}
.tab.on:hover {
  transform: translateY(-2px);
  background: linear-gradient(180deg, #ffe08c 0%, #f4bc48 60%, #e5a02f 100%);
  box-shadow: 0 4px 0 #8a5410, 0 10px 22px rgba(0, 0, 0, 0.46);
}
/* the painted-icon tile again, sized for a pill */
.tab .ic {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  object-fit: cover;
  background: rgba(10, 14, 10, 0.6);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.9),
    0 0 0 2px rgba(196, 176, 122, 0.22);
}

/* --- title block --- */
.ptitle {
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: clamp(26px, 3.4vw, 40px);
  line-height: 1.15;
  color: #f2dfa9;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.6);
}
.psub {
  margin-top: 8px;
  max-width: 62ch;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 500;
  color: #b9c4ad;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: clamp(14px, 2.4vh, 24px) 0 12px;
}
.searchbox {
  width: min(280px, 100%);
  padding: 9px 14px;
  border: 0;
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #e8eadf;
  background: rgba(10, 15, 10, 0.66);
  box-shadow: inset 0 0 0 1px rgba(210, 190, 130, 0.24),
    inset 0 2px 10px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.16s;
}
.searchbox::placeholder { color: #7f8d78; }
.searchbox:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(245, 231, 154, 0.6),
    inset 0 2px 10px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(255, 231, 154, 0.18);
}
.stamp {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: #8c9a84;
}

/* --- the carved frame, lifted verbatim from #dialogue/.panel so
       the table reads as an object in the world, not a grid --- */
.frame {
  padding: 9px;
  border-radius: 16px;
  background: linear-gradient(180deg, #7a5527 0%, #5a3c1c 42%, #37240f 100%);
  box-shadow:
    0 0 0 2px #150d05,
    inset 0 2px 0 rgba(255, 224, 156, 0.38),
    inset 0 -3px 0 rgba(0, 0, 0, 0.45),
    0 22px 58px rgba(0, 0, 0, 0.62);
}
.frame .slab {
  border-radius: 11px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 12% 0%, rgba(120, 146, 92, 0.16), transparent 60%),
    linear-gradient(180deg, #2f3d26 0%, #1b2513 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 232, 170, 0.17),
    inset 0 3px 14px rgba(0, 0, 0, 0.55);
}

/* the table is the one thing on the page allowed to scroll
   sideways; the page body must never do it */
.tablewrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.lb {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.lb th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 12px;
  text-align: right;
  white-space: nowrap;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: #cbd6bf;
  background: linear-gradient(180deg, #2c3a24 0%, #232f1c 100%);
  box-shadow: inset 0 -1px 0 rgba(210, 190, 130, 0.22);
}
table.lb th.sorted { color: #ffe6a8; }
table.lb th:first-child,
table.lb th:nth-child(2) { text-align: left; }
table.lb td {
  padding: 9px 12px;
  text-align: right;
  white-space: nowrap;
  color: #d5dfc9;
  border-top: 1px solid rgba(255, 255, 255, 0.045);
}
table.lb tbody tr:nth-child(even) { background: rgba(0, 0, 0, 0.16); }
table.lb tbody tr:hover { background: rgba(120, 146, 92, 0.14); }

/* These three carry the table.lb prefix deliberately: `table.lb td`
   right-aligns every cell, and at (0,1,2) it out-specifies a bare
   `td.rank` at (0,1,1) — so the unprefixed version loses and every
   player name sits hard against the numbers column. */
table.lb td.rank {
  width: 1%;
  text-align: left;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  color: #8c9a84;
  font-variant-numeric: tabular-nums;
}
/* the podium, in the three metals — the only ranking cue that
   survives being read at a glance */
tbody tr:nth-child(1) td.rank { color: #ffd977; }
tbody tr:nth-child(2) td.rank { color: #d8dde4; }
tbody tr:nth-child(3) td.rank { color: #d9a273; }

table.lb td.who {
  text-align: left;
  width: 40%;
  font-weight: 700;
  color: #f2dfa9;
}
table.lb td.num { font-variant-numeric: tabular-nums; }

/* hordes puts the level in front of the name; the pill keeps a
   two-digit number from being mistaken for part of the name */
.lvpill {
  display: inline-block;
  min-width: 26px;
  margin-right: 9px;
  padding: 1px 6px;
  border-radius: 999px;
  text-align: center;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #ffe6a8;
  background: rgba(10, 14, 10, 0.7);
  box-shadow: inset 0 0 0 1px rgba(210, 190, 130, 0.34);
}

tr.me td { background: rgba(255, 217, 119, 0.1); }
tr.me td.who { color: #fff4dc; }

/* progress to the next level, on a skill tab */
.lbbar {
  display: inline-block;
  vertical-align: middle;
  width: 92px;
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 0 0 1px rgba(210, 190, 130, 0.2);
}
.lbbarfill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #dd9727, #ffd977);
}
/* the em dash a cell shows when the server has sent no progress for
   that row — it must read as "nothing to say here", not as a zero */
.lbmuted { color: #5f6c59; }

/* --- the item grid (/items) ----------------------------------
   Cards, not a table. The compendium's three sources disagree
   about what a row even is — a tool has durability and no
   rarity, a wearable has a slot and no depth — and a column
   that is blank for a third of the page reads as missing data.
   A chip that simply is not there does not.
   Rarity is a HAIRLINE and a name colour, never a fill: at this
   size a filled epic tile is a purple rectangle with text on
   it, and the five tiers stop being distinguishable. */
.cardgrid {
  display: grid;
  /* min(268px, 100%) and not a bare 268px: below a ~300px viewport the
     column would be wider than .wrap and the PAGE would scroll sideways,
     which is the one thing this stylesheet already refuses to allow. */
  grid-template-columns: repeat(auto-fill, minmax(min(268px, 100%), 1fr));
  gap: 12px;
}
.icard {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 13px;
  border-radius: 12px;
  background:
    radial-gradient(120% 90% at 12% 0%, rgba(120, 146, 92, 0.13), transparent 62%),
    linear-gradient(180deg, #2c3a24 0%, #1b2513 100%);
  box-shadow: inset 0 0 0 1px rgba(210, 190, 130, 0.18),
    0 8px 22px rgba(0, 0, 0, 0.38);
}
.ihead { display: flex; align-items: center; gap: 11px; }
/* the painted-icon tile, third appearance — .tab .ic and the
   game's slots are the other two, and the ring is the same */
.itile {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 9px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(10, 14, 10, 0.72);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9), 0 0 0 2px rgba(196, 176, 122, 0.22);
}
.itile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* the monogram sits UNDER the art and is uncovered when the
   <img> removes itself; most entries have no icon painted yet */
.imono {
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 19px;
  color: rgba(226, 214, 175, 0.42);
}
.ititles { min-width: 0; }
.iname {
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  color: #e8eadf;
}
.imeta {
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #8c9a84;
}
.idesc {
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
  color: #b9c4ad;
}
.ichips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
  list-style: none;
}
.ichips li {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: #cbd6bf;
  background: rgba(10, 15, 10, 0.5);
  box-shadow: inset 0 0 0 1px rgba(210, 190, 130, 0.16);
}
/* the ladder, same five colours the bag and the gear panel use
   (app.css .rar-*). `common` is deliberately unpainted, so only
   a step above ordinary is coloured at all. */
.icard.rar-uncommon { box-shadow: inset 0 0 0 1px rgba(150, 198, 120, 0.52), 0 8px 22px rgba(0, 0, 0, 0.38); }
.icard.rar-rare     { box-shadow: inset 0 0 0 1px rgba(255, 205, 105, 0.55), 0 8px 22px rgba(0, 0, 0, 0.38); }
.icard.rar-epic     { box-shadow: inset 0 0 0 1px rgba(186, 132, 233, 0.6),  0 8px 22px rgba(0, 0, 0, 0.38); }
.icard.rar-legendary{ box-shadow: inset 0 0 0 1px rgba(255, 146, 74, 0.68),  0 8px 22px rgba(0, 0, 0, 0.38); }
.icard.rar-uncommon .iname { color: #b7d99a; }
.icard.rar-rare      .iname { color: #ffcd69; }
.icard.rar-epic      .iname { color: #c9a2f0; }
.icard.rar-legendary .iname { color: #ffab6b; }

/* --- loading / empty / error --- */
.lbstate {
  margin-top: 18px;
  padding: 26px 20px;
  border-radius: 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #b9c4ad;
  background: rgba(12, 18, 14, 0.6);
  box-shadow: inset 0 0 0 1px rgba(210, 190, 130, 0.18);
}
.lbstate.err { color: #e08a7a; }
.lbstate.empty { color: #b9c4ad; }
.lbstate .ghost { margin-top: 14px; }

/* --- footer --- */
.sitefoot {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 calc(28px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #8c9a84;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.sitefoot a { color: #b9c4ad; text-decoration: none; }
.sitefoot a:hover { color: #f2dfa9; }

/* ---------------- responsive ------------------------------- */

/* Below this the five skill columns cannot all be read, so the
   Overall table drops to rank / player / level / total and the
   per-skill numbers live on their own tabs. The rule targets the
   columns by a class the renderer puts on them. */
@media (max-width: 860px) {
  table.lb .skillcol { display: none; }
  td.who { width: auto; }
}
/* The nav wants 485px laid out in full. A 390px phone gives it 282
   after the crest and the safe-area padding, so without these two
   steps it silently becomes a sideways scroller with Skills parked
   off the edge and nothing to say so. Measured, not guessed. */
@media (max-width: 620px) {
  .sitehead { gap: 10px; }
  .sitehead .crest { width: 36px; height: 36px; }
  .ghost { padding: 7px 12px; font-size: 13.5px; }
  table.lb th, table.lb td { padding: 9px 9px; }
  /* the annotation goes first — it costs ~35px per item and the grey
     already says the word is not a link */
  .sitehead nav .soon::after { display: none; }
}
@media (max-width: 430px) {
  /* and then the unbuilt sections go entirely: on a phone this screen
     is the Connect button, and a rail of four dead words in front of
     it is the wrong thing to spend the width on */
  .sitehead nav .soon { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sitehead .crest,
  .sitehead nav a,
  .ghost,
  .tab {
    transition: none;
  }
  .sitehead .crest:hover,
  .sitehead nav a:hover,
  .ghost:hover,
  .tab:hover {
    transform: none;
  }
}
