/*
 * The website. Same world as the game, not the same layout.
 *
 * ⚠️ IT SHARES THE GAME'S TYPEFACE, PALETTE AND PIXEL RULES ON PURPOSE — Alessandro:
 * *"our website has to be with our pixel art style, we need to be consistent, so also our
 * website is unique."* A generic marketing page in front of a hand-drawn pixel game would
 * make the game look like a template too.
 *
 * ⚠️ BUT IT IS A SEPARATE STYLESHEET, NOT `app.css`. The app's CSS is 2,400 lines of game
 * interface — scan cards, stat bars, overlays — and none of it is a landing page. Importing
 * it would ship the whole interface to every visitor and couple the two: a spacing tweak for
 * a phone card would move the homepage. The five tokens below are duplicated deliberately,
 * and they are the only thing the two files share.
 */

@font-face {
  font-family: "ScanlingsPixel";
  src: url("/font/scanlings-pixel.ttf") format("truetype");
  font-display: block;
}

:root {
  --bg: #14161a;
  --panel: #101216;
  --line: #2e3238;
  --fg: #e8e6df;
  --dim: #8a8f98;
  --accent: #c8b06a;
  --type: 18px;
  color-scheme: dark;
}

/*
 * ⚠️ COMMITTED TO DARK, unlike the app, which themes. The site is a poster for one world
 * rather than an interface someone lives in, and the creatures are drawn to sit on this
 * ground. A light homepage would need every sprite re-judged against it.
 */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "ScanlingsPixel", ui-monospace, Menlo, monospace;
  font-size: var(--type);
  line-height: 1.6;
  /* The whole page is a pixel grid; never let the browser smooth our glyphs. */
  -webkit-font-smoothing: none;
  font-smooth: never;
}

.wrap { max-width: 940px; margin: 0 auto; padding: 0 20px; }

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

header { padding: 56px 0 8px; text-align: center; }

h1 {
  font-size: 44px;
  margin: 0 0 6px;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.tagline { margin: 0 0 4px; font-size: 21px; }
.sub { margin: 0; color: var(--dim); }

/*
 * The creature parade. ⚠️ `image-rendering: pixelated` is load-bearing: without it the
 * browser bilinearly smooths a 3x sprite and every edge turns to mush — the one thing this
 * whole art style exists to avoid.
 */
.parade {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 8px 20px;
  margin: 28px 0 8px;
  min-height: 120px;
}

/*
 * ⚠️ ONE RULE DERIVES EVERYTHING FROM `--s`, so a media query can resize the whole parade
 * without any value drifting out of step with another. `--w`, `--h` and `--n` are written
 * onto each element by the build.
 *
 * ⚠️ INTEGER SCALES ONLY. 2 and 1, never 1.5 — a fractional scale resamples pixel art and
 * turns every hand-placed edge to mush, which is the whole thing this style exists to avoid.
 */
.creature {
  --s: 2;
  width: calc(var(--w) * var(--s));
  height: calc(var(--h) * var(--s));
  background-size: calc(var(--w) * var(--s) * var(--n)) calc(var(--h) * var(--s));
  background-repeat: no-repeat;
  background-position-x: 0;
  image-rendering: pixelated;
  animation-name: parade;
  animation-iteration-count: infinite;
}

/*
 * The end position is the full strip width, so `steps(n)` lands on each frame exactly. It
 * reads `--s` too, which is why changing the scale cannot desync the animation from the art.
 */
@keyframes parade {
  from { background-position-x: 0; }
  to { background-position-x: calc(-1 * var(--w) * var(--s) * var(--n)); }
}

@media (prefers-reduced-motion: reduce) {
  .creature { animation: none !important; }
}

/* ---------------------------------------------------------------- the button */

.play {
  display: inline-block;
  margin: 20px 0 8px;
  padding: 14px 34px;
  font: inherit;
  font-size: 21px;
  color: #14161a;
  background: var(--accent);
  border: 2px solid var(--accent);
  text-decoration: none;
  letter-spacing: 0.06em;
}

.play:hover, .play:focus-visible { background: #e0c87e; border-color: #e0c87e; }
.play:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }

.free { color: var(--dim); font-size: 15px; margin: 0 0 8px; }

/* ---------------------------------------------------------------- sections */

section { border-top: 1px solid var(--line); margin-top: 44px; padding-top: 26px; }

h2 {
  font-size: var(--type);
  margin: 0 0 16px;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h3 { font-size: var(--type); margin: 0 0 6px; }

p { margin: 0 0 14px; }
p:last-child { margin-bottom: 0; }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.cols p { color: var(--dim); }

/* The live counter. Tabular so it does not jiggle when it updates. */
.count {
  font-size: 34px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- the beta notice */

/*
 * ⚠️ A PANEL, NOT A FOOTNOTE, and that is the point of it. Alessandro wants the beta said
 * plainly and in advance: creatures WILL change, balance WILL move. Saying so before it
 * happens is what makes it a change rather than a betrayal — so it must not read like
 * small print anyone can miss.
 */
.beta {
  border: 1px solid var(--accent);
  background: var(--panel);
  padding: 20px 22px;
}

.beta h2 { margin-bottom: 10px; }
.beta ul { margin: 0; padding-left: 1.2em; color: var(--dim); }
.beta li { margin-bottom: 8px; }
.beta li:last-child { margin-bottom: 0; }
.beta strong { color: var(--fg); font-weight: normal; }

/* ---------------------------------------------------------------- the roadmap */

.road { display: grid; gap: 18px; }

.stage {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 16px 18px;
}

.stage.now { border-color: var(--accent); }

.stage h3 { color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; }
.stage .when { color: var(--dim); font-size: 15px; }
.stage ul { margin: 10px 0 0; padding-left: 1.2em; color: var(--dim); }
.stage li { margin-bottom: 6px; }
.stage li:last-child { margin-bottom: 0; }
.stage li b { color: var(--fg); font-weight: normal; }

/* A shipped item reads as done without needing a tick glyph we would have to draw. */
.stage li.done { color: var(--dim); }
.stage li.done b { color: var(--accent); }

/* ---------------------------------------------------------------- footer */

footer {
  border-top: 1px solid var(--line);
  margin-top: 44px;
  padding: 22px 0 60px;
  color: var(--dim);
  font-size: 15px;
  /*
   * ⚠️ CENTRED ON THE WHOLE FOOTER, not on the nav and the copyright separately. His ask was for
   * the links and the notice, but the homepage and the titles page also put a line of prose up
   * there — centring only two of the three would leave one paragraph hanging left against two
   * centred ones, which reads as a mistake rather than as a choice.
   */
  text-align: center;
}

footer a { color: var(--accent); }

/*
 * ⚠️ THE FOOTER CARRIES EVERY DESTINATION, NOT TWO OF THEM. Each page used to list a different
 * pair — the homepage offered the game and the boards, the boards offered Back and Play.
 * Somebody who has read to the bottom is looking for where to go next, which is the worst
 * possible moment to hand them a subset. It wraps rather than scrolls, same as the top nav.
 */
.footnav { line-height: 2; }

/*
 * ⚠️ QUIETER THAN THE LINKS ABOVE IT. A copyright notice is a fact somebody may want to find,
 * never a thing to read — at the footer's own size it competes with the destinations, which are
 * what the footer is actually for.
 */
.copyright { margin: 14px 0 0; font-size: 13px; opacity: 0.62; }

/*
 * ⚠️ HALF SIZE ON A PHONE. At --s:2 the widest creature is 320px, so six of them stacked one
 * per row on a 430px screen and pushed the Play button five screens down. At --s:1 they sit
 * two or three to a row and the hero fits.
 */
@media (max-width: 700px) {
  .creature { --s: 1; }
  .parade { gap: 10px 14px; min-height: 0; }
}

@media (max-width: 520px) {
  h1 { font-size: 34px; }
  .tagline { font-size: var(--type); }
  header { padding-top: 34px; }
}

/* ---------------------------------------------------------------- the stats page */

.stats-head { text-align: left; padding-top: 40px; }
.crumb { margin: 0 0 8px; font-size: 15px; }
.crumb a { color: var(--dim); text-decoration: none; }
.crumb a:hover { color: var(--accent); }

/*
 * ⚠️ The live nudge is a FLASH, not a permanent badge. It only appears when the number
 * actually changed — a "just updated" line on every poll is noise, and the thing worth
 * noticing is a scan landing while you watch.
 */
.live {
  margin: 6px 0 0;
  color: var(--accent);
  font-size: 15px;
}

.live.flash { animation: flash 1.6s ease-out; }

@keyframes flash {
  from { opacity: 1; }
  to { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .live.flash { animation: none; }
}

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }

.tile {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tile .big {
  font-size: 27px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.tile span:last-child { color: var(--dim); font-size: 15px; line-height: 1.4; }
.tile { min-width: 0; }
/*
 * ⚠️ NEVER BREAK A NUMBER MID-DIGIT. `overflow-wrap: anywhere` was copied here from the
 * name rule and rendered "20,000,0 00,000", which reads as a rendering fault rather than a
 * figure. Names may break anywhere because they are arbitrary; numbers may not, so the big
 * values are worded short enough to fit instead.
 */
.tile .big { overflow-wrap: normal; }

/* --- tier distribution ------------------------------------------------- */

.tierbars { display: grid; gap: 8px; }

.tierbar { display: grid; grid-template-columns: 3.4em 1fr 4em; align-items: center; gap: 10px; }
.tierbar > * { min-width: 0; }
.tier-name { color: hsl(var(--tier-h) var(--tier-s) max(var(--tier-l), 58%)); letter-spacing: 0.08em; }

/*
 * ⭐ EACH BAR IN ITS TIER'S COLOUR — his call, 2026-08-24, matching the app. The bars were all
 * accent-gold, which made the shape of the curve readable and said nothing about which tier was
 * which; the ladder is a colour in this game, and an S bar should be gold because it is an S.
 *
 * ⚠️ ONE SET — this site is dark-only. The floor on the LABEL lifts E and D, which are unsaturated
 * greys at 34% and 48% and would otherwise read as disabled text on a #14161a page.
 */
.tierbar { --tier-h: 0; --tier-s: 0%; --tier-l: 60%; }
.tierbar[data-tier="E"]   { --tier-h: 0;   --tier-s: 0%;  --tier-l: 34%; }
.tierbar[data-tier="D"]   { --tier-h: 0;   --tier-s: 0%;  --tier-l: 48%; }
.tierbar[data-tier="C"]   { --tier-h: 48;  --tier-s: 50%; --tier-l: 40%; }
.tierbar[data-tier="B"]   { --tier-h: 140; --tier-s: 55%; --tier-l: 45%; }
.tierbar[data-tier="A"]   { --tier-h: 212; --tier-s: 65%; --tier-l: 52%; }
.tierbar[data-tier="S"]   { --tier-h: 45;  --tier-s: 70%; --tier-l: 50%; }
.tierbar[data-tier="SS"]  { --tier-h: 45;  --tier-s: 85%; --tier-l: 58%; }
.tierbar[data-tier="SSS"] { --tier-h: 45;  --tier-s: 98%; --tier-l: 66%; }

.tierbar .track { background: var(--panel); border: 1px solid var(--line); height: 14px; }
.tierbar .fill { background: hsl(var(--tier-h) var(--tier-s) var(--tier-l)); height: 100%; }
.tierbar .n { color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }

/* --- boards ------------------------------------------------------------ */

.board-note { margin: -8px 0 14px; font-size: 15px; }

.board { list-style: none; margin: 0; padding: 0; counter-reset: rank; }

.board li {
  counter-increment: rank;
  display: grid;
  grid-template-columns: 2.2em 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.board li::before { content: counter(rank); color: var(--dim); font-variant-numeric: tabular-nums; }
.board li:last-child { border-bottom: none; }

/*
 * ⭐ GOLD, SILVER, BRONZE — the same podium the app got, so a board reads as a board on both.
 *
 * ⚠️ **NO JAVASCRIPT NEEDED HERE.** The rank is a CSS counter on `::before`, so position is
 * already something the stylesheet knows. The app had to set a `data-medal` attribute because it
 * builds its rows by hand.
 *
 * ⚠️ **ONE SET, BECAUSE THIS SITE IS DARK-ONLY** — no `data-theme` anywhere in this file. Measured
 * against `--bg: #14161a`: 8.9:1, 10.3:1 and 6.0:1. The app needs a second set precisely because it
 * has a light theme, and copying its light values here is the mistake that made the title cards
 * unreadable earlier today.
 */
.board li:nth-child(1)::before { color: #d4af37; }
.board li:nth-child(2)::before { color: #c0c0c0; }
.board li:nth-child(3)::before { color: #cd7f32; }

/*
 * ⚠️ `min-width: 0` IS THE FIX, and `overflow-wrap` alone is not.
 *
 * A grid item defaults to `min-width: auto`, which means it refuses to shrink below its
 * content — so an unbroken run of emoji in a chosen name widened the column, pushed the page
 * to 491px on a 430px screen, and made the whole site scroll sideways. The giveaway was that
 * NO element reported a right edge past the viewport: the overflow was the grid track, not a
 * box. Names are player-supplied, so this is not an edge case, it is Tuesday.
 */
.board .who { overflow-wrap: anywhere; min-width: 0; }
/* An opted-out player keeps their rank and number; only the name goes. */
.board .who.anon { color: var(--dim); font-style: normal; }

/*
 * ⚠️ A DELETED PLAYER IS DIMMED, NOT STRUCK THROUGH. A line through the name reads as "this
 * record is void", and the opposite is true: the account is gone and the find still stands.
 * privacy-audit.md — "this account is gone, and this find was still theirs."
 */
.board li.gone .who { color: var(--dim); }
.board .tombstone { font-style: normal; }
/*
 * ⭐ A WORN TITLE, beside the name or the barcode. Alessandro, 2026-08-24: a board row carries
 * the tombstone, the title and the barcode together. Held back from the name's weight on
 * purpose — the name is who they are, the title is a thing they are currently holding.
 */
.board .titlemark {
  font-size: 0.8em;
  opacity: 0.75;
  white-space: nowrap;
}
/*
 * ⚠️ `currentColor` so the bars dim with the row — they ARE the name, not an icon beside it.
 *
 * ⭐ SEVEN NINTHS OF AN EM, ON THE BASELINE. The UI font is a 5×9 pixel grid with its baseline at
 * row 7, so a capital letter is seven rows tall; matching that makes the bars exactly as tall as
 * the name they replace, at any text size. `crispEdges` keeps them hard-edged when that lands on
 * a fraction of a device pixel — a soft barcode would look like a rendering fault.
 */
.board .barcode-name {
  fill: currentColor;
  height: calc(7em / 9);
  width: auto;
  vertical-align: baseline;
  shape-rendering: crispEdges;
}
.board .n { color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- how it works */

.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.4em 1fr;
  gap: 12px;
  color: var(--dim);
}

.steps li::before {
  content: counter(step);
  color: var(--accent);
  font-size: 27px;
  line-height: 1;
}

.steps b { color: var(--fg); font-weight: normal; }

/* ---------------------------------------------------------------- the barcodes */

.codes { display: grid; gap: 22px; }

.code {
  margin: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 16px;
  display: grid;
  gap: 12px;
  justify-items: center;
}

/*
 * ⚠️ THE SYMBOL MUST NOT BE SCALED TO A FRACTION. It is drawn in whole modules, and a
 * browser resizing it to 87% of its width puts bar edges on half pixels — which is precisely
 * how a rendered barcode stops scanning while still looking fine. `max-width: 100%` with
 * `height: auto` keeps the aspect ratio, and the SVG is authored small enough to fit a
 * phone without needing to shrink.
 */
.code svg { max-width: 100%; height: auto; display: block; }

.code figcaption { color: var(--dim); text-align: left; }
.code figcaption b { color: var(--fg); font-weight: normal; }

/* The EAN-8's teaser gets the accent, because it is the one thing on the page being withheld. */
.code.mystery { border-color: var(--accent); }
.code .hint { display: block; margin-top: 8px; color: var(--accent); }

.ghostlink { color: var(--accent); }

/* A band of creatures BETWEEN sections rather than one block in the hero. */
.parade.small { margin: 34px 0 0; }

/* The practical note above the example barcodes. */
.tip { border-left: 2px solid var(--accent); padding-left: 12px; margin-top: 14px; }
.tip em { color: var(--fg); font-style: normal; }

/* ------------------------------------------------------------- the site nav */

/*
 * ⚠️ IT EXISTS BECAUSE THERE WAS NO WAY TO NAVIGATE. The only route to the leaderboards was a
 * link partway down the homepage — Alessandro, 2026-08-17: *"to reach the leaderboard my wife
 * has to scroll the home until she finds the link, that's not usable."*
 *
 * ⚠️ IT WRAPS, IT DOES NOT SCROLL SIDEWAYS. Five short words fit a narrow phone on two lines;
 * a horizontally scrolling bar hides its last item off-screen, which is the same failure as
 * having no menu at all, just less obvious.
 */
.sitenav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 18px;
  padding: 14px 0 10px;
  border-bottom: 1px solid var(--line);
}

.sitenav a {
  color: var(--dim);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.sitenav a:hover, .sitenav a:focus-visible { color: var(--fg); }

/*
 * ⭐ THE CURRENT PAGE IS MARKED IN CSS FROM `data-page`, with no script at all. The pages are
 * static files and the CSP refuses inline script, so anything JavaScript-driven here would be
 * both a fifth copy of the page's identity and a thing that can silently fail to run.
 */
body[data-page="home"] .sitenav [data-nav="home"],
body[data-page="news"] .sitenav [data-nav="news"],
body[data-page="stats"] .sitenav [data-nav="stats"],
body[data-page="goals"] .sitenav [data-nav="goals"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

/* Play is the one thing on the bar that is an action rather than a place. */
.sitenav .navplay { margin-left: auto; color: var(--accent); }
.sitenav .navplay:hover, .sitenav .navplay:focus-visible { color: #e0c87e; }

/* ------------------------------------------------------------- the news page */

.newslist { list-style: none; margin: 0; padding: 0; }

.newsitem {
  padding: 0 0 22px;
  margin: 0 0 22px;
  border-bottom: 1px solid var(--line);
}

.newsitem:last-child { border-bottom: none; }
.newsitem h2 { margin: 0; }
/* The date sits UNDER the headline: what changed matters more than when it did. */
.newsdate { margin: 4px 0 10px; font-size: 15px; }
/* ⚠️ `pre-line` — the paragraph breaks are real newlines in the entry. See `.news-body` in app.css. */
.newsbody { margin: 0; white-space: pre-line; }

/* ------------------------------------------------------------ the goals page */

/*
 * ⛔ NO BORDER ON THE GOALS — and it took two attempts to work out that the border itself was
 * the problem, not its geometry.
 *
 * First the rail was drawn per goal, so the gaps between them cut it into three floating
 * stubs: *"the border enveloping the goals are broken."* Moving it onto the list fixed the
 * gaps and revealed the real fault. This page is short and carries nothing else, so the nav's
 * `border-bottom` and the footer's `border-top` — full-width furniture on EVERY page — lined
 * up with the rail into a rectangle missing its right-hand side: *"we have left, top, bottom
 * borders but not right one, also they don't connect."*
 *
 * ⚠️ THE LESSON IS ABOUT NEIGHBOURS, NOT ABOUT THIS RULE. A border is never seen on its own;
 * it is seen next to whatever else the page draws. A decoration that exists on one page only
 * and forms three sides of a box with the page furniture is worth deleting, not completing.
 * Headings and spacing separate these three stories perfectly well, which is how every other
 * long-form section on the site already works.
 */
.goals { list-style: none; margin: 0; padding: 0; }

.goal { margin: 0 0 26px; padding: 0; }
.goal:last-child { margin-bottom: 0; }

.goal h2 { margin: 0 0 8px; }
.goal p { margin: 0 0 8px; }
/* ⚠️ A WORD, NOT A NUMBER — see the comment at the top of goals.html. */
.goal-state { color: var(--accent); font-size: 15px; margin: 0; }
/*
 * ⭐ A GOAL THE WORLD HAS OPENED — set by `goals-live.js`, never by the build.
 * ⚠️ The words already changed ("the shop — open", "Open."); this only makes the card findable at
 * a glance in a list of four, which is `invisible-mechanics` applied to a page rather than a fight.
 */
.goal.is-open .goal-state { font-weight: 700; }

/* ------------------------------------------- a board row that just changed */

/*
 * ⭐ THE BOARDS ALWAYS UPDATED; THEY NEVER SAID SO. They are re-rendered on every ten-second
 * poll alongside the counter, but with ten players the order rarely moves, so a live page
 * looked frozen — Alessandro reasonably concluded it was not refreshing. The counter has had
 * its "+3 just now" flash all along; this gives a row that moved the same courtesy.
 */
.board li.changed .n { animation: flash 1.6s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .board li.changed .n { animation: none; }
}


/*
 * THE TITLES PAGE — stacked and centred, his layout call 2026-08-24:
 * *"TITLE / DESCRIPTION / HOLDER, and centre all the text."*
 *
 * ⏳ The badge goes beside the name once drawn, which is why `.t-name` is a flex row: an icon
 * drops in without moving anything.
 */
.t-list { list-style: none; margin: 0; padding: 0; }
/*
 * ⭐ THE SAME FAMILY COLOURS THE APP USES — his call, 2026-08-24: *"let's use the same colours we
 * use in the app so even the website starts to be a bit more colourful."* A grade title wears the
 * tier ladder, an element title wears that element's own tone from `art-data.ts`.
 *
 * ⚠️ **A CARD, NOT A RULED ROW.** The border-bottom version could not carry a colour without
 * looking like an underline; a bordered card can.
 */
.t-list { display: grid; gap: 8px; }
/*
 * ⛔ **THE SITE IS DARK-ONLY — `--bg: #14161a`, and there is no `data-theme` anywhere in this
 * stylesheet.** The first version of this block was written for a pale page: a 96%-lightness card
 * with text clamped DOWN to 38%. On the actual site that is dark ink on a near-white card floating
 * on a near-black page — unreadable, which is what he saw.
 *
 * ⚠️ **THE APP HAS TWO THEMES AND THIS DOES NOT.** Copying the app's rules across without checking
 * which half applied is the whole mistake; the site only ever needs the dark half.
 */
.t-list li {
  --el-h: 45; --el-s: 30%; --el-l: 55%;
  text-align: center;
  padding: 14px 10px;
  /* ⚠️ Floored at 40%: E and D are unsaturated greys at 34% and 48%, and the darker one
   * disappears into a #14161a page without it. */
  border: 1px solid hsl(var(--el-h) var(--el-s) max(var(--el-l), 40%));
  border-radius: 6px;
  background: hsl(var(--el-h) calc(var(--el-s) * 0.30) 11%);
}

/* THE TIERS — the same ladder the app and the collection use. */
.t-list li[data-tier="E"]   { --el-h: 0;   --el-s: 0%;  --el-l: 34%; }
.t-list li[data-tier="D"]   { --el-h: 0;   --el-s: 0%;  --el-l: 48%; }
.t-list li[data-tier="C"]   { --el-h: 48;  --el-s: 50%; --el-l: 40%; }
.t-list li[data-tier="B"]   { --el-h: 140; --el-s: 55%; --el-l: 45%; }
.t-list li[data-tier="A"]   { --el-h: 212; --el-s: 65%; --el-l: 52%; }
.t-list li[data-tier="S"]   { --el-h: 45;  --el-s: 70%; --el-l: 50%; }
.t-list li[data-tier="SS"]  { --el-h: 45;  --el-s: 85%; --el-l: 58%; }
.t-list li[data-tier="SSS"] { --el-h: 45;  --el-s: 98%; --el-l: 66%; }

/* THE ELEMENTS — each element's own tone. */
.t-list li[data-element="earth"]     { --el-h: 35;  --el-s: 62%; --el-l: 47%; }
.t-list li[data-element="fire"]      { --el-h: 19;  --el-s: 75%; --el-l: 52%; }
.t-list li[data-element="air"]       { --el-h: 207; --el-s: 11%; --el-l: 67%; }
.t-list li[data-element="lightning"] { --el-h: 52;  --el-s: 56%; --el-l: 51%; }
.t-list li[data-element="void"]      { --el-h: 260; --el-s: 31%; --el-l: 48%; }
.t-list li[data-element="sacred"]    { --el-h: 42;  --el-s: 40%; --el-l: 65%; }
.t-list li[data-element="poison"]    { --el-h: 71;  --el-s: 64%; --el-l: 45%; }
.t-list li[data-element="water"]     { --el-h: 199; --el-s: 52%; --el-l: 47%; }

/*
 * ⭐ FLOORED, NOT CLAMPED — the opposite of what the app's LIGHT theme needs, because this page is
 * dark. `E` and `D` are unsaturated greys at 34% and 48% and would read as disabled text; the
 * floor lifts them to legible without touching the bright ones.
 */
.t-name { color: hsl(var(--el-h) var(--el-s) max(var(--el-l), 60%)); }
.t-token { color: hsl(var(--el-h) var(--el-s) max(var(--el-l), 60%)); font-weight: 600; }
.t-name { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 1.05em; }
/* ⛔ How it is won, above the joke. The joke sells it; the rule tells you what to do. */
.t-how { display: block; font-size: 0.9em; margin-top: 4px; }
.t-desc { display: block; font-size: 0.85em; opacity: 0.7; margin-top: 3px; font-style: italic; }
.t-who { display: block; margin-top: 6px; }
.t-value { opacity: 0.6; }
/* ⭐ An unclaimed title is dimmed, not hidden — the empty pedestal is the advertisement. */
.t-unclaimed { opacity: 0.55; }
/*
 * ⭐ A HANDOVER ANNOUNCES ITSELF — the same `flash` the boards use for a moved number, on the whole
 * card, because on this page the thing that changed is WHO holds it rather than a value.
 * ⚠️ Honours reduced-motion, like the boards do.
 */
.t-list li.t-changed { animation: flash 1.6s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .t-list li.t-changed { animation: none; }
}
.t-open { font-style: italic; }
.t-list .bars { height: 0.78em; width: auto; vertical-align: baseline; fill: currentColor; }
body[data-page="titles"] [data-nav="titles"] { color: var(--accent, #e8c56a); }

/*
 * ⛔ THE TOWER LINKS ARE HIDDEN UNTIL A TOWER EXISTS — tower-screens.md §2e-b.
 *
 * ⚠️ HIDDEN BY DEFAULT AND REVEALED BY SCRIPT, never the other way round. Showing them and hiding
 * them on load is a flash of a page nobody can use; and if the script never runs, staying hidden
 * is the right way to fail before launch.
 */
/*
 * ⭐ **THE FOOTER'S SEPARATORS ARE GENERATED, so hiding a link hides its dot with it.**
 *
 * ⛔ They used to be literal "·" text nodes between the anchors, and a text node does not care
 * that the anchor beside it is `display: none` — so with the tower hidden the footer read
 * "Boards · · Titles". Alessandro spotted it before launch.
 *
 * ⚠️ **`a + a` IS A SIBLING SELECTOR, WHICH IS WHY THIS WORKS.** The hidden tower link is still a
 * sibling, so Titles still gets its own separator; but the tower's own `::before` is not rendered,
 * because a `display: none` element takes its pseudo-elements with it. One dot between every pair
 * of VISIBLE links, at either setting, with nothing to keep in step.
 */
.footnav a + a::before {
  content: "·";
  /*
   * ⛔ **`inline-block` IS LOAD-BEARING, NOT LAYOUT FUSS.** A `::before` lives INSIDE the anchor, so
   * it is covered by that link's underline — and with one on every separator the footer grew a
   * single unbroken rule beneath the whole row. ⚠️ It cannot be cancelled with
   * `text-decoration: none` here, because the underline is painted by the ANCESTOR across all its
   * inline content. An atomic inline-level box is not decorated by its parent, which is the one
   * thing that detaches the dot from the link.
   *
   * ⚠️ Margins rather than spaces inside `content`, since an inline-block collapses them.
   */
  display: inline-block;
  margin: 0 0.35em;
  /* ⚠️ The dot belongs to the row, not to the link it precedes. */
  color: var(--muted, #8a8578);
}

/*
 * ⭐ ALWAYS SHOWN — his ruling, 2026-09-22: "now there's always a tower". They were hidden until `/api/tower/open`
 * said yes, so every page load showed them late. ⚠️ Exactly the display they had when revealed, so nothing moves.
 */
/*
 * ⭐ **THE TOWER CHOOSER WEARS THE SITE'S CLOTHES** — his report, 2026-09-23: *"what is that sad unstyled
 * dropdown?"* A native select takes the system font and the system chrome, which on a pixel-font page reads as a
 * browser dialog that wandered in. ⚠️ `appearance: none` removes the arrow too, so one is drawn back as a
 * background glyph — without it there is nothing to say it opens.
 */
#tower-pick-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tower-pick {
  padding: 8px 12px;
  font: inherit;
  font-size: 15px;
  color: var(--fg);
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
}

/*
 * ⛔ **THE CHOOSER BELONGS TO THE BOARDS, NOT TO THE LORE ABOVE IT** — his report, 2026-09-23: it was glued to
 * the paragraph above and a section's width away from the boards it changes. ⭐ The separation goes ABOVE it (the
 * same 44px a section carries), and the first board follows close below, so the three read as one block.
 */
#tower-pick-line { margin: 44px 0 0; padding-top: 26px; border-top: 1px solid var(--line); }
#tower-memento { margin: 8px 0 0; }
/* ⚠️ The first board would otherwise open its own section rule and push itself a second gap away. */
#boards > section:first-child { margin-top: 18px; padding-top: 0; border-top: 0; }

.tower-pick:hover { border-color: var(--accent); }
.tower-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/*
 * ⭐ **THE LIST IS OURS, NOT THE OPERATING SYSTEM'S** — his ruling, 2026-09-23: *"any way to style also the list
 * like we do in the app?"* A native select's open list cannot be reached by CSS at all, so the chooser is a
 * button and a dialog, exactly as in the app. ⛔ `[open]`, or the closed dialog is laid out in the page.
 */
dialog.list-modal[open] {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  max-height: min(70dvh, 32rem);
  width: min(30rem, calc(100vw - 32px));
  padding: 16px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--accent);
  overflow: hidden;
}

dialog.list-modal::backdrop { background: rgb(0 0 0 / 0.6); }
.list-modal h2 { margin: 0; font-size: 21px; color: var(--accent); }
.list-modal-rows { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.list-modal-foot { display: flex; justify-content: center; margin: 0; }
.list-modal-foot .ghost {
  padding: 8px 18px;
  font: inherit;
  font-size: 15px;
  color: var(--fg);
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
}

.tower-row {
  display: block;
  width: 100%;
  padding: 12px;
  font: inherit;
  font-size: 15px;
  text-align: left;
  color: var(--fg);
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
}

.tower-row[aria-pressed="true"] { border-color: var(--accent); }
.tower-row b { display: block; margin-bottom: 4px; font-size: 18px; }
.tower-row span { display: block; color: var(--dim); font-size: 13px; }
.tower-row span + span { margin-top: 2px; }

[data-nav="tower"] { display: inline-block; }
.footnav a[href="/tower"] { display: inline; }


/*
 * THE DISCORD BUTTON — ours around theirs.
 *
 * ⛔ THE MARK ITSELF IS NEVER TOUCHED. Discord's brand guidelines forbid recolouring,
 * distorting or adding effects to it, so the SVG is served exactly as shipped in their brand
 * pack and carries no filter, no pixelation and no colour of ours. Alessandro asked for a
 * pixelated version to match our art and answered his own question: it is not allowed.
 * ⭐ The BUTTON is ours, which is where our style goes.
 *
 * ⚠️ **WHAT THE POLICY ACTUALLY SAYS**, rather than what was first written here: the mark may be
 * applied "in color, black, or white versions", and Blurple #5865F2 is one of the three listed
 * brand colours. A white symbol on Blurple is therefore two permitted choices combined — NOT a
 * documented pairing, which is how this comment first over-claimed it. If that distinction ever
 * matters, the safe fallback is the Blurple symbol on a light ground.
 *
 * ⛔ **AND THE SYMBOL MAY NOT STAND ALONE:** "Use these only when the Discord brand is clearly
 * visible or has been well established elsewhere." The button's LABEL is what satisfies that, so
 * a future redesign must not reduce this to an icon-only button. Source: discord.com/branding.
 *
 * ⚠️ #5865F2 is Blurple, read out of their own SVG rather than remembered.
 */
.discord-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #5865f2;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
}
.discord-btn:hover { background: #4752c4; }
.discord-btn img { display: block; }
