/* ==========================================================================
   Slay the Spire 2 Build Advisor

   Design thesis: an instrument panel lit by torchlight.

   One rule governs the whole palette — and it carries meaning, not decoration:
     EMBER (warm)  = fit to YOUR build. Mechanistic, inferred from what cards do.
     JADE  (cool)  = COMMUNITY evidence. Statistical, measured from real runs.
     IRIS  (cold)  = YOUR OWN JUDGEMENT. Neither measured nor inferred — the
                     tiers you pushed a card up or down by hand.
   Score bars, badges and explanation rows all obey it, so a glance at a
   recommendation tells you how much is data, how much is inference, and how
   much is you.
   ========================================================================== */

:root {
  /* Ground: the Spire's stone is violet-black, not neutral black. */
  --ash:        #16131a;
  --stone:      #1d1924;
  --stone-hi:   #262030;
  --stone-line: #332b3f;

  --bone:       #ece6dc;
  --smoke:      #9c93a8;
  --smoke-dim:  #6d6579;

  --ember:      #ff7f45;
  --ember-deep: #c2521f;
  --ember-wash: rgba(255, 127, 69, 0.14);

  --jade:       #4fd3a6;
  --jade-deep:  #1e7359;
  --jade-wash:  rgba(79, 211, 166, 0.13);

  --iris:       #a78bfa;
  --iris-deep:  #6d4bd0;
  --iris-wash:  rgba(167, 139, 250, 0.14);

  --blood:      #e05068;
  --gold:       #e5b55f;

  /* Card types, borrowed from the game's own colour language. */
  --t-attack:  #cd5642;
  --t-skill:   #4a86c9;
  --t-power:   #b06fd0;
  --t-curse:   #7a6a8c;
  --t-status:  #5c6773;

  --r-common:   #b9b2a6;
  --r-uncommon: #6fa8d6;
  --r-rare:     #e5b55f;
  --r-ancient:  #d06fb4;

  --display: 'Grenze', Georgia, serif;
  --ui: 'Barlow', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;

  --r-sm: 3px;
  --r-md: 6px;
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(1100px 620px at 76% -10%, rgba(255, 127, 69, 0.09), transparent 62%),
    radial-gradient(760px 520px at 4% 104%, rgba(79, 211, 166, 0.06), transparent 60%),
    var(--ash);
  color: var(--bone);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--stone-line); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--smoke-dim); }

/* --------------------------------------------------------------- primitives */

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--smoke-dim);
}

.btn {
  background: var(--stone-hi);
  border: 1px solid var(--stone-line);
  color: var(--bone);
  padding: 7px 13px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.14s, border-color 0.14s, transform 0.1s;
}
.btn:hover { background: #302938; border-color: var(--smoke-dim); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.btn--primary {
  background: linear-gradient(180deg, var(--ember) 0%, var(--ember-deep) 100%);
  border-color: var(--ember-deep);
  color: #241005;
  font-weight: 600;
}
.btn--primary:hover { background: linear-gradient(180deg, #ff9160 0%, #d15c26 100%); }

.btn--ghost { background: transparent; }
.btn--sm { padding: 3px 8px; font-size: 12px; }
.btn--danger:hover { border-color: var(--blood); color: var(--blood); }

.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--smoke-dim); }

.input, .select {
  background: var(--ash);
  border: 1px solid var(--stone-line);
  border-radius: var(--r-sm);
  padding: 6px 9px;
  width: 100%;
}
.input:focus, .select:focus { border-color: var(--ember-deep); outline: none; }

.stepper { display: flex; align-items: center; gap: 2px; }
.stepper .input { text-align: center; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--stone-hi);
  border: 1px solid var(--stone-line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
}

.tabs { display: flex; gap: 2px; background: var(--ash); padding: 2px; border-radius: var(--r-sm); border: 1px solid var(--stone-line); }
.tab {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 5px 10px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--smoke);
  transition: background 0.14s, color 0.14s;
}
.tab:hover { color: var(--bone); }
.tab[aria-selected="true"] { background: var(--stone-hi); color: var(--bone); font-weight: 600; }

.muted { color: var(--smoke); }
.empty {
  color: var(--smoke);
  font-size: 13px;
  padding: 16px 2px;
  border-top: 1px dashed var(--stone-line);
  margin-top: 4px;
}

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

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--stone-line);
  background: rgba(22, 19, 26, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 40;
  flex-wrap: wrap;
}

.wordmark {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  margin: 0;
  white-space: nowrap;
}
.wordmark em { font-style: normal; color: var(--ember); }

.runline { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; flex: 1; min-width: 200px; }
.runline .chip { background: transparent; }

.topbar-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* Data provenance badge — the app never pretends stale data is live. */
.source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--stone-line);
  color: var(--smoke);
  cursor: help;
}
.source::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.source[data-source="live"] { color: var(--jade); border-color: var(--jade-deep); background: var(--jade-wash); }
.source[data-source="cache"] { color: var(--gold); border-color: #6b5528; }
.source[data-source="offline"] { color: var(--blood); border-color: #6e2a35; }

/* ------------------------------------------------------------------- board */

.board {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr) minmax(0, 430px);
  gap: 1px;
  background: var(--stone-line);
  align-items: stretch;
  min-height: calc(100vh - 96px);
}

.panel {
  background: var(--ash);
  padding: 16px 16px 28px;
  min-width: 0;
}
.panel--advisor { background: linear-gradient(180deg, #191520 0%, var(--ash) 340px); }

.panel-title {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--smoke-dim);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--stone-line);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.block { margin-bottom: 20px; }
.block > h3 {
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--smoke);
  margin: 0 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* -------------------------------------------------------------- deck editor */

.decklist { display: flex; flex-direction: column; gap: 2px; }

.deckrow {
  display: grid;
  grid-template-columns: 3px 26px 1fr auto auto;
  align-items: center;
  gap: 9px;
  padding: 5px 8px 5px 0;
  border-radius: var(--r-sm);
  background: var(--stone);
  transition: background 0.12s;
}
.deckrow:hover { background: var(--stone-hi); }
.deckrow--upgraded { box-shadow: inset 0 0 0 1px rgba(229, 181, 95, 0.28); }

/* The spine carries card type, the game's own colour language. */
.spine { align-self: stretch; border-radius: 2px 0 0 2px; background: var(--smoke-dim); min-height: 26px; }
.spine[data-type="Attack"] { background: var(--t-attack); }
.spine[data-type="Skill"]  { background: var(--t-skill); }
.spine[data-type="Power"]  { background: var(--t-power); }
.spine[data-type="Curse"]  { background: var(--t-curse); }
.spine[data-type="Status"] { background: var(--t-status); }

.cost {
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  color: var(--smoke);
  background: var(--ash);
  border: 1px solid var(--stone-line);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  line-height: 20px;
}

.deckrow-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.deckrow-name .up { color: var(--gold); font-family: var(--mono); font-size: 11px; }
.deckrow-qty { font-family: var(--mono); font-size: 12.5px; color: var(--smoke); min-width: 26px; text-align: right; }
.deckrow-tools { display: flex; gap: 2px; opacity: 0; transition: opacity 0.12s; }
.deckrow:hover .deckrow-tools,
.deckrow:focus-within .deckrow-tools { opacity: 1; }

.relics { display: flex; flex-wrap: wrap; gap: 5px; }
.relic-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--stone);
  border: 1px solid var(--stone-line);
  border-radius: var(--r-sm);
  padding: 3px 4px 3px 3px;
  font-size: 12.5px;
  cursor: pointer;
}
.relic-chip:hover { border-color: var(--blood); }
.relic-chip img { width: 22px; height: 22px; object-fit: contain; }
.relic-chip .x { color: var(--smoke-dim); font-size: 14px; line-height: 1; padding: 0 3px; }
.relic-chip:hover .x { color: var(--blood); }

/* ------------------------------------------------------------ build profile */

.roles { display: flex; flex-direction: column; gap: 5px; }
.role {
  display: grid;
  grid-template-columns: 76px 1fr 58px;
  align-items: center;
  gap: 9px;
  font-size: 12px;
}
.role-track { height: 7px; background: var(--stone); border-radius: 4px; overflow: hidden; position: relative; }
/* The 100% mark: what a functional deck tends to reach. */
.role-track::after {
  content: "";
  position: absolute;
  left: 71.4%;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--stone-line);
}
.role-fill { height: 100%; border-radius: 4px; transition: width 0.5s cubic-bezier(0.2, 0.7, 0.3, 1); }
.role-fill[data-status="strong"]  { background: linear-gradient(90deg, var(--jade-deep), var(--jade)); }
.role-fill[data-status="ok"]      { background: linear-gradient(90deg, #2f6a7d, #5aa9c4); }
.role-fill[data-status="thin"]    { background: linear-gradient(90deg, #7a5a2a, var(--gold)); }
.role-fill[data-status="missing"] { background: linear-gradient(90deg, #5c2630, var(--blood)); }
.role-status { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--smoke-dim); text-align: right; }

/* ----------------------------------------------------------- reward ranking */

.slots { display: flex; flex-direction: column; gap: 6px; }

.slot {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px dashed var(--stone-line);
  border-radius: var(--r-sm);
  background: var(--stone);
  width: 100%;
  cursor: pointer;
  text-align: left;
  color: var(--smoke);
  transition: border-color 0.14s, color 0.14s;
}
.slot:hover { border-color: var(--ember-deep); color: var(--bone); }
.slot--filled { border-style: solid; color: var(--bone); cursor: default; }
.slot img { width: 34px; height: 34px; object-fit: cover; object-position: center 22%; border-radius: 2px; }
.slot-body { flex: 1; min-width: 0; }
.slot-name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-meta { font-size: 11px; color: var(--smoke-dim); }
.slot-shift { font-family: var(--mono); color: var(--iris); font-weight: 500; }

/* --- your own thumb on the scale ------------------------------------------ */

.bias {
  display: inline-flex;
  align-items: stretch;
  flex: none;
  border: 1px solid var(--stone-line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--ash);
}
.bias[data-state="up"]   { border-color: var(--iris-deep); background: var(--iris-wash); }
.bias[data-state="down"] { border-color: #5a3a44; background: rgba(224, 80, 104, 0.1); }

.bias-btn, .bias-val {
  border: 0;
  background: none;
  color: var(--smoke);
  font-family: var(--mono);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: background 0.12s, color 0.12s;
}
.bias-btn { width: 20px; font-size: 11px; }
.bias-btn:hover:not(:disabled) { background: var(--stone-hi); color: var(--bone); }
.bias-btn:disabled, .bias-val:disabled { opacity: 0.35; cursor: default; }

.bias-val {
  min-width: 24px;
  font-size: 11px;
  border-left: 1px solid var(--stone-line);
  border-right: 1px solid var(--stone-line);
  color: var(--smoke-dim);
}
.bias-val:hover:not(:disabled) { background: var(--stone-hi); color: var(--bone); }
.bias[data-state="up"] .bias-val   { color: var(--iris); }
.bias[data-state="down"] .bias-val { color: var(--blood); }

/* The same weighting, restated on the ranked result it moved. */
.bias-tag {
  flex: none;
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1px solid var(--iris-deep);
  color: var(--iris);
  cursor: help;
}
.bias-tag[data-state="down"] { border-color: #6e2a35; color: var(--blood); }

/* --- the signature: a score bar split into evidence and fit ---------------- */

.result {
  border: 1px solid var(--stone-line);
  border-radius: var(--r-md);
  background: var(--stone);
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.16s;
}
.result:hover { border-color: var(--smoke-dim); }
.result--top { border-color: var(--ember-deep); background: linear-gradient(180deg, rgba(255,127,69,0.07), var(--stone) 70%); }
.result--skip { border-style: dashed; }

.result-head {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px 7px;
}
.result-rank { font-family: var(--mono); font-size: 12px; color: var(--smoke-dim); }
.result--top .result-rank { color: var(--ember); }
.result-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 7px; min-width: 0; }
.result-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-score { font-family: var(--mono); font-size: 21px; font-weight: 500; line-height: 1; }
.result--top .result-score { color: var(--ember); }

.tagline { padding: 0 11px 8px 41px; font-size: 12.5px; color: var(--smoke); margin-top: -2px; }

/* The bar: neutral 50 sits at the tick. Cool = measured, warm = inferred. */
.bar { position: relative; height: 9px; margin: 0 11px 9px; background: var(--ash); border-radius: 5px; overflow: hidden; }
.bar-seg { position: absolute; top: 0; bottom: 0; transition: width 0.55s cubic-bezier(0.2,0.7,0.3,1), left 0.55s cubic-bezier(0.2,0.7,0.3,1); }
.bar-seg[data-kind="evidence"] { background: linear-gradient(180deg, var(--jade), var(--jade-deep)); }
.bar-seg[data-kind="fit"]      { background: linear-gradient(180deg, var(--ember), var(--ember-deep)); }
.bar-seg[data-kind="preference"] { background: linear-gradient(180deg, var(--iris), var(--iris-deep)); }
.bar-seg[data-kind="negative"] { background: repeating-linear-gradient(45deg, #4a2530, #4a2530 3px, #3a1d26 3px, #3a1d26 6px); }
.bar-tick { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--smoke-dim); opacity: 0.7; }

.legend { display: flex; gap: 14px; font-size: 10.5px; color: var(--smoke-dim); font-family: var(--mono); letter-spacing: 0.05em; margin: -2px 0 10px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: baseline; }
.legend i[data-kind="evidence"] { background: var(--jade); }
.legend i[data-kind="fit"] { background: var(--ember); }
.legend i[data-kind="preference"] { background: var(--iris); }

.result-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 11px 9px;
  flex-wrap: wrap;
}

.conf {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--stone-line);
  color: var(--smoke-dim);
  cursor: help;
}
.conf[data-level="high"] { color: var(--jade); border-color: var(--jade-deep); }
.conf[data-level="medium"] { color: var(--gold); border-color: #6b5528; }
.conf[data-level="low"] { color: var(--blood); border-color: #6e2a35; }

/* --------------------------------------------------------------- reasoning */

details.why { border-top: 1px solid var(--stone-line); }
details.why > summary {
  list-style: none;
  cursor: pointer;
  padding: 7px 11px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--smoke-dim);
  display: flex;
  justify-content: space-between;
}
details.why > summary::-webkit-details-marker { display: none; }
details.why > summary:hover { color: var(--bone); }
details.why[open] > summary { color: var(--bone); }
.why-body { padding: 2px 11px 12px; }

.ledger { display: flex; flex-direction: column; gap: 1px; }
.ledger-row {
  display: grid;
  grid-template-columns: 3px 1fr auto;
  gap: 9px;
  align-items: baseline;
  padding: 4px 0;
  font-size: 12.5px;
  border-bottom: 1px solid rgba(51, 43, 63, 0.5);
}
.ledger-row i { align-self: stretch; border-radius: 2px; background: var(--stone-line); }
.ledger-row[data-kind="evidence"] i { background: var(--jade); }
.ledger-row[data-kind="fit"] i { background: var(--ember); }
.ledger-row[data-kind="preference"] i { background: var(--iris); }
.ledger-row[data-kind="negative"] i { background: var(--blood); }
.ledger-label { color: var(--bone); }
.ledger-note { display: block; color: var(--smoke-dim); font-size: 11.5px; line-height: 1.35; }
.ledger-delta { font-family: var(--mono); font-size: 12.5px; }
.ledger-delta[data-sign="pos"] { color: var(--jade); }
.ledger-delta[data-sign="neg"] { color: var(--blood); }

.datastrip {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--stone-line);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 11.5px;
  color: var(--smoke);
}
.datastrip b { font-family: var(--mono); font-weight: 500; color: var(--bone); }

/* ------------------------------------------------------------------ removal */

.removal {
  display: grid;
  grid-template-columns: 3px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 6px 9px 6px 0;
  background: var(--stone);
  border-radius: var(--r-sm);
  margin-bottom: 3px;
  cursor: pointer;
  width: 100%;
  border: 0;
  text-align: left;
  color: inherit;
}
.removal:hover { background: var(--stone-hi); }
.removal-name { font-size: 13px; }
.removal-why { font-size: 11.5px; color: var(--smoke-dim); }
.removal-score { font-family: var(--mono); font-size: 15px; color: var(--blood); }

/* ------------------------------------------------------------------- party */

.party { display: flex; flex-direction: column; gap: 4px; }
.party-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  background: var(--stone);
  border: 1px solid var(--stone-line);
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
  color: inherit;
}
.party-tab:hover { border-color: var(--smoke-dim); }
.party-tab[aria-pressed="true"] { border-color: var(--ember-deep); background: var(--ember-wash); }
.party-star { color: var(--ember); }
.party-tab .muted { font-size: 11.5px; }

/* ------------------------------------------------------------------ picker */

.picker {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(10, 8, 13, 0.82);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 16px;
}
.picker[hidden] { display: none; }

.picker-panel {
  background: var(--stone);
  border: 1px solid var(--stone-line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  width: min(1020px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.picker-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--stone-line); display: flex; flex-direction: column; gap: 10px; }
.picker-head h2 { font-family: var(--display); font-size: 20px; margin: 0; font-weight: 600; }
.picker-headrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.picker-filters { display: flex; gap: 5px; flex-wrap: wrap; }

.filter {
  background: transparent;
  border: 1px solid var(--stone-line);
  color: var(--smoke);
  border-radius: 999px;
  padding: 2px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.13s;
}
.filter:hover { color: var(--bone); border-color: var(--smoke-dim); }
.filter[aria-pressed="true"] { background: var(--bone); color: var(--ash); border-color: var(--bone); font-weight: 600; }

/*
 * This one widens the pool rather than filtering the view, so it reads
 * differently from its neighbours — and it stays visibly "off" by default.
 */
.filter--wide { margin-left: auto; border-style: dashed; }
.filter--wide[aria-pressed="true"] {
  background: var(--iris-wash);
  color: var(--iris);
  border: 1px solid var(--iris-deep);
  font-weight: 500;
}

.picker-grid {
  overflow-y: auto;
  padding: 14px 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 11px;
  align-content: start;
}

.albumcard {
  background: var(--ash);
  border: 1px solid var(--stone-line);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  color: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  transition: transform 0.13s, border-color 0.13s, box-shadow 0.13s;
}
.albumcard:hover { transform: translateY(-3px); border-color: var(--ember-deep); box-shadow: 0 8px 18px rgba(0,0,0,0.45); }
.albumcard-art { position: relative; aspect-ratio: 1 / 1; background: #100d14 center 20% / cover no-repeat; border-bottom: 1px solid var(--stone-line); }

/* A borrowed card: yours only because a relic said so. */
.albumcard--foreign { border-color: var(--iris-deep); }
.albumcard--foreign:hover { border-color: var(--iris); }
.albumcard-color {
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  padding: 2px 5px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--iris);
  background: linear-gradient(180deg, transparent, rgba(16, 13, 20, 0.92) 55%);
  text-align: right;
}
.albumcard-art--relic { background-size: 58%; background-position: center; }
.albumcard-body { padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 2px; }
.albumcard-name { font-size: 12.5px; line-height: 1.25; font-weight: 500; }
.albumcard-meta { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 10px; color: var(--smoke-dim); }
.albumcard-rarity[data-rarity="Common"]   { color: var(--r-common); }
.albumcard-rarity[data-rarity="Uncommon"] { color: var(--r-uncommon); }
.albumcard-rarity[data-rarity="Rare"]     { color: var(--r-rare); }
.albumcard-rarity[data-rarity="Ancient"]  { color: var(--r-ancient); }
.albumcard-text { font-size: 11px; color: var(--smoke); line-height: 1.35; margin-top: 2px; }
.albumcard-score { font-family: var(--mono); font-size: 10.5px; color: var(--jade); }

/* -------------------------------------------------------------- new run */

.setup { position: fixed; inset: 0; z-index: 80; overflow-y: auto; background: var(--ash); padding: 5vh 20px; }
.setup[hidden] { display: none; }
.setup-inner { max-width: 720px; margin: 0 auto; }

.setup h1 {
  font-family: var(--display);
  font-size: clamp(30px, 6vw, 46px);
  font-weight: 600;
  line-height: 1.02;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.setup h1 em { font-style: normal; color: var(--ember); }
.setup .lede { color: var(--smoke); max-width: 52ch; margin: 0 0 30px; font-size: 15px; }

.charpick { display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: 9px; }
.charcard {
  background: var(--stone);
  border: 1px solid var(--stone-line);
  border-radius: var(--r-md);
  padding: 0 0 10px;
  cursor: pointer;
  color: inherit;
  text-align: center;
  overflow: hidden;
  transition: transform 0.13s, border-color 0.13s;
}
.charcard:hover { transform: translateY(-3px); border-color: var(--smoke-dim); }
.charcard[aria-pressed="true"] { border-color: var(--ember); background: var(--ember-wash); }
.charcard-art { aspect-ratio: 1/1; background: #100d14 center 12% / 150% no-repeat; }
.charcard-name { font-family: var(--display); font-size: 17px; margin-top: 7px; }
.charcard-hp { font-family: var(--mono); font-size: 11px; color: var(--smoke-dim); }

.setup-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-top: 22px; }

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

.site-foot {
  padding: 20px 18px 34px;
  border-top: 1px solid var(--stone-line);
  color: var(--smoke-dim);
  font-size: 12px;
  line-height: 1.6;
}
.site-foot a { color: var(--smoke); }
.site-foot p { margin: 0 0 4px; max-width: 78ch; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--stone-hi);
  border: 1px solid var(--stone-line);
  border-left: 3px solid var(--ember);
  border-radius: var(--r-sm);
  padding: 9px 15px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 120;
  animation: rise 0.22s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }

/* --------------------------------------------------------------- hover card */

/* Rows are deliberately terse; this is where the rest of the card lives. */
.tip {
  position: fixed;
  z-index: 110;
  width: 288px;
  max-width: calc(100vw - 24px);
  padding: 10px 11px 11px;
  background: var(--stone-hi);
  border: 1px solid var(--stone-line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  pointer-events: none;
  animation: tip-in 0.12s ease-out;
}
.tip[hidden] { display: none; }
@keyframes tip-in { from { opacity: 0; transform: translateY(3px); } }

.tip-head { display: flex; gap: 9px; align-items: center; margin-bottom: 8px; }
.tip-art {
  width: 46px; height: 46px; flex: none;
  object-fit: cover; object-position: center 20%;
  border-radius: var(--r-sm);
  background: var(--ash);
  border: 1px solid var(--stone-line);
}
.tip-title { min-width: 0; }
.tip-name { display: block; font-size: 14px; font-weight: 600; color: var(--bone); line-height: 1.2; }
.tip-sub { display: block; font-size: 10.5px; color: var(--smoke-dim); margin-top: 3px; letter-spacing: 0.03em; }

.tip-text { font-size: 12.5px; line-height: 1.45; color: var(--bone); }
.tip-muted { color: var(--smoke-dim); font-style: italic; }

.tip-up { color: var(--gold); font-family: var(--mono); margin-left: 3px; }

/* What upgrading this card would actually buy you. */
.tip-upgrade {
  margin-top: 7px;
  padding-left: 8px;
  border-left: 2px solid var(--gold);
  font-size: 12px;
  line-height: 1.45;
  color: var(--smoke);
}
.tip-upgrade-tag {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 2px;
}

.tip-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.tip-tags span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--smoke-dim);
  border: 1px solid var(--stone-line);
  border-radius: 999px;
  padding: 1px 6px;
}

.tip-stats {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--stone-line);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--jade);
}
.tip-stats b { color: var(--jade); font-weight: 600; }
.tip-stats em { color: var(--gold); font-style: normal; }

.tip-bias {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--iris);
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .board { grid-template-columns: 240px minmax(0, 1fr); }
  .panel--advisor { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .board { grid-template-columns: 1fr; min-height: 0; }
  .panel { padding: 14px 14px 22px; }
  .topbar { gap: 10px; padding: 9px 14px; }
  .wordmark { font-size: 18px; }
  .picker { padding: 0; }
  .picker-panel { max-height: 100vh; border-radius: 0; border: 0; }
  .picker-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}

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