/* Maniax dashboard — obsidian & aged gold.
 *
 * Self-contained by design: no webfonts, no CDN, no external requests. The
 * type pairs an engraved serif for headings with a monospace for every number,
 * so the page reads as realm instrumentation rather than a generic dashboard.
 */

:root {
  --ink:        #090b0e;
  --ground:     #0d1014;
  --panel:      #13171d;
  --panel-edge: #1e242c;
  --raise:      #191f26;

  --gold:       #c8a55a;
  --gold-bright:#e6c983;
  --gold-dim:   #6d5c33;

  --text:       #d7dae1;
  --text-dim:   #8b919c;
  --text-faint: #5d636d;

  --up:         #6fbf73;
  --down:       #c9564c;
  --alliance:   #5b8fd8;
  --horde:      #bb4038;

  --serif: "Palatino Linotype", "Book Antiqua", Palatino, "Iowan Old Style", Georgia, serif;
  --mono:  "Cascadia Mono", Consolas, "SF Mono", "DejaVu Sans Mono", Menlo, monospace;

  --edge: 1px solid var(--panel-edge);
  --rule: linear-gradient(90deg, transparent, var(--gold-dim) 18%, var(--gold-dim) 82%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1100px 480px at 50% -12%, #16202b 0%, transparent 62%),
    radial-gradient(680px 340px at 92% 8%, #1a1710 0%, transparent 55%),
    var(--ground);
  background-attachment: fixed;
}

/* A faint cold grain over everything, so flat panels never look like plastic. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .5;
  background-image:
    repeating-linear-gradient(0deg,   rgba(255,255,255,.014) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg,  rgba(0,0,0,.05)        0 1px, transparent 1px 3px);
}

body > * { position: relative; z-index: 1; }

a { color: var(--gold-bright); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 2px; }

h1, h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: .01em;
  margin: 0;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }

/* ── header ─────────────────────────────────────────────────────────────── */

.top {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  padding: 18px 28px;
  background: linear-gradient(180deg, rgba(9,11,14,.94), rgba(9,11,14,.62));
  border-bottom: var(--edge);
}

.brand {
  font-family: var(--serif);
  font-size: 1.22rem;
  letter-spacing: .34em;
  color: var(--gold);
  text-shadow: 0 0 22px rgba(200,165,90,.28);
}
.brand:hover { text-decoration: none; color: var(--gold-bright); }

.top nav { display: flex; gap: 22px; margin-right: auto; flex-wrap: wrap; }
.top nav a {
  color: var(--text-dim);
  font-size: .8rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
}
.top nav a:hover {
  color: var(--gold-bright);
  border-bottom-color: var(--gold-dim);
  text-decoration: none;
}

.quick input {
  width: 190px;
  padding: 7px 11px;
  color: var(--text);
  background: var(--ink);
  border: var(--edge);
  border-radius: 2px;
  font: inherit;
  font-size: .82rem;
}
.quick input::placeholder { color: var(--text-faint); }
.quick input:focus { border-color: var(--gold-dim); outline: none; }

/* ── status bar ─────────────────────────────────────────────────────────── */

.statusbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding: 11px 28px;
  font-size: .84rem;
  color: var(--text-dim);
  background: rgba(0,0,0,.28);
  border-bottom: var(--edge);
}
.statusbar strong { color: var(--text); font-weight: 600; }
.statusbar .sep { color: var(--text-faint); }

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: none;
}
.is-up   .dot { background: var(--up);   box-shadow: 0 0 0 3px rgba(111,191,115,.15); animation: pulse 2.6s ease-in-out infinite; }
.is-down .dot { background: var(--down); box-shadow: 0 0 0 3px rgba(201,86,76,.14); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(111,191,115,.15); }
  50%      { box-shadow: 0 0 0 6px rgba(111,191,115,.04); }
}

.notice {
  padding: 11px 28px;
  font-size: .84rem;
  color: #e5cf9a;
  background: rgba(200,165,90,.07);
  border-bottom: 1px solid var(--gold-dim);
}

/* ── layout ─────────────────────────────────────────────────────────────── */

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 34px 28px 60px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.page-title { margin-bottom: -4px; }

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

.panel {
  padding: 20px 22px;
  background: linear-gradient(180deg, var(--panel), var(--raise));
  border: var(--edge);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(255,255,255,.02) inset, 0 10px 30px -22px #000;
  animation: rise .45s cubic-bezier(.2,.7,.3,1) both;
  /* Deliberately no clip-path here. Notched corners were originally cut with
   * one, but clip-path clips every descendant — including the item tooltips,
   * which are absolutely positioned and meant to overflow the panel. A
   * decorative corner was silently truncating the content people came for.
   * The corners are drawn below instead, which clips nothing. */
  position: relative;
}

/* Engraved corner accents: the same suggestion of a metal frame, drawn rather
 * than cut, so nothing inside the panel gets clipped. */
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  pointer-events: none;
  opacity: .55;
}
.panel::before {
  top: -1px; left: -1px;
  border-top: 1px solid var(--gold-dim);
  border-left: 1px solid var(--gold-dim);
}
.panel::after {
  bottom: -1px; right: -1px;
  border-bottom: 1px solid var(--gold-dim);
  border-right: 1px solid var(--gold-dim);
}
.grid .panel:nth-child(2) { animation-delay: .05s; }
.grid .panel:nth-child(3) { animation-delay: .10s; }
.grid .panel:nth-child(4) { animation-delay: .15s; }
.grid .panel:nth-child(5) { animation-delay: .20s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 11px;
  margin-bottom: 15px;
  border-bottom: 1px solid transparent;
  border-image: var(--rule) 1;
}
.panel-head .muted, .panel-head .more { font-size: .76rem; }
.more { letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); }
.more:hover { color: var(--gold-bright); }

.muted  { color: var(--text-dim); }
.empty  { color: var(--text-faint); font-style: italic; margin: 6px 0 2px; }

/* ── population graph ───────────────────────────────────────────────────── */

.graph {
  display: block;
  width: 100%;
  height: 128px;
  overflow: visible;
}
.graph-line {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 5px rgba(200,165,90,.4));
}
.graph-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-size: .7rem;
  color: var(--text-faint);
}

/* ── lists & tables ─────────────────────────────────────────────────────── */

.ranks { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.ranks li {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 6px 0 6px 10px;
  border-left: 2px solid transparent;
  transition: border-color .15s, padding-left .15s;
}
.ranks li:hover { border-left-color: var(--gold-dim); padding-left: 14px; }
.ranks li .muted { font-size: .76rem; margin-left: auto; text-align: right; }

.ranks.numbered li { counter-increment: rank; }
.ranks.numbered li::before {
  content: counter(rank);
  min-width: 1.5em;
  color: var(--text-faint);
  font-size: .74rem;
}
.ranks.numbered li:nth-child(1)::before { color: var(--gold-bright); }
.ranks.numbered li:nth-child(2)::before { color: #b9bcc4; }
.ranks.numbered li:nth-child(3)::before { color: #b1794a; }

.rows { width: 100%; border-collapse: collapse; font-size: .86rem; }
.rows th {
  text-align: left;
  font-family: var(--serif);
  font-weight: 600;
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 12px 9px 0;
  border-bottom: 1px solid var(--panel-edge);
}
.rows td { padding: 8px 12px 8px 0; border-bottom: 1px solid rgba(30,36,44,.5); }
.rows tbody tr:hover td { background: rgba(200,165,90,.035); }
.rows tbody tr:last-child td { border-bottom: none; }

/* ── search ─────────────────────────────────────────────────────────────── */

.search { display: flex; gap: 9px; margin: 14px 0 4px; flex-wrap: wrap; }
.search input {
  flex: 1 1 220px;
  padding: 9px 12px;
  color: var(--text);
  background: var(--ink);
  border: var(--edge);
  border-radius: 2px;
  font: inherit;
}
.search input:focus { border-color: var(--gold-dim); outline: none; }
.search button {
  padding: 9px 20px;
  font: inherit;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: none;
  border-radius: 2px;
  cursor: pointer;
}
.search button:hover { filter: brightness(1.1); }

/* ── character sheet ────────────────────────────────────────────────────── */

.sheet-head h1 { font-size: 2.1rem; letter-spacing: .01em; }
.subtitle { margin: 4px 0 0; color: var(--text-dim); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.faction {
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 2px;
  border: 1px solid currentColor;
}
.faction.alliance { color: var(--alliance); }
.faction.horde    { color: var(--horde); }
.faction.unknown  { color: var(--text-faint); }

.online {
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--up);
}
.online::before { content: "● "; font-size: .7em; vertical-align: middle; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin: 20px 0 0;
  background: var(--panel-edge);
  border: var(--edge);
}
.stats > div { padding: 12px 14px; background: var(--panel); }
.stats dt {
  font-size: .68rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.stats dd { margin: 4px 0 0; font-size: 1.02rem; color: var(--text); }

.coin { font-size: .74em; margin-left: 1px; }
.coin.g { color: #d5b45c; }
.coin.s { color: #b6bcc6; }
.coin.c { color: #c0784c; }

/* ── equipment ──────────────────────────────────────────────────────────── */

.gear { list-style: none; margin: 0; padding: 0; }
.gear li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(30,36,44,.55);
}
.gear li:last-child { border-bottom: none; }
.slot {
  flex: none;
  width: 92px;
  font-size: .7rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.ilvl {
  margin-left: auto;
  font-size: .74rem;
  color: var(--text-faint);
  border: 1px solid var(--panel-edge);
  border-radius: 2px;
  padding: 1px 7px;
}

/* ── footer ─────────────────────────────────────────────────────────────── */

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 28px 40px;
  font-size: .72rem;
  color: var(--text-faint);
  border-top: var(--edge);
}
.rev { font-size: .68rem; opacity: .7; }

/* ── responsive & motion ────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .top { gap: 16px; padding: 14px 18px; }
  .top nav { gap: 15px; order: 3; width: 100%; }
  .quick { margin-left: auto; }
  .quick input { width: 150px; }
  .statusbar, .notice { padding-left: 18px; padding-right: 18px; }
  main { padding: 24px 18px 48px; }
  .slot { width: 74px; }
  .sheet-head h1 { font-size: 1.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ── paper doll ─────────────────────────────────────────────────────────────
 *
 * Two columns of slots flanking the character, weapons beneath — the armory's
 * own arrangement. Tooltips are pure CSS: left-column slots open theirs to the
 * right and right-column slots to the left, which is deterministic and so
 * cannot clip off-screen. That is the whole reason tooltips usually need
 * JavaScript, and it buys the page keeping its no-script property.
 */

.doll {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: start;
  margin-top: 4px;
}
.doll-col { display: flex; flex-direction: column; gap: 8px; }

.doll-weapons {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid transparent;
  border-image: var(--rule) 1;
}

.doll-mid {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  border: 1px solid var(--panel-edge);
  border-radius: 2px;
  background:
    radial-gradient(120px 160px at 50% 40%, rgba(200,165,90,.06), transparent 70%),
    rgba(0,0,0,.18);
}
.doll-crest { display: flex; flex-direction: column; align-items: center; gap: 2px; opacity: .9; }
.crest-class { font-family: var(--serif); font-size: 1.15rem; letter-spacing: .04em; }
.crest-level { font-size: 2.6rem; font-family: var(--serif); line-height: 1; color: var(--text); }
.crest-race  { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); }

/* ── slots ──────────────────────────────────────────────────────────────── */

.slot {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 3px;
  flex: none;
}

.slot.empty {
  border: 1px dashed var(--panel-edge);
  background: rgba(0,0,0,.22);
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot-label {
  font-size: .52rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: center;
  padding: 0 2px;
  line-height: 1.15;
}

.slot.filled {
  /* --q is the item's quality colour, set inline per slot. The tile shows
   * through when the icon image fails to load, so a blocked icon host
   * degrades to a coloured square rather than a broken-image glyph. */
  border: 1px solid var(--q, var(--panel-edge));
  background: color-mix(in srgb, var(--q, #444) 18%, #0c0f13);
  box-shadow: 0 0 0 1px rgba(0,0,0,.5) inset;
}
.slot.filled a { display: block; width: 100%; height: 100%; position: relative; }
.slot .icon { display: block; width: 100%; height: 100%; border-radius: 2px; object-fit: cover; }

.slot-ilvl {
  position: absolute;
  right: 1px;
  bottom: 0;
  font-size: .58rem;
  color: var(--text);
  text-shadow: 0 0 3px #000, 0 0 3px #000;
  pointer-events: none;
}

.slot.filled:hover { border-color: var(--gold-bright); }

/* ── tooltip ────────────────────────────────────────────────────────────── */

.tip {
  position: absolute;
  z-index: 40;
  /* Centred on the slot rather than hung from its top edge. A long tooltip —
   * a trinket with a full Use: line, say — then grows equally up and down
   * instead of running off the bottom. */
  top: 50%;
  width: 264px;
  padding: 10px 12px;
  background: #06080b;
  border: 1px solid var(--q, var(--panel-edge));
  border-radius: 3px;
  box-shadow: 0 12px 34px -10px #000;
  font-size: .78rem;
  line-height: 1.42;
  color: var(--text);
  opacity: 0;
  visibility: hidden;
  transform: translateY(calc(-50% + 3px));
  transition: opacity .11s ease, transform .11s ease, visibility .11s;
  pointer-events: none;
}
.tip-right .tip { left: calc(100% + 10px); }
.tip-left  .tip { right: calc(100% + 10px); }

.slot:hover .tip,
.slot:focus-within .tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%);
}

/* The weapon row sits at the bottom of the panel, so its tooltips open
 * upward — there is nothing below them but the page edge. */
.tip-up .tip {
  left: 50%;
  margin-left: -132px;
  top: auto;
  bottom: calc(100% + 10px);
  transform: translateY(3px);
}
.tip-up .slot:hover .tip,
.tip-up.slot:hover .tip,
.tip-up.slot:focus-within .tip { transform: none; }

.tip p { margin: 0 0 2px; }
.tip-name { font-family: var(--serif); font-size: .96rem; line-height: 1.25; margin-bottom: 3px !important; }
.tip-ilvl { color: var(--gold); }
.tip-row { display: flex; justify-content: space-between; gap: 10px; }
.tip-right { color: var(--text-dim); }
.tip-stat { color: var(--text); }
.tip-effect { color: var(--up); margin-top: 3px !important; }
.tip-flavour { color: var(--gold); font-style: italic; margin-top: 5px !important; }

.tip-socket { color: var(--text-dim); padding-left: 14px; position: relative; }
.tip-socket::before {
  content: "";
  position: absolute;
  left: 0; top: .45em;
  width: 8px; height: 8px;
  border: 1px solid rgba(255,255,255,.25);
  transform: rotate(45deg);
}
.socket-red::before    { background: #b0342c; }
.socket-yellow::before { background: #b8a02e; }
.socket-blue::before   { background: #2f5fa8; }
.socket-meta::before   { background: #8a8a8a; }

@media (max-width: 640px) {
  .doll { grid-template-columns: auto auto; justify-content: center; }
  .doll-mid { display: none; }
  /* With the columns adjacent there is no room to either side, so tooltips
   * go above regardless of which column the slot is in. */
  .tip-right .tip, .tip-left .tip {
    left: 50%; right: auto;
    margin-left: -132px;
    top: auto; bottom: calc(100% + 10px);
    transform: translateY(3px);
  }
  .tip-right.slot:hover .tip, .tip-left.slot:hover .tip,
  .tip-right.slot:focus-within .tip, .tip-left.slot:focus-within .tip {
    transform: none;
  }
  .tip { width: min(264px, 78vw); }
}

/* ── character panel ────────────────────────────────────────────────────────
 *
 * The middle column used to hold only a class crest, which left the largest
 * area of the page saying almost nothing. It now carries the figures a player
 * actually compares — all derived from item_template, no new dependency.
 */

.doll-mid {
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px;
  text-align: center;
}
.doll-mid.alliance { box-shadow: inset 0 0 60px -30px var(--alliance); }
.doll-mid.horde    { box-shadow: inset 0 0 60px -30px var(--horde); }

.ilvl { line-height: 1.1; }
.ilvl-n {
  display: block;
  font-family: var(--serif);
  font-size: 2.1rem;
  color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(200,165,90,.25);
}
.ilvl-l {
  font-size: .62rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* Quality mix as one bar: proportions read faster than a list of numbers. */
.qbar {
  display: flex;
  width: 100%;
  height: 6px;
  gap: 1px;
  border-radius: 2px;
  overflow: hidden;
}
.qseg { display: block; min-width: 3px; opacity: .85; }

.qkey {
  list-style: none;
  margin: -6px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  font-size: .66rem;
  color: var(--text-dim);
}
.qkey li { display: flex; align-items: center; gap: 5px; }
.qkey i { width: 7px; height: 7px; border-radius: 1px; display: inline-block; }

.setlist {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
  width: 100%;
  border-top: 1px solid transparent;
  border-image: var(--rule) 1;
  font-size: .72rem;
}
.setlist li { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.setname { color: var(--gold); }
.setn    { color: var(--text-faint); }

.slotcount {
  margin: 0;
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.missing {
  margin: -8px 0 0;
  font-size: .66rem;
  line-height: 1.4;
  color: var(--down);
  opacity: .8;
}

/* ── addons ─────────────────────────────────────────────────────────────── */

.lede { margin: -2px 0 4px; color: var(--text-dim); max-width: 62ch; }
.lede code {
  font-size: .92em;
  color: var(--gold);
  background: rgba(0,0,0,.3);
  padding: 1px 5px;
  border-radius: 2px;
}

.cat-blurb { margin: -6px 0 12px; font-size: .8rem; color: var(--text-faint); font-style: italic; }

.addonlist { list-style: none; margin: 0; padding: 0; }
.addon {
  padding: 11px 0 11px 12px;
  border-left: 2px solid transparent;
  border-bottom: 1px solid rgba(30,36,44,.55);
  transition: border-left-color .15s;
}
.addon:last-child { border-bottom: none; }
.addon:hover { border-left-color: var(--gold-dim); }

.addon-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.addon-name { font-family: var(--serif); font-size: 1rem; }
.addon-ver {
  font-size: .66rem;
  color: var(--text-faint);
  border: 1px solid var(--panel-edge);
  border-radius: 2px;
  padding: 0 6px;
}
.addon-by { font-size: .7rem; color: var(--text-faint); margin-left: auto; }

.addon-notes { margin: 3px 0 0; font-size: .8rem; color: var(--text-dim); max-width: 78ch; }

.addon-plugins { margin-top: 6px; font-size: .76rem; }
.addon-plugins summary {
  cursor: pointer;
  color: var(--text-faint);
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: .66rem;
}
.addon-plugins summary:hover { color: var(--gold-bright); }
.addon-plugins ul { list-style: none; margin: 7px 0 0; padding: 0 0 0 12px; }
.addon-plugins li { padding: 3px 0; border-left: 1px solid var(--panel-edge); padding-left: 10px; }
.plugin-notes { display: block; color: var(--text-faint); font-size: .72rem; }

/* ── the character ──────────────────────────────────────────────────────────
 *
 * The model stands where the crest used to. Its height is fixed rather than
 * derived from the canvas, because a canvas with no intrinsic size collapses
 * to nothing before the mesh arrives and the whole column jumps when it does.
 */

.model-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#model {
  width: 100%;
  /* Tall on purpose. A character is roughly four times as tall as they are
     wide, so a short canvas frames them by height and leaves the column
     mostly empty either side. Bounded at both ends so a laptop still shows
     the gear below the fold and a tall monitor does not stretch her. */
  height: clamp(420px, 64vh, 700px);
  display: block;
  cursor: grab;
  touch-action: none;
}
#model:active { cursor: grabbing; }

.model-hint {
  margin: 0;
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* The animation buttons. Empty in the markup and filled by the viewer only
   once it has a skeleton and the uniform room to skin with, so this collapses
   to nothing on a browser that draws the static pose. */
.model-anims {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.model-anims:empty {
  display: none;
}

.model-anim {
  font: inherit;
  font-size: .62rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 8px;
  cursor: pointer;
  color: var(--text-faint);
  background: transparent;
  border: var(--edge);
  border-radius: 3px;
}

.model-anim:hover {
  color: var(--text-dim);
  background: var(--raise);
}

.model-anim[aria-pressed="true"] {
  color: var(--gold);
  border-color: var(--gold-dim);
}

/* A browser that cannot draw keeps the figures below rather than an empty box. */
.model-fail {
  margin: 0;
  padding: 24px 8px;
  font-size: .76rem;
  color: var(--text-faint);
  max-width: 22ch;
}

/* A playerbot, marked rather than hidden.
 *
 * Deliberately quiet: this realm is 6,000 bots to 9 people, so a loud badge on
 * nearly every row would be the page's dominant feature. It reads as an aside,
 * which is what it is. */
.bot {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  border: 1px solid var(--panel-edge);
  border-radius: 2px;
  font-size: .6rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
  vertical-align: middle;
  cursor: help;
}

/* The bots toggle, and the row it sits in.
 *
 * A link rather than a form: the choice is a query parameter, so it survives a
 * reload and can be linked to, and there is nothing to submit. */
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toggle {
  margin-left: 10px;
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px dotted var(--panel-edge);
  text-decoration: none;
  white-space: nowrap;
}
.toggle:hover { color: var(--gold-bright); border-bottom-color: var(--gold-bright); }

/* ── statistics ─────────────────────────────────────────────────────────────
 *
 * Each card is one number the realm has actually reached, with the handful of
 * characters behind it. The figure leads because that is what a visitor came
 * for; the names are the supporting detail, so they are smaller and quieter.
 */

/* Wider than the leaderboard cards: a statistic label is a phrase, not a
   word, and at 280px "Gold spent changing talents" broke one word per line. */
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.stats .stat { display: flex; flex-direction: column; gap: 10px; }

.stat-label {
  margin: 0;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .01em;
}

.stat-total { margin: 0; line-height: 1.1; }
.stat-figure {
  font-family: var(--serif);
  font-size: 1.9rem;
  color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(200,165,90,.22);
}
.stat-note {
  display: block;
  margin-top: 2px;
  font-size: .6rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.stat-top {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-top: 1px solid var(--panel-edge);
  padding-top: 8px;
}
.stat-top li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: .82rem;
}
/* The leader of each statistic gets the emphasis; the rest recede. */
.stat-top li:first-child .stat-value { color: var(--text); }
.stat-value {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── signup ─────────────────────────────────────────────────────────────── */

/* The one call to action in the nav. It is a link like the others, weighted
 * rather than boxed: a button in a text nav reads as an advert. */
.nav-cta { color: var(--gold-bright); }
.nav-cta:hover { color: var(--gold-bright); }

.signup { display: flex; flex-direction: column; max-width: 420px; }
.signup label {
  font-family: var(--serif);
  font-size: .8rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 16px 0 6px;
}
.signup label:first-child { margin-top: 0; }
.signup input {
  padding: 9px 12px;
  color: var(--text);
  background: var(--ink);
  border: var(--edge);
  border-radius: 2px;
  font: inherit;
}
.signup input:focus { border-color: var(--gold-dim); outline: none; }
/* Only after the field has been touched, so an untouched form is not scolding. */
/* :user-invalid, not :invalid — a required field is invalid while it is simply
   still empty, so plain :invalid flagged three fields red before the visitor
   had typed anything. This fires only after they have interacted with it.
   The earlier :not(:placeholder-shown) guard did nothing: these inputs carry
   no placeholder attribute, so the selector was always true. */
.signup input:user-invalid { border-color: var(--down); }

.field-note { margin: 6px 0 0; font-size: .82rem; color: var(--text-faint); }

.signup button {
  margin-top: 22px;
  align-self: flex-start;
  padding: 10px 26px;
  font: inherit;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: none;
  border-radius: 2px;
  cursor: pointer;
}
.signup button:hover { filter: brightness(1.1); }

.signup-err { border-left: 2px solid var(--down); }
.signup-done h2 { font-size: 1.5rem; margin: 0 0 8px; }
