/* ── BALLIN TYCOON · WIKI ───────────────────────────────────────────────
   Same design tokens, backdrop and nav as the landing + hiscores pages
   (see public/leaderboard/index.html). Layout is the classic wiki shape —
   a left navigation rail, an article column with a Contents box, tables
   and floating infoboxes — dressed in the site's glass-on-carnival theme.
   Generated pages (public/wiki/*.html) only ever use the wk-* classes. */

:root {
  --ink:        #eef3ff;
  --ink-dim:    #a9b4d0;
  --ink-faint:  #6f7b99;
  --pink:       #ff3aa8;
  --cyan:       #36e0ff;
  --gold:       #ffc93c;
  --violet:     #a855f7;
  --play:       #22c55e;
  --play-deep:  #15803d;
  --glass:      rgba(16, 14, 32, 0.62);
  --panel:      rgba(16, 14, 32, 0.78);
  --panel-2:    rgba(255, 255, 255, 0.035);
  --hairline:   rgba(255, 255, 255, 0.12);
  --line:       rgba(255, 255, 255, 0.10);
  --link:       #7fd8ff;
  --radius:     14px;
  --shell:      min(1380px, 100% - 40px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-padding-top: 76px; }
html, body {
  width: 100%; min-height: 100%;
  background: #0a0714;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── BACKDROP (identical system to landing.html) ────────────────────── */
.bg {
  position: fixed; inset: 0; z-index: 0;
  background: linear-gradient(180deg, #1a0b2e 0%, #2a0f3d 22%, #3d1147 40%, #14091f 78%, #0a0714 100%);
}
.bg::before {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: min(52vh, 560px);
  background: url('/assets/backdrops/backdrop_world1.png') repeat-x left bottom;
  background-size: auto 100%;
  image-rendering: pixelated; opacity: .8;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 40%, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 40%, #000 100%);
}
.bg::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(110% 45% at 50% 10%, rgba(168, 85, 247, 0.28), transparent 62%),
    linear-gradient(180deg, rgba(10, 7, 20, 0.74) 0%, rgba(10, 7, 20, 0.62) 30%,
                             rgba(10, 7, 20, 0.80) 60%, rgba(10, 7, 20, 0.95) 100%);
}

/* ── SITE NAV (shared with landing/hiscores) ────────────────────────── */
.site-nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  width: var(--shell); margin: 0 auto; padding: 14px 0;
}
.nav-left { display: flex; align-items: center; gap: 8px; }
.nav-tab, .nav-discord {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: 999px;
  font-size: 12.5px; font-weight: 800; letter-spacing: .12em;
  color: var(--ink-dim); text-decoration: none;
  background: var(--glass); border: 1px solid var(--hairline);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: color .16s, border-color .16s, transform .16s;
}
.nav-tab:hover, .nav-discord:hover { color: var(--ink); border-color: rgba(255,255,255,.3); transform: translateY(-1px); text-decoration: none; }
.nav-tab.active { color: var(--ink); border-color: rgba(255, 58, 168, .55); box-shadow: 0 0 16px rgba(255,58,168,.22); }
.nav-discord svg { width: 18px; height: 18px; fill: currentColor; }
.btn-free {
  padding: 11px 20px; border-radius: 999px; text-decoration: none;
  font-size: 12.5px; font-weight: 900; letter-spacing: .1em; color: #04220f;
  background: linear-gradient(180deg, #6ee794, var(--play) 55%, var(--play-deep));
  box-shadow: 0 4px 0 #0d5c2c, 0 0 22px rgba(34, 197, 94, .35);
  transition: transform .12s, box-shadow .12s;
}
.btn-free:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #0d5c2c, 0 0 28px rgba(34,197,94,.5); text-decoration: none; }
.btn-free:active { transform: translateY(2px); box-shadow: 0 1px 0 #0d5c2c; }

/* ── WIKI HEADER: brand + search ────────────────────────────────────── */
.wk-head {
  position: relative; z-index: 6;
  width: var(--shell); margin: 6px auto 16px;
  display: flex; align-items: center; gap: 16px;
}
.wk-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; flex: none; }
.wk-brand:hover { text-decoration: none; }
.wk-brand img { width: 118px; height: auto; image-rendering: auto; filter: drop-shadow(0 3px 0 rgba(0,0,0,.5)); }
.wk-brand span {
  font-size: 26px; font-weight: 900; letter-spacing: .18em; line-height: 1;
  background: linear-gradient(180deg, #fff 0%, #ffe9a8 42%, var(--gold) 78%, #d98b1f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.55));
}
.wk-search {
  position: relative; flex: 1 1 320px; max-width: 520px; margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--glass); border: 1px solid var(--hairline);
  border-radius: 11px; padding: 10px 13px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color .16s;
}
.wk-search:focus-within { border-color: rgba(54,224,255,.5); }
.wk-search > svg { width: 16px; height: 16px; fill: var(--ink-faint); flex: none; }
.wk-search input {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  color: var(--ink); font-size: 14px; font-family: inherit;
}
.wk-search input::placeholder { color: var(--ink-faint); }
.wk-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  background: #13102a; border: 1px solid var(--hairline); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,.6); overflow: hidden;
}
.wk-res { display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: var(--ink); border-bottom: 1px solid rgba(255,255,255,.05); }
.wk-res:last-child { border-bottom: none; }
.wk-res:hover, .wk-res.sel { background: rgba(54,224,255,.10); text-decoration: none; }
.wk-res img, .wk-res-noimg { width: 26px; height: 26px; object-fit: contain; image-rendering: pixelated; flex: none; }
.wk-res-t { display: flex; flex-direction: column; font-weight: 800; font-size: 14px; }
.wk-res-t small { color: var(--ink-faint); font-weight: 700; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.wk-res-empty { padding: 12px 14px; color: var(--ink-dim); font-size: 13px; }
.wk-menu-btn {
  display: none; font-family: inherit; font-weight: 900; font-size: 12px; letter-spacing: .12em;
  color: var(--ink-dim); background: var(--glass); border: 1px solid var(--hairline);
  border-radius: 11px; padding: 10px 14px; cursor: pointer;
}

/* ── LAYOUT: sidebar + article ──────────────────────────────────────── */
.wk-layout {
  position: relative; z-index: 5;
  width: var(--shell); margin: 0 auto 40px;
  display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start;
}
.wk-side {
  position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 18px 50px rgba(0,0,0,0.5);
  padding: 6px 0 10px; scrollbar-width: thin;
}
.wk-side-grp { padding: 8px 0 4px; border-bottom: 1px solid rgba(255,255,255,.05); }
.wk-side-grp:last-child { border-bottom: none; }
.wk-side-h {
  padding: 6px 16px 5px; font-size: 10.5px; font-weight: 900; letter-spacing: .2em;
  color: var(--ink-faint); text-transform: uppercase; cursor: default;
}
.wk-side-h a { color: inherit; }
.wk-side-h a:hover { color: var(--ink); text-decoration: none; }
.wk-side ul { list-style: none; }
.wk-side li a {
  display: block; padding: 6px 16px 6px 19px; font-size: 13px; font-weight: 700;
  color: var(--ink-dim); border-left: 3px solid transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wk-side li a:hover { color: var(--ink); background: rgba(54,224,255,0.08); text-decoration: none; }
.wk-side li a.cur { color: #ffe9a8; background: rgba(255,201,60,0.12); border-left-color: var(--gold); }

.wk-article {
  min-width: 0;
  background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 18px 50px rgba(0,0,0,0.5);
  padding: clamp(16px, 3vw, 34px) clamp(16px, 3.4vw, 40px) 30px;
  font-size: 15px; line-height: 1.6;
}
.wk-crumbs { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--ink-faint); margin-bottom: 10px; }
.wk-crumbs a { color: var(--ink-dim); }
.wk-title {
  font-size: clamp(28px, 4.2vw, 42px); line-height: 1.05; font-weight: 900; letter-spacing: .01em;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, #fff 0%, #ffe9a8 55%, var(--gold) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wk-lead { font-size: 16.5px; color: var(--ink-dim); margin-bottom: 18px; }
.wk-article p { margin: 0 0 12px; }
.wk-article ul, .wk-article ol { margin: 0 0 14px 24px; }
.wk-article li { margin: 3px 0; }
.wk-article h2 {
  font-size: 23px; font-weight: 900; margin: 30px 0 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--hairline); color: #fff;
}
.wk-sec:first-of-type h2 { margin-top: 12px; }
.wk-article h3 { font-size: 17.5px; font-weight: 900; margin: 20px 0 8px; color: #ffe9a8; }
.wk-article h4 { font-size: 15px; font-weight: 900; margin: 14px 0 6px; color: var(--ink); }
.wk-article code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: rgba(255,255,255,.07); padding: 1px 5px; border-radius: 5px; }
.wk-dim { color: var(--ink-faint); font-weight: 600; }
.wk-meta { margin-top: 34px; padding-top: 14px; border-top: 1px solid var(--hairline); font-size: 12px; color: var(--ink-faint); }

/* ── Contents box ───────────────────────────────────────────────────── */
.wk-toc {
  display: inline-block; min-width: 260px; max-width: 100%;
  background: var(--panel-2); border: 1px solid var(--hairline); border-radius: 10px;
  padding: 10px 16px 10px 12px; margin: 4px 0 18px; font-size: 13.5px;
}
.wk-toc-h { font-weight: 900; letter-spacing: .06em; font-size: 12.5px; margin-bottom: 6px; color: var(--ink); text-align: center; }
.wk-toc-tgl { font: inherit; font-size: 11px; font-weight: 700; color: var(--link); background: none; border: none; cursor: pointer; margin-left: 6px; }
.wk-toc ol { list-style: none; margin: 0; }
.wk-toc ol ol { margin-left: 18px; }
.wk-toc li { margin: 2px 0; }
.wk-toc a { color: var(--link); }
.wk-toc-n { color: var(--ink-faint); font-weight: 700; margin-right: 7px; font-size: 12px; }
.wk-toc.collapsed ol { display: none; }

/* ── Notes / callouts ───────────────────────────────────────────────── */
.wk-note {
  display: flex; gap: 12px; align-items: flex-start;
  background: rgba(54,224,255,.07); border: 1px solid rgba(54,224,255,.25); border-left-width: 4px;
  border-radius: 10px; padding: 10px 14px; margin: 10px 0 16px; font-size: 14px;
}
.wk-note-k { flex: none; font-size: 10.5px; font-weight: 900; letter-spacing: .16em; color: var(--cyan); margin-top: 3px; }
.wk-note-tip { background: rgba(34,197,94,.08); border-color: rgba(34,197,94,.3); }
.wk-note-tip .wk-note-k { color: #6ee794; }
.wk-note-warn { background: rgba(255,201,60,.08); border-color: rgba(255,201,60,.35); }
.wk-note-warn .wk-note-k { color: var(--gold); }
.wk-note-dev { background: rgba(168,85,247,.10); border-color: rgba(168,85,247,.4); }
.wk-note-dev .wk-note-k { color: #c9a3ff; }
.wk-note p:last-child { margin-bottom: 0; }

/* ── Tables ─────────────────────────────────────────────────────────── */
.wk-tablewrap { overflow-x: auto; margin: 8px 0 18px; border: 1px solid var(--hairline); border-radius: 10px; background: rgba(0,0,0,.18); }
.wk-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.wk-table caption { text-align: left; padding: 8px 12px; font-weight: 900; font-size: 12px; letter-spacing: .1em; color: var(--ink-dim); text-transform: uppercase; }
.wk-table th {
  text-align: left; padding: 9px 12px; font-size: 11px; font-weight: 900; letter-spacing: .12em;
  color: var(--ink-faint); text-transform: uppercase; background: rgba(255,255,255,.04);
  border-bottom: 1px solid var(--hairline); white-space: nowrap;
}
.wk-table th.sortable { cursor: pointer; user-select: none; }
.wk-table th.sortable:hover { color: var(--ink); }
.wk-table th.asc::after { content: ' ▲'; font-size: 9px; color: var(--gold); }
.wk-table th.desc::after { content: ' ▼'; font-size: 9px; color: var(--gold); }
.wk-table td { padding: 7px 12px; border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: middle; }
/* Sprite columns: the global img{max-width:100%} collapses width-attribute
   imgs to 0 inside a squeezed scrolling table on phones — keep their size. */
.wk-table img { max-width: none; }
.wk-table tbody tr:nth-child(even) td { background: rgba(255,255,255,.022); }
.wk-table tbody tr:hover td { background: rgba(54,224,255,.06); }
.wk-table tr:last-child td { border-bottom: none; }
.wk-table .al-right, .wk-table td.al-right, .wk-table th.al-right { text-align: right; }
.wk-table .al-center, .wk-table td.al-center, .wk-table th.al-center { text-align: center; }
.wk-table tr.total td { font-weight: 900; background: rgba(255,201,60,.08); }

/* ── Sprites + badges ───────────────────────────────────────────────── */
.wk-spr { image-rendering: pixelated; object-fit: contain; vertical-align: middle; display: inline-block; }
.wk-sheet { background-repeat: no-repeat; image-rendering: pixelated; vertical-align: middle; }
.wk-nosprite { display: inline-block; vertical-align: middle; border-radius: 6px; background: repeating-linear-gradient(45deg, rgba(255,58,168,.25) 0 4px, rgba(255,255,255,.05) 4px 8px); }
.wk-it { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.wk-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 900; letter-spacing: .1em;
  color: var(--b, var(--ink-dim)); border: 1px solid color-mix(in srgb, var(--b, #888) 55%, transparent);
  background: color-mix(in srgb, var(--b, #888) 16%, transparent); vertical-align: middle; white-space: nowrap;
}

/* ── Facts (kv) + infobox ───────────────────────────────────────────── */
.wk-kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 6px 0 16px; font-size: 14px; }
.wk-kv dt { font-weight: 900; color: var(--ink-dim); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; padding-top: 3px; }
.wk-kv dd { margin: 0; }
.wk-infobox {
  float: right; width: min(300px, 100%); margin: 0 0 16px 22px;
  /* Solid ground — the box floats over banners/tables, and the old
     3.5%-white glass let them bleed through its rows. */
  background: #16132a; border: 1px solid var(--hairline); border-radius: 12px; overflow: hidden; font-size: 13.5px;
  position: relative; z-index: 2; box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.wk-infobox-t { padding: 9px 12px; font-weight: 900; letter-spacing: .06em; text-align: center; background: rgba(255,201,60,.12); color: #ffe9a8; border-bottom: 1px solid var(--hairline); }
.wk-infobox-img { display: flex; justify-content: center; padding: 14px; background: rgba(0,0,0,.2); }
.wk-infobox-img .wk-spr, .wk-infobox-img .wk-sheet { width: 96px !important; height: 96px !important; }
.wk-infobox table { width: 100%; border-collapse: collapse; }
.wk-infobox th { text-align: left; padding: 6px 10px; width: 42%; color: var(--ink-dim); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; vertical-align: top; border-bottom: 1px solid rgba(255,255,255,.05); }
.wk-infobox td { padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,.05); }
.wk-infobox tr:last-child th, .wk-infobox tr:last-child td { border-bottom: none; }

/* ── Cards + tiles ──────────────────────────────────────────────────── */
.wk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 8px 0 20px; }
.wk-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 16px 12px 14px; border-radius: 12px; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--hairline);
  transition: transform .14s, border-color .14s, background .14s;
}
.wk-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.06); text-decoration: none; }
.wk-card-ico { height: 64px; display: flex; align-items: center; justify-content: center; }
.wk-card-ico img, .wk-card-ico .wk-spr, .wk-card-ico .wk-sheet { max-height: 64px; width: auto; max-width: 96px; image-rendering: pixelated; }
.wk-card-ico img { height: 64px; object-fit: contain; }
.wk-card-t { font-weight: 900; font-size: 15px; letter-spacing: .02em; }
.wk-card-s { font-size: 12.5px; color: var(--ink-dim); line-height: 1.4; }

.wk-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin: 8px 0 20px; }
.wk-tile {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 5px;
  padding: 12px 8px 10px; border-radius: 10px; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--hairline);
  transition: transform .14s, border-color .14s;
}
a.wk-tile:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.3); text-decoration: none; }
.wk-tile-ico { height: 56px; display: flex; align-items: center; justify-content: center; }
.wk-tile-ico .wk-spr, .wk-tile-ico .wk-sheet, .wk-tile-ico img { width: 52px !important; height: 52px !important; }
.wk-tile-t { font-weight: 800; font-size: 12.5px; line-height: 1.25; }
.wk-tile-s { font-size: 11px; color: var(--ink-dim); }
.wk-tile.r-common { border-color: rgba(184,196,216,.35); }
.wk-tile.r-uncommon { border-color: rgba(78,203,132,.5); }
.wk-tile.r-rare { border-color: rgba(79,141,255,.55); }
.wk-tile.r-epic { border-color: rgba(168,85,247,.6); }
.wk-tile.r-legendary { border-color: rgba(255,201,60,.65); box-shadow: 0 0 14px rgba(255,201,60,.12); }
.wk-tile.r-mythic { border-color: rgba(255,58,168,.7); box-shadow: 0 0 16px rgba(255,58,168,.18); }

/* Main-page stats strip */
.wk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 22px; }
.wk-stat { background: var(--panel-2); border: 1px solid var(--hairline); border-radius: 12px; padding: 12px 14px; }
.wk-stat b { display: block; font-size: 26px; font-weight: 900; color: #ffe9a8; line-height: 1.1; }
.wk-stat span { font-size: 11.5px; font-weight: 800; letter-spacing: .12em; color: var(--ink-faint); text-transform: uppercase; }
.wk-hero { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 8px; }
.wk-hero > div { flex: 1 1 380px; }

footer {
  position: relative; z-index: 5;
  width: var(--shell); margin: 0 auto; padding: 22px 0 30px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12.5px; color: var(--ink-faint); text-align: center;
}
footer a { color: var(--ink-dim); text-decoration: none; margin: 0 6px; }
footer a:hover { color: var(--ink); }

a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 8px; }
a, button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .wk-infobox { float: none; width: 100%; margin: 0 0 16px; }
}
@media (max-width: 760px) {
  .wk-layout { display: block; }
  .wk-side { position: static; max-height: none; display: none; margin-bottom: 14px; }
  .wk-side.open { display: block; }
  .wk-side-grp ul { display: none; }
  .wk-side-grp.open ul { display: block; }
  .wk-side-h { cursor: pointer; }
  .wk-side-h::after { content: ' ▸'; float: right; }
  .wk-side-grp.open .wk-side-h::after { content: ' ▾'; }
  .wk-menu-btn { display: inline-block; }
  .wk-head { flex-wrap: wrap; gap: 10px; }
  .wk-brand img { width: 88px; }
  .wk-brand span { font-size: 20px; }
  .wk-search { flex-basis: 100%; max-width: none; order: 3; }
  .wk-toc { display: block; }
}
@media (max-width: 560px) {
  :root { --shell: min(1380px, 100% - 22px); }
  .site-nav { padding: 10px 0; gap: 8px; }
  .nav-left { gap: 6px; }
  .nav-tab { padding: 8px 10px; font-size: 11px; letter-spacing: .06em; }
  .nav-discord { padding: 8px 9px; font-size: 0; gap: 0; }
  .nav-discord svg { width: 18px; height: 18px; }
  .btn-free { padding: 9px 13px; font-size: 11px; white-space: nowrap; }
  .wk-article { font-size: 14px; }
  .wk-tiles { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}
