/* ARRR homepage — the aged-vellum ledger (claude.ai/design Homepage.dc.html).
   One parchment sheet: mottled paper, ink rules, wax-red actions. Ink (--ink)
   carries the text, wax red (--red) is spent on actions and the seal, brass
   (--brass) only on treasure numbers (points, gold). Type is game-playful:
   Lilita One (thick, rounded) for display, Nunito for body and bold labels;
   JetBrains Mono stays for tabular numerals. */
:root {
  --paper: #e5d4ac;
  --paper-hi: #f1e6c9;
  --paper-dk: #c9b184;
  --ink: #2f2114;
  --ink-soft: #6a533a;
  --line: rgba(58, 37, 15, .3);
  --line-soft: rgba(58, 37, 15, .16);
  --red: #8c2b1b;
  --red-hi: #b23c22;
  --red-dk: #5e1810;
  --brass: #7c531c;
  --good: #2f5a4a;
  --bad: #8c2b1b;
  --seal-ink: #f2e3c2;
  --edge: #3a250f;
  --shadow: 0 8px 26px -14px rgba(45, 28, 12, .55);
  --radius: 6px;
  /* The dark-brown/gold band: navbar + footer (and the widgets living on
     them). Gold is the brand metal — wordmark, active pill, login badge —
     cream carries the lettering, everything else stays quiet brown. */
  --bar: #2b2013;
  --bar-hi: #362919;
  --bar-edge: #c8922a;
  --gold: #f0b43e;
  --gold-hi: #f8cd6b;
  --gold-dk: #d3902a;
  --cream: #f3e8cd;
  --cream-dim: #d9c8a3;
  --cream-faint: #b9a67f;
  --display: 'Lilita One', 'Trebuchet MS', sans-serif;
  --label: 'Nunito', 'Trebuchet MS', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

@keyframes flicker { 0%, 100% { opacity: .9 } 45% { opacity: .78 } 70% { opacity: .95 } }
@keyframes sealBreath {
  0%, 100% { box-shadow: 0 10px 26px -8px rgba(20,8,4,.7), 0 2px 4px rgba(0,0,0,.4), inset 0 3px 8px rgba(255,190,160,.28), inset 0 -8px 16px rgba(40,8,4,.7); }
  50% { box-shadow: 0 14px 34px -8px rgba(20,8,4,.75), 0 2px 4px rgba(0,0,0,.4), inset 0 3px 10px rgba(255,190,160,.34), inset 0 -8px 16px rgba(40,8,4,.7); }
}
@keyframes driftY { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-4px) } }
@keyframes livePulse { 0%, 100% { opacity: 1 } 50% { opacity: .45 } }
@keyframes fade { 0% { opacity: 0 } 100% { opacity: 1 } }
@keyframes sealStamp {
  0% { transform: rotate(-11deg) scale(1.9); opacity: 0 }
  60% { opacity: 1 }
  100% { transform: rotate(-4deg) scale(1); opacity: 1 }
}

* { box-sizing: border-box; }
html { background: #241a10; }
html, body { margin: 0; padding: 0; }
body {
  /* Parchment mottling — highlights top-left, shade pooling at the edges. */
  background:
    radial-gradient(70% 55% at 22% 18%, rgba(255,246,222,.55), transparent 60%),
    radial-gradient(60% 50% at 82% 30%, rgba(160,130,86,.28), transparent 62%),
    radial-gradient(55% 60% at 68% 82%, rgba(120,92,54,.3), transparent 60%),
    radial-gradient(50% 45% at 12% 78%, rgba(150,120,78,.26), transparent 62%),
    radial-gradient(120% 100% at 50% 50%, var(--paper-hi), var(--paper) 55%, var(--paper-dk) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'Nunito', 'Trebuchet MS', sans-serif;
  font-weight: 500;
  line-height: 1.55;
  min-height: 100vh;
}

/* ── parchment scenery (fixed, under the z-index:1 content) ── */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.32  0 0 0 0 0.24  0 0 0 0 0.14  0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px;
}
.page-stains, .page-edges, .page-vignette { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.stain { position: absolute; border-radius: 50%; }
.stain-a { top: 14%; left: 16%; width: 190px; height: 150px; background: radial-gradient(circle, rgba(96,62,28,.16), transparent 66%); filter: blur(6px); }
.stain-b { bottom: 18%; right: 12%; width: 230px; height: 180px; border-radius: 48% 52% 55% 45%; background: radial-gradient(circle, rgba(110,72,34,.14), transparent 68%); filter: blur(8px); }
/* Burnt / aged edges — the candle-side flicker is the page's only ambient motion. */
.page-edges {
  box-shadow: inset 0 0 90px 20px rgba(58,37,15,.55), inset 0 0 220px 60px rgba(40,25,10,.35);
  animation: flicker 7s ease-in-out infinite;
}
.page-vignette { background: radial-gradient(130% 120% at 50% 45%, transparent 58%, rgba(45,28,12,.5) 100%); }

main, .topbar, .launch-banner, .footer { position: relative; z-index: 1; }

a { color: var(--ink); }
a:hover { color: var(--red); }

/* ── top bar — the dark-brown band with the gold rule ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 46px);
  background: linear-gradient(180deg, var(--bar-hi), var(--bar));
  border-bottom: 3px solid var(--bar-edge);
  box-shadow: 0 6px 18px -8px rgba(30, 18, 6, .6);
  /* Above <main> (both are z-index:1 siblings, main comes later in the DOM),
     so the session dropdown hanging below the bar stays clickable. */
  z-index: 5;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand:hover { color: inherit; }
/* The official pirate-hat skull (logo-skull.webp, cut from the painted sign).
   The art ships as a black square — the source has no alpha, so the skull is
   pre-centered on black with even margins baked in — and the CSS adds only a
   thin rounded gold ring around it. */
.brand-skull {
  width: 44px; height: 44px; display: block; border-radius: 12px;
  border: 1.5px solid var(--gold);
  box-shadow: 0 3px 8px rgba(20, 12, 4, .5);
  transition: transform .15s;
}
.brand:hover .brand-skull { transform: scale(1.06) rotate(-4deg); }
/* The chunky gold ARRR wordmark (Lilita One); the dark ledge under the
   letters is what makes it read as a carved sign rather than flat type. */
.brand-word {
  font-family: var(--display); font-size: 27px; line-height: 1; letter-spacing: .04em;
  color: var(--gold);
  text-shadow: 0 2px 0 rgba(96, 58, 8, .9), 0 4px 8px rgba(0, 0, 0, .35);
}
.session-area { display: flex; align-items: center; gap: 10px; }
/* The signed-in chrome badges — Ruby pill, Notifications bell, login badge —
   share ONE dark-glass-and-gold-ring recipe so the row reads as a matched
   set: same 40px height, same 1.5px bar-edge ring, same glass, same
   fully-round corners (999px collapses to a circle on the square bell), and
   the same hover (ring brightens to full gold). Badge-specific rules below
   carry only layout and lettering — never ring, glass, or radius. */
.ruby-pill, .notif-btn, .session-user {
  height: 40px; border-radius: 999px;
  background: rgba(0, 0, 0, .14); border: 1.5px solid var(--bar-edge);
  transition: .15s;
}
.ruby-pill:hover, .ruby-pill:focus-visible, .notif-btn:hover, .session-user:hover {
  border-color: var(--gold);
}
/* The Ruby pill — the signed-in account's premium balance, fetched live from
   the game server (app.ts refreshRubyPill). Hidden only while logged OUT;
   signed in it always shows (bare gem until a verified balance answers — it
   must never silently vanish, it's the nav's door to the Ruby shop).
   It's a link to the Buy-Rubies page (ARRR/ruby), so it carries the
   anchor resets plus the shared ring hover that reads as clickable. */
.ruby-pill {
  display: none; align-items: center; gap: 8px;
  padding: 0 16px;
  font-family: var(--label); font-weight: 800; font-size: 15px; color: var(--cream);
  text-decoration: none;
}
/* Appears only once a balance answers, so it can't reserve space up front
   (the count's width is unknown until then, and the flex gap would leave a
   ghost hole beside an invisible pill). A short fade-and-settle makes the
   late arrival read as intentional instead of a pop-in. */
.ruby-pill.shown { display: inline-flex; animation: rubyIn .25s ease-out; }
@keyframes rubyIn { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: none; } }
/* The gem is the official ruby art (ruby.webp, ~4:5 — taller than wide), so
   it's sized by height with the width left to the intrinsic aspect ratio. */
.ruby-gem { height: 16px; width: auto; flex: 0 0 auto; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
/* The Notifications bell — icon-only, beside the Ruby pill (it replaced the
   old "Notifications" nav text link); the red .nav-badge unread count rides
   its top corner. */
.notif-btn {
  position: relative; display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 40px;
  color: var(--gold); cursor: pointer;
}
.notif-btn:hover { color: var(--gold-hi); }
.notif-bell { width: 19px; height: 19px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }
.notif-btn .nav-badge { position: absolute; top: -6px; right: -6px; margin-left: 0; }
/* The login badge: gold avatar coin + name in gold, ringed in the bar's gold. */
.session-user {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--label); font-weight: 800; font-size: 15px; letter-spacing: .02em;
  color: var(--gold);
  padding: 0 12px 0 5px; cursor: pointer;
}
.session-user:hover { color: var(--gold-hi); }
.session-user .avatar {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 60%, var(--gold-dk));
  box-shadow: inset 0 1px 2px rgba(255, 235, 190, .8), inset 0 -2px 4px rgba(122, 77, 10, .5);
  color: #3a2410; font-family: var(--display); font-size: 14px; line-height: 1;
}
.session-user .caret { color: var(--gold); }
/* Buttons sitting ON the dark bar (the logged-out Login) trade the wax red
   for the bar's gold — the parchment page below keeps the red .btn-primary. */
.topbar .btn-primary {
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-dk));
  color: #3a2410; border: 1px solid #a76f14; border-radius: 12px;
  font-weight: 800; text-shadow: none;
  box-shadow: inset 0 1px 2px rgba(255, 235, 190, .7), 0 3px 8px rgba(20, 12, 4, .45);
}
.topbar .btn-primary:hover { filter: brightness(1.06); border-color: #a76f14; color: #3a2410; }

/* ── buttons ── */
.btn {
  font-family: var(--label); font-weight: 700; font-size: 15px; letter-spacing: .04em;
  color: var(--ink); background: rgba(241, 230, 201, .55); border: 1px solid rgba(58, 37, 15, .45);
  padding: 8px 16px; border-radius: var(--radius); cursor: pointer; transition: .15s;
  text-decoration: none;
}
.btn:hover { border-color: var(--red); color: var(--red); background: var(--paper-hi); }
/* Primary = a dab of the same sealing wax as the Play seal. */
.btn-primary {
  background: radial-gradient(circle at 40% 32%, var(--red-hi), var(--red) 60%, var(--red-dk) 100%);
  color: var(--seal-ink); border-color: var(--red-dk);
  text-shadow: 0 1px 1px rgba(40, 8, 4, .5);
}
.btn-primary:hover { filter: brightness(1.08); border-color: var(--red-dk); color: var(--seal-ink); }
.btn-lg { font-size: 18px; padding: 13px 26px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── layout ── */
main { max-width: 980px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 24px) 80px; }
.view { margin-top: clamp(20px, 4vw, 40px); }
.hidden { display: none !important; }

/* ── hero (the parchment landing) ── */
.hero {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  /* Nav + hero + cue ≈ one viewport, so "The Ledger of Souls ▾" sits at the
     fold — it links over to the Leaderboard page (its own page now). 76px is
     the dark topbar's height (14px padding ×2 + 44px brand tile + 3px rule
     + the 1px shadow rounding). */
  min-height: calc(100svh - 76px);
  padding: 30px 12px 0;
  animation: fade .9s ease both;
  margin-top: 0;
}
.hero-inner {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  max-width: 720px; padding-bottom: 40px;
}
.title { margin: 14px 0 0; line-height: 0; }
/* The ARRR sign — sized like the old display type was (≈full hero width on
   phones, capped on desktop); a soft ink shadow seats it on the parchment. */
.hero-logo {
  display: block; width: min(420px, 82vw); height: auto;
  filter: drop-shadow(0 8px 16px rgba(45, 28, 12, .3));
}
.tagline {
  font-family: var(--label); font-weight: 600; font-style: italic;
  font-size: clamp(15px, 1.6vw, 18px); line-height: 1.5; color: var(--ink-soft);
  margin: 10px 0 0; max-width: 520px;
}
.tagline-link {
  font-family: var(--label); font-weight: 700; font-style: normal; letter-spacing: .05em;
  color: var(--red); text-decoration: underline; text-underline-offset: 3px;
}
.hero-rule { display: flex; align-items: center; gap: 16px; width: min(340px, 80%); margin: 30px 0 4px; }
.hero-rule i { flex: 1; height: 1px; }
.hero-rule i:first-child { background: linear-gradient(90deg, transparent, rgba(58, 37, 15, .5)); }
.hero-rule i:last-child { background: linear-gradient(90deg, rgba(58, 37, 15, .5), transparent); }
.rule-star { font-size: 20px; color: var(--red); }

/* The wax seal — THE play button, stamped onto the page on load. A flat bar
   of sealing wax: rectangular, with slightly uneven rounded corners so it
   still reads as hand-stamped rather than a UI pill. */
.wax-seal {
  position: relative; margin: 26px 0 0; padding: 20px 62px;
  border-radius: 22px 27px 20px 29px / 27px 20px 29px 22px;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 40% 32%, var(--red-hi), var(--red) 52%, var(--red-dk) 100%);
  color: var(--seal-ink); cursor: pointer; text-decoration: none;
  transform: rotate(-4deg);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  animation: sealStamp .55s cubic-bezier(.2, .9, .3, 1.15) .45s backwards,
             sealBreath 4.5s ease-in-out 1.1s infinite;
}
.wax-seal:hover { transform: rotate(-1deg) scale(1.06); color: var(--seal-ink); }
.wax-seal:active { transform: rotate(-4deg) scale(.9); }
.seal-ring { position: absolute; inset: 7px; border-radius: 16px 21px 14px 23px / 21px 14px 23px 16px; border: 1.5px solid rgba(255, 220, 190, .35); }
.seal-word { font-family: var(--label); font-weight: 700; font-size: 25px; letter-spacing: .2em; padding-left: .2em; text-shadow: 0 1px 1px rgba(40, 8, 4, .5); }

/* Scene dressing flanking the landing: the dragon patrols the top-left, the
   war elephant marches at bottom-right. Anchored to the hero's corners, clear
   of the centered column on any sane viewport; the fluid clamp keeps them
   from crowding the content as the window narrows. */
.hero-dragon, .hero-elephant { position: absolute; height: auto; pointer-events: none; filter: drop-shadow(0 8px 14px rgba(45, 28, 12, .3)); }
/* calc(50% - 50vw) walks from the 980px content column out to the viewport
   edge, so the pair hug the page corners, not the column's. */
.hero-dragon { top: 26px; left: calc(50% - 50vw + 3vw); width: clamp(192px, 27vw, 400px); animation: driftY 5s ease-in-out infinite; }
.hero-elephant { bottom: 24px; right: calc(50% - 50vw + 3vw); width: clamp(154px, 19vw, 288px); }
/* Phones: still big — the dragon may layer behind the sign's edge, and the
   bottom strip is ceded to the elephant: the centered copy ends above it
   (hero-inner padding) and the cue walks to the bottom-left, out from under
   its tusks. */
@media (max-width: 640px) {
  .hero-dragon { top: 4px; width: 154px; }
  .hero-elephant { bottom: 0; width: 122px; }
  .hero-inner { padding-bottom: 120px; }
  .hero-cue { align-self: flex-start; padding-left: 10px; }
}

.hero-sub { font-family: var(--label); font-weight: 700; font-size: 13px; letter-spacing: .14em; color: var(--ink-soft); margin-top: 16px; }
.hero-live { font-style: italic; font-size: 16px; color: var(--ink-soft); margin-top: 22px; }
/* The dot keeps the design's gentle drift but also breathes in opacity —
   a red dot beside live data reads as a "live" indicator, and a pulse is
   the signal people expect from one. */
.live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); margin-right: 8px; vertical-align: middle;
  animation: driftY 3s ease-in-out infinite, livePulse 2s ease-in-out infinite;
}
.hero-cue {
  background: none; border: none; cursor: pointer; align-self: center;
  font-family: var(--label); font-weight: 700; font-size: 12px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-soft); padding: 0 0 26px;
}
.hero-cue:hover { color: var(--red); }

/* ── navbar pages ── */
.nav { display: flex; gap: 6px; margin: 0 auto 0 22px; flex-wrap: wrap; align-items: center; }
.nav-link {
  background: none; border: 1.5px solid transparent; color: var(--cream);
  font-family: var(--label); font-weight: 800; font-size: 15.5px; letter-spacing: .02em;
  padding: 8px 15px; cursor: pointer; border-radius: 12px; transition: .15s;
}
.nav-link:hover { color: var(--gold-hi); }
.nav-link.active {
  color: var(--gold); background: rgba(240, 180, 62, .1);
  border-color: var(--bar-edge);
  box-shadow: 0 2px 8px -2px rgba(0, 0, 0, .5);
}

/* ── sub-tabs (My Points sources · Leaderboard's Pirates | Clans · the character page's Pirate | Clan | My Points) ── */
.subtabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin: 14px 0 20px; border-bottom: 1px solid var(--line);
}
.subtab {
  background: none; border: none; color: var(--ink-soft);
  font-family: var(--label); font-weight: 700; font-size: 15px; letter-spacing: .04em;
  padding: 8px 16px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: .15s;
}
.subtab:hover { color: var(--ink); }
.subtab.active { color: var(--red); border-bottom-color: var(--red); }
/* Count pill on a sub-tab (My Listings): wax-red like the active tab ink, so
   it reads as part of the ledger rather than an alert. Hidden at zero. */
.subtab-badge {
  display: inline-block; min-width: 20px; padding: 1px 7px; margin-left: 4px;
  border-radius: 999px; background: var(--red); color: var(--seal-ink);
  font-family: var(--mono); font-weight: 700; font-size: 11px; line-height: 1.5;
  text-align: center; vertical-align: 1px;
}
.subtab-badge.hidden { display: none; }

/* single-source detail (Game / Contribution tabs) */
.source-detail { display: flex; gap: 22px; flex-wrap: wrap; align-items: stretch; margin-bottom: 24px; }
.stat-panel {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, rgba(140, 43, 27, .08), rgba(241, 230, 201, .5));
  border: 1px solid rgba(124, 83, 28, .55); border-radius: var(--radius);
  padding: 26px 40px; box-shadow: var(--shadow);
}
.stat-num { font-family: var(--mono); font-weight: 700; font-size: 40px; line-height: 1; color: var(--brass); }
.stat-lbl { font-family: var(--label); font-weight: 700; letter-spacing: 1.5px; font-size: 12px; color: var(--ink-soft); }
.source-meta { display: flex; flex-direction: column; justify-content: center; gap: 0; flex: 1 1 260px; min-width: 220px; }
.meta-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); }
.meta-row:last-child { border-bottom: none; }
.meta-k { color: var(--ink-soft); font-size: 14px; }
.meta-v { font-family: var(--mono); font-size: 13px; color: var(--ink); }

.source-h { font-family: var(--label); font-weight: 700; font-size: 16px; letter-spacing: .04em; margin: 0 0 12px; color: var(--ink); }
.howto { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 12px; }
.howto li { display: flex; align-items: flex-start; gap: 12px; font-size: 15px; color: var(--ink); }
.howto-ic { flex: 0 0 auto; font-size: 18px; line-height: 1.45; }
.howto strong { color: var(--red); }

/* ── My Points head: the page's one answer (total + rank), pinned at the top
      so it's visible on every sub-tab and viewport without scrolling ── */
.points-head { align-items: stretch; }
.points-title { flex: 1 1 280px; min-width: 0; }
.points-total {
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 6px;
  margin-left: auto; padding: 12px 20px;
  background: linear-gradient(135deg, rgba(140, 43, 27, .08), rgba(241, 230, 201, .5));
  border: 1px solid rgba(124, 83, 28, .55); border-radius: var(--radius); box-shadow: var(--shadow);
}
.pt-num { font-family: var(--mono); font-weight: 700; font-size: 34px; line-height: 1; color: var(--brass); }
.pt-lbl { font-family: var(--label); font-weight: 700; letter-spacing: 1.5px; font-size: 12px; color: var(--ink-soft); }
.pt-lbl strong { color: var(--ink); }
@media (max-width: 640px) {
  .points-total { align-items: flex-start; margin-left: 0; flex: 1 1 100%; }
}

/* ── My Points breakdown ── */
.points-breakdown {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; align-items: stretch;
}
.pb-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: rgba(241, 230, 201, .5);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 18px; box-shadow: var(--shadow);
}
.pb-card[data-tab] { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.pb-card[data-tab]:hover { border-color: var(--red); transform: translateY(-2px); }
.pb-num { font-family: var(--mono); font-weight: 700; font-size: 30px; line-height: 1; color: var(--ink); }
.pb-grand { border-color: rgba(124, 83, 28, .55); background: linear-gradient(135deg, rgba(140, 43, 27, .08), rgba(241, 230, 201, .5)); }
.pb-grand .pb-num { color: var(--brass); font-size: 36px; }
.pb-lbl { font-family: var(--label); font-weight: 700; letter-spacing: 1.5px; font-size: 12px; color: var(--ink-soft); text-align: center; }
.pb-lbl strong { color: var(--ink); }
@media (max-width: 640px) { .points-breakdown { grid-template-columns: repeat(2, 1fr); } }

/* ── Social breakdown: X posts + invite bonus = Social ── */
.social-sum { display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.social-sum .pb-card { flex: 1 1 150px; }
.pb-plus, .pb-eq { align-self: center; font-family: var(--mono); font-weight: 700; font-size: 26px; color: var(--ink-soft); }
@media (max-width: 640px) {
  .social-sum { display: grid; grid-template-columns: 1fr 1fr; }
  .pb-plus, .pb-eq { display: none; }
  .social-sum .pb-grand { grid-column: 1 / -1; }
}

/* ── Social streams: one bounded section per stream (X posts · invite bonus),
      action first, scoring rules folded into a details disclosure ── */
.stream-card {
  margin: 0 0 18px; padding: 18px 20px;
  background: rgba(241, 230, 201, .5);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.stream-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.stream-head .source-h { margin: 0; }
.stream-pts { font-family: var(--mono); font-weight: 700; color: var(--brass); font-size: 20px; margin-left: 8px; vertical-align: -1px; }
.stream-intro { margin: 0 0 14px; font-size: 15px; color: var(--ink); }
.stream-intro strong { color: var(--red); }
.howto-fold { margin-top: 16px; border-top: 1px dashed var(--line); }
.howto-fold summary {
  cursor: pointer; list-style: none; padding: 10px 0 2px;
  font-family: var(--label); font-weight: 700; font-size: 13px; letter-spacing: .04em; color: var(--ink-soft);
}
.howto-fold summary::-webkit-details-marker { display: none; }
.howto-fold summary::before { content: '▸'; display: inline-block; margin-right: 8px; transition: transform .15s; }
.howto-fold[open] summary::before { transform: rotate(90deg); }
.howto-fold summary:hover, .howto-fold[open] summary { color: var(--ink); }
.howto-fold .source-meta { margin-bottom: 6px; }
.howto-fold .howto { margin: 10px 0 6px; }

/* ── invite bonus: your referral link + the friends it's brought in ── */
.invite-label { display: block; font-family: var(--label); font-weight: 700; letter-spacing: 1px; font-size: 12px; color: var(--ink-soft); margin: 16px 0 6px; }
.invite-row { max-width: 640px; }
.invite-row .input { flex: 1; min-width: 0; }
.invite-table td.pts { color: var(--brass); font-weight: 700; }

/* ── point decay (Overview explainer + per-source status) ── */
.decay-card {
  margin-top: 18px; padding: 20px 22px;
  background: rgba(241, 230, 201, .5);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.decay-intro { margin: 0 0 4px; font-size: 15px; color: var(--ink); }
.decay-intro strong { color: var(--red); }
.decay-table td:first-child { white-space: nowrap; }
.decay-table .decay-st { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.decay-rules { margin-top: 16px; }
.decay-ok { color: var(--good); }
.decay-warn { color: var(--bad); }
/* ▾ next to a points value whose source is currently decaying */
.decay-ind { color: var(--bad); cursor: help; font-size: 12px; }

/* ── setup notices (Notifications page) ── */
.notices { display: grid; gap: 10px; margin-top: 14px; }
.notice {
  display: flex; align-items: center; gap: 14px;
  background: rgba(124, 83, 28, .1); border: 1px solid rgba(124, 83, 28, .45);
  border-radius: var(--radius); padding: 14px 16px;
}
.notice-x { background: rgba(140, 43, 27, .08); border-color: rgba(140, 43, 27, .4); }
.notice-done { background: rgba(47, 90, 74, .1); border-color: rgba(47, 90, 74, .45); }
.notice-icon { display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 auto; border-radius: 50%; background: var(--brass); color: var(--seal-ink); font-family: var(--mono); font-weight: 700; }
.notice-x .notice-icon { background: var(--bad); color: var(--seal-ink); }
.notice-done .notice-icon { background: var(--good); color: var(--seal-ink); }
.notice-text { flex: 1; font-size: 15px; }
.notice-cta { flex: 0 0 auto; }

/* ── Treasure Hunt page: the hall of fame ── */
.hunt-fame-table td:first-child { font-weight: 700; }
/* The ongoing hunt's OPEN winner seat atop the hall of fame. */
.hunt-open-row td { background: rgba(124, 83, 28, .08); font-style: italic; }

/* Two columns: the live ongoing hunts (left) and the rules (right). Collapses
   to a single stack on narrow screens, hunts first. */
.hunt-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 12px 34px; margin-bottom: 22px; }
.hunt-col { min-width: 0; }
.hunt-col .howto { margin-bottom: 0; }
@media (max-width: 720px) { .hunt-layout { grid-template-columns: 1fr; gap: 22px; } }

/* Ongoing-hunt cards. Each is a small vellum plaque: name, prize (brass, the
   treasure metal), then quiet start-time + region meta. */
.hunt-ongoing { display: grid; gap: 12px; }
.hunt-ongoing-msg { margin: 0; font-size: 15px; color: var(--ink-soft); font-style: italic; }
.hunt-card { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(241, 230, 201, .5); padding: 13px 15px; }
.hunt-card-name { font-family: var(--label); font-weight: 800; font-size: 16px; color: var(--ink); line-height: 1.3; }
.hunt-card-prize-row { margin-top: 4px; }
.hunt-card-prize { font-family: var(--mono); font-weight: 700; font-size: 15px; color: var(--brass); }
.hunt-card-prize-none { color: var(--ink-soft); font-weight: 400; font-style: italic; }
.hunt-card-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; }
.hunt-card-meta-item { font-size: 13px; color: var(--ink-soft); }

/* Hall of Fame — its own bordered panel, set apart from the hunts + rules. */
.hunt-hall { border-top: 1px solid var(--line-soft); padding-top: 20px; }

/* Hunt wiki (/hunt-wiki): the inline "read the wiki" link-button reads as a
   plain anchor, and the wiki's tables keep their prose columns readable. */
.wiki-link {
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; color: var(--ink); text-decoration: underline;
}
.wiki-link:hover { color: var(--red); }
#hw-body p { max-width: 720px; }
.hw-table td { line-height: 1.5; }

/* navbar notifications badge */
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 7px; padding: 0 5px; border-radius: 9px; background: var(--red); color: var(--seal-ink); font-family: var(--mono); font-size: 11px; font-weight: 700; vertical-align: middle; }

/* ── My Account dropdown — hangs off the dark bar, so it wears the bar's
   brown/gold rather than the page's paper. ── */
.session-menu { position: relative; }
.caret { margin-left: 6px; font-size: 11px; opacity: .8; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 170px; background: var(--bar-hi); border: 1px solid var(--bar-edge); border-radius: 12px; box-shadow: 0 12px 28px -10px rgba(15, 9, 3, .8); overflow: hidden; z-index: 50; }
.dropdown-item { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--cream); font-family: var(--label); font-weight: 700; font-size: 15px; letter-spacing: .04em; padding: 11px 16px; cursor: pointer; }
.dropdown-item:hover { background: rgba(240, 180, 62, .12); color: var(--gold-hi); }

/* ── My Account page ── */
.page-title { font-family: var(--display); font-weight: 400; font-size: 30px; color: var(--ink); margin: 0 0 4px; }
.account-section { padding: 18px 0; border-top: 1px solid var(--line); }
.account-section:first-of-type { border-top: none; }
.account-section h3 { font-size: 16px; margin: 0 0 8px; display: flex; align-items: center; gap: 10px; }
/* Inputs only need room for an email / wallet address — don't let them eat the whole column. */
.account-section .row { max-width: 560px; }
/* ── verify-with-a-post linking ── */
.link-steps { margin: 4px 0 0; padding-left: 20px; max-width: 560px; }
.link-steps li { margin: 0 0 12px; line-height: 1.5; }
.link-steps .row { margin-top: 8px; }
.link-code { display: inline-block; margin-top: 6px; padding: 6px 12px; font-family: var(--mono); font-size: 15px; font-weight: 700; letter-spacing: .5px; color: var(--red); background: rgba(140, 43, 27, .08); border: 1px solid var(--line); border-radius: var(--radius); user-select: all; }

.tag { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; padding: 2px 8px; border-radius: 20px; }
.tag-good { background: rgba(47, 90, 74, .14); color: var(--good); }
.tag-warn { background: rgba(124, 83, 28, .16); color: var(--brass); }

/* ── cards ── */
.card {
  background: linear-gradient(180deg, rgba(241, 230, 201, .55), rgba(229, 212, 172, .3));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px;
  box-shadow: var(--shadow);
}
.card h2 { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 0 0 12px; color: var(--ink); letter-spacing: .02em; }
/* Wraps: on narrow screens the blurb drops below the heading instead of
   being crushed into a one-word-per-line column beside it. */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.muted { color: var(--ink-soft); }
.hint { font-size: 14px; margin-top: 8px; min-height: 18px; }
.hint.ok { color: var(--good); }
.hint.err { color: var(--bad); }

/* ── inputs ── */
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.input { flex: 1 1 220px; min-width: 0; background: rgba(255, 250, 235, .7); border: 1px solid rgba(58, 37, 15, .45); color: var(--ink); padding: 10px 13px; border-radius: var(--radius); font-family: var(--mono); font-size: 14px; }
.input:focus { outline: none; border-color: var(--red); }
/* Read-only wallet address: same box as an input, but not editable — modd.io owns it. */
.wallet-address { flex: 1 1 220px; min-width: 0; background: rgba(255, 250, 235, .7); border: 1px solid rgba(58, 37, 15, .45); color: var(--ink); padding: 10px 13px; border-radius: var(--radius); font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere; display: flex; align-items: center; }
.linked-handle { font-size: 17px; }
.linked-handle .check { color: var(--good); }

/* ── tables (the ledger) ── */
.table-wrap { overflow-x: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-family: var(--label); font-weight: 700; font-size: 12px; letter-spacing: 1.5px; color: var(--ink-soft); padding: 8px 10px; border-bottom: 1px solid rgba(58, 37, 15, .45); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); }
tbody tr:hover { background: rgba(58, 37, 15, .04); }
.empty-row td { color: var(--ink-soft); text-align: center; padding: 22px; }
td .num, .lb-table td:last-child, .contrib-table td:nth-child(5) { font-family: var(--mono); }
.pts { color: var(--brass); font-weight: 700; }
.contrib-table .age { color: var(--ink-soft); font-size: 13px; white-space: nowrap; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; font-family: var(--mono); }
.badge.verified { background: rgba(47, 90, 74, .14); color: var(--good); }
.badge.pending { background: rgba(124, 83, 28, .16); color: var(--brass); }
.badge.rejected { background: rgba(140, 43, 27, .12); color: var(--bad); }
.contrib-remove { margin-top: 6px; padding: 0; border: none; background: none; color: var(--ink-soft); font-size: 11px; font-family: var(--mono); cursor: pointer; }
.contrib-remove:hover { color: var(--bad); text-decoration: underline; }
.contrib-remove:disabled { opacity: .5; cursor: default; text-decoration: none; }
.lb-table .me { background: rgba(124, 83, 28, .1); }
.lb-table .cut td { border-bottom: 2px solid var(--brass); }
.lb-table tr.lb-row { cursor: pointer; }
.lb-table tr.lb-row:hover { background: rgba(58, 37, 15, .07); }
/* Per-source breakdown columns (Game / X Posts / RunHQ): quiet next to the
   Points total they sum to. Hidden on phones — the total still tells the story. */
.lb-table .lb-src { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
th.lb-src { font-size: 10px; }
@media (max-width: 640px) { .lb-table .lb-src { display: none; } }
/* Magic Find column (far right): the loot bonus the row's Points buy in-game.
   Gently highlighted — a gold wash over the whole column with a hairline gold
   rule on its left — so the perk reads at a glance without shouting over the
   Points total. Stays visible on phones (unlike .lb-src): it IS the reward. */
.lb-table .lb-mf { background: rgba(240, 180, 62, .13); border-left: 1px solid rgba(211, 144, 42, .45); font-family: var(--mono); font-weight: 700; color: var(--gold-dk); white-space: nowrap; }
.lb-table th.lb-mf { background: rgba(240, 180, 62, .13); border-left: 1px solid rgba(211, 144, 42, .45); color: var(--gold-dk); }
.lb-table .lb-mf .muted { font-weight: 400; }
/* Pirates-board Clan column (third, right of the pirate). The clan name is its own click target
   inside the clickable row (row → profile, name → clan page), so it reads as
   a link; ellipsized so a long clan name can't squash the pirate column. */
.lb-clan { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clan-link { color: var(--brass); font-weight: 700; cursor: pointer; }
.clan-link:hover { text-decoration: underline; }

/* Small 𝕏 logo after a verified pirate's name (replaces the old X column).
   Links to their X profile; the handle lives in the tooltip. */
.x-badge { display: inline-flex; margin-left: 6px; vertical-align: -1px; color: var(--ink-soft); }
.x-badge .x-logo { width: 12px; height: 12px; display: block; }
.x-badge:hover { color: var(--red); }

/* Leaderboard pager (50 supporters per page) */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.pager .btn { padding: 6px 14px; font-size: 13px; }

/* ── scoring info tooltip ──
   A small (i) next to headings; hovering (or focusing, for keyboards/touch)
   shows how scoring works. Pure CSS, shown instantly — no transition delay. */
.info-tip { position: relative; display: inline-flex; margin-left: 6px; vertical-align: 1px; cursor: help; outline: none; }
.info-ic {
  width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--ink-soft); color: var(--ink-soft);
  font: 700 10px/13px var(--mono); text-align: center; font-style: normal;
}
.info-tip:hover .info-ic, .info-tip:focus .info-ic { border-color: var(--red); color: var(--red); }
.info-tip .tip-body {
  display: none; position: absolute; top: calc(100% + 8px); left: -12px;
  width: min(320px, 78vw); z-index: 30;
  background: var(--paper-hi); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow);
  font-family: var(--label); font-size: 13px; font-weight: 500;
  line-height: 1.5; color: var(--ink); text-transform: none; letter-spacing: normal;
  white-space: normal;
}
.info-tip .tip-body strong { display: block; color: var(--red); margin-bottom: 4px; }
/* Icons sitting at the right edge of a card anchor their popover rightward. */
.info-tip.tip-end .tip-body { left: auto; right: -12px; }
.info-tip:hover .tip-body, .info-tip:focus .tip-body { display: block; }
/* Phones: an icon-anchored popover would run off-screen — pin it to the
   viewport as a floating card instead (tap focuses the icon and shows it). */
@media (max-width: 640px) {
  .info-tip .tip-body, .info-tip.tip-end .tip-body { position: fixed; left: 16px; right: 16px; top: 110px; width: auto; }
}

/* ── supporter profile (leaderboard drill-down) ── */
.profile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.profile-head .page-title { margin-bottom: 0; }
.profile-posts-h { margin-top: 26px; }
.rank-medal { font-family: var(--mono); font-weight: 700; }
.airdrop-star { color: var(--brass); }
a.post-link { color: var(--red); text-decoration: none; }
a.post-link:hover { text-decoration: underline; }

/* ── clans ── */
.clan-create { margin: 2px 0 6px; }
.clan-create .row { max-width: 560px; }
.clan-desc { margin: 0 0 16px; max-width: 640px; }
/* Two stat cards (members · clan total) — don't stretch across the whole card. */
.clan-stats { grid-template-columns: repeat(2, 1fr); max-width: 480px; margin-bottom: 6px; }
.clan-actions { margin: 10px 0 2px; align-items: center; }
.clan-kick-cell { text-align: right; }
.kick-btn { padding: 4px 12px; font-size: 12px; }
/* Hunt log — the clan's treasure-hunt campaign feed (app.ts loadClanHuntFeed). */
#clan-hunt-log { margin: 14px 0; }
.hunt-log { display: flex; flex-direction: column; gap: 6px; }
.hunt-log-row { display: flex; align-items: baseline; gap: 10px; font-size: 13px; line-height: 1.5; }
.hunt-log-when { flex: 0 0 auto; min-width: 88px; font-family: var(--mono); font-size: 12px; }
.hunt-log-who { flex: 0 0 auto; color: var(--ink); }
.hunt-log-what { min-width: 0; }

/* ── launch banner ── */
.launch-banner { margin: 0 auto; max-width: 980px; padding: 16px clamp(16px, 5vw, 24px) 0; }
.launch-inner { border-radius: var(--radius); padding: 18px 22px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.launch-inner.revealed { background: linear-gradient(135deg, rgba(124, 83, 28, .16), rgba(241, 230, 201, .5)); border: 1px solid rgba(124, 83, 28, .6); }
.launch-inner.final { background: linear-gradient(135deg, rgba(140, 43, 27, .18), rgba(124, 83, 28, .12)); border: 1px solid var(--red); }
.launch-title { font-family: var(--display); font-size: 22px; color: var(--ink); }
.launch-when { font-family: var(--mono); font-weight: 700; }
.countdown { font-family: var(--mono); font-size: 22px; color: var(--red); }

/* ── modal (clan invite link + join-via-link prompt) ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(36, 26, 16, .6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
/* Solid paper — the parchment page must not bleed through a dialog. */
.modal { width: 100%; max-width: 460px; background: var(--paper-hi); }
.modal-title { font-family: var(--display); font-size: 26px; color: var(--ink); margin: 0 0 6px; }
.modal-text { margin: 0 0 16px; color: var(--ink-soft); font-size: 15px; }
.modal .row { flex-wrap: wrap; }
.invite-link-input { flex: 1 1 100%; font-size: 13px; }

/* ── treasure map ── */
.treasure-wrap { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.treasure-frame {
  position: relative; flex: 1 1 520px; max-width: 720px;
  border: 1px solid rgba(58, 37, 15, .5); border-radius: var(--radius); overflow: hidden;
  background: #ccae84; /* parchment tan, shows under the canvas while it charts */
  box-shadow: var(--shadow);
}
.treasure-canvas { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; cursor: grab; touch-action: none; }
.treasure-canvas:active { cursor: grabbing; }
.treasure-zoom { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; }
.treasure-zoom-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 20px; line-height: 1; font-weight: 700;
  color: var(--seal-ink); background: rgba(47, 33, 20, .58); border: 1px solid rgba(242, 227, 194, .35);
  border-radius: var(--radius); cursor: pointer; transition: background .15s, border-color .15s; user-select: none;
}
.treasure-zoom-btn:hover { background: rgba(47, 33, 20, .8); border-color: var(--paper-hi); color: #fff; }
.treasure-coords {
  position: absolute; left: 10px; bottom: 10px;
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  color: var(--seal-ink); background: rgba(47, 33, 20, .55); padding: 4px 9px; border-radius: var(--radius);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .8); pointer-events: none; letter-spacing: .5px;
}
.treasure-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 26px; color: #4a341e;
  background: rgba(204, 178, 132, .85);
}
.treasure-loading.hidden { display: none; }
.treasure-controls { flex: 1 1 240px; min-width: 220px; display: flex; flex-direction: column; gap: 16px; }
.treasure-stats { grid-template-columns: 1fr 1fr; margin: 0; }
.treasure-buttons { flex-wrap: wrap; }
#treasure-search-area { font-size: 26px; }

/* ── buy rubies (/ruby) ── */
.ruby-state { padding: 6px 0 2px; font-size: 15px; }
.ruby-state p { margin: 8px 0; }
/* The same official ruby art as the navbar pill, inline with the copy: sized
   to the surrounding text (height-only — the art is taller than wide) and
   baseline-tucked so it sits like the emoji it replaced. */
.ruby-img { height: 1em; width: auto; vertical-align: -0.12em; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }
.ruby-img-title { height: 1.05em; vertical-align: -0.14em; }

/* ── marketplace ── */
.btn-small { padding: 3px 10px; font-size: 13px; }
.mk-table th.num, .mk-table td.num { text-align: right; }
.mk-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.mk-sort:hover { color: var(--red); }
.mk-sort::after { content: ' ⇅'; opacity: .35; font-size: 11px; }
.mk-sort.mk-sort-active { color: var(--red); }
.mk-sort.mk-sort-active[data-dir="asc"]::after { content: ' ▲'; opacity: 1; }
.mk-sort.mk-sort-active[data-dir="desc"]::after { content: ' ▼'; opacity: 1; }
.mk-item { font-weight: 600; }
.mk-rarity { font-size: 12px; letter-spacing: .4px; }
/* the board-state banner lives outside a .notices grid — owns its spacing */
.mk-notice { margin: 14px 0 18px; }
#mk-mine-wrap { margin-bottom: 18px; }
.mk-setprice { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; }
.mk-price-input { flex: none; width: 84px; min-width: 0; padding: 4px 8px; font-size: 13px; }
/* Net-proceeds preview: empty (no height) until the seller types a price, then
   drops onto its own line under the input/button row. */
.mk-net-hint { display: block; margin-left: 8px; font-size: 12px; }
.mk-net-hint:empty { display: none; }

/* Filter bar: type / rarity selects on the left, page size on the right. */
.mk-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 2px 0 12px; }
.mk-control { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-soft); }
.mk-control select { width: auto; padding: 5px 8px; font-size: 13px; text-transform: capitalize; }
.mk-controls-gap { flex: 1 1 auto; }

/* Item pictures: the emoji glyph paints instantly; the lazy chunk swaps in the
   render-once 3D thumbnail as a background image (adds .has-thumb). The plate
   behind the render is a MID-TONE warm brown tinted by the item's rarity
   (--rc, set by applyListingThumb): mid-tone is the only value with contrast
   headroom in BOTH directions — a near-black plate swallows gunmetal/wood
   items and pure parchment swallows bone/pearl ones. A dark vignette rim
   keeps pale items defined at the edges where they meet the parchment. */
.mk-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin-right: 9px; flex: none;
  font-size: 21px; line-height: 1; vertical-align: middle;
  border-radius: 7px; border: 1px solid rgba(47, 33, 20, .25);
  background-color: rgba(47, 33, 20, .08);
  background-size: contain; background-repeat: no-repeat; background-position: center;
}
.mk-icon.has-thumb {
  background-color: color-mix(in srgb, var(--rc, #dddddd) 24%, #806a4b);
  border-color: color-mix(in srgb, var(--rc, #dddddd) 42%, rgba(47, 33, 20, .5));
  background-size: 86%;
  box-shadow: inset 0 0 0 1px rgba(255, 243, 214, .14), inset 0 0 10px rgba(24, 16, 6, .4);
}
.mk-item-cell { white-space: nowrap; }
.mk-row { cursor: pointer; }
.mk-row:hover td { background: rgba(47, 33, 20, .06); }

/* Numbered pager. */
.mk-pages { display: inline-flex; align-items: center; gap: 4px; }
.mk-page-num {
  min-width: 32px; padding: 5px 8px; font: inherit; font-size: 13px; cursor: pointer;
  border: 1px solid rgba(47, 33, 20, .35); border-radius: var(--radius);
  background: transparent; color: var(--ink-soft);
}
.mk-page-num:hover { color: var(--ink); border-color: var(--ink); }
.mk-page-num.active { background: var(--red); border-color: var(--red); color: #fff; cursor: default; }
.mk-page-gap { color: var(--ink-soft); padding: 0 2px; }
#mk-page-label { margin-left: 10px; }

/* Listing dialog. */
.mk-modal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.mk-icon-lg { width: 64px; height: 64px; font-size: 40px; border-radius: 10px; margin-right: 0; }
.mk-modal-title .modal-title { margin-bottom: 2px; }
/* The stat/trait block is the game's own tooltip HTML (light text, inline
   colors tuned for a dark surface) — give it the game's dark plate. */
.mk-modal-tip {
  background: rgba(10, 10, 20, .95); border: 1px solid #666; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 14px;
  font: 12px var(--mono); color: #fff; line-height: 1.5;
}
.mk-modal-actions { align-items: center; gap: 10px; }
.mk-modal-actions .btn-primary .ruby-img { margin: 0 2px 0 4px; }

/* ── blacksmith guide (/blacksmith-guide) ── */
.bg-intro { max-width: 72ch; font-size: 14px; line-height: 1.55; color: var(--ink-soft); margin: 0 0 6px; }
.bg-count { max-width: 72ch; font-size: 13px; line-height: 1.5; margin: 12px 0 18px; }
/* Item cards: one per base item, its rollable stats as range lines. */
.bg-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px; margin: 0 0 22px;
}
.bg-item {
  border: 1px solid rgba(47, 33, 20, .3); border-radius: var(--radius);
  background: rgba(241, 230, 201, .45); padding: 11px 13px;
}
.bg-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.bg-icon { font-size: 20px; line-height: 1; flex: none; }
.bg-name { font-weight: 700; font-size: 15px; }
.bg-stats { list-style: none; margin: 0; padding: 0; }
.bg-stats li {
  font: 12.5px var(--mono); color: var(--ink); line-height: 1.7;
  border-top: 1px dashed rgba(47, 33, 20, .18);
}
.bg-stats li:first-child { border-top: 0; }

/* ── profile: in-game character sheet ──
   The sheet itself (slot grid, figure stage, stat column) is the game's own
   markup + CSS (ledger design system, injected by the lazy chunk); the page
   only provides the host: the dark .bsh-card surface so the ledger's
   cream-on-dark palette reads exactly as in-game, plus breathing room. */
/* Capped at the in-game ledger panel's width (min(940px,96vw)) so the figure
   stage keeps its in-game proportions instead of ballooning across the wider
   parchment card. */
.pf-sheet { padding: 8px 18px 4px; margin: 2px 0 8px; max-width: 940px; }
.pf-gold { font-family: var(--mono); color: var(--brass); }

/* ── footer — the navbar's dark band mirrored at the page foot ── */
.footer {
  margin-top: 40px;
  background: linear-gradient(180deg, var(--bar-hi), var(--bar));
  border-top: 3px solid var(--bar-edge);
  color: var(--cream-dim); font-family: var(--label);
}
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px 40px;
  padding: 46px clamp(16px, 5vw, 24px) 34px;
}
.footer-brand .brand-word { font-size: 26px; display: inline-block; }
.footer-tag { margin: 14px 0 0; font-size: 15px; font-weight: 500; line-height: 1.6; color: var(--cream-dim); max-width: 340px; }
.footer-col { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.footer-h {
  margin: 4px 0 12px; font-size: 13px; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: var(--cream);
}
.footer-link {
  display: block; background: none; border: none; padding: 5px 0; cursor: pointer;
  font-family: var(--label); font-weight: 600; font-size: 15px; color: var(--cream-dim);
  text-decoration: none; text-align: left; transition: color .15s;
}
.footer-link:hover { color: var(--gold-hi); }
.footer-bottom {
  border-top: 1px solid rgba(242, 227, 194, .14);
  padding: 18px clamp(16px, 5vw, 24px); text-align: center;
  font-size: 14px; font-weight: 600; color: var(--cream-faint);
}
@media (max-width: 760px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

/* Motion is flavor, never load-bearing — honor the OS setting. */
@media (prefers-reduced-motion: reduce) {
  .wax-seal, .live-dot, .page-edges, .hero, .hero-dragon, .ruby-pill.shown { animation: none !important; }
  .wax-seal, .pb-card[data-tab], .howto-fold summary::before { transition: none; }
}

@media (max-width: 640px) {
  .nav { margin: 0; gap: 0; }
  .nav-link { padding: 8px 10px; font-size: 14px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .notice { flex-wrap: wrap; }
  .hero { min-height: calc(100svh - 150px); }
}

/* ── Buy Rubies: the embedded checkout (#view-ruby → #ruby-checkout) ─────────
   The form itself comes from the SHARED checkout template (apps/token
   checkout-markup.ts — one markup + controller with the standalone page), so
   these rules style ITS class names, scoped so the standalone page's look is
   reproduced without leaking `.warn`/`.btn` variants into the rest of the
   site. Same palette vars; the standalone page inlines copies of them. */
#ruby-checkout .split-note {
  font: 700 12px var(--mono); color: var(--brass); letter-spacing: .03em; margin-bottom: 16px;
}
#ruby-checkout .split-note:empty { display: none; }
#ruby-checkout .field-label { display: block; font: 800 14px var(--label); color: var(--ink); margin: 0 0 8px; }
#ruby-checkout .warn {
  border: 1px solid rgba(140, 43, 27, .5); background: rgba(140, 43, 27, .08);
  border-radius: var(--radius); padding: 12px 14px; margin: 14px 0; font-size: 13px; line-height: 1.55;
}
#ruby-checkout .warn strong { color: var(--red); }
#ruby-checkout .checkout-grid { display: grid; gap: 14px; margin-top: 14px; }
@media (min-width: 640px) { #ruby-checkout .checkout-grid { grid-template-columns: 190px 1fr; align-items: start; } }
#ruby-checkout .pay-methods { display: flex; flex-direction: column; gap: 8px; }
#ruby-checkout .pay-method {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 12px; border-radius: var(--radius); cursor: pointer; text-align: left;
  font: 800 13px var(--mono); background: rgba(241, 230, 201, .55);
  color: var(--ink-soft); border: 1px solid var(--line);
}
#ruby-checkout .pay-method.active { background: var(--ink); color: var(--cream); border-color: var(--ink); }
#ruby-checkout .pay-method:disabled { opacity: .55; cursor: not-allowed; }
#ruby-checkout .pm-tag {
  font: 800 10px var(--mono); padding: 2px 7px; border-radius: 99px; white-space: nowrap;
  border: 1px solid var(--line); color: var(--ink-soft); background: rgba(241, 230, 201, .75);
}
#ruby-checkout .pm-tag-deal { background: var(--gold); color: #3a2a08; border-color: var(--gold-dk); }
#ruby-checkout .cost-line { font: 700 13px var(--mono); color: var(--brass); min-height: 18px; margin: 2px 0 8px; }
#ruby-checkout .amount-row { display: flex; gap: 10px; align-items: center; margin: 0 0 8px; }
#ruby-checkout .amount-row input {
  flex: 1; padding: 11px 12px; font: 600 16px var(--mono); min-width: 0;
  background: rgba(255, 250, 236, .8); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink);
}
#ruby-checkout .ruby-ico { height: 24px; width: auto; filter: drop-shadow(0 1px 2px rgba(45, 28, 12, .45)); }
#ruby-checkout .max-btn {
  font: 800 11px var(--mono); padding: 7px 12px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--line); background: rgba(241, 230, 201, .75); color: var(--ink-soft);
  letter-spacing: .05em;
}
#ruby-checkout .max-btn:hover { background: var(--ink); color: var(--cream); border-color: var(--ink); }
/* The template's buttons wear the standalone page's classes (.btn /
   .btn.secondary); the site's own .btn is an outline chip, so restyle both
   here to the checkout's block buttons. */
#ruby-checkout .btn {
  display: block; width: 100%; padding: 13px; margin-top: 8px; border-radius: var(--radius); cursor: pointer;
  font: 800 15px var(--label); letter-spacing: .04em;
  background: linear-gradient(180deg, var(--red-hi), var(--red) 60%, var(--red-dk));
  color: var(--cream); border: 1px solid var(--red-dk);
  box-shadow: inset 0 1px 1px rgba(255, 220, 190, .25), 0 3px 8px rgba(45, 28, 12, .35);
  text-decoration: none;
}
#ruby-checkout .btn:hover:not(:disabled) { filter: brightness(1.07); color: var(--cream); background: linear-gradient(180deg, var(--red-hi), var(--red) 60%, var(--red-dk)); }
#ruby-checkout .btn:disabled { opacity: .45; cursor: not-allowed; }
#ruby-checkout .btn.secondary {
  background: rgba(241, 230, 201, .55); color: var(--ink); border: 1px solid rgba(58, 37, 15, .45);
  box-shadow: none;
}
#ruby-checkout .wallet-line { font: 700 12px var(--mono); color: var(--good); text-align: center; margin: 6px 0; }
#ruby-checkout .status {
  margin-top: 16px; padding: 11px 13px; border-radius: var(--radius);
  font-size: 13px; line-height: 1.5; min-height: 18px; font-weight: 600;
}
#ruby-checkout .status:empty { display: none; }
#ruby-checkout .status-info { background: rgba(58, 37, 15, .07); color: var(--ink-soft); }
#ruby-checkout .status-ok { background: rgba(47, 90, 74, .12); color: var(--good); }
#ruby-checkout .status-err { background: rgba(140, 43, 27, .1); color: var(--bad); }
#ruby-checkout .status-txlink { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
#ruby-checkout .closed-note { text-align: center; padding: 10px 0 4px; }
#ruby-checkout .closed-note .gem { display: block; margin: 6px auto 10px; height: 44px; width: auto; }
#ruby-checkout .closed-note p { font-size: 13px; line-height: 1.6; color: var(--ink-soft); margin: 8px 0; }
#ruby-checkout .closed-note strong { color: var(--ink); }
#ruby-checkout .closed-note .btn { display: inline-block; width: auto; padding: 12px 26px; margin-top: 16px; }
#ruby-checkout .fine { font-size: 11px; color: var(--ink-soft); margin-top: 14px; line-height: 1.5; }

/* ── /ruby ▸ transaction history (signed Ruby amounts) ── */
.ruby-tx-pos { color: var(--good); font-weight: 700; font-family: var(--mono); white-space: nowrap; }
.ruby-tx-neg { color: var(--red); font-weight: 700; font-family: var(--mono); white-space: nowrap; }
#ruby-history h3 { margin: 22px 0 10px; }

.top-ca-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(410px, 34vw);
  min-height: 38px;
  padding: 0 18px;
  border: 1.5px solid var(--bar-edge);
  border-radius: 12px;
  background: rgba(0, 0, 0, .12);
  color: var(--gold-hi);
  font-family: var(--mono);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: inset 0 1px 2px rgba(255, 235, 190, .06);
}

.top-x-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 18px;
  border: 1.5px solid var(--bar-edge);
  border-radius: 999px;
  background: rgba(0, 0, 0, .14);
  color: var(--cream);
  font-family: var(--label);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .04em;
  text-decoration: none;
  white-space: nowrap;
  transition: .15s;
}
.top-x-link:hover {
  border-color: var(--gold);
  color: var(--gold-hi);
  box-shadow: 0 2px 8px -2px rgba(0, 0, 0, .5);
}
.top-tg-link {
  padding: 0 14px;
}
