/* Battle stats (bs-*) and pet refinement (prf-*) visual guides, on top of the er-* guide styles.
   Shared bits (gs-*): the "to check" marker, the "still to fill in" box and the model banner. */
.gs-check { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 700; line-height: 1.5; white-space: nowrap; vertical-align: middle; color: #f0c27a; background: #e3a1441f; border: 1px solid #e3a14499; }
.gs-checkline { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.gs-fill { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; border: 1px dashed #9aa3b2; font-size: 13px; color: var(--muted); background: repeating-linear-gradient(135deg, #ffffff06 0 8px, transparent 8px 16px); }
.gs-fill b { color: var(--text); }
.gs-model { margin: 12px 0; padding: 10px 12px; border-radius: 10px; border-left: 4px solid #6aa6e8; background: #6aa6e81a; font-size: 13px; }
.gs-note { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--c, #d8b25a) 12%, transparent); border-left: 4px solid var(--c, #d8b25a); font-size: 14px; }
.gs-h3 { font-family: var(--font-display); margin: 18px 0 8px; font-size: 17px; }
.gs-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: center; }
.gs-dia { width: 100%; height: auto; display: block; }
.gs-dia-t { fill: var(--text); font: 700 11px var(--font-body); }
.gs-dia-m { fill: var(--muted); font: 600 10px var(--font-body); }
.gs-out { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.gs-big { display: grid; min-width: 0; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.gs-big small { color: var(--muted); font-size: 12px; }
.gs-big b { font: 800 24px var(--font-display); color: var(--gold-2); overflow-wrap: anywhere; }
.gs-big em { font-style: normal; font-size: 12px; color: var(--muted); }
.gs-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-weight: 700; }
.gs-tabs { margin-bottom: 10px; }

/* Battle stats */
.bs-hero { background: radial-gradient(circle at 0 0, #e06a5f33, transparent 60%), var(--panel); }
.bs-formulas { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-top: 14px; }
.bs-formula { display: grid; gap: 6px; padding: 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); border-top: 4px solid var(--c); }
.bs-formula b { color: var(--c); font-size: 15px; }
.bs-formula code { font: 700 14px var(--font-body); color: var(--text); background: none; padding: 0; overflow-wrap: anywhere; }
.bs-formula small { color: var(--muted); font-size: 12px; }
.bs-trust { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-top: 12px; }
.bs-trust > div { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font-size: 13px; }
.bs-trust .ok { border-color: #5fbf83; background: #5fbf8314; }
.bs-trust .maybe { border-color: #e3a144; background: repeating-linear-gradient(135deg, #e3a14414 0 8px, transparent 8px 16px); }
.bs-trust ul { margin: 6px 0 0; padding-left: 18px; }
.bs-counter-wrap { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 16px; align-items: center; }
.bs-troops { display: grid; gap: 8px; }
.bs-troop { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 4px 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--c); }
.bs-troop img { width: 52px; height: 52px; object-fit: contain; grid-row: span 3; }
.bs-troop b { color: var(--c); }
.bs-troop small { color: var(--muted); font-size: 12px; }
.bs-tg { display: flex; align-items: center; gap: 0; margin: 14px 0 4px; }
.bs-tg-line { flex: 1; height: 4px; background: linear-gradient(90deg, #d8b25a55, #d8b25a); min-width: 8px; }
.bs-tg-node { flex: none; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; border: 2px solid #d8b25a; background: #d8b25a22; font: 800 13px var(--font-body); color: var(--gold-2); }
.bs-tg-node img { width: 26px; height: 26px; object-fit: contain; }
.bs-field-ctl { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.bs-field-step { min-height: 3.2em; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; }
.bs-dots { display: flex; gap: 6px; }
.bs-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.bs-dots i.on { background: var(--c); }
.bs-split { display: flex; height: 34px; border-radius: 8px; overflow: hidden; margin-top: 10px; font-size: 12px; font-weight: 800; border: 1px solid var(--line); }
.bs-split span { display: grid; place-items: center; white-space: nowrap; overflow: hidden; transition: flex-basis .3s ease; min-width: 0; }
.bs-split .dead { background: #e06a5fcc; color: #10140f; }
.bs-split .inf { background: #5fbf83aa; color: #10140f; }
.bs-split .rest { background: #9aa3b244; }
.bs-stat { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.bs-pair { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); border-top: 4px solid var(--c); min-width: 0; }
.bs-pair h3 { margin: 0; font-family: var(--font-display); color: var(--c); font-size: 17px; }
.bs-pair label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; }
.bs-pair label b { color: var(--gold-2); }
.bs-pair input[type=range] { width: 100%; accent-color: var(--gold); }
.bs-area { width: 100%; max-width: 260px; margin: 4px auto 0; display: block; }
.bs-factor { text-align: center; font-size: 13px; color: var(--muted); }
.bs-factor b { display: block; font: 800 30px var(--font-display); color: var(--c); }
.bs-ex { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.bs-where { margin-top: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--c); background: var(--panel-2); }
.bs-where h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 16px; }
.bs-wrow { display: grid; grid-template-columns: 130px minmax(0, 1fr) 72px; gap: 10px; align-items: center; font-size: 13px; margin-top: 8px; }
.bs-wrow b { text-align: right; font-variant-numeric: tabular-nums; }
.bs-wrow .er-hbar span { transition: width .3s ease; }
.bs-ingr { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.bs-ingr li { position: relative; display: grid; justify-items: center; text-align: center; gap: 4px; padding: 12px 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.bs-ingr svg { width: 64px; height: 44px; }
.bs-ingr small { color: var(--muted); font-size: 12px; }
.bs-sqrt { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 16px; align-items: center; margin-top: 14px; }
.bs-scale { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; text-align: center; margin-top: 10px; }
.bs-scale .gs-big { text-align: center; }
.bs-scale > em { font-style: normal; font: 800 22px var(--font-display); color: var(--muted); }
.bs-base { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.bs-pill { padding: 4px 10px; border-radius: 99px; border: 1px solid var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); font-size: 13px; font-weight: 700; }
.bs-pill.off { text-decoration: line-through; opacity: .5; }
.bs-stack { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; font-weight: 700; }
.bs-stack span { padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.bs-stack i { font-style: normal; color: var(--muted); font-size: 18px; }
.bs-mix { display: grid; gap: 6px; margin-top: 10px; }
.bs-mix-bar { display: flex; height: 40px; border-radius: 8px; overflow: hidden; font-size: 12px; font-weight: 800; }
.bs-mix-bar span { display: flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; overflow: hidden; min-width: 0; color: #10140f; }
.bs-mix-bar img { width: 26px; height: 26px; object-fit: contain; flex: none; }
.bs-mix-bar .i { background: #6aa6e8; }
.bs-mix-bar .c { background: #e3a144; }
.bs-mix-bar .a { background: #c58be0; }
.bs-mix-bar .q { background: repeating-linear-gradient(135deg, #9aa3b266 0 6px, transparent 6px 12px); color: var(--text); }
.bs-bear { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; align-items: center; margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid #c58be0; }
.bs-bear img { width: 72px; height: 72px; object-fit: contain; }
.bs-lead { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bs-hcard { display: grid; justify-items: center; gap: 6px; padding: 8px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); min-width: 0; }
.bs-hcard img { width: 100%; max-width: 64px; aspect-ratio: 194 / 236; object-fit: cover; border-radius: 8px; }
.bs-hcard.dim img { filter: grayscale(1); opacity: .45; }
.bs-sk { display: flex; gap: 4px; }
.bs-sk i { width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel); }
.bs-sk i.on { background: #f2c94c; border-color: #f2c94c; box-shadow: 0 0 6px #f2c94c88; }
.bs-jrow { display: grid; grid-template-columns: 70px repeat(3, minmax(0, 1fr)); gap: 6px; align-items: center; margin-top: 6px; }
.bs-jrow > b { font-size: 12px; color: var(--muted); }
.bs-jrow .bs-hcard { padding: 4px; }
.bs-jrow .bs-hcard img { max-width: 40px; }
.bs-gar { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.bs-gar > div { padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.bs-gar b { display: block; margin-bottom: 4px; }
.bs-skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.bs-skill { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 8px; align-items: center; padding: 6px 8px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.bs-skill img { width: 44px; aspect-ratio: 194 / 236; object-fit: cover; border-radius: 6px; grid-row: span 2; }
.bs-skill b { font-size: 14px; }
.bs-tags { display: flex; flex-wrap: wrap; gap: 3px; }
.bs-tag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 99px; color: #10140f; background: var(--t); }
.bs-tag.then { background: none; color: var(--muted); padding: 1px 2px; }
.bs-same { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 13px; }
.bs-same span { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.bs-same img { width: 26px; aspect-ratio: 194 / 236; object-fit: cover; border-radius: 4px; }
.bs-picker { display: grid; gap: 6px; margin-top: 10px; }
.bs-prow { display: grid; grid-template-columns: 24px 40px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); transition: border-color .2s, opacity .2s; }
.bs-prow.in { border-color: #f2c94c; box-shadow: inset 4px 0 0 #f2c94c; }
.bs-prow.out { opacity: .55; }
.bs-prow img { width: 40px; aspect-ratio: 194 / 236; object-fit: cover; border-radius: 6px; }
.bs-prow select { width: 100%; min-width: 0; padding: 6px 8px; }
.bs-prow small { grid-column: 3 / -1; color: var(--muted); font-size: 12px; }
.bs-lv { display: flex; align-items: center; gap: 4px; }
.bs-lv button { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; }
.bs-lv b { min-width: 42px; text-align: center; font-size: 13px; }
.bs-pn { font-weight: 800; color: var(--muted); text-align: center; }
.bs-matter { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bs-matter li { display: grid; grid-template-columns: 32px 64px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.bs-matter li svg, .bs-matter li img { width: 64px; height: 48px; object-fit: contain; }
.bs-matter small { display: block; color: var(--muted); font-size: 12px; }

/* Pet refinement */
.prf-hero { background: radial-gradient(circle at 0 0, #5fbf8333, transparent 60%), var(--panel); }
.prf-six { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.prf-troop { display: grid; justify-items: center; gap: 6px; padding: 10px 6px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); border-top: 4px solid var(--c); min-width: 0; }
.prf-troop img { width: 56px; height: 56px; object-fit: contain; }
.prf-troop b { color: var(--c); }
.prf-stat { width: 100%; text-align: center; padding: 4px; border-radius: 8px; font-size: 12px; font-weight: 700; background: color-mix(in srgb, var(--c) 14%, transparent); }
.prf-track { display: flex; align-items: stretch; gap: 0; margin: 12px 0 4px; overflow: hidden; }
.prf-node { flex: 1 1 0; min-width: 0; display: grid; justify-items: center; align-content: start; text-align: center; gap: 4px; position: relative; padding: 0 2px; }
.prf-node::before { content: ""; position: absolute; top: 22px; left: 0; right: 0; height: 4px; background: #5fbf8366; z-index: 0; }
.prf-node:first-child::before { left: 50%; }
.prf-node:last-child::before { right: 50%; }
.prf-node > span { position: relative; z-index: 1; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); border: 2px solid var(--c, #5fbf83); font: 800 12px var(--font-body); color: var(--text); overflow: hidden; }
.prf-node > span img { width: 34px; height: 34px; object-fit: contain; }
.prf-node b { font-size: 12px; }
.prf-node small { font-size: 11px; color: var(--muted); }
.prf-cost { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.prf-costc { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--c); }
.prf-costc img { width: 64px; height: 64px; object-fit: contain; }
.prf-costc small { display: block; color: var(--muted); font-size: 12px; }
.prf-flow { display: flex; gap: 6px; align-items: stretch; flex-wrap: wrap; margin-top: 12px; }
.prf-flow > div { flex: 1 1 120px; display: grid; justify-items: center; text-align: center; gap: 4px; padding: 10px 8px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.prf-flow svg { width: 44px; height: 44px; }
.prf-flow small { color: var(--muted); font-size: 12px; }
.prf-flow .hot { border-color: #5fbf83; background: #5fbf8314; }
.prf-ratchet { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--c); }
.prf-ratchet h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 16px; }
.prf-rbar { position: relative; display: flex; height: 38px; border-radius: 8px; overflow: hidden; margin: 12px 0 4px; border: 1px solid var(--line); }
.prf-rbar > span { position: relative; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #10140f; border-right: 2px solid var(--bg); min-width: 0; overflow: hidden; }
.prf-rbar > span.lock { color: var(--muted); background: repeating-linear-gradient(135deg, #ffffff0d 0 6px, transparent 6px 12px) !important; }
.prf-rmark { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; background: #fff; border-radius: 2px; box-shadow: 0 0 0 2px #10140f; transition: left .2s; z-index: 2; }
.prf-rfloor { position: absolute; top: 0; bottom: 0; width: 0; border-left: 3px dashed #e06a5f; z-index: 1; transition: left .2s; }
.prf-grades { display: grid; gap: 6px; margin-top: 12px; }
.prf-grow { display: grid; grid-template-columns: 88px minmax(0, 1fr) 96px; gap: 10px; align-items: center; font-size: 13px; }
.prf-grow b { text-align: right; font-variant-numeric: tabular-nums; }
.prf-gbar { position: relative; height: 18px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.prf-gbar span { position: absolute; top: 0; bottom: 0; background: var(--c); border-radius: 9px; transition: opacity .2s; }
.prf-grow.locked { opacity: .45; }
.prf-grow.locked .prf-gbar span { background: repeating-linear-gradient(135deg, #9aa3b288 0 5px, transparent 5px 10px); }
.prf-grow small { color: var(--muted); font-size: 11px; display: block; }
.prf-cmp { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.prf-cmp th, .prf-cmp td { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.prf-cmp th { font-size: 12px; color: var(--muted); font-weight: 700; }
.prf-cmp input { width: 100%; max-width: 72px; padding: 5px 6px; font-variant-numeric: tabular-nums; }
.prf-cmp td.d { font-weight: 800; text-align: right; white-space: nowrap; }
.prf-cmp td.d.up { color: #5fbf83; }
.prf-cmp td.d.down { color: #e06a5f; }
.prf-cmp tr.unused { opacity: .45; }
.prf-cmp img { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; margin-right: 4px; }
.prf-use { display: flex; gap: 6px; flex-wrap: wrap; }
.prf-use label { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; font-weight: 700; cursor: pointer; }
.prf-use input { width: auto; accent-color: var(--gold); }
.prf-use img { width: 26px; height: 26px; object-fit: contain; }
.prf-tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.prf-tip { display: grid; gap: 6px; padding: 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.prf-tip small { color: var(--muted); font-size: 12px; }
.prf-pets { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; min-height: 44px; }
.prf-pets img { width: 40px; height: 40px; object-fit: contain; }
.prf-marks { display: flex; flex-wrap: wrap; gap: 2px; }
.prf-marks img { width: 22px; height: 22px; object-fit: contain; }
.prf-rank { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.prf-rank span { display: grid; justify-items: center; gap: 2px; font-size: 12px; font-weight: 700; }
.prf-rank img { width: 56px; height: 56px; object-fit: contain; }
.prf-cycle { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 16px; align-items: center; margin-top: 12px; }

@media (max-width: 700px) {
  .gs-grid2, .bs-counter-wrap, .bs-stat, .bs-sqrt, .prf-cycle { grid-template-columns: 1fr; }
  .bs-counter-wrap .gs-dia, .bs-sqrt .gs-dia, .prf-cycle .gs-dia { max-width: 300px; margin: 0 auto; }
  .bs-wrow { grid-template-columns: minmax(0, 1fr) 64px; }
  .bs-wrow .er-hbar { grid-column: 1 / -1; grid-row: 2; }
  .bs-jrow { grid-template-columns: 52px repeat(3, minmax(0, 1fr)); }
  .bs-matter li { grid-template-columns: 28px 44px minmax(0, 1fr); gap: 8px; }
  .bs-matter li svg, .bs-matter li img { width: 44px; height: 34px; }
  .prf-grow { grid-template-columns: 70px minmax(0, 1fr) 78px; gap: 6px; }
  .prf-node > span { width: 40px; height: 40px; }
  .prf-node::before { top: 18px; }
  .prf-node > span img { width: 28px; height: 28px; }
}
@media (max-width: 420px) {
  .prf-six { gap: 4px; }
  .prf-troop img { width: 42px; height: 42px; }
  .prf-stat { font-size: 11px; }
  .bs-lead { gap: 4px; }
  .bs-prow { grid-template-columns: 20px 34px minmax(0, 1fr); }
  .bs-prow .bs-lv { grid-column: 2 / -1; }
  .prf-cmp { font-size: 12px; }
  .prf-cmp input { max-width: 58px; }
}
