/* Oratrix design layer.
 *
 * Dark-first, because that is the norm for this genre and where people will
 * spend their time; light mode is supported and deliberate, not an
 * afterthought. Everything is driven by tokens so a change lands everywhere.
 *
 * Motion is a garnish. Every transition here is short, subtle, and disabled
 * outright under prefers-reduced-motion.
 */

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: dark light;

  --bg: #0e1015;
  --bg-raised: #161a22;
  --bg-hover: #1d222c;
  --border: #262c38;
  --border-strong: #38404f;

  --text: #e7eaf0;
  --text-muted: #949cad;
  --text-faint: #6b7386;

  --accent: #7aa2f7;
  --accent-soft: rgba(122, 162, 247, 0.14);
  --gold: #e3b341;
  --silver: #c4cbd8;
  --bronze: #c98b52;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.45), 0 12px 32px rgba(0, 0, 0, 0.35);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --fast: 120ms;
  --normal: 200ms;

  /* Element accents, used for character identity. */
  --pyro: #ec6a49;
  --hydro: #4cc2f1;
  --anemo: #74c2a8;
  --electro: #b98cf5;
  --dendro: #a5c83b;
  --cryo: #9fd6e3;
  --geo: #fab72e;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f8fa;
    --bg-raised: #ffffff;
    --bg-hover: #f0f2f6;
    --border: #e2e6ed;
    --border-strong: #cbd2dd;
    --text: #171a21;
    --text-muted: #5c6474;
    --text-faint: #878e9d;
    --accent: #2f5fd0;
    --accent-soft: rgba(47, 95, 208, 0.1);
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
    --shadow-hover: 0 2px 4px rgba(16, 24, 40, 0.08), 0 12px 32px rgba(16, 24, 40, 0.1);
  }
}

/* ---------------------------------------------------------------- base */

* { box-sizing: border-box; }

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--fast) var(--ease);
}
a:hover { color: var(--text); }

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 1.5rem 0 0.5rem; }

.muted { color: var(--text-muted); font-size: 0.875rem; }
.faint { color: var(--text-faint); }

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

/* ---------------------------------------------------------------- layout */

.wrap {
  max-width: 74rem;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

header.site {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.bar {
  max-width: 74rem;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  font-weight: 650;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

nav.main { display: flex; gap: 1.25rem; }

nav.main a {
  position: relative;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.15rem 0;
}
nav.main a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--normal) var(--ease);
}
nav.main a:hover { color: var(--text); }
nav.main a:hover::after { transform: scaleX(1); }

.spacer { margin-left: auto; }

footer.site {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.8rem;
}

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

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }

th {
  text-align: left;
  padding: 0.6rem 0.9rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-raised) 60%, var(--bg));
}

td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr { transition: background var(--fast) var(--ease); }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- pieces */

/* Character art. The front-facing icons are transparent, so they sit on
 * the card with nothing drawn around them. */
.face {
  width: 64px;
  height: 64px;
  flex: none;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.who { display: flex; align-items: center; gap: 0.65rem; }

.hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.5rem 0 0.25rem;
}
.hero img {
  width: 84px;
  height: 84px;
  object-fit: contain;
}
.hero h2 { margin: 0; font-size: 1.4rem; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid currentColor;
  background: color-mix(in srgb, currentColor 12%, transparent);
}
.el-Pyro { color: var(--pyro); }
.el-Hydro { color: var(--hydro); }
.el-Anemo { color: var(--anemo); }
.el-Electro { color: var(--electro); }
.el-Dendro { color: var(--dendro); }
.el-Cryo { color: var(--cryo); }
.el-Geo { color: var(--geo); }

.rank {
  display: inline-block;
  min-width: 1.9rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: var(--text-muted);
}
.rank-1 { color: var(--gold); }
.rank-2 { color: var(--silver); }
.rank-3 { color: var(--bronze); }

.score { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------------------------------------------------------------- forms */

input, select, textarea, button {
  font: inherit;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
textarea { width: 100%; font-family: ui-monospace, "Cascadia Code", Menlo, monospace; font-size: 0.82rem; }

button {
  cursor: pointer;
  font-weight: 550;
  background: var(--accent);
  border-color: transparent;
  color: #0b0d12;
  transition: transform var(--fast) var(--ease), filter var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease);
}
button:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: var(--shadow); }
button:active { transform: translateY(0); }
button:disabled { opacity: 0.5; cursor: default; transform: none; filter: none; }

form.inline { display: inline; }

/* ---------------------------------------------------------------- misc */

pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  overflow-x: auto;
  font-size: 0.78rem;
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  color: var(--text-muted);
}

.err {
  background: color-mix(in srgb, #f2555a 16%, var(--bg-raised));
  border: 1px solid color-mix(in srgb, #f2555a 45%, transparent);
  color: var(--text);
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
}

.flash {
  padding: .65rem .9rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  margin: 0 0 1rem;
  font-size: .9rem;
}
.flash-error { background: color-mix(in srgb, #f2555a 15%, var(--bg-raised));
               border-color: color-mix(in srgb, #f2555a 45%, transparent); }
.flash-warn  { background: color-mix(in srgb, var(--gold) 15%, var(--bg-raised));
               border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.flash-ok    { background: color-mix(in srgb, #3fb950 15%, var(--bg-raised));
               border-color: color-mix(in srgb, #3fb950 45%, transparent); }

.empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-faint);
}

.tagline { font-size: 1.05rem; color: var(--text-muted); margin: 0.25rem 0 1.5rem; }
.tagline em { color: var(--text); font-style: normal; font-weight: 600; }

.stats { display: flex; gap: 1.25rem; flex-wrap: wrap; }

/* Rows fade in on load. Purely decorative, and the first thing to go when
 * someone has asked for less motion. */
@media (prefers-reduced-motion: no-preference) {
  tbody tr { animation: rise var(--normal) var(--ease) backwards; }
  tbody tr:nth-child(1) { animation-delay: 0ms; }
  tbody tr:nth-child(2) { animation-delay: 20ms; }
  tbody tr:nth-child(3) { animation-delay: 40ms; }
  tbody tr:nth-child(4) { animation-delay: 60ms; }
  tbody tr:nth-child(5) { animation-delay: 80ms; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
  }
}

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

@media (max-width: 40rem) {
  .bar { gap: 1rem; flex-wrap: wrap; }
  .wrap { padding: 0 0.9rem 3rem; }
  table { font-size: 0.82rem; }
  th, td { padding: 0.5rem 0.6rem; }
}

/* ---------------------------------------------------------------- ballot builder */

.stack { display: flex; flex-direction: column; gap: 0.6rem; max-width: 34rem; }
.stack label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9rem; }
.stack label input { align-self: flex-start; }

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
button.ghost:hover { box-shadow: none; filter: none; border-color: var(--accent); }

.chip-btn {
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 0.25rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 999px;
}
.chip-btn:hover { border-color: var(--accent); box-shadow: none; transform: none; filter: none; }
.chip-btn.ghost { color: var(--text-muted); }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.1rem 0.4rem;
}
.icon-btn:hover { color: var(--text); box-shadow: none; transform: none; filter: none; }

.builder { margin-top: 1rem; }
.builder-top {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.presets { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

.mix {
  display: flex;
  height: 1.7rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-raised);
  border: 1px solid var(--border);
}
.mix-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: hsl(var(--hue) 55% 48% / 0.75);
  border-right: 1px solid var(--bg);
  transition: width var(--normal) var(--ease);
  min-width: 2px;
}
.mix-label { font-size: 0.72rem; font-weight: 600; color: #fff; white-space: nowrap; padding: 0 0.3rem; text-shadow: 0 1px 1px rgba(0,0,0,.4); }
.mix-empty { padding: 0 0.75rem; align-self: center; }

.preview-score { display: flex; align-items: baseline; gap: 0.4rem; }
.preview-score[hidden], .attr-body[hidden], [hidden] { display: none !important; }
.preview-score b { font-size: 1.4rem; }

.attr-list { display: flex; flex-direction: column; gap: 0.5rem; }

.attr {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid hsl(var(--hue) 55% 55%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color var(--fast) var(--ease), opacity var(--fast) var(--ease);
}
.attr.off { border-left-color: var(--border-strong); opacity: 0.7; box-shadow: none; }
.attr.off:hover { opacity: 1; }

.attr-head {
  display: grid;
  grid-template-columns: auto minmax(8rem, 1fr) 3rem minmax(4rem, 10rem) auto 1rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  user-select: none;
}
.attr-name { font-weight: 600; }
.attr-share { text-align: right; color: var(--text-muted); font-size: 0.85rem; }
.attr-mini { display: block; height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.attr-mini span { display: block; height: 100%; background: hsl(var(--hue) 55% 55%); transition: width var(--normal) var(--ease); }
.attr-hint { font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caret { width: 0.5rem; height: 0.5rem; border-right: 2px solid var(--text-faint); border-bottom: 2px solid var(--text-faint); transform: rotate(-45deg); transition: transform var(--fast) var(--ease); }
.attr.open .caret { transform: rotate(45deg); }

.switch input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); cursor: pointer; }

.attr-body { padding: 0.25rem 0.9rem 0.9rem; border-top: 1px solid var(--border); }

.field {
  display: grid;
  grid-template-columns: 6.5rem 1fr 5rem 5rem;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  margin: 0.35rem 0;
}
.field-label { color: var(--text-muted); }
.field input[type="range"] { width: 100%; padding: 0; border: none; background: transparent; accent-color: var(--accent); }
.field .num-in { padding: 0.2rem 0.4rem; font-size: 0.8rem; width: 100%; }
.field output { text-align: right; color: var(--text); font-size: 0.82rem; }
.field select { padding: 0.25rem 0.4rem; font-size: 0.82rem; grid-column: 2 / span 3; }
.weight-field { margin: 0.6rem 0 0.4rem; }
.weight-field input[type="range"] { accent-color: hsl(var(--hue) 55% 55%); }

.combined { margin: 0.5rem 0 0.75rem; }
.combined .plot { max-width: 30rem; }
.plot-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.2rem; }
.plot-note { margin: 0.2rem 0 0; font-size: 0.78rem; }

.shapes { display: flex; flex-direction: column; gap: 0.5rem; }
.shape {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem 0.6rem;
  background: color-mix(in srgb, var(--bg-raised) 70%, var(--bg));
}
.shape-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.shape-head b { font-size: 0.9rem; }
.shape-sub { font-size: 0.8rem; flex: 1; }
.influence { margin: 0; grid-template-columns: 4.5rem 8rem 4rem auto; font-size: 0.78rem; }
.influence .num-in { display: none; }
.shape-grid { display: grid; grid-template-columns: 1fr minmax(14rem, 22rem); gap: 0.75rem 1.25rem; align-items: start; margin-top: 0.3rem; }
.shape-fields .field { grid-template-columns: 6rem 1fr 4.5rem 4.5rem; }

.add-shape { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: 0.75rem; }

.plot { width: 100%; height: auto; display: block; touch-action: none; }
.plot .axis { stroke: var(--border-strong); stroke-width: 1; }
.plot .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 3; }
.plot .curve { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.plot .area { fill: var(--accent); opacity: 0.12; }
.plot .tick { fill: var(--text-faint); font-size: 9px; }
.plot .marker { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 3 3; }
.plot .marker-label { fill: var(--gold); }
.plot .handle { fill: var(--bg-raised); stroke: var(--accent); stroke-width: 2; cursor: ew-resize; transition: r var(--fast) var(--ease); }
.plot .handle:hover, .plot.dragging .handle { r: 7; fill: var(--accent); }

.builder-submit { display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0 0.5rem; flex-wrap: wrap; }
.raw { margin-top: 0.75rem; }
.raw summary { cursor: pointer; }
.raw textarea { margin-top: 0.5rem; }

/* ---------------------------------------------------------------- consensus readout */

.consensus { display: flex; flex-direction: column; gap: 0.6rem; }
.consensus-row { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.55rem 0.8rem; }
.consensus-head { display: flex; justify-content: space-between; align-items: baseline; }
.consensus-label { font-weight: 600; }
.consensus-share { color: var(--text-muted); font-size: 0.85rem; }
.share-bar { height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; margin: 0.3rem 0 0.4rem; }
.share-bar span { display: block; height: 100%; background: var(--accent); }
.consensus-shapes { display: flex; flex-wrap: wrap; gap: 0.35rem 0.6rem; font-size: 0.8rem; align-items: center; }
.chip { display: inline-flex; gap: 0.35rem; align-items: baseline; padding: 0.15rem 0.5rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); }
.chip b { font-weight: 600; color: var(--text); }
.chip em { font-style: normal; color: var(--text-faint); }

@media (max-width: 40rem) {
  .attr-head { grid-template-columns: auto 1fr 3rem 1rem; }
  .attr-mini, .attr-hint { display: none; }
  .shape-grid { grid-template-columns: 1fr; }
  .field { grid-template-columns: 5.5rem 1fr 4rem; }
  .field .num-in { display: none; }
  .shape-fields .field { grid-template-columns: 5.5rem 1fr 4rem; }
}

/* ---------------------------------------------------------------- proposals */

.proposals { display: flex; flex-direction: column; gap: 0.6rem; }
.proposal {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.75rem;
  align-items: start;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  box-shadow: var(--shadow);
  transition: border-color var(--fast) var(--ease);
}
.proposal.mine { border-color: var(--accent); }
.proposal.winner { border-color: var(--gold); }
.proposal-rank { padding-top: 0.1rem; }
.proposal-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; }
.proposal-title { font-size: 1rem; }
.proposal-blurb { margin: 0.25rem 0 0.35rem; color: var(--text); }
.proposal-rules { margin-top: 0.25rem; }
.proposal-rules summary { cursor: pointer; font-size: 0.85rem; }
.proposal-rules .consensus { margin-top: 0.5rem; }
.proposal-votes { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; min-width: 4.5rem; }
.proposal-votes b { font-size: 1.3rem; }
.proposal-votes form { margin-top: 0.3rem; }
.winner-pill { color: var(--gold); }
.proposal-form { margin-bottom: 0.75rem; }

@media (max-width: 40rem) {
  .proposal { grid-template-columns: 1.5rem 1fr; }
  .proposal-votes { grid-column: 2; flex-direction: row; align-items: baseline; gap: 0.5rem; }
}

/* ---------------------------------------------------------------- readout curves */

.curves { margin-top: 0.4rem; }
.curves > summary { cursor: pointer; font-size: 0.8rem; list-style: none; display: inline-flex; align-items: center; gap: 0.35rem; }
.curves > summary::-webkit-details-marker { display: none; }
.curves > summary::before {
  content: ""; width: 0.4rem; height: 0.4rem;
  border-right: 2px solid var(--text-faint); border-bottom: 2px solid var(--text-faint);
  transform: rotate(-45deg); transition: transform var(--fast) var(--ease);
}
.curves[open] > summary::before { transform: rotate(45deg); }
.curve-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.6rem 1rem; margin: 0.5rem 0 0.2rem; }
figure.curve { margin: 0; }
figure.curve figcaption { font-size: 0.78rem; margin-top: 0.15rem; }
figure.curve figcaption em { font-style: normal; color: var(--text-faint); }
.curve-note { grid-column: 1 / -1; margin: 0; font-size: 0.78rem; }

/* ---------------------------------------------------------------- lookup + player page */

.lookup { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: -0.75rem 0 1.5rem; }
.lookup input { font-size: 1rem; padding: 0.5rem 0.7rem; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0.75rem 0 1rem; }

.build-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 0.75rem; }
.build {
  --el: var(--border-strong);
  background: linear-gradient(90deg, color-mix(in srgb, var(--el) 9%, var(--bg-raised)), var(--bg-raised) 42%);
  border: 1px solid var(--border);
  box-shadow: inset 3px 0 0 var(--el), var(--shadow);
  border-radius: var(--radius);
  padding: 0.8rem 0.9rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform var(--normal) var(--ease), box-shadow var(--normal) var(--ease);
}
.build:hover { transform: translateY(-2px); box-shadow: inset 3px 0 0 var(--el), var(--shadow-hover); }
/* data-el rather than the .el-* classes: those set `color`, which would
 * tint every number on the card. */
.build[data-el="Pyro"] { --el: var(--pyro); }
.build[data-el="Hydro"] { --el: var(--hydro); }
.build[data-el="Anemo"] { --el: var(--anemo); }
.build[data-el="Electro"] { --el: var(--electro); }
.build[data-el="Dendro"] { --el: var(--dendro); }
.build[data-el="Cryo"] { --el: var(--cryo); }
.build[data-el="Geo"] { --el: var(--geo); }
.build-head { display: flex; align-items: center; gap: 0.7rem; }
.build-title { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.build-title a { color: var(--text); }
.build-title .pill { align-self: flex-start; }
.build-title .muted { font-size: 0.8rem; }
.build-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.3rem 0.6rem; margin: 0; }
.build-stats div { display: flex; justify-content: space-between; gap: 0.4rem; font-size: 0.82rem; border-bottom: 1px dashed var(--border); padding-bottom: 0.15rem; }
.build-stats dt { color: var(--text-faint); font-weight: 600; letter-spacing: 0.04em; font-size: 0.7rem; align-self: center; }
.build-stats dd { margin: 0; }
.build-boards { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; margin-top: auto; }
.build-boards p { margin: 0; font-size: 0.82rem; }
.board-row { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.board-row a { flex: 1; min-width: 8rem; }
.board-place .rank { min-width: 0; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 0.75rem; }
.game-card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 0.9rem; box-shadow: var(--shadow); }
.game-card h4 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.uid-list { list-style: none; margin: 0 0 0.5rem; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.uid-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; }
.uid-list li a:last-child { margin-left: auto; font-size: 0.8rem; }
.pending { margin: 0.5rem 0; padding: 0.5rem 0.6rem; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); font-size: 0.85rem; }
.pending-row { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.3rem; }
.claim-form { display: flex; gap: 0.4rem; margin-top: 0.5rem; }

/* ---------------------------------------------------------------- shelf */

.shelf { display: flex; flex-direction: column; gap: 0.4rem; margin: -0.9rem 0 1.5rem; }
.shelf-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.shelf-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; min-width: 5.5rem; }
.shelf-item {
  display: inline-flex; align-items: center; gap: 0.1rem;
  padding: 0.15rem 0.25rem 0.15rem 0.6rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-raised); font-size: 0.85rem;
}
.shelf-item.pinned { border-color: color-mix(in srgb, var(--gold) 55%, transparent); }
.shelf-item a { color: var(--text); }
.shelf-item .icon-btn { font-size: 0.95rem; padding: 0 0.3rem; }
.shelf-item.pinned .icon-btn:first-of-type { color: var(--gold); }

/* ---------------------------------------------------------------- polish pass */

/* Number boxes: the slider is the control, the box is for typing an exact
 * value. Browser spinner arrows add nothing but clutter. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; font-variant-numeric: tabular-nums; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* One chevron for every fold-out on the site. */
details > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 0.4rem; user-select: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: ""; flex: none; width: 0.4rem; height: 0.4rem;
  border-right: 2px solid var(--text-faint); border-bottom: 2px solid var(--text-faint);
  transform: rotate(-45deg) translateY(-1px);
  transition: transform var(--fast) var(--ease);
}
details[open] > summary::before { transform: rotate(45deg) translateY(-2px); }
details > summary:hover { color: var(--text); }
details > summary:hover::before { border-color: var(--accent); }
.curves > summary::before { transform: rotate(-45deg) translateY(-1px); }
.curves[open] > summary::before { transform: rotate(45deg) translateY(-2px); }

/* Hero: a quiet gradient band, tinted by the character's element. */
.hero {
  --hero-tint: var(--accent);
  position: relative;
  padding: 1rem 1.1rem;
  margin: 0.25rem 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 160% at 0% 0%, color-mix(in srgb, var(--hero-tint) 16%, transparent), transparent 55%),
    var(--bg-raised);
  overflow: hidden;
  border-top: 2px solid color-mix(in srgb, var(--hero-tint) 65%, var(--border));
}
.hero[data-el="Pyro"] { --hero-tint: var(--pyro); }
.hero[data-el="Hydro"] { --hero-tint: var(--hydro); }
.hero[data-el="Anemo"] { --hero-tint: var(--anemo); }
.hero[data-el="Electro"] { --hero-tint: var(--electro); }
.hero[data-el="Dendro"] { --hero-tint: var(--dendro); }
.hero[data-el="Cryo"] { --hero-tint: var(--cryo); }
.hero[data-el="Geo"] { --hero-tint: var(--geo); }
.hero img { width: 84px; height: 84px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)); }
.hero.profile img { border-radius: 50%; object-fit: cover; }
.hero h2 { font-size: 1.45rem; }
.hero .muted a { color: var(--text); }
.hero .muted a:hover { color: var(--accent); }
.hero code { font-size: 0.85em; background: var(--bg); padding: 0.05rem 0.35rem; border-radius: 4px; border: 1px solid var(--border); }

/* Section headings: a touch more air, a hairline underneath. */
h3 { margin-top: 1.75rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--border); }
h3 + p.muted { margin-top: 0.4rem; }

/* Secondary actions read as secondary. */
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--border-strong); font-weight: 500; }
button.ghost:hover { background: var(--bg-hover); border-color: var(--accent); box-shadow: none; transform: none; filter: none; }
button.danger { background: #f2555a; color: #fff; }

/* Flash messages: dismissable, tidy. */
.flash { position: relative; padding-right: 2.4rem; display: flex; align-items: center; }
.flash-close {
  position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; color: var(--text-muted); font-size: 1.1rem; line-height: 1; padding: 0.2rem 0.4rem;
}
.flash-close:hover { color: var(--text); box-shadow: none; transform: translateY(-50%); filter: none; }

/* Confirmation dialog. */
dialog.confirm {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--text);
  padding: 0;
  max-width: 26rem;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-hover);
}
dialog.confirm::backdrop { background: rgba(6, 8, 12, 0.6); backdrop-filter: blur(2px); }
.confirm-body { padding: 1.1rem 1.2rem 1rem; }
.confirm-text { margin: 0 0 1rem; font-size: 0.95rem; line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* Forms: inputs and buttons line up on one baseline. */
form.inline { display: inline-flex; align-items: center; gap: 0.4rem; }
input, select { min-height: 2.1rem; }
button { min-height: 2.1rem; }

/* Empty states and cards. */
.empty { padding: 1.75rem 1rem; }
.card + h3 { margin-top: 2rem; }

/* Character list: a touch of element colour on hover. */
tbody tr:hover .pill { filter: brightness(1.15); }

/* Ballot page: proposals and builder breathe a little more. */
.proposal { padding: 0.85rem 1rem; }
.proposal-title { font-size: 1.05rem; }
.attr-head { padding: 0.7rem 0.9rem; }
.shape { padding: 0.6rem 0.8rem 0.7rem; }
.builder-submit { margin-top: 1.25rem; }


/* ---------------------------------------------------------------- lists as tiles */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.7rem;
}
.tile {
  --el: var(--border-strong);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0.9rem 0.7rem 0.8rem;
  background: linear-gradient(90deg, color-mix(in srgb, var(--el) 10%, var(--bg-raised)), var(--bg-raised) 45%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 3px 0 0 var(--el), var(--shadow);
  color: var(--text);
  min-width: 0;
  transition: transform var(--normal) var(--ease), box-shadow var(--normal) var(--ease), border-color var(--fast) var(--ease);
}
.tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--el) 60%, var(--border-strong)); box-shadow: inset 3px 0 0 var(--el), var(--shadow-hover); color: var(--text); }
.tile[data-el="Pyro"] { --el: var(--pyro); }
.tile[data-el="Hydro"] { --el: var(--hydro); }
.tile[data-el="Anemo"] { --el: var(--anemo); }
.tile[data-el="Electro"] { --el: var(--electro); }
.tile[data-el="Dendro"] { --el: var(--dendro); }
.tile[data-el="Cryo"] { --el: var(--cryo); }
.tile[data-el="Geo"] { --el: var(--geo); }
.tile .face { width: 60px; height: 60px; }
span.face { display: block; }
.tile-body { display: flex; flex-direction: column; gap: 0.12rem; min-width: 0; }
.tile-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-facts { display: flex; flex-wrap: wrap; gap: 0.25rem 0.7rem; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.tile-facts b { color: var(--text); font-weight: 600; }
.live { color: var(--accent); font-weight: 600; }

/* Compact rows for a character's boards and ballots. */
.rows { display: flex; flex-direction: column; gap: 0.4rem; }
.row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding: 0.6rem 0.9rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.row:hover { border-color: var(--accent); background: var(--bg-hover); color: var(--text); }
.row.dim { opacity: 0.72; }
.row.dim:hover { opacity: 1; }
.row-title { font-weight: 600; }
.row-meta { font-size: 0.85rem; white-space: nowrap; }
.status {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  border: 1px solid var(--border-strong); color: var(--text-muted);
}
.status-ratified, .status-open { color: #3fb950; border-color: color-mix(in srgb, #3fb950 55%, transparent); }
.status-open { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }

/* Front page. */
.welcome { text-align: center; padding: 1.75rem 0 1.5rem; }
.welcome h1 { font-size: 1.9rem; margin: 0 0 0.35rem; letter-spacing: -0.02em; }
.welcome > p.muted { margin: 0 0 1rem; font-size: 1rem; }
.welcome .lookup { justify-content: center; margin: 0 auto 0.9rem; }
.welcome .lookup input { width: 18rem; max-width: 100%; }
.welcome .shelf { align-items: center; margin: 0 0 1rem; }
.welcome .shelf-group { justify-content: center; }
.welcome .shelf-label { min-width: 0; }
.welcome .stats { justify-content: center; margin: 0; font-size: 0.85rem; }
.welcome .stats b { color: var(--text-muted); font-weight: 600; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 1.75rem 0 0.75rem; }
.section-head h2 { margin: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }
.page-head h2 { margin: 0; }
.search { display: flex; gap: 0.4rem; }

.account a { color: var(--text); font-size: 0.9rem; }
.account a.muted { color: var(--text-muted); }

/* Narrow screens: same components, stacked. */
@media (max-width: 40rem) {
  .welcome { padding: 1rem 0 1rem; }
  .welcome h1 { font-size: 1.45rem; }
  .welcome .lookup input { width: 100%; }
  .welcome .lookup button { width: 100%; }
  .tiles { grid-template-columns: 1fr; }
  .tile .face { width: 52px; height: 52px; }
  .row { grid-template-columns: 1fr auto; }
  .row-meta:nth-child(2) { grid-column: 1; }
  .hero { padding: 0.8rem 0.9rem; }
  .hero img { width: 64px; height: 64px; }
  .hero h2 { font-size: 1.2rem; }
  .build-grid { grid-template-columns: 1fr; }
  .section-head { flex-wrap: wrap; }
  .shelf-item { font-size: 0.8rem; }
}

/* ---------------------------------------------------------------- region emblems
 * An oversized monotone glyph behind each character tile, card and hero:
 * texture, not information. Drawn as CSS masks so they take the theme's
 * text colour at low opacity in light and dark alike. The glyphs are
 * original simple shapes, one per region. */

[data-region="mondstadt"] { --emblem: url("/static/emblems/mondstadt.png"); }
[data-region="liyue"] { --emblem: url("/static/emblems/liyue.png"); }
[data-region="inazuma"] { --emblem: url("/static/emblems/inazuma.png"); }
[data-region="sumeru"] { --emblem: url("/static/emblems/sumeru.png"); }
[data-region="fontaine"] { --emblem: url("/static/emblems/fontaine.png"); }
[data-region="natlan"] { --emblem: url("/static/emblems/natlan.png"); }
[data-region="snezhnaya"] { --emblem: url("/static/emblems/snezhnaya.png"); }
[data-region="nodkrai"] { --emblem: url("/static/emblems/nodkrai.png"); }
[data-region="primogem"] { --emblem: url("/static/emblems/primogem.png"); }
.tile, .build, .hero { position: relative; overflow: hidden; isolation: isolate; }
.tile > *, .build > *, .hero > * { position: relative; z-index: 1; }
.tile::before, .build::before, .hero::before {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  display: none;
  background: var(--text);
  opacity: 0.055;
  -webkit-mask: var(--emblem) center / contain no-repeat;
  mask: var(--emblem) center / contain no-repeat;
}
.tile[data-region]:not([data-region=""])::before,
.build[data-region]:not([data-region=""])::before,
.hero[data-region]:not([data-region=""])::before { display: block; }
.tile::before { width: 8rem; height: 8rem; right: -1.4rem; top: -1.2rem; }
.build::before { width: 10.5rem; height: 10.5rem; right: -2.4rem; top: -2rem; }
.hero::before { width: 13rem; height: 13rem; right: 1.5rem; top: -3rem; opacity: 0.05; }


@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .tile::before,
  :root:not([data-theme="dark"]) .build::before,
  :root:not([data-theme="dark"]) .hero::before { opacity: 0.07; }
}
@media (max-width: 40rem) {
  .hero::before { width: 9rem; height: 9rem; right: -1rem; top: -1.5rem; }
}

/* ---------------------------------------------------------------- team strips */

.team { display: inline-flex; align-items: center; gap: 0.2rem; vertical-align: middle; }
.mate {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex: none;
}
.mate img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); }
.mate.lead { margin-right: 0.35rem; }
.mate.lead::after { content: ""; position: absolute; right: -0.3rem; top: 15%; height: 70%; width: 1px; background: var(--border-strong); }
.mate.flex { border: 1px dashed var(--border-strong); border-radius: 50%; color: var(--text-faint); font-size: 0.6rem; letter-spacing: 0.02em; }
.mate-c {
  position: absolute; right: -3px; bottom: -3px;
  font-size: 0.58rem; font-weight: 700; line-height: 1; padding: 0.1rem 0.22rem;
  border-radius: 4px; background: var(--bg); color: var(--gold); border: 1px solid var(--border-strong);
  font-variant-numeric: tabular-nums;
}
.mate-name { font-size: 0.7rem; font-weight: 600; }
.team-xs .mate { width: 24px; height: 24px; }
.team-xs .mate-c { font-size: 0.52rem; padding: 0.05rem 0.18rem; }
.team-xs .mate.flex { font-size: 0.5rem; }
.team-md .mate { width: 40px; height: 40px; }
.team-md .mate-c { font-size: 0.66rem; }
.team-line { margin: 0.45rem 0 0; }
.tile .team { margin-top: 0.3rem; }
.row-title .team { margin-left: 0.4rem; }
.board-row .team { margin-right: auto; }

.team-fields, .guide-fields { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem 0.7rem; margin: 0; }
.team-fields legend, .guide-fields legend { padding: 0 0.35rem; font-size: 0.85rem; color: var(--text-muted); }
.team-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.35rem 0; }
.team-label { min-width: 5rem; font-size: 0.85rem; font-weight: 600; }
.team-row select { font-size: 0.85rem; padding: 0.3rem 0.5rem; }
.guide-fields label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; margin: 0.35rem 0; }
.guide-fields textarea { font-family: inherit; font-size: 0.85rem; }

.guide { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0.75rem; }
.guide-col { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.6rem 0.9rem; }
.guide-col h4 { margin: 0 0 0.35rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.guide-col ul { margin: 0; padding-left: 1.1rem; }
.guide-col li { margin: 0.15rem 0; }

/* ---------------------------------------------------------------- discussion */

.discussion { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.discussion-log { max-height: 26rem; overflow-y: auto; padding: 0.6rem 0.9rem; display: flex; flex-direction: column; gap: 0.55rem; }
.discussion-log .empty { padding: 1.25rem 0.5rem; }
.msg { padding: 0.45rem 0.7rem; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--border); max-width: 46rem; }
.msg.mine { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.msg-head { display: flex; align-items: baseline; gap: 0.5rem; font-size: 0.8rem; margin-bottom: 0.15rem; }
.msg-head a { color: var(--text); }
.msg-delete { margin-left: auto; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.92rem; }
.compose { display: flex; gap: 0.5rem; align-items: flex-end; padding: 0.6rem 0.9rem; border-top: 1px solid var(--border); }
.compose textarea { flex: 1; font-family: inherit; font-size: 0.9rem; resize: vertical; min-height: 2.4rem; }
.discussion > p.muted { margin: 0; padding: 0.6rem 0.9rem; border-top: 1px solid var(--border); }

/* ---------------------------------------------------------------- tiles: uniform, with a count badge */

.tiles { grid-auto-rows: 1fr; }
.tile { min-height: 5.9rem; padding-right: 4.2rem; }
.tile-count {
  position: absolute; right: 0.8rem; bottom: 0.55rem; z-index: 1;
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1.05;
}
.tile-count b { font-size: 1.15rem; font-weight: 650; }
.tile-count small { font-size: 0.58rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.tile .team { margin-top: 0.35rem; }

/* Flex slot: a dashed ring around a nondescript silhouette. */
.mate.flex svg { width: 62%; height: 62%; fill: var(--text-faint); opacity: 0.7; }

/* ---------------------------------------------------------------- moderation */

.msg-tools { margin-left: auto; display: inline-flex; align-items: center; gap: 0.3rem; }
.report-menu { display: inline-block; font-size: 0.78rem; }
.report-menu > summary { font-size: 0.75rem; }
.report-menu > summary::before { display: none; }
.report-form { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; align-items: center; }
.report-form select, .report-form input { font-size: 0.8rem; padding: 0.25rem 0.45rem; min-height: 0; }
.report-form button { font-size: 0.78rem; padding: 0.25rem 0.6rem; min-height: 0; }
.hidden-content { opacity: 0.6; border-style: dashed; }
.banned-pill { color: #f2555a; }
.danger-text { color: #f2555a; }

.queue { display: flex; flex-direction: column; gap: 0.75rem; }
.report { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 0.9rem; box-shadow: var(--shadow); }
.report-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; font-size: 0.9rem; }
.report-note { margin: 0.25rem 0 0; font-style: italic; }
.report-target { margin: 0.5rem 0; }
.report-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }

/* ---------------------------------------------------------------- countdown */

.countdown { font-variant-numeric: tabular-nums; }
.countdown.soon { color: var(--gold); font-weight: 600; }
.countdown.overdue { color: #f2555a; font-weight: 600; }

/* ---------------------------------------------------------------- proposal columns */

.proposal-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.proposal-column h4 { margin: 0 0 0.5rem; font-size: 0.9rem; }
.proposal-column h4 .muted { font-weight: 400; font-size: 0.8rem; }
.proposal-columns .proposal { grid-template-columns: 2.4rem 1fr auto; }
@media (max-width: 52rem) {
  .proposal-columns { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- announcements */

.announcements { display: flex; flex-direction: column; gap: 0.75rem; }
.announcement {
  display: grid; grid-template-columns: 1fr; gap: 0.9rem; align-items: start;
  background: var(--bg-raised); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 0.9rem 1.1rem; box-shadow: var(--shadow);
}
.announcement.with-image { grid-template-columns: minmax(10rem, 18rem) 1fr; }
.announcement img { width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
.announcement h3 { margin: 0 0 0.2rem; padding: 0; border: none; font-size: 1.05rem; }
.announcement-meta { margin: 0 0 0.4rem; font-size: 0.8rem; }
.announcement-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.announce-form textarea { font-family: inherit; }
.announce-form input[type="file"] { border: none; background: transparent; padding-left: 0; }
@media (max-width: 40rem) {
  .announcement.with-image { grid-template-columns: 1fr; }
}

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

/* The in-game profile card: namecard as the backdrop, picture, and the
 * end-game records. The banner is faded and washed toward the surface
 * colour on the left so the text stays readable over any artwork. */
.profile-hero {
  position: relative; overflow: hidden; isolation: isolate;
  margin: 0.25rem 0 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-raised); box-shadow: var(--shadow);
}
.profile-hero .banner {
  position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 35%; opacity: 0.6;
}
.profile-hero.has-banner::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--bg-raised) 94%, transparent) 0%,
      color-mix(in srgb, var(--bg-raised) 72%, transparent) 40%,
      color-mix(in srgb, var(--bg-raised) 30%, transparent) 100%),
    linear-gradient(180deg, transparent 55%, color-mix(in srgb, var(--bg-raised) 85%, transparent) 100%);
}
.profile-main {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 1.1rem;
  padding: 1.15rem 1.25rem 0.95rem;
}
.pfp {
  width: 92px; height: 92px; flex: none; overflow: hidden;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  border: 2px solid color-mix(in srgb, var(--gold) 60%, var(--border-strong));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bg-raised) 70%, transparent), 0 3px 10px rgba(0, 0, 0, 0.4);
}
.pfp img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-id { min-width: 0; }
.profile-id h2 { margin: 0; font-size: 1.55rem; }
.signature { margin: 0.1rem 0 0; color: var(--text-muted); font-style: italic; overflow-wrap: anywhere; }
.profile-meta { margin: 0.3rem 0 0; }
.profile-meta a { color: var(--text); }
.profile-meta a:hover { color: var(--accent); }

.records {
  position: relative; z-index: 1; list-style: none; margin: 0;
  padding: 0.7rem 1.25rem 0.9rem;
  display: flex; flex-wrap: wrap; gap: 0.5rem 0.6rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--bg-raised) 55%, transparent);
  backdrop-filter: blur(8px);
}
.record {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0.8rem 0.4rem 0.55rem; min-width: 10.5rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}
.record .badge {
  --badge-tint: var(--text);
  width: 32px; height: 32px; flex: none; background: var(--badge-tint); opacity: 0.92;
  -webkit-mask: var(--badge) center / contain no-repeat;
  mask: var(--badge) center / contain no-repeat;
}
.record[data-badge="abyss"] { --badge: url("/static/badges/abyss.png"); }
.record[data-badge="abyss"] .badge { --badge-tint: var(--electro); }
.record[data-badge="theater"] { --badge: url("/static/badges/theater.png"); }
.record[data-badge="theater"] .badge { --badge-tint: var(--hydro); }
.record[data-badge="stygian"] { --badge: url("/static/badges/stygian.png"); }
.record[data-badge="achievements"] { --badge: url("/static/badges/achievements.png"); }
.record[data-badge="achievements"] .badge { --badge-tint: var(--gold); }
.record[data-badge="friendship"] { --badge: url("/static/badges/friendship.png"); }
.record[data-badge="friendship"] .badge { --badge-tint: var(--pyro); }
.record .medal { width: 36px; height: 36px; flex: none; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); }
.record-text { display: flex; flex-direction: column; line-height: 1.2; }
.record-text b { font-size: 1rem; }
.record-text small { color: var(--text-muted); font-size: 0.72rem; }
.star { color: var(--gold); margin-left: 0.05rem; }

/* ---------------------------------------------------------------- build cards */

/* The whole card opens the build; the leaderboard links inside sit above
 * the overlay so they still go where they say. */
.build-open { position: absolute; inset: 0; z-index: 2; border-radius: inherit; }
.build-open:focus-visible { outline-offset: -3px; }
.build .board-row a { position: relative; z-index: 3; }
.build .cv { margin-left: auto; align-self: flex-start; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.build .cv small { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.08em; color: var(--text-faint); }
.build .cv b { font-size: 0.95rem; }
.gear-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 0.3rem; }
.gear-icon {
  width: 34px; height: 34px; object-fit: contain; display: block;
  border-radius: 7px; border: 1px solid var(--border);
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--gold) 16%, transparent), color-mix(in srgb, var(--bg) 70%, transparent) 75%);
}
.gear-icon.weapon { margin-right: 0.3rem; background: color-mix(in srgb, var(--bg) 70%, transparent); }
.set-chip { font-size: 0.7rem; padding: 0.05rem 0.45rem; color: var(--text-muted); }
.board-row.best a:first-child { font-weight: 600; }

/* ---------------------------------------------------------------- build detail */

.crumbs { margin: 0.6rem 0 0.5rem; font-size: 0.875rem; }
.detail {
  --el: var(--border-strong);
  position: relative; overflow: hidden; isolation: isolate;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-raised); box-shadow: var(--shadow);
}
.detail[data-el="Pyro"] { --el: var(--pyro); }
.detail[data-el="Hydro"] { --el: var(--hydro); }
.detail[data-el="Anemo"] { --el: var(--anemo); }
.detail[data-el="Electro"] { --el: var(--electro); }
.detail[data-el="Dendro"] { --el: var(--dendro); }
.detail[data-el="Cryo"] { --el: var(--cryo); }
.detail[data-el="Geo"] { --el: var(--geo); }
.detail-head {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; gap: 1rem; align-items: flex-start;
  padding: 1.15rem 1.25rem 1rem; min-height: 9.5rem;
  background: linear-gradient(90deg, color-mix(in srgb, var(--el) 18%, transparent), transparent 65%);
  border-bottom: 1px solid var(--border);
}
.detail-head .splash {
  position: absolute; right: -4%; top: 50%; transform: translateY(-50%);
  height: 220%; width: auto; max-width: none; opacity: 0.28; z-index: 0; pointer-events: none;
  -webkit-mask: linear-gradient(90deg, transparent 0%, #000 45%);
  mask: linear-gradient(90deg, transparent 0%, #000 45%);
}
.detail-head > * { position: relative; z-index: 1; }
.face-lg { width: 112px; height: 112px; }
.detail-id { min-width: 0; }
.detail-id h2 { margin: 0; font-size: 1.5rem; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.detail-id .muted { margin: 0.2rem 0 0; }
.detail-id .muted a { color: var(--text); }
.detail-id .muted a:hover { color: var(--accent); }
.talents { list-style: none; margin: 0.7rem 0 0; padding: 0; display: flex; gap: 0.6rem; }
.talent {
  position: relative; width: 46px; height: 46px; border-radius: 50%;
  background: #171a22; border: 1px solid var(--border-strong);
  display: grid; place-items: center;
}
.talent img { width: 70%; height: 70%; object-fit: contain; }
.talent-blank { width: 50%; height: 50%; border-radius: 50%; border: 1px dashed var(--border-strong); }
.talent b {
  position: absolute; right: -5px; bottom: -4px;
  font-size: 0.66rem; line-height: 1; padding: 0.12rem 0.32rem; border-radius: 5px;
  background: var(--bg); border: 1px solid var(--border-strong); color: var(--text);
}
.talent.boosted b { color: var(--accent); border-color: var(--accent); }
.consts { list-style: none; margin: 0 0 0 auto; padding: 0; display: grid; grid-template-columns: repeat(3, 36px); gap: 0.4rem; }
.const {
  width: 36px; height: 36px; border-radius: 50%;
  background: #171a22; border: 1px solid var(--border-strong);
  display: grid; place-items: center; opacity: 0.32; color: var(--text-muted); font-size: 0.75rem;
}
.const.on {
  opacity: 1;
  border-color: color-mix(in srgb, var(--el) 75%, var(--border-strong));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--el) 28%, transparent);
}
.const img { width: 72%; height: 72%; object-fit: contain; }

.detail-boards, .detail .panel, .artifacts { padding: 0.9rem 1.25rem 1rem; }
.detail-boards { border-bottom: 1px solid var(--border); }
.detail h3 { margin: 0 0 0.6rem; font-size: 0.95rem; }
.detail h3 .muted { font-weight: 400; font-size: 0.78rem; margin-left: 0.4rem; }
.detail .section-head { margin: 0 0 0.6rem; align-items: center; flex-wrap: wrap; }
.detail .section-head h3 { margin: 0; }
.board-picker { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.board-picker .chip { font-size: 0.8rem; color: var(--text-muted); transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease); }
.board-picker .chip:hover { border-color: var(--border-strong); color: var(--text); }
.board-picker .chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.standing-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1rem; }
.standing-rank .rank { font-size: 1.7rem; min-width: 0; line-height: 1; }
.standing-top { font-weight: 600; }
.standing-score b { font-size: 1.25rem; }
.standing-score small { color: var(--text-faint); }
.standing-link { margin-left: auto; font-weight: 600; }
.breakdown { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.7rem; max-width: 42rem; }
.breakdown-row { display: grid; grid-template-columns: 9.5rem 5rem 1fr 6rem; gap: 0.6rem; align-items: center; font-size: 0.85rem; }
.breakdown-label { color: var(--text-muted); }
.breakdown-row .share-bar { margin: 0; }
.breakdown-pts { text-align: right; }
.breakdown-pts small { color: var(--text-faint); }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); }
.detail-grid .panel + .panel { border-left: 1px solid var(--border); }
.stat-panel { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.15rem 1rem; }
.stat-panel div { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; border-bottom: 1px dashed var(--border); padding: 0.2rem 0; font-size: 0.85rem; }
.stat-panel dt { color: var(--text-muted); }
.stat-panel dd { margin: 0; text-align: right; }
.stat-panel dd small { font-size: 0.7rem; margin-left: 0.3rem; }
.stat-panel .cv-row dt { color: var(--text); font-weight: 600; }
.weapon { display: flex; gap: 0.85rem; align-items: flex-start; }
.weapon-icon {
  width: 74px; height: 74px; flex: none; object-fit: contain; border-radius: 9px;
  border: 1px solid var(--border);
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--gold) 16%, transparent), color-mix(in srgb, var(--bg) 70%, transparent) 75%);
}
.stars { color: var(--gold); font-size: 0.72rem; letter-spacing: 0.06em; margin-left: 0.3rem; vertical-align: 0.1em; }
.weapon .muted { margin: 0.15rem 0; }
.weapon-stats { margin: 0.2rem 0 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.85rem; }
.weapon-stats small { color: var(--text-muted); }
.set-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.875rem; }
.set-list li { display: flex; align-items: center; gap: 0.4rem; }
.set-list img { width: 28px; height: 28px; object-fit: contain; }
.set-list b { color: var(--gold); }

.artifact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr)); gap: 0.6rem; }
.artifact {
  display: flex; flex-direction: column; gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg) 45%, var(--bg-raised));
}
.artifact-head { display: flex; gap: 0.6rem; align-items: center; min-width: 0; }
.artifact-art {
  position: relative; width: 54px; height: 54px; flex: none; border-radius: 9px;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 72%);
}
.artifact-art img { width: 100%; height: 100%; object-fit: contain; display: block; }
.artifact-level {
  position: absolute; right: -5px; bottom: -4px;
  font-size: 0.62rem; font-weight: 700; line-height: 1; padding: 0.12rem 0.3rem; border-radius: 4px;
  background: var(--bg); border: 1px solid var(--border-strong);
}
.artifact-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.artifact-id b { font-size: 0.82rem; line-height: 1.2; }
.artifact-id small { font-size: 0.7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-main {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem;
  padding: 0.3rem 0.55rem; border-radius: 6px; font-size: 0.82rem;
  background: color-mix(in srgb, var(--el) 14%, transparent);
}
.artifact-main b { font-size: 1rem; }
.substats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.22rem; }
.substat { display: grid; grid-template-columns: 1fr auto auto; gap: 0.5rem; align-items: center; font-size: 0.8rem; }
.substat-label { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.substat b { min-width: 3.2rem; text-align: right; }
/* One pip per roll; taller and brighter for a higher-value roll. */
.rolls { display: inline-flex; gap: 2px; align-items: flex-end; height: 11px; --roll: var(--text); }
.rolls i { display: block; width: 5px; height: 4px; border-radius: 1px; background: var(--roll); opacity: 0.35; }
.rolls i[data-tier="2"] { height: 6px; opacity: 0.55; }
.rolls i[data-tier="3"] { height: 8px; opacity: 0.78; }
.rolls i[data-tier="4"] { height: 11px; opacity: 1; }
.substat[data-stat="FIGHT_PROP_CRITICAL"] .rolls,
.substat[data-stat="FIGHT_PROP_CRITICAL_HURT"] .rolls { --roll: var(--gold); }

/* The expanded build, opened in place over the player page. */
dialog.expand {
  padding: 0; border: none; background: transparent; overflow: visible;
  width: min(66rem, calc(100vw - 2rem)); max-width: none; max-height: none;
}
dialog.expand::backdrop { background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(3px); }
.expand-body { position: relative; max-height: calc(100vh - 2.5rem); overflow: auto; border-radius: var(--radius); }
.expand-close {
  position: absolute; top: 0.6rem; right: 0.6rem; z-index: 5;
  width: 2rem; height: 2rem; padding: 0; line-height: 1; font-size: 1.2rem; border-radius: 50%;
}
.expand .loading { padding: 3rem; text-align: center; color: var(--text-muted); background: var(--bg-raised); border-radius: var(--radius); }

@media (max-width: 48rem) {
  .profile-main { gap: 0.85rem; }
  .pfp { width: 72px; height: 72px; }
  .profile-id h2 { font-size: 1.3rem; }
  .record { min-width: calc(50% - 0.3rem); }
  .detail-head { flex-wrap: wrap; }
  .detail-head .splash { display: none; }
  .face-lg { width: 84px; height: 84px; }
  .consts { margin-left: 0; grid-template-columns: repeat(6, 32px); }
  .const { width: 32px; height: 32px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid .panel + .panel { border-left: none; border-top: 1px solid var(--border); }
  .stat-panel { grid-template-columns: 1fr; }
  .breakdown-row { grid-template-columns: 6.5rem 3.8rem 1fr 4.5rem; gap: 0.4rem; }
  .standing-link { margin-left: 0; }
  dialog.expand { width: calc(100vw - 1rem); }
  .expand-body { max-height: calc(100vh - 1rem); }
}
