/* VOICE everyday hobby tool with a little ceremony
   IDEA a rulebook hero profile card under a heraldic banner
   PICTURE the live hero card: faction shield, tier ladder, profile line
   COLOUR white ground, pine green #1e3d2f bands, sun red accent; night #0d1511
   TYPE Cinzel display + Alegreya Sans text
   LAYOUT laptop: builder left, sticky card right overlapping the banner; phone: title, card, builder, slim bar */

/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */
@font-face { font-family: "Cinzel"; src: url("fonts/cinzel-variable.woff2") format("woff2"); font-weight: 500 800; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }

/* ---------- Theme ---------- */
:root {
  color-scheme: light dark;
  --bg: light-dark(#ffffff, #0d1511);
  --panel: light-dark(#ffffff, #121d17);
  --sunk: light-dark(#f1f5f1, #1a2820);
  --ink: light-dark(#16221b, #e6ede8);
  --muted: light-dark(#56665c, #9fb2a6);
  --line: light-dark(#dce4dd, #26372d);
  --line-strong: light-dark(#b6c5ba, #3d5345);
  --green: light-dark(#24583f, #82cfa3);
  --on-green: light-dark(#ffffff, #0d1511);
  --green-tint: light-dark(#ebf4ee, #183022);
  --red: light-dark(#b8321f, #ff7f63);
  --pine: #1e3d2f;
  --pine-deep: #15301f;
  --on-band: #f1f5ef;
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --text: "Alegreya Sans", "Gill Sans", "Segoe UI", system-ui, sans-serif;
  --gutter: max(5vw, 16px);
  --max: 1240px;
}
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; }

* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 var(--text);
  font-variant-numeric: lining-nums;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; }
button, input, select { font: inherit; color: inherit; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- Layout ---------- */
/* Clips the full-bleed band without breaking the sticky card */
.page { overflow-x: clip; }
.layout {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter) 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  grid-template-rows: auto 1fr;
  grid-template-areas: "head card" "builder card";
  column-gap: 48px;
}

/* ---------- Masthead: a full-width pine band with a mountain edge ---------- */
.masthead {
  grid-area: head;
  position: relative;
  isolation: isolate;
  padding: var(--top) 0 clamp(84px, 8vw, 108px);
  background: var(--pine);
  /* paints the band past the column to both screen edges */
  border-image: linear-gradient(var(--pine), var(--pine)) fill 0 // 0 100vmax;
  color: var(--on-band);
  --top: clamp(28px, 4.5vw, 56px);
}
.masthead::before, .masthead::after {
  content: "";
  position: absolute;
  left: -100vmax;
  right: -100vmax;
  bottom: -8px;
  -webkit-mask-repeat: repeat-x, no-repeat;
  mask-repeat: repeat-x, no-repeat;
  -webkit-mask-position: center bottom, center bottom;
  mask-position: center bottom, center bottom;
  -webkit-mask-size: auto 100%, 100% 6px;
  mask-size: auto 100%, 100% 6px;
}
.masthead::before {
  height: clamp(44px, 5vw, 64px);
  background: color-mix(in srgb, var(--pine) 62%, var(--bg));
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 60'%3E%3Cpath d='M0 60V30L70 16 130 28 200 10 260 24 330 15 400 3 460 20 520 13 590 26 660 6 720 21 790 12 860 25 930 9 1000 30V60Z'/%3E%3C/svg%3E"), linear-gradient(#000, #000);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 60'%3E%3Cpath d='M0 60V30L70 16 130 28 200 10 260 24 330 15 400 3 460 20 520 13 590 26 660 6 720 21 790 12 860 25 930 9 1000 30V60Z'/%3E%3C/svg%3E"), linear-gradient(#000, #000);
}
.masthead::after {
  height: clamp(34px, 3.8vw, 50px);
  background: var(--bg);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 720 60'%3E%3Cpath d='M0 60V44L50 36 95 42 150 26 195 38 240 31 300 45 360 29 405 18 450 33 510 40 565 27 610 15 655 30 700 38 720 44V60Z'/%3E%3C/svg%3E"), linear-gradient(#000, #000);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 720 60'%3E%3Cpath d='M0 60V44L50 36 95 42 150 26 195 38 240 31 300 45 360 29 405 18 450 33 510 40 565 27 610 15 655 30 700 38 720 44V60Z'/%3E%3C/svg%3E"), linear-gradient(#000, #000);
}
.masthead h1 {
  font: 700 clamp(2rem, 4.6vw, 3.25rem)/1.05 var(--display);
  letter-spacing: -0.01em;
}
.lede {
  margin: 14px 0 0;
  max-width: 44ch;
  font-size: 1.08rem;
  color: color-mix(in srgb, var(--on-band) 80%, transparent);
}

.builder { grid-area: builder; container-type: inline-size; }
.card-wrap {
  grid-area: card;
  align-self: start;
  position: sticky;
  top: 20px;
  margin-top: clamp(28px, 4.5vw, 56px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 2px;
  z-index: 1;
}

/* ---------- Builder sections ---------- */
.sec { padding: 28px 0; border-top: 1px solid var(--line); }
.sec:first-child { border-top: 0; padding-top: 22px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sec h2 { font: 700 1.5rem/1.2 var(--display); letter-spacing: -0.005em; }
.sec-pts {
  white-space: nowrap;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--green-tint);
  color: var(--green);
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: lining-nums tabular-nums;
}
.hint { margin: 4px 0 14px; color: var(--muted); }
.hint strong { color: var(--ink); }

/* Shared selected look for every pickable thing */
.tile, .ftile, .atile, .pcard {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.tile:hover, .ftile:hover, .atile:hover, .pcard:hover { border-color: var(--line-strong); }
.tile.is-on, .ftile.is-on, .atile.is-on, .pcard.is-on {
  border-color: var(--green);
  background: var(--green-tint);
  box-shadow: inset 0 0 0 1px var(--green);
}
.ftile:has(.sr:focus-visible), .atile:has(.sr:focus-visible), .seg-opt:has(.sr:focus-visible) {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* Faction tiles */
.factions { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.ftile {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  cursor: pointer;
}
.ftile .emblem { width: 34px; height: 41px; display: block; }
.ftile-name { display: block; font-weight: 700; line-height: 1.25; }
.ftile-meta { display: block; color: var(--muted); font-size: 0.875rem; }
@container (min-width: 540px) {
  .factions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ftile-none { grid-column: 1 / -1; }
}

/* Checkbox tiles */
.tiles { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
@container (min-width: 660px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile-hit {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  min-height: 48px;
  padding: 11px 12px;
  cursor: pointer;
}
.tile-name { display: block; font-weight: 500; line-height: 1.25; }
.tile-note { display: block; margin-top: 2px; font-size: 0.875rem; line-height: 1.3; color: var(--muted); }
.tile-cost { white-space: nowrap; font-size: 0.95rem; color: var(--muted); font-variant-numeric: lining-nums tabular-nums; }
.tile.is-on .tile-cost { color: var(--green); font-weight: 700; }
.tile-variant { padding: 0 12px 12px 42px; }
.tile-variant select { width: 100%; }

.check, .radio {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  display: grid;
  place-content: center;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  border: 1.5px solid var(--line-strong);
  background: var(--panel);
  cursor: pointer;
}
.check { border-radius: 5px; }
.radio { border-radius: 50%; }
.check::before {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--on-green);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
  transform: scale(0);
  transition: transform 0.12s;
}
.radio::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  transform: scale(0);
  transition: transform 0.12s;
}
.check:checked { background: var(--green); border-color: var(--green); }
.radio:checked { border-color: var(--green); }
.check:checked::before, .radio:checked::before { transform: scale(1); }

select {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 34px 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23809086' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center / 12px no-repeat;
  font-size: 1rem;
  cursor: pointer;
}

/* Armour tiles */
.armours { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container (min-width: 600px) { .armours { grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); } }
.atile {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 10px;
  cursor: pointer;
}
.adef { font: 700 2.1rem/1 var(--display); font-variant-numeric: lining-nums tabular-nums; }
.adef small { display: block; margin-top: 4px; font: 500 0.8125rem/1 var(--text); color: var(--muted); }
.atile.is-on .adef { color: var(--green); }
.aname { margin-top: 10px; font-weight: 700; line-height: 1.2; }
.acost { margin-top: auto; padding-top: 4px; font-size: 0.95rem; color: var(--muted); }
@container (max-width: 599px) {
  .atile { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); grid-template-areas: "d n" "d c"; column-gap: 10px; align-items: center; padding: 10px 12px; }
  .adef { grid-area: d; font-size: 1.9rem; text-align: center; }
  .adef small { display: none; }
  .aname { grid-area: n; margin: 0; align-self: end; }
  .acost { grid-area: c; margin: 0; padding: 0; align-self: start; }
}
.badge {
  display: inline-block;
  margin-left: 2px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--sunk);
  color: var(--muted);
  font-size: 0.8125rem;
}

/* Skill rows */
.skills { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.srow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 6.5rem;
  grid-template-areas: "t s c";
  align-items: center;
  gap: 6px 18px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  transition: background-color 0.15s;
}
.srow:first-child { border-top: 0; }
.srow.is-on { background: var(--green-tint); }
.stext { grid-area: t; }
.sname { display: block; font-weight: 700; }
.snote { display: block; font-size: 0.875rem; line-height: 1.3; color: var(--muted); }
.stepper { grid-area: s; display: flex; align-items: center; gap: 4px; }
.stepper button {
  display: grid;
  place-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--green);
  font: 500 1.4rem/1 var(--text);
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s, transform 0.08s;
}
.stepper button:hover:not(:disabled) { background: var(--green); border-color: var(--green); color: var(--on-green); }
.stepper button:active:not(:disabled) { transform: scale(0.92); }
.stepper button:disabled { opacity: 0.3; cursor: default; }
.sval {
  min-width: 3rem;
  text-align: center;
  font: 800 1.35rem/1 var(--text);
  font-variant-numeric: lining-nums tabular-nums;
}
.sval.up { color: var(--green); }
.scost { grid-area: c; text-align: right; line-height: 1.25; font-variant-numeric: lining-nums tabular-nums; }
.scost b { display: block; color: var(--green); }
.scost .none { display: block; color: var(--muted); }
.scost small { display: block; font-size: 0.8125rem; color: var(--muted); }
@container (max-width: 520px) {
  .srow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "t s" "c s"; padding: 10px 12px; }
  .scost { display: flex; gap: 10px; align-items: baseline; text-align: left; }
  .scost b, .scost .none, .scost small { display: inline; }
  .scost .none { font-size: 0.875rem; }
}

/* Personal skill cards */
.pcards { display: grid; gap: 8px; }
.pc-hit {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 6px;
  cursor: pointer;
}
.pcard-none .pc-hit { padding-bottom: 12px; }
.pc-name { font-weight: 700; font-size: 1.05rem; }
.pc-cost { white-space: nowrap; color: var(--muted); font-variant-numeric: lining-nums tabular-nums; }
.pcard.is-on .pc-cost { color: var(--green); font-weight: 700; }
.pc-body { padding: 0 16px 12px 48px; font-size: 0.95rem; color: var(--muted); }
.pc-body p { margin: 0 0 4px; }
.pcard.is-on .pc-body { color: var(--ink); }
.pc-flavour { font-style: italic; }
.pcard.is-on .pc-flavour { color: var(--muted); }
.seg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 16px 12px 48px; }
.seg-label { width: 4rem; font-size: 0.875rem; color: var(--muted); }
.seg-opt {
  position: relative;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  font-weight: 500;
  cursor: pointer;
}
.seg-opt small { margin-left: 6px; font-size: 0.875rem; color: var(--muted); }
.seg-opt.is-on { background: var(--green); border-color: var(--green); color: var(--on-green); }
.seg-opt.is-on small { color: inherit; opacity: 0.85; }
@container (max-width: 520px) {
  .pc-body, .seg { padding-left: 16px; }
  .seg-label { width: 100%; }
}

/* ---------- Hero card ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 10px 28px -14px rgb(20 42 32 / 0.35);
}
.card-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--field, var(--pine));
  border-bottom: 3px solid var(--metal, #e4ece6);
  color: #fff;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.card-emblem { display: block; width: 50px; height: 60px; filter: drop-shadow(0 2px 2px rgb(0 0 0 / 0.35)); }
.card-tier { font: 700 1.4rem/1.1 var(--display); color: #fff; }
.card-faction { margin: 5px 0 0; font-size: 0.875rem; line-height: 1.25; color: rgb(255 255 255 / 0.8); }
.card-total { margin: 0; text-align: right; line-height: 1; }
.card-total .num {
  display: block;
  font: 700 2.7rem/1 var(--display);
  font-variant-numeric: lining-nums tabular-nums;
  transform-origin: right center;
}
.card-total .unit { font-size: 0.875rem; color: rgb(255 255 255 / 0.8); }

.ladder { padding: 16px 18px 2px; }
.ladder-track { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
.rung .bar { display: block; height: 6px; border-radius: 3px; background: var(--line); }
.rung.past .bar { background: color-mix(in srgb, var(--green) 40%, var(--line)); }
.rung.now .bar { background: var(--green); }
.rung-name { display: block; margin-top: 7px; font-size: 0.8125rem; line-height: 1.2; color: var(--muted); }
.rung.now .rung-name { color: var(--ink); font-weight: 700; }
.rung small { display: block; font-size: 0.8125rem; color: var(--muted); font-variant-numeric: lining-nums tabular-nums; }
.marker {
  position: absolute;
  top: -4px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: var(--red);
  border: 2.5px solid var(--panel);
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.08);
  transition: left 0.3s ease-out;
}
.ladder-note { margin: 8px 0 0; font-size: 0.9rem; color: var(--muted); }
.ladder-note b { color: var(--red); }

.profile-wrap { padding: 12px 18px 2px; overflow-x: auto; }
.profile { width: 100%; border-collapse: collapse; text-align: center; font-variant-numeric: lining-nums tabular-nums; }
.profile th {
  padding: 0 2px 5px;
  border-bottom: 1px solid var(--line);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
}
.profile td { padding: 8px 2px 4px; font: 800 1.3rem/1.1 var(--text); vertical-align: top; white-space: nowrap; }
.profile td small { display: block; margin-top: 2px; font: 500 0.8125rem/1 var(--text); color: var(--muted); }
.profile .up { color: var(--green); }
.profile .gap { border-left: 1px solid var(--line); }

.card-sec { padding: 14px 18px 0; }
.card-sec h3 { margin-bottom: 7px; font: 700 0.95rem/1.2 var(--display); letter-spacing: 0.02em; }
.h3-note { font: 500 0.875rem var(--text); letter-spacing: 0; color: var(--muted); margin-left: 4px; }
.card-sec .rules { margin: 0; font-size: 0.95rem; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.chips li { padding: 2px 10px; border-radius: 999px; background: var(--sunk); font-size: 0.9rem; }
.chips li.bought { background: var(--green-tint); color: var(--green); font-weight: 700; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 35%, transparent); }

.gear { margin: 0; padding: 0; list-style: none; font-size: 0.95rem; }
.gear.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
.gear.two li:first-child { grid-column: 1 / -1; }
.gear li { position: relative; padding: 1px 0 1px 15px; break-inside: avoid; }
.gear li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 5px;
  height: 5px;
  background: var(--green);
  transform: rotate(45deg);
}

.spells { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.spell-head { display: flex; align-items: baseline; gap: 8px; }
.cast {
  padding: 0 7px;
  border-radius: 4px;
  background: var(--sunk);
  font-size: 0.875rem;
  font-weight: 700;
  font-variant-numeric: lining-nums tabular-nums;
}
.spell-text { display: block; font-size: 0.9rem; color: var(--muted); }

.ledger { margin: 0; padding: 0 0 18px; font-size: 0.95rem; font-variant-numeric: lining-nums tabular-nums; }
.ledger div { display: flex; align-items: baseline; gap: 6px; padding: 1px 0; }
.ledger dd { margin: 0; }
.ledger .dots { flex: 1; border-bottom: 1px dotted var(--line-strong); transform: translateY(-4px); }
.ledger .sum { margin-top: 5px; padding-top: 6px; border-top: 1.5px solid var(--ink); font-weight: 800; }
.ledger .sum .dots { visibility: hidden; }

.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn {
  min-height: 44px;
  padding: 9px 18px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: var(--on-green);
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.12s, background-color 0.12s;
}
.btn:hover { filter: brightness(1.12); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-quiet:hover { filter: none; background: var(--sunk); }

/* The total gives a small nod when it changes */
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
.bump { animation: bump 0.32s ease-out; }

/* ---------- Footer ---------- */
.site-footer { background: var(--pine); color: color-mix(in srgb, var(--on-band) 78%, transparent); padding: 22px var(--gutter); font-size: 0.9rem; }
.site-footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 32px;
}
.site-footer p { margin: 0; }
.credit { font: 500 1.05rem/1.4 var(--display); color: var(--on-band); }
.credit strong { font-weight: 800; }

/* Shown only on paper */
.print-only { display: none; }
.card-credit {
  margin: 0;
  padding: 8px 18px 12px;
  border-top: 1px dotted var(--line-strong);
  font: 500 0.8125rem var(--display);
  color: var(--muted);
  text-align: right;
}

/* ---------- Phones and narrow windows ---------- */
.peek { display: none; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "head" "card" "builder"; row-gap: 28px; }
  .masthead { padding-bottom: 112px; }
  .card-wrap { position: static; margin: -116px auto 0; width: 100%; max-width: 560px; max-height: none; overflow: visible; }
  .builder { padding-top: 4px; }
  .sec:first-child { border-top: 1px solid var(--line); padding-top: 28px; }

  .peek {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px var(--gutter);
    padding-top: max(10px, env(safe-area-inset-top));
    background: var(--pine);
    color: var(--on-band);
    text-decoration: none;
    box-shadow: 0 2px 10px rgb(0 0 0 / 0.2);
    transform: translateY(-110%);
    transition: transform 0.2s ease-out;
  }
  .peek.show { transform: none; }
  .peek-pts { font: 800 1.2rem/1 var(--text); white-space: nowrap; }
  .peek-tier { flex: 1; font-weight: 500; }
  .peek-go { font-size: 0.9rem; opacity: 0.85; white-space: nowrap; }
}

@media (max-width: 420px) {
  body { font-size: 16px; }
  .card-top { padding: 14px; gap: 12px; }
  .card-emblem { width: 42px; height: 50px; }
  .card-total .num { font-size: 2.3rem; }
  .ladder, .profile-wrap, .card-sec { padding-left: 14px; padding-right: 14px; }
  .profile td { font-size: 1.1rem; }
  .gear.two { grid-template-columns: minmax(0, 1fr); }
}

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

/* ---------- Print: only the hero card ---------- */
@media print {
  :root { color-scheme: light; }
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .no-print { display: none !important; }
  .print-only { display: block; }
  .layout { display: block; padding: 0; max-width: none; }
  .card-wrap { position: static; margin: 0; max-height: none; overflow: visible; }
  .card { max-width: 150mm; margin: 0 auto; box-shadow: none; border-color: #9aa59d; break-inside: avoid; }
  .bump { animation: none; }
}
