/* Shroom and Gloom wiki
   The game is a dark, wet, glowing cave, and a card is a bright object held up
   inside it. So the site is dark too, and cream card stock appears only where
   there is an actual card. Depth comes from layered darks and a little
   bioluminescence, not from outlining everything in black. */

:root {
  /* the cave, in layers */
  --pit: #140d1d;
  --floor: #1c1329;
  --wall: #261a37;
  --ridge: #362548;
  --edge-soft: #3f2c55;

  /* light in the dark */
  --lit: #ece4d8;
  --dim: #a698ba;
  --faint: #7a6b90;

  /* the game's own signals */
  --spore: #9ae24f;
  --glow: #4fcfec;
  --flesh: #ef6a63;

  /* card stock, used only on cards */
  --paper: #e9e4d0;
  --paper-lit: #f5f1e2;
  --ink: #14110f;

  --sans: "Noto Sans", "Noto Sans SC", ui-sans-serif, system-ui, sans-serif;
  --display: "Lilita One", "WDXL Lubrifont SC", var(--sans);
  --display-cjk: "WDXL Lubrifont SC", "Lilita One", var(--sans);

  --rule: 1px solid var(--ridge);
  --pad: clamp(1rem, 3.5vw, 2rem);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(120% 70% at 50% -10%, #2a1c3d 0%, transparent 60%),
    var(--pit);
  background-attachment: fixed;
  color: var(--lit);
  font: 16px/1.65 var(--sans);
}

:where(a) { color: var(--spore); text-underline-offset: 3px; }
:where(a):hover { color: #b6f06e; }

:focus-visible { outline: 2px solid var(--spore); outline-offset: 2px;
  border-radius: 4px; }

/* ---------------------------------------------------------------- chrome */

header.site {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.05rem;
  padding: .7rem var(--pad);
  background: linear-gradient(180deg, #231733, #1b1228);
  border-bottom: 1px solid var(--edge-soft);
}

.brand {
  font-family: var(--display); font-size: 1.3rem; line-height: 1;
  color: var(--spore); text-decoration: none;
  text-shadow: 0 0 18px rgba(154, 226, 79, .45);
}
:lang(zh-Hans) .brand { font-family: var(--display-cjk); }
.brand:hover { color: #c3f884; }

.ver {
  font: 600 .68rem/1 var(--sans); letter-spacing: .04em;
  color: var(--faint); text-decoration: none;
  padding: .25rem .45rem; border: 1px solid var(--ridge); border-radius: 4px;
  white-space: nowrap;
}
.ver:hover { color: var(--lit); border-color: var(--edge-soft); }

header.site nav { display: flex; gap: 1rem; overflow-x: auto; scrollbar-width: none; }
header.site nav::-webkit-scrollbar { display: none; }
header.site nav a {
  color: var(--dim); text-decoration: none; white-space: nowrap;
  font-size: .94rem; padding: .2rem 0; border-bottom: 2px solid transparent;
}
header.site nav a:hover { color: var(--lit); border-bottom-color: var(--spore); }

.langs { margin-left: auto; display: flex; gap: .25rem; }
.langs button {
  font: 600 .72rem/1 var(--sans); padding: .34rem .5rem;
  background: transparent; color: var(--faint);
  border: 1px solid var(--ridge); border-radius: 5px; cursor: pointer;
}
.langs button:hover { color: var(--lit); }
.langs button[aria-pressed="true"] {
  color: var(--pit); background: var(--spore); border-color: var(--spore);
}

/* ------------------------------------------------------------ find a card */

.find { position: relative; flex: 1 1 12rem; min-width: 9rem; max-width: 21rem; }
.find input {
  width: 100%; font: 400 .9rem/1 var(--sans); padding: .5rem .7rem;
  color: var(--lit); background: var(--pit);
  border: 1px solid var(--ridge); border-radius: 6px;
}
.find input:focus { border-color: var(--spore); outline: none; }
.find input::placeholder { color: var(--faint); }
.find ul {
  position: absolute; z-index: 30; top: calc(100% + .3rem); left: 0; right: 0;
  margin: 0; padding: .25rem; list-style: none;
  max-height: 60vh; overflow-y: auto;
  background: var(--wall); border: 1px solid var(--edge-soft);
  border-radius: 8px; box-shadow: 0 14px 34px rgba(0, 0, 0, .55);
}
.find li a {
  display: flex; align-items: center; gap: .55rem;
  padding: .35rem .45rem; border-radius: 5px;
  color: var(--lit); text-decoration: none; font-size: .9rem;
}
.find li a:hover, .find li a:focus-visible { background: var(--ridge); }
.find li img { width: 1.7rem; height: 1.7rem; object-fit: contain; flex: none;
  background: var(--paper); border-radius: 3px; padding: 1px; }
.find .pip { margin-left: auto; }

/* ------------------------------------------------------------------ page */

main { max-width: 70rem; margin: 0 auto; padding: 1rem var(--pad) 3rem; }

h1 {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(1.9rem, 5.5vw, 2.9rem); line-height: 1.02;
  margin: .1rem 0 .9rem; color: var(--lit);
}
h1 [lang="zh-Hans"] { font-family: var(--display-cjk); }

h2 {
  font-family: var(--display); font-weight: 400;
  font-size: 1.05rem; letter-spacing: .02em; line-height: 1.2;
  margin: 2.2rem 0 .7rem; color: var(--spore);
  display: flex; align-items: center; gap: .6rem;
}
h2::after { content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--ridge), transparent); }
h2 [lang="zh-Hans"] { font-family: var(--display-cjk); }
h2 .n { font-family: var(--sans); font-size: .74rem; color: var(--faint);
  font-weight: 400; }

h3 { font-size: .95rem; margin: 1.3rem 0 .4rem; color: var(--dim); }

main p { max-width: 64ch; }
main p.note { color: var(--dim); font-size: .92rem; }

.crumbs { max-width: 70rem; margin: 0 auto; padding: .85rem var(--pad) 0;
  font-size: .82rem; color: var(--faint); }
.crumbs a { color: var(--faint); text-decoration: none; }
.crumbs a:hover { color: var(--dim); }

footer {
  max-width: 70rem; margin: 0 auto; padding: 1.4rem var(--pad) 3rem;
  border-top: var(--rule); color: var(--faint); font-size: .8rem;
}
footer a { color: var(--dim); }
footer code { color: var(--dim); background: var(--floor);
  padding: .1rem .35rem; border-radius: 3px; }

/* ------------------------------------------------------------------- hero */

.hero { display: grid; place-items: center; padding: 0 0 .8rem; }
.hero .logo { width: min(15rem, 52%); height: auto; display: block;
  filter: drop-shadow(0 0 30px rgba(154, 226, 79, .3)); }

/* -------------------------------------------------------------- gateways */

ul.gates {
  list-style: none; margin: .4rem 0 0; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(5.4rem, 14vw, 7.4rem), 1fr));
  gap: clamp(.45rem, 1.3vw, .8rem);
}
.gate {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  height: 100%; padding: .75rem .4rem .6rem;
  background: linear-gradient(180deg, var(--wall), var(--floor));
  border: 1px solid var(--ridge); border-radius: 10px;
  color: var(--lit); text-decoration: none; text-align: center;
  transition: border-color .12s, background .12s;
}
.gate:hover, .gate:focus-visible {
  border-color: var(--spore);
  background: linear-gradient(180deg, #2e2042, var(--wall));
}
.gate .shot {
  display: block; width: 100%;
  height: clamp(3.4rem, 9vw, 4.8rem);
  background: var(--paper); border-radius: 7px; padding: .3rem;
}
.gate .shot img { width: 100%; height: 100%; object-fit: contain; }
.gate .cap { font-family: var(--display); font-size: .84rem; line-height: 1.12;
  color: var(--dim); }
.gate:hover .cap { color: var(--lit); }
.gate .cap [lang="zh-Hans"] { font-family: var(--display-cjk); }

/* -------------------------------------------------- cards: the paper bits */

ul.hand {
  list-style: none; margin: .9rem 0 0; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(5.8rem, 17vw, 7.8rem), 1fr));
  gap: clamp(.45rem, 1.3vw, .75rem);
}
ul.hand > li { margin: 0; }

.tile {
  position: relative; display: flex; flex-direction: column; height: 100%;
  padding: .35rem .35rem .45rem;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 9px;
  color: var(--ink); text-decoration: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .45);
  transition: transform .1s, box-shadow .1s;
}
.tile:hover, .tile:focus-visible {
  background: var(--paper-lit); transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .55), 0 0 0 2px rgba(154, 226, 79, .7);
}
@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; } .tile:hover { transform: none; }
}
.tile .top { display: flex; align-items: flex-start; }
.tile figure { margin: .1rem 0 .3rem; flex: 1 1 auto;
  height: clamp(3.2rem, 10vw, 4.4rem); }
.tile img { display: block; width: 100%; height: 100%; object-fit: contain; }
.tile .name { font-family: var(--display); font-weight: 400; font-size: .78rem;
  line-height: 1.1; text-align: center; overflow-wrap: anywhere; }
.tile .name [lang="zh-Hans"] { font-family: var(--display-cjk); }

.pip {
  flex: none; display: inline-grid; place-items: center;
  width: 1.35rem; height: 1.35rem; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font: 400 .78rem/1 var(--display);
}
.pip.free { background: var(--glow); color: var(--ink); }

/* ---------------------------------------------------------- filter rail */

.filters {
  position: sticky; top: 0; z-index: 12;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem;
  margin: 1rem 0 0; padding: .6rem .85rem;
  background: rgba(28, 19, 41, .94); backdrop-filter: blur(6px);
  border: 1px solid var(--ridge); border-radius: 8px; font-size: .86rem;
}
.filters label { display: flex; align-items: center; gap: .35rem;
  color: var(--faint); }
.filters select, .filters input {
  font: inherit; padding: .28rem .45rem; color: var(--lit);
  background: var(--pit); border: 1px solid var(--ridge); border-radius: 5px;
}
.filters select:focus, .filters input:focus { border-color: var(--spore);
  outline: none; }
.filters .count { margin-left: auto; color: var(--faint); }
.filters .count b { color: var(--spore); }

/* --------------------------------------------------------- detail pages */

.card-detail { display: grid; gap: clamp(1rem, 2.5vw, 1.8rem); align-items: start; }
@media (min-width: 46rem) {
  .card-detail { grid-template-columns: minmax(12rem, 17.5rem) minmax(0, 1fr); }
}

.face {
  position: relative; padding: .5rem;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 12px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
}
.face figure { margin: 0; }
.face img { display: block; width: 100%; height: auto; }
.face .pip { position: absolute; top: .55rem; left: .55rem; }

.stats { margin: 0 0 1.1rem; display: grid; grid-template-columns: auto 1fr;
  border-top: var(--rule); }
.stats dt, .stats dd { padding: .4rem .2rem; border-bottom: var(--rule); margin: 0; }
.stats dt { color: var(--faint); font-size: .85rem; padding-right: 1.6rem; }
.stats dd { font-weight: 600; text-align: right; }

.rules {
  margin: 0; padding: .85rem 1rem;
  background: var(--floor); border: 1px solid var(--ridge);
  border-left: 3px solid var(--spore); border-radius: 0 7px 7px 0;
  font-size: 1.04rem;
}

ul.plain { list-style: none; padding: 0; margin: .4rem 0; }
ul.plain li { padding: .2rem 0; }
ul.plain li + li { border-top: var(--rule); }

/* ------------------------------------------------------------------ chips */

.chips, ul.terms { list-style: none; padding: 0; margin: .5rem 0 0;
  display: flex; flex-wrap: wrap; gap: .4rem; }
.chips a, ul.terms a {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .75rem; font-size: .87rem;
  background: var(--floor); border: 1px solid var(--ridge); border-radius: 20px;
  color: var(--lit); text-decoration: none;
}
.chips a:hover, ul.terms a:hover { border-color: var(--spore); color: var(--spore); }
ul.terms a { padding-left: .35rem; }
img.ico { width: 1.2rem; height: 1.2rem; object-fit: contain; flex: none; }

/* ------------------------------------------------------------- facets */

ul.facets { list-style: none; padding: 0; margin: .6rem 0 0;
  display: flex; flex-wrap: wrap; gap: .4rem; }
ul.facets a {
  display: flex; align-items: baseline; gap: .45rem; padding: .4rem .8rem;
  background: var(--floor); border: 1px solid var(--ridge); border-radius: 6px;
  color: var(--lit); text-decoration: none; font-size: .9rem;
}
ul.facets a:hover { border-color: var(--spore); color: var(--spore); }
ul.facets .n { color: var(--faint); font-size: .76rem; }

/* -------------------------------------------------------- upgrade trees */

ul.trees { list-style: none; padding: 0; margin: .9rem 0 0; display: grid;
  gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); }
ul.trees > li { padding: .7rem .85rem; background: var(--floor);
  border: 1px solid var(--ridge); border-radius: 9px; }

.step {
  display: flex; align-items: center; gap: .55rem;
  padding: .3rem 0 .3rem calc(var(--depth) * 1.1rem);
  position: relative;
}
.step + .step { border-top: var(--rule); }
.step[style*="--depth:0"] + .step::before,
.step:not([style*="--depth:0"])::before {
  content: ""; position: absolute;
  left: calc(var(--depth) * 1.1rem - .65rem); top: 50%;
  width: .5rem; height: 1px; background: var(--edge-soft);
}

.chip-card {
  display: inline-flex; align-items: center; gap: .4rem; flex: none;
  color: var(--lit); text-decoration: none; font-size: .9rem;
  max-width: 11rem;
}
.chip-card:hover b { color: var(--spore); }
.chip-card .mini { flex: none; width: 2.1rem; height: 2.1rem;
  background: var(--paper); border-radius: 4px; padding: 2px; }
.chip-card .mini img { width: 100%; height: 100%; object-fit: contain; }
.chip-card .pip { width: 1.1rem; height: 1.1rem; font-size: .66rem; }
.chip-card b { font-weight: 600; line-height: 1.15; }

.step .what { color: var(--dim); font-size: .82rem; line-height: 1.3;
  overflow: hidden; }

/* ------------------------------------------------------------- bestiary */

ul.mobs { list-style: none; padding: 0; margin: .9rem 0 0; display: grid;
  gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
.mob {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  height: 100%; padding: .7rem .5rem .75rem;
  background: linear-gradient(180deg, var(--wall), var(--floor));
  border: 1px solid var(--ridge); border-radius: 10px;
  color: var(--lit); text-decoration: none; text-align: center;
}
.mob:hover, .mob:focus-visible { border-color: var(--spore); }
.mob figure { margin: 0; width: 100%; height: clamp(4.2rem, 12vw, 6rem);
  background: var(--paper); border-radius: 7px; padding: .3rem; }
.mob img { width: 100%; height: 100%; object-fit: contain; }
.mob .name { font-family: var(--display); font-size: .85rem; line-height: 1.15; }
.mob .name [lang="zh-Hans"] { font-family: var(--display-cjk); }
.mob .hp { font-size: .78rem; color: var(--flesh); font-weight: 700; }
.mob .sub { font-size: .75rem; color: var(--faint); }
ul.mobs.chars .mob { justify-content: flex-start; }
.mob figure.pack { height: clamp(4.5rem, 13vw, 6rem); }

/* ------------------------------------------------------------- glossary */

dl.glossary { margin: .9rem 0 0; }
dl.glossary dt { display: flex; align-items: center; gap: .5rem;
  font-weight: 700; margin-top: 1.1rem; scroll-margin-top: 4.5rem; }
dl.glossary dt:target { color: var(--spore); }
dl.glossary dd { margin: .2rem 0 0; color: var(--dim); max-width: 64ch; }

/* ---------------------------------------------------------------- pools */

.pool { margin: 1.7rem 0 0; }
.pool h2 { margin: 0 0 .4rem; scroll-margin-top: 4.5rem; }
.pool ul { list-style: none; padding: 0; margin: 0; display: flex;
  flex-wrap: wrap; gap: .25rem .9rem; font-size: .9rem; }
.pool ul a { color: var(--dim); text-decoration: none; }
.pool ul a:hover { color: var(--spore); }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; margin: 1rem 0; }
table.data { border-collapse: collapse; font-size: .9rem; min-width: 22rem; }
table.data th, table.data td { padding: .35rem 1rem; text-align: right;
  border-bottom: var(--rule); }
table.data th:first-child, table.data td:first-child { text-align: left;
  color: var(--dim); }
table.data thead th { color: var(--faint); font-weight: 600;
  border-bottom: 1px solid var(--edge-soft); }
table.data tbody tr:hover { background: var(--floor); }

.empty { margin: 1.5rem 0; color: var(--faint); }

/* an explicit display on a row outranks the [hidden] default */
[hidden] { display: none !important; }

/* the three tiers carry the game's own colours so the table reads as a ramp */
table.data td.zero { color: var(--faint); }
table.data td.t-common { color: var(--dim); font-weight: 600; }
table.data td.t-uncommon { color: var(--glow); font-weight: 600; }
table.data td.t-rare { color: var(--spore); font-weight: 700; }

/* an enemy's turn actions are a sequence, so they are numbered */
ol.turns { list-style: none; padding: 0; margin: .6rem 0 0; counter-reset: turn; }
ol.turns li { display: flex; gap: .7rem; align-items: baseline;
  padding: .4rem 0; border-bottom: var(--rule); }
ol.turns .turn {
  flex: none; width: 1.5rem; height: 1.5rem; display: grid; place-items: center;
  border-radius: 50%; background: var(--wall); border: 1px solid var(--ridge);
  color: var(--dim); font: 600 .72rem/1 var(--sans);
}

table.data.pools { min-width: 44rem; width: 100%; }
table.data.pools td:first-child, table.data.pools th:first-child { min-width: 16rem; }
table.data.pools a { color: var(--lit); text-decoration: none; }
table.data.pools a:hover { color: var(--spore); }
table.data.pools td { color: var(--dim); }
table.data.pools td:last-child { color: var(--lit); font-weight: 600; }
.pool h3 { display: flex; align-items: baseline; gap: .5rem; color: var(--lit);
  font-size: .95rem; margin: 0 0 .3rem; scroll-margin-top: 4.5rem; }
.pool h3:target { color: var(--spore); }
.pool h3 .n { font-size: .74rem; color: var(--faint); font-weight: 400; }

dl.defs { margin: .5rem 0 0; }
dl.defs dt { display: flex; align-items: center; gap: .45rem; font-weight: 700;
  margin-top: .8rem; }
dl.defs dt a { color: var(--lit); text-decoration: none; }
dl.defs dt a:hover { color: var(--spore); }
dl.defs dd { margin: .15rem 0 0; color: var(--dim); max-width: 64ch; }

table.data.wide-table { width: 100%; min-width: 46rem; }
table.data td.wide { text-align: left; color: var(--lit); }
/* a left-aligned column needs its heading to agree */
table.data th:nth-last-child(1) { text-align: right; }
table.data.wide-table th:last-child { text-align: left; }
table.data td.who { text-align: left; white-space: nowrap; }
table.data td.who > * { display: inline-flex; align-items: center; gap: .5rem;
  vertical-align: middle; }
table.data td.who b { font-weight: 700; }
img.ico.big { width: 1.9rem; height: 1.9rem; background: var(--paper);
  border-radius: 4px; padding: 2px; }

/* the class gateways carry a card face and a count */
ul.gates.classes { grid-template-columns:
  repeat(auto-fit, minmax(clamp(5rem, 12vw, 6.6rem), 1fr)); }
ul.gates.classes .gate { position: relative; }
ul.gates.classes .n {
  position: absolute; top: .35rem; right: .4rem;
  font: 600 .68rem/1 var(--sans); color: var(--faint);
  background: var(--pit); border: 1px solid var(--ridge);
  border-radius: 10px; padding: .12rem .34rem;
}
ul.gates.classes .gate:hover .n { color: var(--lit); border-color: var(--spore); }

.themes { display: grid; gap: 1.4rem; margin-top: .6rem; }
@media (min-width: 46rem) { .themes { grid-template-columns: 1fr 1fr; } }
.themes section { min-width: 0; }
.themes h3 { display: flex; align-items: baseline; gap: .5rem;
  color: var(--dim); font-size: .92rem; margin: 0 0 .5rem;
  padding-bottom: .35rem; border-bottom: var(--rule); }
.themes h3 .n { font-size: .74rem; color: var(--faint); }
.themes ul.facets { margin: 0; }
.themes ul.facets:empty { display: none; }
.themes p.note { margin: .6rem 0 .4rem; font-size: .84rem; }

table.data td.kind { color: var(--faint); font-size: .84rem; text-align: left;
  white-space: nowrap; }
table.data td.hp-cell { color: var(--flesh); font-weight: 700; }
.chip-card .mini.mob-mini { width: 2.4rem; height: 2.4rem; }
table.data td.who b { white-space: normal; }
