/* Tensura Modpack Wiki — flat surfaces, gradient accents, full width -------
   Palette is Elib v3 (Elib.Colors). Surfaces are FLAT colours.
   Gradients are used only as accents: bars, badges, the top band, headings. */

:root {
  --background:      #141414;
  --header:          #1e1e1e;
  --scroller:        #303030;
  --primary-text:    #f0f0f0;
  --secondary-text:  #c8c8c8;
  --disabled-text:   #646464;
  --primary:         #b43a3a;
  --disabled:        #787878;
  --positive:        #46af46;
  --negative:        #be4141;
  --gold:            #d6ae22;
  --info:            #5494d6;
  --concept:         #a680dc;
  --silver:          #c0c0c0;
  --bronze:          #915e31;

  /* flat surface steps */
  --surface:   #1a1a1a;
  --surface-2: #202020;
  --line:      #2a2a2a;
  --line-soft: #232323;

  /* gradient accents */
  --g-rail:  linear-gradient(180deg, #d24f4f, #8c2b2b);
  --g-bar:   linear-gradient(90deg, #d24f4f, #8c2b2b);
  --g-band:  linear-gradient(90deg, rgba(180,58,58,.20), rgba(180,58,58,.02) 55%, transparent);

  --radius:   6px;
  --radius-s: 4px;
  --sidebar:  226px;
  --topbar:   52px;
}

* { box-sizing: border-box; }
/* min-height, not height: a body pinned to one screen tall while the page
   overflows it can make the browser clamp the scroll position when layout
   changes underneath, which is one way to get thrown back to the top. */
html { height: 100%; }
body { min-height: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--primary-text);
  font-family: Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid #d24f4f; outline-offset: 2px; border-radius: 3px; }

h1 { font-size: 2rem; font-weight: 700; letter-spacing: -.015em; margin: 0 0 .15em; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 2rem 0 .7rem; }
h3 { font-size: .95rem; font-weight: 600; margin: 1.4rem 0 .5rem; }
p  { max-width: 82ch; }

/* top bar ----------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar);
  display: flex; align-items: center; gap: 1.2rem;
  padding: 0 1.1rem;
  background: var(--header);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; flex: none; }
.brand img { width: 30px; height: 30px; border-radius: var(--radius-s); display: block; }
.brand b { font-weight: 700; }
.brand b i { font-style: normal; color: #d24f4f; }

.topsearch { flex: 1; max-width: 420px; margin-left: auto; display: flex; position: relative; }
.ts-drop {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 90;
  background: var(--header); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0,0,0,.5); padding: .25rem; max-height: 70vh; overflow-y: auto;
}
.ts-drop a { display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem; border-radius: var(--radius-s); }
.ts-drop a:hover, .ts-drop a.on { background: var(--surface-2); }
.ts-drop img { width: 28px; height: 28px; flex: none; object-fit: contain; image-rendering: pixelated; }
.ts-drop span { display: flex; flex-direction: column; min-width: 0; }
.ts-drop b { font-weight: 500; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-drop small { color: var(--disabled-text); font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-drop .ts-all { color: var(--secondary-text); font-size: .82rem; border-top: 1px solid var(--line-soft); border-radius: 0; margin-top: .2rem; padding: .45rem .5rem; }
.topsearch input {
  flex: 1; min-width: 0;
  padding: .38rem .7rem;
  background: var(--background);
  border: 1px solid var(--line); border-right: 0;
  border-radius: var(--radius-s) 0 0 var(--radius-s);
  color: var(--primary-text); font: inherit; font-size: .9rem;
}
.topsearch input::placeholder { color: var(--disabled-text); }
.topsearch input:focus { outline: none; border-color: #6a3030; }
.topsearch button {
  padding: .38rem .8rem; border: 0;
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  background: var(--g-bar);
  color: #fff; font: inherit; font-size: .9rem; cursor: pointer;
}

/* "Hide concepts" (browse lists only, inside .concept-scope): concept cards
   go, and so does a type group left with nothing else in it. */
.concept-toggle { flex: none; }
.concept-toggle[hidden] { display: none; }
.hide-concepts .concept-scope .is-concept,
.hide-concepts .concept-scope .group:not(:has(.grid > li:not(.is-concept))),
.only-concepts .concept-scope .not-concept,
.only-concepts .concept-scope .group:not(:has(.is-concept)) { display: none; }

/* shell ------------------------------------------------------------------- */

.shell { display: flex; align-items: flex-start; min-height: calc(100vh - var(--topbar)); }

.sidebar {
  position: sticky; top: var(--topbar);
  width: var(--sidebar); flex: none;
  height: calc(100vh - var(--topbar)); overflow-y: auto;
  padding: .9rem 0 2rem;
  background: var(--header);
  border-right: 1px solid var(--line);
}
.side-group { margin-bottom: 1.1rem; }
.side-title {
  display: flex; align-items: center; gap: .45rem;
  padding: 0 1rem .35rem;
  font-size: .72rem; font-weight: 600; letter-spacing: .08em;
  color: var(--disabled-text); text-transform: uppercase;
}
.side-title::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--g-bar); }

.sidebar a {
  position: relative; display: flex; align-items: center; gap: .55rem;
  padding: .33rem 1rem;
  color: var(--secondary-text); font-size: .92rem;
}
.sidebar a:hover { background: var(--surface); color: var(--primary-text); }
.sidebar a.on { background: var(--g-band); color: #fff; }
.sidebar a.on::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--g-rail);
}
.sidebar .dot { width: 6px; height: 6px; border-radius: 2px; flex: none; }
.side-count {
  margin-left: auto; padding: 0 .45rem; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: .72rem; font-weight: 600; line-height: 1.5;
}

.main { flex: 1; min-width: 0; padding: 1.1rem 1.4rem 4rem; }

/* breadcrumbs ------------------------------------------------------------- */

.crumbs { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .85rem; color: var(--disabled-text); margin-bottom: .9rem; }
.crumbs a:hover { color: var(--secondary-text); }
.crumbs .here { color: var(--secondary-text); }

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

.page-head { margin-bottom: 1.1rem; }
.page-head h1 { display: flex; align-items: center; gap: .6rem; }
.head-icon { width: 38px; height: 38px; object-fit: contain; image-rendering: pixelated; flex: none; }
.page-head .count-chip {
  display: inline-block; vertical-align: middle; margin-left: .6rem;
  padding: .1rem .55rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--secondary-text); font-size: .85rem; font-weight: 500;
}
.page-head p { margin: .2rem 0 0; color: var(--secondary-text); }
.page-head--action { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .8rem 1.2rem; }

/* home -------------------------------------------------------------------- */

.home-hero { padding: 1.6rem 0 1.4rem; }
.home-eyebrow { display: flex; align-items: center; gap: .5rem; color: var(--disabled-text); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }
.home-eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--g-bar); }
.home-hero h1 { font-size: clamp(2.2rem, 4.4vw, 3.4rem); margin: .5rem 0 .4rem; }
.home-hero h1 i { font-style: normal; color: #d24f4f; }
.home-hero p { color: var(--secondary-text); max-width: 60ch; }

.mod-pills { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.mod-pills a, .badge-mod {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .18rem .6rem; border-radius: 999px;
  font-size: .78rem; font-weight: 500;
  color: var(--c, var(--secondary-text));
  background: linear-gradient(90deg, color-mix(in srgb, var(--c, #888) 22%, transparent), color-mix(in srgb, var(--c, #888) 8%, transparent));
  border: 1px solid color-mix(in srgb, var(--c, #888) 35%, transparent);
}
.badge-icon { width: 1.25em; height: 1.25em; margin: -.1rem -.15rem -.1rem -.35rem; object-fit: contain; image-rendering: pixelated; }
.type-badge:has(.badge-icon) { display: inline-flex; align-items: center; gap: .4rem; }
.mod-pills a:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--c, #888) 34%, transparent), color-mix(in srgb, var(--c, #888) 12%, transparent)); }

.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.btn {
  padding: .5rem 1.1rem; border-radius: var(--radius-s);
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--primary-text); font-size: .92rem; font-weight: 500;
}
.btn:hover { border-color: #6a3030; }
.btn--primary { background: var(--g-bar); background-origin: border-box; border-color: transparent; color: #fff; }  /* border-box: a transparent border would tile the gradient into streaks at the ends */
.btn--primary:hover { filter: brightness(1.1); }

.stat-band {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 1.6rem 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.stat-band a { padding: 1.1rem .8rem; text-align: center; border-left: 1px solid var(--line-soft); }
.stat-band a:first-child { border-left: 0; }
/* the same band as plain figures, not links (icon repair) */
.stat-band > div { padding: 1.1rem .8rem; text-align: center; border-left: 1px solid var(--line-soft); }
.stat-band > div:first-child { border-left: 0; }
.stat-band a:hover { background: var(--surface-2); }
.stat-num { display: block; font-size: 1.9rem; font-weight: 700; line-height: 1.15; }
.stat-label { display: block; color: var(--disabled-text); font-size: .78rem; letter-spacing: .07em; text-transform: uppercase; }

/* section heading with gradient rule -------------------------------------- */

.section-head {
  display: flex; align-items: center; gap: .7rem;
  margin: 2rem 0 .8rem;
}
.section-head h2 { margin: 0; }
.section-head .rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.section-head .count { color: var(--disabled-text); font-size: .85rem; }

/* toolbar ----------------------------------------------------------------- */

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem;
  padding: .5rem;
  margin-bottom: .9rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.toolbar .spacer { margin-left: auto; }
.toolbar .count { color: var(--disabled-text); font-size: .85rem; }

.dd { position: relative; }
.dd > summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: .1rem;
  padding: .35rem .7rem; border-radius: var(--radius-s);
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--secondary-text); font-size: .88rem; white-space: nowrap;
}
.dd > summary::-webkit-details-marker { display: none; }
.dd > summary::after { content: " \25BE"; color: var(--disabled-text); }
.dd > summary:hover { border-color: #6a3030; color: var(--primary-text); }
.dd--set > summary { background: var(--g-bar); background-origin: border-box; border-color: transparent; color: #fff; }
.dd[open] > summary { border-color: #6a3030; }

.dd-menu {
  position: absolute; z-index: 50; top: calc(100% + 4px); left: 0;
  min-width: 210px; max-height: 60vh; overflow-y: auto;
  padding: .25rem;
  background: var(--header); border: 1px solid var(--line); border-radius: var(--radius);
}
.dd-menu a { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .32rem .55rem; border-radius: var(--radius-s); color: var(--secondary-text); font-size: .89rem; }
.dd-menu a > span:first-child { display: inline-flex; align-items: center; }
.dd-menu a:hover { background: var(--surface-2); color: var(--primary-text); }
.dd-menu a.on { color: #fff; background: var(--g-band); }
.dd-menu .n { color: var(--disabled-text); font-size: .8rem; }

.applied { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .9rem; }
.applied a {
  display: inline-flex; align-items: center; gap: .1rem;
  padding: .18rem .6rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--secondary-text); font-size: .82rem;
}
.applied a:hover { border-color: #6a3030; color: var(--primary-text); }
.applied a::after { content: " \2715"; color: var(--disabled-text); }

/* type group header (old wiki pattern) ------------------------------------ */

.group-head {
  display: flex; align-items: center; gap: .6rem;
  margin: 1.4rem 0 .6rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--line);
}
.group:first-of-type .group-head { margin-top: .4rem; }
.type-badge {
  padding: .18rem .7rem; border-radius: var(--radius-s);
  font-size: .78rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--c, var(--secondary-text));
  background: linear-gradient(90deg, color-mix(in srgb, var(--c, #888) 26%, transparent), color-mix(in srgb, var(--c, #888) 8%, transparent));
  border: 1px solid color-mix(in srgb, var(--c, #888) 38%, transparent);
}
.group-head .rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.group-head .n { color: var(--disabled-text); font-size: .82rem; }

/* card grid --------------------------------------------------------------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: .5rem; list-style: none; margin: 0; padding: 0; }
.grid > li { display: flex; }   /* so every card in a row is the same height */
.grid--mods { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.card {
  position: relative; overflow: hidden;
  flex: 1;
  display: flex; align-items: center; gap: .85rem;
  padding: .7rem .8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--g-rail); opacity: 0;
}
.card { transition: background .15s, border-color .15s, box-shadow .15s; }
.card:hover {
  background: linear-gradient(160deg, color-mix(in srgb, var(--c, #d24f4f) 22%, var(--surface-2)), color-mix(in srgb, var(--c, #d24f4f) 7%, var(--surface-2)));
  border-color: color-mix(in srgb, var(--c, #d24f4f) 70%, transparent);
  box-shadow: 0 0 18px -6px var(--c, #d24f4f);
}
.card--roll:hover::before { opacity: 1; }
/* the whole card is the link; the count badges sit above it and keep their own */
.card--mod .card-name { color: var(--c); }
.card-link::after { content: ""; position: absolute; inset: 0; }
.card--mod .badge-mod { position: relative; z-index: 1; }

/* the icon is the point of the card, so give it real room */
.card-icon {
  width: 72px; height: 72px; flex: none;
  display: grid; place-items: center;
  background: var(--background);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-s);
}
.card-icon img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; display: block; }
/* fallback type octagon: it has its own frame, so drop the plate behind it */
.card-icon--type { background: linear-gradient(160deg, color-mix(in srgb, var(--c, #888) 14%, transparent), transparent 70%); border-color: color-mix(in srgb, var(--c, #888) 26%, transparent); }

/* icon + the "evolves into" strip under it */
.card-side { display: flex; flex-direction: column; align-items: center; gap: .35rem; flex: none; }
.card-evo { display: flex; justify-content: center; gap: 3px; width: 72px; }
.card-evo-i {
  width: 22px; height: 22px; flex: none;
  display: grid; place-items: center;
  background: var(--background); border: 1px solid var(--line-soft); border-radius: var(--radius-s);
}
.card-evo-i img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; display: block; }
.card-evo-more { font-size: .68rem; font-weight: 600; color: var(--disabled-text); }

/* the server verdict, sitting on top of the icon */
.card-side .badge-st {
  max-width: 84px; padding: .08rem .4rem;
  font-size: .64rem; letter-spacing: .02em; line-height: 1.2;
  text-align: center; white-space: normal;
}

/* skills you can roll at reincarnation: starfield behind the card. The image
   is dark on the right, which is where the text sits. background-image rather
   than the shorthand so .card:hover's flat colour doesn't wipe it out. */
.card--roll,
.card--roll:hover {
  background-image:
    linear-gradient(90deg, rgba(8, 10, 28, .15), rgba(8, 10, 28, .5) 60%, rgba(8, 10, 28, .7)),
    url(reincarnation-bg.webp);
  background-size: cover;
  background-position: 18% center;
  background-color: #0b0d1c;
}
.card--roll { border-color: rgba(122, 140, 232, .32); }
.card--roll:hover { border-color: rgba(150, 168, 255, .7); }
.card--roll::before { background: linear-gradient(180deg, #9fb2ff, #5a5fd6); }
.card--roll .card-sub { color: #9aa3c4; }

.card-text { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.card-name { font-weight: 500; line-height: 1.25; }
.card-sub {
  color: var(--disabled-text); font-size: .82rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
/* one line each; a name too long for a narrow card is cut (the full name is on hover) */
.card-foot .badge-mod { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot .badge-icon { vertical-align: middle; margin: -.2rem .3rem -.1rem -.3rem; }
.badge-n { opacity: .65; }

/* mod cards on the home page stack instead of sitting beside an icon */
.card--mod { flex-direction: column; align-items: flex-start; gap: .5rem; }

/* type icons -------------------------------------------------------------- */

/* small octagon shown in group headers, dropdowns and the info panel */
.type-icon   { width: 26px; height: 26px; object-fit: contain; image-rendering: pixelated; flex: none; }
.type-icon--s { width: 18px; height: 18px; object-fit: contain; image-rendering: pixelated; flex: none;
                vertical-align: middle; margin-right: .35rem; }

/* collapsible type groups ------------------------------------------------- */

.group { margin-bottom: .4rem; }
.group > summary { list-style: none; cursor: pointer; }
.group > summary::-webkit-details-marker { display: none; }
.group-caret { color: var(--disabled-text); transition: transform .12s ease; display: inline-block; }
.group:not([open]) .group-caret { transform: rotate(-90deg); }
.group:not([open]) .group-head { opacity: .8; }
.group-head:hover { opacity: 1; }

/* dense rows (search results) --------------------------------------------- */

.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.row {
  position: relative;
  display: flex; align-items: center; gap: .8rem;
  padding: .5rem .8rem;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-s);
}
.row:hover { background: var(--surface-2); border-color: #6a3030; }
/* a row with its own Edit button beside it (your recent edits) */
.rows li:has(> .row-edit) { display: flex; gap: 2px; }
.rows li:has(> .row-edit) > .row { flex: 1; min-width: 0; }
.row-edit {
  display: grid; place-items: center; padding: 0 1rem;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-s);
  color: var(--secondary-text); font-size: .85rem;
}
.row-edit:hover { background: var(--surface-2); border-color: #6a3030; color: var(--primary-text); }
.row-icon { width: 28px; height: 28px; flex: none; background: var(--background); border-radius: var(--radius-s); }
.row-icon img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.row-main { flex: 1; min-width: 0; }
.row-name { display: block; font-weight: 500; }
.row-sub { display: block; font-size: .82rem; color: var(--disabled-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { display: flex; align-items: center; gap: .4rem; flex: none; }

/* page numbers under a long list ------------------------------------------ */

.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem; margin-top: 1.6rem; }
.pager a, .pager span {
  min-width: 2.2rem; padding: .35rem .65rem; text-align: center;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-s);
  color: var(--secondary-text);
}
.pager a:hover, .pager .on { background: var(--surface-2); border-color: #6a3030; color: var(--primary-text); }
.pager .on { font-weight: 600; }
.pager .off { background: none; border-color: transparent; color: var(--disabled-text); }

/* status ------------------------------------------------------------------ */

.st-allowed     { --s: var(--positive); }
.st-limited     { --s: var(--gold); }
.st-wip         { --s: var(--info); }
.st-concept     { --s: var(--concept); }
.st-blacklisted,
.st-broken      { --s: var(--negative); }
.st-untested    { --s: var(--disabled-text); }
.st-allowed, .st-limited, .st-wip, .st-concept, .st-blacklisted, .st-broken, .st-untested { color: var(--s); }

/* Solid, so the verdict reads at a glance on any background, the starfield too. */
.badge-st {
  display: inline-block; padding: .12rem .55rem; border-radius: var(--radius-s);
  font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; line-height: 1.35;
  color: color-mix(in srgb, var(--s) 55%, #fff);
  background: color-mix(in srgb, var(--s) 30%, #121212);
  border: 1px solid color-mix(in srgb, var(--s) 75%, transparent);
}

.empty { color: var(--disabled-text); }

/* entry page: content + info sidebar --------------------------------------- */

.entry-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.6rem; align-items: start; }

.entry-hero--banner {
  margin-bottom: 1.2rem; padding: 1.1rem 1.4rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  /* banners are about 9:1 (see banner-src/); the subject sits on the right, so cover crops the left first,
     and the gradient darkens that side for the text */
  background: linear-gradient(90deg, rgba(0,0,0,.8) 0%, rgba(0,0,0,.5) 40%, rgba(0,0,0,0) 75%),
              var(--banner) right center / cover no-repeat;
}
.entry-hero--banner .entry-lead { max-width: 56ch; }
.entry-title { font-size: clamp(1.9rem, 3vw, 2.6rem); }
.entry-lead { color: var(--secondary-text); font-size: 1.02rem; max-width: 80ch; }

.notice {
  margin: 1.2rem 0; padding: .85rem 1rem;
  border: 1px solid var(--line); border-left: 3px solid var(--disabled);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: linear-gradient(90deg, rgba(120,120,120,.12), transparent 60%);
}
.notice > strong { display: block; margin-bottom: .15rem; }
.notice > strong:last-child { margin-bottom: 0; }
[data-toc] > .notice { max-width: 82ch; }
[data-toc] > .notice:first-child { margin-top: 0; }
.notice p { margin: 0; color: var(--secondary-text); font-size: .93rem; }
.notice--allowed     { border-left-color: var(--positive); background: linear-gradient(90deg, rgba(70,175,70,.14), transparent 60%); }
.notice--limited     { border-left-color: var(--gold);     background: linear-gradient(90deg, rgba(214,174,34,.14), transparent 60%); }
.notice--wip         { border-left-color: var(--info);     background: linear-gradient(90deg, rgba(84,148,214,.14), transparent 60%); }
.notice--concept     { border-left-color: var(--concept);  background: linear-gradient(90deg, rgba(166,128,220,.14), transparent 60%); }
.notice--blacklisted,
.notice--broken      { border-left-color: var(--negative); background: linear-gradient(90deg, rgba(190,65,65,.16), transparent 60%); }

.rule-h { height: 1px; background: linear-gradient(90deg, var(--line), transparent); margin: 1.6rem 0; }

.prose p { color: var(--secondary-text); margin: 0 0 .85rem; }
.prose strong { color: var(--primary-text); }

.abilities { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.ability-head { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; }
.ability-head .tag { margin-right: 0; }
.ability-name { font-size: 1rem; }
.ability .prose { margin-top: .35rem; }
.abilities p { margin: .2rem 0 0; color: var(--secondary-text); font-size: .93rem; }

/* Stat pills: the ability header's cost and cooldown, and [[cost:...]] in text */
.pill {
  display: inline-block; padding: .02rem .5rem; border-radius: 999px; white-space: nowrap;
  font-size: .78rem; font-weight: 600; line-height: 1.5; color: var(--primary-text);
  --p: var(--disabled); background: color-mix(in srgb, var(--p) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--p) 45%, transparent);
}
.pill b { color: color-mix(in srgb, var(--p) 65%, #fff); font-weight: 700; margin-right: .15rem; }
.pill--cost     { --p: var(--info); }
.pill--cooldown { --p: var(--concept); }
.pill--duration { --p: var(--gold); }
.pill--range    { --p: var(--positive); }
.pill--damage   { --p: var(--negative); }

.tag {
  display: inline-block; padding: .02rem .5rem; margin-right: .45rem;
  border-radius: var(--radius-s); font-size: .78rem; font-weight: 600;
  color: var(--secondary-text);
  background: linear-gradient(90deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  border: 1px solid var(--line);
}
.tag--passive_true    { color: #6fc96f; background: linear-gradient(90deg, rgba(70,175,70,.22), rgba(70,175,70,.05));   border-color: rgba(70,175,70,.35); }
.tag--passive_toggled { color: #86cf86; background: linear-gradient(90deg, rgba(70,175,70,.14), rgba(70,175,70,.04));   border-color: rgba(70,175,70,.25); }
.tag--active_press    { color: #e58585; background: linear-gradient(90deg, rgba(190,65,65,.26), rgba(190,65,65,.06));   border-color: rgba(190,65,65,.4); }
.tag--active_hold     { color: #e0bd50; background: linear-gradient(90deg, rgba(214,174,34,.24), rgba(214,174,34,.06)); border-color: rgba(214,174,34,.38); }
.tag--in_slot         { color: var(--silver); background: linear-gradient(90deg, rgba(192,192,192,.18), rgba(192,192,192,.05)); border-color: rgba(192,192,192,.3); }

table.data { width: 100%; border-collapse: collapse; margin: .5rem 0 1.2rem; }
table.data th {
  text-align: left; padding: .45rem .8rem;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--disabled-text); font-size: .76rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
table.data td { padding: .45rem .8rem; border: 1px solid var(--line-soft); color: var(--secondary-text); }
table.data td:first-child { color: var(--primary-text); }

/* info panel */
.info-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); position: sticky; top: calc(var(--topbar) + 1rem); }
.info-head { padding: .7rem .9rem; border-bottom: 1px solid var(--line); background: var(--g-band); font-weight: 600; }
.info-icon { display: grid; place-items: center; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line); }
.info-icon img { width: 100%; max-width: 168px; height: auto; object-fit: contain; image-rendering: pixelated; display: block; }
.info-section { padding: .35rem 0 .6rem; border-bottom: 1px solid var(--line); }
.info-section:last-child { border-bottom: 0; }
.info-label { padding: .4rem .9rem .15rem; color: var(--disabled-text); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.info-line { display: flex; justify-content: space-between; gap: .8rem; padding: .28rem .9rem; font-size: .9rem; }
.info-line dt { color: var(--disabled-text); }
.info-line dd { margin: 0; text-align: right; font-weight: 500; display: flex; align-items: center; justify-content: flex-end; gap: .1rem; }
.info-text { padding: .28rem .9rem; color: var(--secondary-text); font-size: .9rem; }
.info-links { display: flex; flex-wrap: wrap; gap: .3rem; padding: .3rem .9rem .6rem; }
.info-links a { color: #d87a7a; font-size: .88rem; }
.info-links a:hover { color: #f09b9b; }

/* evolution chain --------------------------------------------------------- */

.evo-label { color: var(--disabled-text); font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .5rem; }

/* pager ------------------------------------------------------------------- */

.pager { display: flex; align-items: center; gap: .4rem; margin-top: 1.2rem; }
.pager a, .pager span {
  padding: .3rem .8rem; border-radius: var(--radius-s);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--secondary-text); font-size: .9rem;
}
.pager a:hover { border-color: #6a3030; color: var(--primary-text); }
.pager .now { background: var(--g-bar); border-color: transparent; color: #fff; }

.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
  margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line);
  color: var(--disabled-text); font-size: .82rem;
}

/* scrollbars -------------------------------------------------------------- */

* { scrollbar-color: var(--scroller) var(--background); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--background); }
::-webkit-scrollbar-thumb { background: var(--scroller); border-radius: 5px; }

@media (max-width: 980px) {
  .entry-layout { grid-template-columns: 1fr; }
  .info-panel { position: static; }
}

.burger, .nav-scrim { display: none; }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; height: auto; padding: .5rem .8rem; gap: .5rem .7rem; }
  .brand b { font-size: .95rem; }
  .topsearch { order: 3; width: 100%; max-width: none; margin: 0; }
  .topsearch input { font-size: 16px; }   /* under 16px iOS zooms in on focus */

  /* The sidebar becomes a slide-in drawer opened by the burger, instead of a
     screen-high block stacked above every page. */
  .burger { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: none;
            border: 1px solid var(--line); border-radius: var(--radius-s); cursor: pointer; }
  .burger span, .burger span::before, .burger span::after { display: block; width: 18px; height: 2px; background: var(--primary-text); content: ""; position: relative; }
  .burger span::before { position: absolute; top: -6px; }
  .burger span::after { position: absolute; top: 6px; }
  .shell { flex-direction: column; align-items: stretch; }
  .sidebar { position: fixed; z-index: 80; top: 0; left: 0; bottom: 0; width: min(82vw, 300px); height: auto;
             transform: translateX(-100%); transition: transform .2s; border-right: 1px solid var(--line);
             padding-top: 1rem; overscroll-behavior: contain; }
  .sidebar a { padding-top: .6rem; padding-bottom: .6rem; }   /* bigger tap targets */
  .navtoggle:checked ~ .shell .sidebar { transform: none; }
  .navtoggle:checked ~ .nav-scrim { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.55);
                                 display: flex; align-items: center; justify-content: flex-start; padding-left: calc(min(82vw, 300px) + .6rem); }
  /* a hint that tapping the dimmed strip closes the menu */
  .navtoggle:checked ~ .nav-scrim::after { content: "\2039\2039"; font-size: 2.6rem; line-height: 1; color: rgba(255,255,255,.7); }
  .main { padding: 1rem .8rem 3rem; }
  .grid { grid-template-columns: 1fr; }
  .grid--mods, .grid--types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--mods .card, .grid--types .card { padding: .6rem; }
  .side-group--mods { display: none; }
  .card { padding: .65rem .7rem; gap: .7rem; }
  .main table.data { display: block; overflow-x: auto; max-width: 100%; }
  .toolbar { gap: .5rem; }
  .btn, .toolbar select, .dd > summary { min-height: 40px; }
}

/* forms (editor) ---------------------------------------------------------- */

.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 1.2rem; align-items: start; }
.form--narrow { max-width: 520px; }
/* min-width: 0 because a fieldset otherwise refuses to shrink below its
   content, which pushes the page sideways on a phone. */
.form fieldset.panel {
  min-width: 0; margin: 0 0 1rem; padding: 0 0 .9rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.form-side .panel { position: relative; }
.panel-title {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem .9rem; margin-bottom: .1rem;
  border-bottom: 1px solid var(--line);
  color: var(--secondary-text); font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.panel-title::before { content: ""; width: 3px; height: .9rem; border-radius: 2px; background: var(--g-rail); }

/* Resizing a textarea changes the page height under the pointer; with scroll
   anchoring on, the browser re-scrolls to keep something else still, which
   is what made the editor jump while dragging a box's corner. */
.form, .form textarea { overflow-anchor: none; }

/* editor header: icon, title, badges, links */
.edit-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.edit-head .card-icon { width: 60px; height: 60px; }
.edit-head-text { flex: 1; min-width: 0; }
.edit-head h1 { margin: 0; overflow-wrap: anywhere; }
.edit-head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; margin: .3rem 0 0;
                  color: var(--disabled-text); font-size: .86rem; max-width: none; }
.edit-head-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* short fields two to a row; long ones and group headings take the full width */
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.field-grid > .field--wide,
.field-grid > .field-group { grid-column: 1 / -1; }
.field-grid > .check { padding-top: 2rem; }

/* one ability = one small card */
.ability-row {
  margin: .6rem .9rem 0; padding: .6rem;
  background: var(--background); border: 1px solid var(--line-soft); border-radius: var(--radius-s);
}
.ability-top { display: grid; grid-template-columns: auto 170px minmax(0, 1fr) auto auto auto; gap: .4rem; margin-bottom: .4rem; }
.ability-grip {
  display: grid; place-items: center; width: 1.3rem;
  color: var(--disabled-text); font-size: .9rem; letter-spacing: -.2em; cursor: grab; user-select: none;
}
.ability-grip:hover { color: var(--secondary-text); }
.ability-row.is-dragging { opacity: .45; border-style: dashed; }
.ability-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin: .9rem .9rem 0; }
.form .ability-tools .btn { margin: 0; }
.icon-btn[data-move]:hover { color: var(--primary-text); border-color: #6a3030; }
.icon-btn {
  width: 2.1rem; height: 2.1rem; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line); border-radius: var(--radius-s);
  color: var(--disabled-text); font: inherit; font-size: 1rem; cursor: pointer;
}
.icon-btn:hover { color: #e07575; border-color: rgba(190,65,65,.55); }

/* icon upload with a preview plate, same size as a card's */
.icon-field { display: flex; gap: .8rem; align-items: center; }
.icon-field input[type=file] { min-width: 0; }

/* save bar: always in reach at the bottom of the screen */
.save-bar {
  position: sticky; bottom: 0; z-index: 40;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem;
  margin: .4rem 0 0; padding: .65rem .9rem;
  background: color-mix(in srgb, var(--header) 94%, transparent);
  border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .35);
  backdrop-filter: blur(6px);
}
.save-bar .btn { margin: 0; }
.save-bar-summary { flex: 1 1 260px; min-width: 0; }
.form .save-bar-summary input { width: 100%; }
.form .save-bar select { width: auto; }
.save-bar-note { color: var(--disabled-text); font-size: .82rem; }

/* Write / Preview on the description, and its folded formatting help */
.md-edit-head { display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem; }
.md-edit-tabs { display: inline-flex; margin-bottom: .25rem; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.md-edit-tabs button {
  padding: .2rem .75rem; background: transparent; border: 0;
  color: var(--disabled-text); font: inherit; font-size: .82rem; cursor: pointer;
}
.md-edit-tabs button + button { border-left: 1px solid var(--line); }
.md-edit-tabs button:hover { color: var(--primary-text); }
.md-edit-tabs button.on { background: rgba(180,58,58,.18); color: var(--primary-text); }
.md-preview {
  padding: .6rem .8rem; overflow: auto;
  background: var(--background); border: 1px dashed var(--line); border-radius: var(--radius-s);
}
.md-help { margin-top: .3rem; }
.md-help > summary { cursor: pointer; width: max-content; color: var(--disabled-text); font-size: .8rem; }
.md-help > summary:hover { color: var(--secondary-text); }

.field { padding: .6rem .9rem 0; }
.field label { display: block; margin-bottom: .25rem; color: var(--secondary-text); font-size: .88rem; }
.field small { display: block; margin-top: .25rem; color: var(--disabled-text); font-size: .8rem; }
.field code { background: var(--surface-2); padding: 0 .3rem; border-radius: 3px; }

.form input[type=text], .form input[type=password], .form input[type=number],
.form input:not([type]), .form input[type=search], .form select, .form textarea {
  width: 100%; padding: .42rem .6rem;
  background: var(--background); border: 1px solid var(--line); border-radius: var(--radius-s);
  color: var(--primary-text); font: inherit; font-size: .92rem;
}
.form textarea { resize: vertical; line-height: 1.5; }
.form select[multiple] { height: auto; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: #6a3030; }
.form input[type=file] { color: var(--secondary-text); font-size: .88rem; }

.check { display: flex; align-items: center; gap: .5rem; padding: .5rem .9rem 0; color: var(--secondary-text); font-size: .9rem; }
.check input { width: auto; }

.form .btn { margin: .9rem .9rem 0 .9rem; display: inline-block; }
.btn--small { padding: .28rem .7rem; font-size: .85rem; }

.icon-preview { display: block; width: 48px; height: 48px; object-fit: contain; image-rendering: pixelated; margin-bottom: .4rem; }

form.inline { display: inline-flex; gap: .3rem; align-items: center; margin: 0; }
form.inline input { width: 150px; padding: .25rem .5rem; background: var(--background); border: 1px solid var(--line); border-radius: var(--radius-s); color: var(--primary-text); font: inherit; font-size: .85rem; }
form.inline select {
  padding: .25rem .5rem; background: var(--background); border: 1px solid var(--line); color-scheme: dark;
  border-radius: var(--radius-s); color: var(--primary-text); font: inherit; font-size: .85rem;
}
form.inline input:focus, form.inline select:focus { outline: none; border-color: #6a3030; }
form.inline .btn { margin: 0; }
/* a browser's saved sign-in fills a field yellow; keep it the site's colours */
input:-webkit-autofill, select:-webkit-autofill {
  -webkit-text-fill-color: var(--primary-text); caret-color: var(--primary-text);
  box-shadow: 0 0 0 100px var(--background) inset;
}

@media (max-width: 980px) {
  /* minmax(0, ...) rather than 1fr: a bare 1fr won't shrink below its widest
     content, which pushed the editor sideways on a phone. */
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .field-grid > .check { padding-top: .5rem; }
  .ability-top { grid-template-columns: auto minmax(0, 1fr) auto auto auto; }
  .ability-top select { grid-column: 2 / -1; }
  .ability-top input { grid-column: 1 / 3; }
}

/* skill-type cards on the home page --------------------------------------- */

.card--type { flex-direction: column; align-items: center; text-align: center; gap: .55rem; padding: 1.1rem .8rem; }
.type-tile {
  display: grid; place-items: center;
  width: 86px; height: 86px; flex: none;
  border-radius: var(--radius-s);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c, #888) 18%, transparent), transparent 70%);
  border: 1px solid color-mix(in srgb, var(--c, #888) 30%, transparent);
}
.type-tile img { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; display: block; }
.card--type .card-name { color: var(--c, var(--primary-text)); }
.card--type .card-foot { justify-content: center; align-items: baseline; gap: .35rem; }
.type-count { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }

/* import tool ------------------------------------------------------------- */

.import-list { max-height: 420px; overflow-y: auto; padding: .3rem .4rem; margin: .5rem .9rem 0;
               background: var(--background); border: 1px solid var(--line); border-radius: var(--radius-s); }
.import-list .check { padding: .15rem .5rem; font-size: .9rem; }
.attribution { margin-top: 2rem; padding: .6rem .8rem; border-left: 3px solid var(--line);
               color: var(--disabled-text); font-size: .85rem; }
.attribution a { color: var(--secondary-text); text-decoration: underline; }

.attribution {
  margin: 1.6rem 0 0; padding: .6rem .9rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--disabled-text); font-size: .84rem;
}
.attribution a { color: var(--secondary-text); text-decoration: underline; }

/* searchable picker (evolution links) ------------------------------------- */

.picker { position: relative; }
.picker-chosen { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .4rem; }
.picker-chosen:empty { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .2rem .3rem .2rem .45rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s);
  font-size: .88rem;
}
.chip img { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; }
.chip-x {
  border: 0; background: none; color: var(--disabled-text); cursor: pointer;
  font-size: 1.05rem; line-height: 1; padding: 0 .25rem;
}
.chip-x:hover { color: var(--negative); }

.picker-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 3px);
  max-height: 360px; overflow-y: auto;
  margin: 0; padding: .25rem; list-style: none;
  background: var(--header); border: 1px solid var(--line); border-radius: var(--radius);
}
.picker-list li[data-i] {
  display: flex; align-items: center; gap: .55rem;
  padding: .35rem .5rem; border-radius: var(--radius-s); cursor: pointer;
}
.picker-list li[data-i].on,
.picker-list li[data-i]:hover { background: var(--g-band); }
.picker-list .pk-icon { width: 32px; height: 32px; flex: none; display: grid; place-items: center; }
.picker-list .pk-icon img { width: 32px; height: 32px; object-fit: contain; image-rendering: pixelated; }
.picker-list .pk-name { flex: 1; min-width: 0; }
.picker-list .pk-name em { font-style: normal; color: var(--disabled-text); font-size: .78rem; }
.picker-empty { padding: .45rem .6rem; color: var(--disabled-text); font-size: .88rem; }

/* inline forms inside section headings (approve all / publish all) */
.section-head form.inline select {
  padding: .25rem .5rem; background: var(--background); border: 1px solid var(--line);
  border-radius: var(--radius-s); color: var(--primary-text); font: inherit; font-size: .85rem;
}

/* race evolution tree ----------------------------------------------------- */
/* Top-down org-chart: race box, dashed requirement box, race box, branching
   into columns wherever a race has more than one path. Lines are drawn with
   borders on the list items, so no JS or canvas is needed. */

.race-tree { overflow-x: auto; padding: 1rem 0 1.5rem; margin: .5rem 0 1rem; }
.race-tree--line { max-width: 82ch; }   /* a skill line sits under the text, not centred in the space beside it */
.race-tree--line .t-node { max-width: 320px; }   /* skill names stay on one line, so the icon fills the box */
.nowrap { white-space: nowrap; }
.race-tree-inner { display: flex; flex-direction: column; align-items: center; min-width: max-content; padding: 0 1rem; }

/* a tree wider than the page (see layout_end()): a framed window with zoom
   buttons above it, dragged around rather than scrolled to its far bottom */
.tree-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
  margin-top: .5rem; padding: .4rem .5rem;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}
.tree-bar output { min-width: 3rem; text-align: center; color: var(--secondary-text); font-size: .82rem; }
.tree-hint { margin-left: auto; color: var(--disabled-text); font-size: .8rem; }
.race-tree.is-big {
  max-height: min(78vh, 900px); overflow: auto; margin-top: 0; padding: 1.2rem 0;
  background: var(--background); border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
  cursor: grab;
}
.race-tree.is-big.is-dragging { cursor: grabbing; }
.race-tree.is-big.is-dragging a { cursor: grabbing; }
@media (hover: none) { .tree-hint { display: none; } }

.t-root, .t-root ul { display: flex; justify-content: center; margin: 0; padding: 0; list-style: none; }
.t-root ul { position: relative; padding-top: 20px; }
.t-root li { position: relative; display: flex; flex-direction: column; align-items: center; padding: 20px 10px 0; }
.t-root > li { padding-top: 0; }

/* horizontal bar across siblings + a short drop into each child */
.t-root ul > li::before,
.t-root ul > li::after {
  content: ""; position: absolute; top: 0; width: 50%; height: 20px;
  border-top: 1px solid var(--scroller);
}
.t-root ul > li::before { right: 50%; }
.t-root ul > li::after  { left: 50%; border-left: 1px solid var(--scroller); }
.t-root ul > li:first-child::before,
.t-root ul > li:last-child::after { border: 0; }
.t-root ul > li:last-child::before { border-right: 1px solid var(--scroller); border-top-right-radius: 6px; }
.t-root ul > li:first-child::after { border-top-left-radius: 6px; }
.t-root ul > li:only-child::before,
.t-root ul > li:only-child::after { display: none; }
.t-root ul > li:only-child { padding-top: 0; }
/* the drop from a parent down to the bar */
.t-root ul::before {
  content: ""; position: absolute; top: 0; left: 50%; height: 20px;
  border-left: 1px solid var(--scroller);
}

.t-stem { display: block; width: 1px; height: 14px; background: var(--scroller); flex: none; }

/* a race box */
.t-node {
  position: relative;
  display: flex; align-items: center; gap: .55rem;
  min-width: 170px; max-width: 250px;
  padding: .5rem .65rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--primary-text);
}
.t-node:hover { border-color: #6a3030; background: var(--surface-2); }
.t-node--current {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(180,58,58,.22), var(--surface) 70%);
}
.t-icon { width: 54px; height: 54px; flex: none; object-fit: contain; image-rendering: pixelated; }
.t-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.t-name { font-weight: 600; font-size: .92rem; line-height: 1.2; }
.t-diff {
  align-self: flex-start; padding: 0 .4rem; border-radius: 3px; font-size: .7rem; font-weight: 600;
  color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
  background: color-mix(in srgb, var(--c) 14%, transparent);
}
.t-stats { color: var(--disabled-text); font-size: .76rem; }
.t-here { position: absolute; top: -.5rem; left: .6rem; padding: 0 .3rem; background: var(--background); line-height: 1;
          color: var(--primary); font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.t-body .badge-st { align-self: flex-start; font-size: .62rem; padding: 0 .35rem; }
.t-skills { display: flex; flex-wrap: wrap; gap: 2px; margin-top: .1rem; }
.t-skills img { width: 20px; height: 20px; object-fit: contain; image-rendering: pixelated; }
.t-skill-txt, .t-more { font-size: .7rem; color: var(--secondary-text); padding: 0 .2rem; }

/* the requirement between two races, dashed like the Tensura wiki's */
.t-req {
  padding: .4rem .7rem; min-width: 110px; max-width: 230px;
  border: 1px dashed var(--scroller); border-radius: var(--radius-s);
  background: var(--background);
  color: var(--secondary-text); font-size: .8rem; text-align: center; line-height: 1.45;
}
.t-req--empty { color: var(--disabled-text); min-width: 0; padding: .15rem .6rem; }
.t-req a, .data td a, .way a { color: #d87a7a; }
.way a:hover { color: #f09b9b; }
.req-icon { width: 16px; height: 16px; object-fit: contain; image-rendering: pixelated; vertical-align: -3px; margin-right: .2rem; }

/* the race(s) it comes from, drawn above */
.t-parents { display: flex; gap: 1.2rem; justify-content: center; }
.t-parent { display: flex; flex-direction: column; align-items: center; opacity: .8; }
.t-parent:hover { opacity: 1; }

/* segmented toggle (Starting races / All races) --------------------------- */

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.seg a, .seg button { padding: .35rem .75rem; font: inherit; font-size: .88rem; color: var(--secondary-text); background: var(--surface-2); border: 0; cursor: pointer; }
.seg > :not(:first-child) { border-left: 1px solid var(--line); }
.seg a:hover, .seg button:hover { color: var(--primary-text); }
.seg a.on, .seg [aria-pressed="true"] { background: var(--g-bar); color: #fff; }
.ability-filter { margin-bottom: 1rem; flex-wrap: wrap; }
.ability-filter[hidden] { display: none; }

/* an on/off filter in a toolbar, e.g. "Has evolutions" */
.toggle {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .7rem; border-radius: var(--radius-s);
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--secondary-text); font-size: .88rem; white-space: nowrap;
}
.toggle::before {
  content: ""; width: .75rem; height: .75rem; border-radius: 3px;
  border: 1px solid var(--disabled); background: var(--background);
}
.toggle:hover { border-color: #6a3030; color: var(--primary-text); }
button.toggle { font: inherit; font-size: .88rem; cursor: pointer; }
.toggle.on { background: var(--g-bar); border-color: transparent; color: #fff; }
.toggle.on::before { border-color: #fff; background: #fff; box-shadow: inset 0 0 0 2px #b43a3a; }
/* the "without" state of a three-way toggle: a cross instead of a filled box */
.toggle.neg { background: var(--surface-2); border-color: #6a3030; color: var(--primary-text); }
.toggle.neg::before {
  border-color: #b43a3a; box-shadow: none;
  background: #b43a3a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3.5 3.5l5 5M8.5 3.5l-5 5' stroke='white' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}

/* the compact "reincarnation skill pool" panel a guide drops in */
.pool-link {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem;
  margin: 1rem 0; padding: .8rem 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.pool-link:hover { border-color: #6a3030; background: var(--surface-2); }
.pool-link-text { display: flex; flex-direction: column; gap: .1rem; }
.pool-link-text b { color: var(--primary-text); font-weight: 600; }
.pool-link-text small { color: var(--disabled-text); font-size: .82rem; }
.pool-icons { display: flex; flex-wrap: wrap; gap: 4px; }
.pool-icons img {
  width: 30px; height: 30px; object-fit: contain; image-rendering: pixelated;
  background: var(--background); border: 1px solid var(--line-soft); border-radius: var(--radius-s);
}
.pool-link-go { margin-left: auto; color: var(--primary-text); font-size: .9rem; white-space: nowrap; }

/* race editor bits -------------------------------------------------------- */

.field-group {
  margin: .9rem .9rem 0; padding-bottom: .25rem; border-bottom: 1px solid var(--line);
  color: var(--disabled-text); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.range-inputs { display: flex; align-items: center; gap: .5rem; }
.range-inputs span { color: var(--disabled-text); font-size: .85rem; }
.path-row {
  display: grid; grid-template-columns: 1fr 1.4fr auto; gap: .5rem; align-items: start;
  padding: .55rem .9rem; border-top: 1px solid var(--line-soft);
}
.path-target { display: flex; flex-direction: column; gap: .35rem; }
.path-row .btn { margin: 0; }
.incoming { list-style: none; margin: 0; padding: .4rem .9rem 0; }
.incoming li { padding: .25rem 0; color: var(--secondary-text); font-size: .9rem; }
@media (max-width: 980px) { .path-row { grid-template-columns: 1fr; } }

/* delete buttons and the danger zone -------------------------------------- */

.btn--danger { background: transparent; border: 1px solid rgba(190,65,65,.55); color: #e07575; }
.btn--danger:hover { background: var(--negative); border-color: var(--negative); color: #fff; }
.danger-zone {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-top: 1.5rem; padding: .9rem 1rem;
  border: 1px solid rgba(190,65,65,.35); border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(190,65,65,.10), transparent 60%);
}
.danger-zone p { margin: .2rem 0 0; color: var(--secondary-text); font-size: .88rem; }
.danger-zone .btn { margin: 0; }

/* edit history ------------------------------------------------------------ */

.history-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px;
                position: sticky; top: calc(var(--topbar) + 1rem); max-height: calc(100vh - var(--topbar) - 2rem); overflow-y: auto; }
.history-list a {
  display: flex; flex-direction: column; gap: .1rem;
  padding: .5rem .7rem; border: 1px solid var(--line-soft); border-radius: var(--radius-s);
  background: var(--surface);
}
.history-list a:hover { border-color: #6a3030; }
.history-list li.on a { background: var(--g-band); border-color: #6a3030; }
.h-when { font-weight: 500; font-size: .9rem; }
.h-who  { color: var(--secondary-text); font-size: .82rem; display: flex; gap: .35rem; align-items: center; }
.h-note { color: var(--disabled-text); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-tag { padding: 0 .35rem; border-radius: 3px; font-size: .7rem; font-weight: 600; border: 1px solid currentColor; }
.h-tag--now      { color: var(--positive); }
.h-tag--pending  { color: var(--gold); }
.h-tag--rejected { color: var(--negative); }

.diff td:first-child { width: 170px; white-space: nowrap; }
.diff tr:not(.changed) td { color: var(--disabled-text); }
.diff-val { white-space: pre-wrap; word-break: break-word; font-size: .88rem; }
.diff-old { background: rgba(190,65,65,.10); border-left: 2px solid rgba(190,65,65,.6); padding: .15rem .45rem; }
.diff-new { background: rgba(70,175,70,.10);  border-left: 2px solid rgba(70,175,70,.6);  padding: .15rem .45rem; }

@media (max-width: 980px) { .history-layout { grid-template-columns: 1fr; } .history-list { position: static; max-height: none; } }

/* long-form prose (guide pages) -------------------------------------------- */
/* .prose had two rules, because nothing could produce anything but <p> and
   <strong>. Markdown can, so everything it emits needs one here or it falls
   back to the browser's light-theme defaults on a dark page. Entry pages share
   .prose too: descriptions and notes are Markdown, with headings from h3 down. */

.prose h2:first-child { margin-top: 0; }
.prose > h3:first-child, .prose > h4:first-child { margin-top: .4rem; }
.prose h4 { font-size: .9rem; font-weight: 600; margin: 1.1rem 0 .4rem; color: var(--secondary-text); }
.prose h5 { font-size: .78rem; font-weight: 600; margin: 1rem 0 .35rem; color: var(--disabled-text);
            letter-spacing: .06em; text-transform: uppercase; }

/* "Written by X · Last edited by Y" under a page title */
.credits { margin: .35rem 0 0; color: var(--disabled-text); font-size: .84rem; }
.credits b { color: var(--secondary-text); font-weight: 600; }
.prose ul, .prose ol { margin: 0 0 .9rem; padding-left: 1.35rem; max-width: 82ch; color: var(--secondary-text); }
.prose li { margin: .18rem 0; }
.prose a { color: #d87a7a; }
.prose a:hover { color: #f09b9b; }
.prose em { color: var(--primary-text); font-style: italic; }
.prose code {
  padding: 0 .3rem; font-size: .92em;
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 3px;
}
.prose pre.md-code {
  margin: 0 0 1rem; padding: .8rem 1rem; max-width: 82ch; overflow-x: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--primary); border-radius: 0 var(--radius) var(--radius) 0;
}
.prose pre.md-code code { padding: 0; font-size: .88rem; background: none; border: 0; color: var(--secondary-text); }
/* the AI prompt on /api-docs is prose, so it wraps rather than scrolling */
.prose pre.ai-prompt { white-space: pre-wrap; word-break: break-word; margin-bottom: .5rem; }
/* a Copy button in the corner of each code block (API docs) */
.copy-wrap { position: relative; max-width: 82ch; }
.prose .copy-wrap > pre { max-width: none; padding-right: 4.5rem; }
.copy-wrap > .copy-btn { position: absolute; top: .4rem; right: .4rem; opacity: .75; }
.copy-wrap > .copy-btn:hover, .copy-wrap > .copy-btn:focus-visible { opacity: 1; }
.prose blockquote {
  margin: 0 0 1rem; padding: .55rem 1rem; max-width: 82ch;
  color: var(--secondary-text); background: var(--g-band);
  border-left: 3px solid var(--line); border-radius: 0 var(--radius) var(--radius) 0;
}
/* > [!tip] callouts, the same left-bar look as the server notices */
.callout {
  margin: 0 0 1rem; padding: .55rem 1rem; max-width: 82ch; color: var(--secondary-text);
  border: 1px solid var(--line); border-left: 3px solid var(--info); border-radius: 0 var(--radius) var(--radius) 0;
  background: linear-gradient(90deg, rgba(84,148,214,.14), transparent 60%);
}
.callout-title { color: var(--primary-text); }
.callout--tip     { border-left-color: var(--positive); background: linear-gradient(90deg, rgba(70,175,70,.14), transparent 60%); }
.callout--warning { border-left-color: var(--negative); background: linear-gradient(90deg, rgba(190,65,65,.16), transparent 60%); }
.callout--tip .callout-title     { color: #6fc96f; }
.callout--note .callout-title    { color: #7fb3e8; }
.callout--warning .callout-title { color: #e58585; }

/* +++ folded sections */
.md-fold { margin: 0 0 1rem; max-width: 82ch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.md-fold > summary { cursor: pointer; padding: .5rem .9rem; font-weight: 600; }
.md-fold > summary:hover { color: #f09b9b; }
.md-fold-body { padding: 0 .9rem .3rem; }
.mods-empty { margin-top: .6rem; max-width: none; }
.mods-empty .md-fold-body { display: flex; flex-wrap: wrap; gap: .35rem; padding-bottom: .8rem; }

/* === tabs */
.md-tabs { margin: 0 0 1rem; max-width: 82ch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.md-tab-bar { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.md-tab-bar button {
  padding: .5rem .9rem; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--secondary-text); font: inherit; font-weight: 600; cursor: pointer;
}
.md-tab-bar button:hover { color: #f09b9b; }
.md-tab-bar button[aria-selected="true"] { color: var(--primary-text); border-bottom-color: var(--primary); }
.md-tab { padding: .7rem .9rem .2rem; }

/* numbers with a unit, picked out by md_stats() */
.stat { color: var(--primary-text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* [[key:R]] */
kbd {
  display: inline-block; padding: 0 .4rem; font: 600 .82em/1.5 ui-monospace, Consolas, monospace;
  background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
}

/* heading links and the "On this page" box */
[data-toc] h2, [data-toc] h3, .ability-name { scroll-margin-top: calc(var(--topbar) + 12px); }
.h-copy { cursor: pointer; width: fit-content; }   /* the text is the target, not the empty row beside it */
.h-copy:hover { color: #f09b9b; }
/* the padding is the hitbox; the negative margin keeps it from pushing text around */
/* takes no room until its heading is hovered, then slides in and pushes what
   follows (an ability's pills) to the right */
.h-anchor {
  display: inline-flex; vertical-align: middle; width: 0; margin-left: 0; overflow: hidden;
  padding: 0; border: 0; background: none; font: inherit;
  color: var(--disabled-text); opacity: 0; cursor: pointer;
  transition: width .12s, margin-left .12s, opacity .12s;
}
.h-anchor svg { flex: none; width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.h-anchor .i-done, .h-anchor.is-copied .i-copy { display: none; }
.h-anchor.is-copied .i-done { display: block; color: var(--positive); }
:hover > .h-anchor, .h-anchor:focus-visible, .h-anchor.is-copied { width: 1em; margin-left: .45rem; opacity: 1; }
.h-anchor:hover { color: #f09b9b; }
@media (hover: none) { .h-anchor { width: 1em; margin-left: .45rem; opacity: .6; } }
/* "On this page": a rail of links, the current section marked in red. Sections
   are bright, the subsections under them smaller, dimmer and indented. */
.toc { float: right; width: 230px; margin: 0 0 1rem 1.2rem; font-size: .86rem; }
.toc > b { display: block; margin-bottom: .45rem; color: var(--disabled-text); font-size: .7rem; font-weight: 600;
           letter-spacing: .08em; text-transform: uppercase; }
.toc ol { position: relative; margin: 0; padding: 0; list-style: none; max-height: 60vh; overflow-y: auto;
          border-left: 1px solid var(--line); }
.toc a { display: block; margin-left: -1px; padding: .2rem 0 .2rem .8rem; border-left: 2px solid transparent;
         color: var(--primary-text); font-weight: 600; line-height: 1.35; }
.toc li:not(:first-child):not(.toc-sub) > a { margin-top: .35rem; }
.toc .toc-sub > a { padding-left: 1.5rem; color: var(--disabled-text); font-size: .8rem; font-weight: 400; }
.toc a:hover { color: #f09b9b; }
.toc a.is-current { color: #f09b9b; border-left-color: #d24f4f; }
@media (max-width: 980px) { .toc { float: none; width: auto; margin: 0 0 1.2rem; } }
/* guides and the API page: the list is a column beside the text, sticky so it
   stays in view while you read (a sticky float would slide over the text) */
.toc-wrap { display: flex; align-items: flex-start; gap: 1.4rem; }
.toc-wrap > [data-toc] { flex: 1; min-width: 0; }
.toc-wrap > .toc { float: none; flex: none; margin: 0; position: sticky; top: calc(var(--topbar) + 1rem); }

/* entry pages: the info panel and the contents stick together on the right.
   The contents list takes whatever height is left and scrolls on its own. */
.entry-side {
  position: sticky; top: calc(var(--topbar) + 1rem); display: flex; flex-direction: column; gap: 1.3rem;
  max-height: calc(100vh - var(--topbar) - 2rem); overflow-y: auto;
}
.entry-side .info-panel { position: static; flex: none; }
/* the info panel always shows in full; only the contents list shrinks and scrolls
   (the whole side scrolls only if the panel alone is taller than the screen) */
.entry-side > [data-toc-slot] { display: flex; flex-direction: column; min-height: 0; }
.entry-side .toc { float: none; width: auto; margin: 0; display: flex; flex-direction: column; min-height: 0; }
.entry-side .toc ol { max-height: none; flex: 1 1 auto; min-height: 0; }
@media (max-width: 980px) { .entry-side { position: static; max-height: none; overflow: visible; } }

/* sortable table headers */
.th-sort { all: unset; cursor: pointer; }
.th-sort::after { content: " \2195"; color: var(--disabled-text); font-size: .8em; }
[aria-sort=ascending] > .th-sort::after { content: " \2191"; color: var(--primary-text); }
[aria-sort=descending] > .th-sort::after { content: " \2193"; color: var(--primary-text); }
.th-sort:focus-visible { outline: 2px solid #d24f4f; outline-offset: 2px; }

/* hover preview of a [[wiki link]]: the page's own browse card, floating */
.wiki-pop { position: fixed; z-index: 100; width: 340px; max-width: calc(100vw - 16px); pointer-events: none; display: flex; box-shadow: 0 8px 24px rgba(0,0,0,.5); border-radius: var(--radius); }
.prose .wiki-link img { width: 16px; height: 16px; vertical-align: -3px; margin-right: .25rem; }
/* .rule-h is used on a <div> elsewhere; on an <hr> the browser's own border
   shows through it, so clear it and keep the rule inside the text measure. */
.prose hr.rule-h { border: 0; max-width: 82ch; }

/* figures: a screenshot is not a 16px sprite, so it must not be pixelated ---- */
.md-figure { margin: 1.2rem 0; max-width: 82ch; }
.md-figure img, .md-img {
  display: block; width: 100%; height: auto; image-rendering: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.md-img { display: inline-block; width: auto; max-width: 100%; vertical-align: middle; }
.md-figure figcaption { margin-top: .4rem; color: var(--disabled-text); font-size: .82rem; }

/* video embeds - the first aspect-ratio rule in this file -------------------- */
.embed {
  position: relative; width: 100%; max-width: 820px; aspect-ratio: 16 / 9;
  margin: 1.2rem 0; overflow: hidden; background: #000;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.embed iframe { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border: 0; }
@supports not (aspect-ratio: 16 / 9) {
  .embed { height: 0; padding-top: 56.25%; }
}

.guide-preview { padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* the guide editor's picture panel ------------------------------------------ */
.gimg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .5rem; padding: .6rem .9rem; }
.gimg { padding: .3rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s); }
.gimg img { display: block; width: 100%; height: 64px; object-fit: contain; image-rendering: auto; }
.gimg code { display: block; margin-top: .25rem; font-size: .68rem; color: var(--disabled-text);
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gimg .btn { width: 100%; margin-top: .25rem; }

/* used in six views, never had a rule ---------------------------------------- */
.tag-off { color: var(--disabled-text); font-style: italic; font-size: .85rem; }
.field-list { margin: 0; padding-left: 1.1rem; }

/* import: pages skipped as already on the wiki */
.import-skipped { margin: 12px 0 18px; }
.import-skipped > summary { cursor: pointer; color: var(--secondary-text, inherit); padding: 6px 0; }
.import-skipped > summary:hover { color: var(--primary-text); }
.import-skipped .data { margin-top: 8px; }

/* import: the "pick the pages yourself" box */
.import-adv { margin: .9rem .9rem 0; padding-top: .6rem; border-top: 1px solid var(--line-soft); }
.import-adv > summary { cursor: pointer; width: max-content; color: var(--secondary-text); font-size: .88rem; }
.import-adv > summary:hover { color: var(--primary-text); }
.import-adv-note { margin: .5rem 0 0; color: var(--disabled-text); font-size: .82rem; }
.import-adv .field { padding-inline: 0; }

/* API tokens on /admin */
.section-note { color: var(--secondary-text); margin: -4px 0 14px; max-width: 70ch; }
.token-once small { display: block; color: var(--secondary-text); margin-top: 6px; }
.token-value {
  display: block; width: 100%; max-width: 100%; margin-top: 8px; box-sizing: border-box;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85rem;
}
.data tr.is-revoked td { color: var(--disabled-text); }

/* Markdown tables (guides, descriptions): scroll sideways on a phone rather
   than push the page wider. */
.md-table { overflow-x: auto; margin: .5rem 0 1.2rem; }
.md-table table.data { margin: 0; }
.md-table table.data, table.data.fit { width: auto; }   /* columns as wide as their text, not the page */
.md-table td, .md-table th { vertical-align: top; }
/* On a phone a column is never squeezed under ~7em; the table scrolls instead. */
@media (max-width: 760px) { .md-table td, .md-table th { min-width: 7em; } }

/* editor area ------------------------------------------------------------- */

/* wide tables scroll on their own rather than pushing the page sideways */
.table-scroll { overflow-x: auto; }
.table-scroll table.data { min-width: 560px; }

/* Create a page: one card per kind, in the order of the top menu */
.create-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .8rem;
  margin: 0; padding: 0; list-style: none;
}
.create-card {
  display: flex; flex-direction: column; gap: .5rem;
  padding: .9rem 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.create-card--tool { background: var(--background); border-style: dashed; }
.create-card-head { display: flex; align-items: center; gap: .55rem; }
.create-card-head strong { font-size: 1.02rem; }
.create-card-head .type-icon { width: 26px; height: 26px; object-fit: contain; }
.create-card-head .n { margin-left: auto; color: var(--disabled-text); font-size: .8rem; }
.create-card-sub { margin: 0; color: var(--disabled-text); font-size: .84rem; flex: 1; }
.create-card-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

/* Reincarnation pool */
.toolbar-search {
  min-width: 0; width: 200px; padding: .35rem .6rem;
  background: var(--background); border: 1px solid var(--line); border-radius: var(--radius-s);
  color: var(--primary-text); font: inherit; font-size: .88rem;
}
.toolbar-search:focus { outline: none; border-color: #6a3030; }
.bulk-bar {
  position: sticky; top: var(--topbar); z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding: .5rem; margin-bottom: .5rem;
  background: var(--header); border: 1px solid var(--line); border-radius: var(--radius);
}
.bulk-bar .spacer { margin-left: auto; }
.bulk-verdict { display: inline-flex; align-items: center; gap: .4rem; color: var(--secondary-text); font-size: .85rem; }
.bulk-bar select, .bulk-table select {
  padding: .25rem .5rem; background: var(--background); border: 1px solid var(--line);
  border-radius: var(--radius-s); color: var(--primary-text); font: inherit; font-size: .85rem;
}
.bulk-note { color: var(--disabled-text); font-size: .85rem; }
.bulk-dirty { color: var(--gold); font-size: .85rem; }
table.bulk-table td { padding-block: .3rem; }
/* Feedback: one panel per report */
.report-card { margin: 0 0 .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.report-card.is-done { opacity: .65; }
.report-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line-soft); }
.report-title { flex: 1 1 14rem; min-width: 0; margin: 0; font-size: 1.02rem; overflow-wrap: anywhere; }
.report-when { color: var(--disabled-text); font-size: .82rem; white-space: nowrap; }
.report-text { padding: .8rem 1rem; max-width: 80ch; color: var(--secondary-text); overflow-wrap: anywhere; }
.report-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .6rem 1rem; border-top: 1px solid var(--line-soft); }
.report-foot form.inline { margin-left: auto; }
.report-page { min-width: 0; color: var(--secondary-text); font-size: .88rem; overflow-wrap: anywhere; }
.report-page b { color: #d87a7a; font-weight: 600; }
/* Drafts: "Whole mod…" opens the publish/delete-all form beside it */
.mod-bulk[open] { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.mod-bulk > summary { display: inline-block; list-style: none; cursor: pointer; }
.mod-bulk > summary::-webkit-details-marker { display: none; }
.mod-bulk[open] > summary { border-color: #6a3030; }
.bulk-table th.bulk-tick, .bulk-table td.bulk-tick { width: 1%; text-align: center; white-space: nowrap; }
/* tick boxes drawn like the box on a .toggle filter */
.bulk-table .bulk-tick input {
  appearance: none; margin: 0; vertical-align: middle; cursor: pointer;
  width: 1.05rem; height: 1.05rem; border-radius: 4px;
  border: 1px solid var(--disabled); background: var(--background) center / 80% no-repeat;
  transition: background-color .12s ease, border-color .12s ease;
}
.bulk-table .bulk-tick input:hover { border-color: #d24f4f; }
.bulk-table .bulk-tick input:focus-visible { outline: 2px solid #d24f4f; outline-offset: 2px; }
.bulk-table .bulk-tick input:checked,
.bulk-table .bulk-tick input:indeterminate { background-color: #b43a3a; border-color: #d24f4f; }
.bulk-table .bulk-tick input:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.6 6.3l2.2 2.2 4.6-4.9' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.bulk-table .bulk-tick input:indeterminate {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6h6' stroke='white' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}
.bulk-table tr:has(input[form="drafts-sel"]:checked) td { background: rgba(180,58,58,.09); }
.bulk-name { display: flex; align-items: center; gap: .55rem; }
.bulk-name a:hover { text-decoration: underline; }
.bulk-table tr.is-changed td { background: rgba(214,174,34,.07); }
.bulk-table tr.is-changed td:first-child { box-shadow: inset 3px 0 0 var(--gold); }

@media (max-width: 760px) {
  .toolbar-search { width: 100%; order: 5; }
  .bulk-bar { position: static; }
}

.notfound { text-align: center; padding: 1rem 0; }
.notfound img { max-width: 240px; height: auto; border-radius: 50%; }

/* Site stats page: every class starts with st- so it can't clash with the entry .card styles. */
.st-range { display: flex; gap: .4rem; margin: 0 0 1.2rem; }
.st-range a { padding: .35rem .9rem; border: 1px solid var(--line-soft); border-radius: var(--radius-s); color: var(--secondary-text); font-size: .88rem; }
.st-range a.on { border-color: var(--primary); color: var(--primary-text); background: rgba(180,58,58,.18); }
.st-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; margin-bottom: .8rem; }
.st-tiles div { border: 1px solid var(--line-soft); border-radius: var(--radius); padding: .8rem 1rem; }
.st-tiles b { display: block; font-size: 2.2rem; line-height: 1.1; font-weight: 700; color: var(--primary-text); }
.st-tiles span { display: block; margin-top: .3rem; color: var(--disabled-text); font-size: .74rem; letter-spacing: .07em; text-transform: uppercase; }
.st-row { display: grid; gap: 1.2rem; margin-bottom: 1.2rem; }
.st-row--main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.st-row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1000px) {
  .st-tiles { grid-template-columns: repeat(2, 1fr); }
  .st-row--main, .st-row--2 { grid-template-columns: minmax(0, 1fr); }
}
.st-panel { border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.2rem; min-width: 0; }
.st-row > .st-panel { margin-bottom: 0; }
.st-panel--col { display: flex; flex-direction: column; }
.st-panel h2 { margin: 0 0 .9rem; font-size: 1rem; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.st-legend { font-size: .76rem; font-weight: 400; color: var(--disabled-text); }
.st-legend i { display: inline-block; width: .65rem; height: .65rem; border-radius: 2px; margin: 0 .3rem 0 .8rem; }
.k-v { background: var(--primary); } .k-u { background: var(--gold); }
.st-chart { width: 100%; height: auto; display: block; }
.st-chart text { fill: var(--disabled-text); font-size: 12px; }
.st-grid { stroke: var(--line-soft); stroke-width: 1; }
.st-b { fill: var(--primary); opacity: .85; }
.st-b:hover { opacity: 1; }
.st-l { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; }
.st-dot { fill: var(--gold); }
.st-map { aspect-ratio: 2 / 1; width: 100%; }
.st-hbar { display: grid; grid-template-columns: minmax(0, 42%) 1fr auto; gap: .6rem; align-items: center; margin: .45rem 0; font-size: .88rem; }
.st-hbar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-hbar-t { background: var(--line-soft); border-radius: 3px; height: .5rem; overflow: hidden; }
.st-hbar-t i { display: block; height: 100%; background: var(--g-bar); border-radius: 3px; }
.st-hbar-n { color: var(--secondary-text); font-variant-numeric: tabular-nums; min-width: 1.5rem; text-align: right; }
.st-donuts { display: flex; flex-wrap: wrap; justify-content: space-around; align-items: center; gap: 1.2rem; flex: 1; }
.st-donuts figure { margin: 0; text-align: center; }
.st-donuts figcaption { margin-top: .8rem; max-width: 10rem; color: var(--secondary-text); font-size: .85rem; }
.st-donuts figcaption b { display: block; color: var(--primary-text); font-size: 1rem; }
.st-donut { width: 9.5rem; height: 9.5rem; border-radius: 50%; display: grid; place-items: center; position: relative; margin: 0 auto; }
.st-donut::before { content: ''; position: absolute; inset: 1.1rem; border-radius: 50%; background: var(--background); }
.st-donut b { position: relative; font-size: 1.8rem; }
.st-bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; }
.st-bars span { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.st-bars i { display: block; width: 100%; background: var(--g-rail); opacity: .85; border-radius: 3px 3px 0 0; }
.st-bars span:hover i { opacity: 1; }
.st-bars em { font-style: normal; font-size: .72rem; color: var(--disabled-text); margin-top: .3rem; height: 1em; }
.st-bars--24 { gap: 3px; }

/* Discord invite button (home row, and full-width in the report side panel) */
.btn-discord {
  display: inline-block; padding: .5rem 1.1rem; border: 0; border-radius: var(--radius-s);
  background: #5865f2; color: #fff; font-weight: 600; text-align: center; text-decoration: none;
}
.btn-discord:hover { background: #4752c4; color: #fff; }
.info-section .btn-discord { display: block; margin: .8rem .9rem .9rem; padding: .75rem 1rem; border-radius: var(--radius); }
/* Ko-fi widget (home row): its injected sheet is all !important, so these have to be too */
.actions .btn-container { display: flex !important; }
.actions a.kofi-button { display: flex !important; align-items: center; justify-content: center; font-size: 17px !important; }
.actions span.kofitext { display: inline-flex; align-items: center; }
.actions .kofitext img.kofiimg { margin-bottom: 0 !important; }
.report-side { align-self: stretch; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.discord-widget { flex: 1; width: 100%; min-height: 260px; border: 0; border-radius: var(--radius); }

/* build planner ----------------------------------------------------------- */
/* The build on the left, what it leads to on the right. The right side lays
   its cards out in as many columns as the screen has room for. */

.plan { display: grid; grid-template-columns: clamp(290px, 24vw, 400px) minmax(0, 1fr); gap: 1.4rem; align-items: start; }
/* No overflow here: it would clip the search lists that drop out of the
   panel. A long build scrolls inside .plan-own instead. */
.plan-build { position: sticky; top: calc(var(--topbar) + 1rem); }
.plan-build fieldset.panel { margin-bottom: .7rem; }
.plan-build fieldset.panel:last-child { margin-bottom: 0; }
/* buttons here are <button>s, which don't take the page font on their own,
   and .form gives every .btn a margin meant for the editor */
.plan button { font-family: inherit; cursor: pointer; }
.plan .btn { margin: 0; }
.plan-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .7rem; }
.plan-actions .btn { flex: 1 1 auto; padding-inline: .7rem; white-space: nowrap; }
.plan .notice { margin: 0 0 .7rem; }
.plan-hint { display: block; margin: .35rem .9rem 0; color: var(--disabled-text); font-size: .76rem; line-height: 1.4; }
.plan .picker { margin: .6rem .9rem 0; }

.plan-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; padding: .6rem .9rem 0; }
.plan-stats label { color: var(--secondary-text); font-size: .82rem; }
.plan-stats input { margin-top: .2rem; }

.plan-race { display: flex; align-items: center; gap: .7rem; padding: .6rem .9rem 0; }
.plan-race .card-icon { width: 52px; height: 52px; }
.plan-race-name { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; font-weight: 600; }
.plan-race-name a:hover, .plan-own .chip a:hover, .plan-ref a:hover { text-decoration: underline; }

/* 30rem is about what sits above it in the panel */
.plan-own { padding: 0 .9rem; max-height: max(9rem, calc(100vh - var(--topbar) - 30rem)); overflow-y: auto; }
.plan-own-k {
  margin: .8rem 0 .35rem;
  color: var(--disabled-text); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.plan-own .picker-chosen { margin: 0; }
.plan-own .empty { margin: .6rem 0 0; font-size: .88rem; }

.plan-next > .section-head:first-child { margin-top: 0; }
.plan-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: .6rem;
  list-style: none; margin: 0; padding: 0;
}

.plan-card {
  display: flex; flex-direction: column; gap: .55rem;
  padding: .75rem .85rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
/* everything it names is in the build */
.plan-card--all { border-color: rgba(70,175,70,.45); background: linear-gradient(160deg, rgba(70,175,70,.09), var(--surface) 55%); }
.plan-card-head { display: flex; align-items: center; gap: .7rem; }
.plan-card-head:hover b { color: #f09b9b; }
.plan-icon {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  background: var(--background); border: 1px solid var(--line-soft); border-radius: var(--radius-s);
}
.plan-icon img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; display: block; }
.plan-card-title { min-width: 0; display: flex; flex-direction: column; gap: .25rem; }
.plan-card-title b { font-weight: 600; line-height: 1.25; }
.plan-badges { display: flex; flex-wrap: wrap; gap: .3rem; }

.plan-row { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .45rem; color: var(--secondary-text); font-size: .9rem; }
.plan-k { color: var(--disabled-text); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.plan-reqs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; color: var(--secondary-text); font-size: .9rem; }
.plan-reqs li { position: relative; padding-left: .85rem; }
.plan-reqs li::before { content: ""; position: absolute; left: 0; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--scroller); }

/* a page named in a requirement: solid and green when it is in the build,
   dashed with a "+" when it could be */
.plan-ref {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: 0 .4rem; line-height: 1.5;
  background: var(--background); border: 1px solid var(--line); border-radius: var(--radius-s);
  color: #d87a7a;
}
.plan-ref .req-icon { margin-right: .25rem; }
.plan-ref.have { color: #6fc96f; border-color: rgba(70,175,70,.4); background: rgba(70,175,70,.1); }
.plan-ref.miss { color: var(--primary-text); border-style: dashed; border-color: var(--scroller); }
.plan-add { min-width: 1.3rem; margin-right: -.3rem; padding: 0; border: 0; background: none; color: var(--disabled-text); font-size: 1rem; font-weight: 700; line-height: 1; }
.plan-add:hover { color: var(--positive); }

.plan-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-top: auto; padding-top: .55rem; border-top: 1px solid var(--line-soft); }
.plan-more { margin-top: .75rem; }
.plan-more > summary { cursor: pointer; width: fit-content; margin-bottom: .75rem; color: var(--secondary-text); font-size: .9rem; }
.plan-more > summary:hover { color: var(--primary-text); }
.plan-more[open] > summary { display: none; }
.plan-tally { flex: 1; min-width: 0; display: flex; align-items: center; gap: .5rem; color: var(--disabled-text); font-size: .82rem; }
.plan-bar { display: block; width: 3rem; flex: none; }
.plan-card--all .plan-tally { color: var(--positive); }
.plan-card--all .plan-bar i { background: var(--positive); }

@media (max-width: 980px) {
  .plan { grid-template-columns: minmax(0, 1fr); }
  .plan-build { position: static; }
  .plan-own { max-height: none; }
}
@media (max-width: 760px) {
  .plan input { font-size: 16px; }   /* under 16px iOS zooms in on focus */
  .plan-add { min-width: 1.8rem; }
}

/* editor: one box per way of obtaining, "or" between them */
.req-list { counter-reset: way; margin-top: .6rem; }
.req-way { counter-increment: way; position: relative; padding: .6rem .75rem .7rem; background: var(--background); border: 1px solid var(--line); border-radius: var(--radius); }
.req-way + .req-way { margin-top: 2rem; }
.req-way + .req-way::before {
  content: "or"; position: absolute; top: -1.6rem; left: 0; right: 0; text-align: center;
  color: var(--secondary-text); font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.req-way-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; margin-bottom: .45rem; color: var(--secondary-text); font-size: .9rem; }
.req-way-head b { color: var(--primary-text); }
.req-way-head b::before { content: "Way " counter(way); }
.req-how { flex: 1; min-width: 12rem; }
.req-way-head label { display: flex; align-items: center; gap: .35rem; margin: 0; white-space: nowrap; font-size: .85rem; }
.req-way-head label[hidden] { display: none; }
.req-way-head label input { width: auto; }
.form #req-add { margin: .7rem 0 0; }

/* a page's ways of obtaining, stacked with "or" between, as wide as the longest */
.ways-note { margin: 0 0 .6rem; color: var(--secondary-text); font-size: .9rem; }
.ways { display: inline-flex; flex-direction: column; gap: .3rem; min-width: min(100%, 22rem); max-width: 100%; }
.way { padding: .6rem .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.way-or { align-self: center; color: var(--secondary-text); font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

/* tier lists (admin/tiers) ------------------------------------------------- */

.tl-new, .tl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.tl-new input, .tl-bar input[type=text] {
  padding: .45rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface-2); color: var(--primary-text); font: inherit;
}
.tl-bar .spacer { flex: 1; }
.tl-lists { list-style: none; padding: 0; }
.tl-lists li { padding: .45rem 0; border-bottom: 1px solid var(--line-soft); }
.tl-lists small { color: var(--secondary-text); margin-left: .6rem; }
.tl-board { display: grid; gap: 2px; background: #000; border: 1px solid var(--line); }
.tl-row { display: flex; min-height: 72px; background: #1a1a1a; }
.tl-label {
  flex: none; width: 110px; display: flex; align-items: center; justify-content: center; padding: .3rem;
  color: #111; font-weight: 600; font-size: 1.3rem; text-align: center; word-break: break-word; outline: none;
}
.tl-items { flex: 1; display: flex; flex-wrap: wrap; align-content: flex-start; }
.tl-tools { flex: none; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 0 .3rem; }
.tl-tools input { width: 26px; height: 20px; padding: 0; border: 0; background: none; cursor: pointer; }
.tl-tools button { background: none; border: 0; color: var(--secondary-text); cursor: pointer; font-size: .75rem; }
.tl-tools button:hover { color: var(--primary-text); }
.tl-icon { width: 64px; height: 64px; margin: 4px; object-fit: contain; cursor: grab; image-rendering: pixelated; }
.tl-icon.is-dragging { display: none; }
/* where the dragged icon would land */
.tl-ghost {
  width: 64px; height: 64px; margin: 4px; object-fit: contain; image-rendering: pixelated;
  background: rgba(255,255,255,.1); outline: 2px dashed rgba(255,255,255,.7); outline-offset: -2px;
  opacity: .6; pointer-events: none;
}
.tl-icon[hidden] { display: none; }
.tl-drop.is-over { background: rgba(255,255,255,.06); }
.tl-dd { display: contents; }
.tl-hint { margin: 1.2rem 0 .5rem; color: var(--secondary-text); font-size: .85rem; }
.tl-pool { min-height: 80px; padding: .3rem .6rem .6rem; border: 1px dashed var(--line); border-radius: var(--radius); }
.tl-pool.is-over { background: rgba(255,255,255,.04); border-color: #6a3030; }
.tl-pool-items { display: flex; flex-wrap: wrap; }

/* to-do board (admin/todo) ------------------------------------------------- */

.todo-board { display: flex; align-items: flex-start; gap: .7rem; overflow-x: auto; padding-bottom: .8rem; min-height: 55vh; }   /* the whole strip is a drop target while dragging */
.todo-col {
  flex: 0 0 272px; display: flex; flex-direction: column; gap: .5rem;
  max-height: calc(100vh - var(--topbar) - 12rem);
  padding: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.todo-col.is-dragging { opacity: .4; }
.todo-col--done { border-top: 3px solid var(--positive); }
.todo-col--new { background: none; border-style: dashed; }
.todo-col-head { display: flex; align-items: center; gap: .15rem; cursor: grab; }
.todo-col-name {
  flex: 1; min-width: 0; padding: .25rem .35rem; border: 1px solid transparent; border-radius: var(--radius-s);
  background: none; color: var(--primary-text); font: inherit; font-weight: 600; font-size: .95rem; overflow-wrap: anywhere;
}
div.todo-col-name { cursor: pointer; }
.todo-col-name:hover { border-color: var(--line); }
.todo-col-name:focus { outline: none; border-color: #6a3030; background: var(--background); }
.todo-count { color: var(--disabled-text); font-size: .8rem; padding: 0 .3rem; }
.todo-donemark { color: var(--positive); font-size: .9rem; }
.todo-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 1.9rem; height: 1.9rem; padding: 0;
  border: 0; border-radius: var(--radius-s); background: none;
  color: var(--disabled-text); font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.todo-icon:hover { color: var(--primary-text); background: var(--surface-2); }
/* line icons (icon() in views/todo.php), drawn in the text colour */
.todo-svg { flex: none; width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.todo-svg circle { fill: currentColor; stroke: none; }

/* the "…" menu of a list: a native popover, placed by the page */
.todo-menu {
  inset: auto; margin: 0; padding: .3rem; width: 230px;
  background: var(--header); color: var(--primary-text); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.todo-menu:popover-open { display: flex; flex-direction: column; }
.todo-menu-item {
  padding: .45rem .6rem; border: 0; border-radius: var(--radius-s); background: none;
  color: inherit; font: inherit; font-size: .9rem; text-align: left; cursor: pointer;
}
.todo-menu-item:hover, .todo-menu-item:focus-visible { background: var(--surface-2); outline: none; }
.todo-menu-item--danger { color: var(--negative); }
.todo-menu small { padding: 0 .6rem .4rem; color: var(--disabled-text); font-size: .78rem; line-height: 1.35; }

.todo-cards { display: flex; flex-direction: column; gap: .4rem; min-height: 3rem; overflow-y: auto; }
.todo-card {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s);
  cursor: grab; font-size: .9rem; overflow: hidden; overflow-wrap: anywhere;
}
.todo-card:hover { border-color: #6a3030; }
.todo-card.is-dragging { opacity: .4; }
.todo-card-in { padding: .5rem .6rem; }
.todo-cover { height: 32px; background-color: var(--line); }
.todo-cover--img { height: 120px; background-size: cover; background-position: center; }
.todo-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; margin-bottom: .4rem; }
.todo-chip {
  display: inline-flex; align-items: center; max-width: 100%; height: 1.15rem; padding: 0 .5rem;
  border-radius: 3px; font-size: .72rem; font-weight: 600; line-height: 1; overflow: hidden; white-space: nowrap;
}
.todo-chip--empty { width: 2.4rem; padding: 0; }   /* no text: a plain colour pill, as tall as the others */
.todo-card .todo-chip { cursor: pointer; }
/* click a label on a card and every label shrinks to a thin bar with no text */
.todo-board.labels-small .todo-chip { width: 2.4rem; height: .5rem; padding: 0; font-size: 0; }
.todo-card-meta { display: flex; align-items: center; gap: .6rem; margin-top: .4rem; color: var(--secondary-text); font-size: .78rem; }
.todo-card-meta:empty { display: none; }
.todo-badge { display: inline-flex; align-items: center; gap: .25rem; }
.todo-badge .todo-svg { width: .95rem; height: .95rem; }
.todo-badge--done { padding: 0 .3rem; border-radius: 3px; background: var(--positive); color: #fff; }
.todo-avatars { display: flex; margin-left: auto; }
.todo-avatar {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 1.6rem; height: 1.6rem; margin-left: -.35rem; border: 2px solid var(--surface-2); border-radius: 50%;
  color: #fff; font-size: .62rem; font-weight: 700; letter-spacing: .02em;
}
.todo-avatars .todo-avatar:first-child { margin-left: 0; }
.todo-add input, .todo-col--new input {
  width: 100%; padding: .4rem .5rem; border: 1px solid transparent; border-radius: var(--radius-s);
  background: none; color: var(--primary-text); font: inherit; font-size: .88rem;
}
.todo-add input:hover, .todo-col--new input:hover { background: var(--surface-2); }
.todo-add input:focus, .todo-col--new input:focus { outline: none; border-color: #6a3030; background: var(--background); }

/* the open card */
.todo-dialog, .todo-ask {
  width: min(640px, 94vw); max-height: 92vh; padding: 0; overflow-y: auto; color: var(--primary-text);
  background: var(--header); border: 1px solid var(--line); border-radius: var(--radius);
}
.todo-dialog::backdrop, .todo-ask::backdrop { background: rgba(0,0,0,.6); }
/* the panel that stands in for confirm() and alert() */
.todo-ask { width: min(380px, 94vw); padding: 1.2rem; }
.todo-ask p { margin: 0 0 1.1rem; line-height: 1.45; overflow-wrap: anywhere; }
.todo-ask-btns { display: flex; justify-content: flex-end; gap: .5rem; }
.todo-ask .btn { display: inline-block; font: inherit; font-size: .85rem; cursor: pointer; }
.todo-ask [hidden] { display: none; }
.todo-dlg { padding-bottom: 1rem; }
.todo-dlg:focus { outline: none; }   /* the dialog's own starting focus, so no button shows a ring when it opens */
.todo-dlg .todo-cover { height: 88px; }
.todo-dlg .todo-cover--img { height: 190px; }
.todo-dlg h4 { margin: 0 0 .4rem; color: var(--secondary-text); font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.todo-dlg-top { display: flex; align-items: center; justify-content: space-between; padding: .7rem 1rem 0; }
.todo-dlg-list { padding: .15rem .55rem; border-radius: var(--radius-s); background: var(--surface-2); color: var(--secondary-text); font-size: .82rem; }
.todo-dlg-title {
  display: block; width: calc(100% - 2rem); margin: .5rem 1rem 0; padding: .3rem .5rem;
  border: 1px solid transparent; border-radius: var(--radius-s); background: none;
  color: var(--primary-text); font: inherit; font-size: 1.4rem; font-weight: 700;
}
.todo-dlg-title:hover { border-color: var(--line); }
.todo-dlg-title:focus { outline: none; border-color: #6a3030; background: var(--background); }
.todo-dlg-actions { display: flex; gap: .4rem; margin: .6rem 1rem 0; }
.todo-act {
  padding: .35rem .85rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface-2);
  color: var(--secondary-text); font: inherit; font-size: .86rem; cursor: pointer;
}
.todo-act:hover, .todo-act.on { border-color: #6a3030; color: var(--primary-text); }
#todo-d-panel { margin: .7rem 1rem 0; }
.todo-panel { padding: .7rem .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.todo-dlg-summary { display: flex; flex-wrap: wrap; gap: .8rem 1.6rem; margin: .9rem 1rem 0; }
.todo-dlg-summary[hidden] { display: none; }
.todo-dlg-summary > div { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.todo-dlg-summary h4 { flex-basis: 100%; margin-bottom: .1rem; }
.todo-dlg-summary .todo-avatar { width: 2rem; height: 2rem; margin: 0; border-color: var(--header); font-size: .75rem; }
.todo-dlg .todo-chip { height: 1.7rem; padding: 0 .75rem; font-size: .85rem; }
.todo-dlg .todo-chip--empty { width: 3rem; padding: 0; }
.todo-dlg-section { margin: 1.1rem 1rem 0; }
.todo-dlg-body {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--background);
  color: var(--primary-text); font: inherit; font-size: .92rem; line-height: 1.5; resize: vertical;
}
.todo-dlg-body:focus { outline: none; border-color: #6a3030; }
.todo-dlg .btn { display: inline-block; font: inherit; font-size: .85rem; cursor: pointer; }
.todo-dlg .btn--primary { font-weight: 600; }
.todo-dlg-foot { display: flex; align-items: center; justify-content: space-between; margin: 1.3rem 1rem 0; }
.todo-meta { color: var(--disabled-text); font-size: .8rem; }

/* pickers inside the open card */
.todo-lrow { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
/* tick boxes drawn like the ones on the Drafts page (.bulk-tick) */
.todo-lrow input, .todo-item input[type=checkbox] {
  appearance: none; flex: none; margin: 0; width: 1.05rem; height: 1.05rem; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--disabled); background: var(--background) center / 80% no-repeat;
  transition: background-color .12s ease, border-color .12s ease;
}
.todo-lrow input:hover, .todo-item input[type=checkbox]:hover { border-color: #d24f4f; }
.todo-lrow input:focus-visible, .todo-item input[type=checkbox]:focus-visible { outline: 2px solid #d24f4f; outline-offset: 2px; }
.todo-lrow input:checked, .todo-item input[type=checkbox]:checked {
  background-color: #b43a3a; border-color: #d24f4f;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.6 6.3l2.2 2.2 4.6-4.9' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.todo-lrow .todo-chip { flex: 1; width: auto; }
.todo-lform { margin: .2rem 0 .7rem 1.5rem; padding: .6rem; background: var(--background); border: 1px solid var(--line); border-radius: var(--radius-s); }
.todo-lform > input, .todo-additem input, .todo-pageadd input {
  width: 100%; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--background);
  color: var(--primary-text); font: inherit; font-size: .9rem;
}
.todo-lform > input:focus, .todo-additem input:focus, .todo-pageadd input:focus { outline: none; border-color: #6a3030; }
.todo-page { display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; font-size: .92rem; }
.todo-page a { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.todo-pageadd { margin-top: .5rem; }
.todo-suggest { margin-top: .3rem; max-height: 14rem; overflow-y: auto; background: var(--background); border: 1px solid var(--line); border-radius: var(--radius-s); }
.todo-suggest[hidden] { display: none; }
.todo-suggest-row {
  display: block; width: 100%; padding: .45rem .6rem; border: 0; background: none; color: var(--primary-text);
  font: inherit; font-size: .88rem; text-align: left; cursor: pointer;
}
.todo-suggest-row:hover, .todo-suggest-row:focus-visible { background: var(--surface-2); outline: none; }
.todo-pagelink {
  padding: .25rem .65rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface-2);
  color: var(--primary-text); font-size: .85rem; text-decoration: none;
}
.todo-pagelink:hover { border-color: #6a3030; }
.todo-lform-actions { display: flex; gap: .4rem; }
.todo-swatches { display: flex; flex-wrap: wrap; gap: .35rem; margin: .6rem 0; }
.todo-panel > .todo-swatches { margin-top: 0; }
.todo-swatch { width: 2.1rem; height: 1.5rem; padding: 0; border: 2px solid transparent; border-radius: var(--radius-s); cursor: pointer; }
.todo-swatch:hover { border-color: var(--secondary-text); }
.todo-swatch.on { border-color: #fff; }
/* the swatch that opens the colour picker: a colour wheel until a custom colour is chosen */
.todo-swatch--custom { position: relative; display: block; cursor: pointer; background: conic-gradient(#f33, #ff3, #3f3, #3ff, #33f, #f3f, #f33); }
.todo-swatch--custom input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.todo-mrow {
  display: flex; align-items: center; gap: .6rem; width: 100%; padding: .35rem .4rem;
  border: 0; border-radius: var(--radius-s); background: none; color: var(--primary-text);
  font: inherit; font-size: .9rem; text-align: left; cursor: pointer;
}
.todo-mrow:hover { background: var(--surface-2); }
.todo-mrow .todo-avatar { margin: 0; border-color: transparent; }
.todo-tick { margin-left: auto; color: var(--positive); }

/* checklist */
.todo-check-head { display: flex; align-items: baseline; gap: .6rem; }
.todo-check-head h4 { margin: 0; }
.todo-pct { color: var(--secondary-text); font-size: .8rem; }
.todo-bar { height: 8px; margin: .45rem 0 .6rem; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.todo-bar i { display: block; height: 100%; background: var(--info); transition: width .2s; }
.todo-bar--done i { background: var(--positive); }
.todo-item { display: flex; align-items: center; gap: .5rem; padding: .1rem 0; }
.todo-item-text {
  flex: 1; min-width: 0; padding: .3rem .4rem; border: 1px solid transparent; border-radius: var(--radius-s);
  background: none; color: var(--primary-text); font: inherit; font-size: .92rem;
}
.todo-item-text:hover { background: var(--surface-2); }
.todo-item-text:focus { outline: none; border-color: #6a3030; background: var(--background); }
.todo-item.is-done .todo-item-text { color: var(--disabled-text); text-decoration: line-through; }
.todo-additem input { margin-top: .4rem; }
.tl-kinds { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
