/*
 * Native game screens (one section per screen). Every screen fills the app, respects the
 * safe-area insets and keeps touch targets >= 44 px. Visual language: see theme.css
 * (charcoal surfaces, hairlines, chamfers, champagne accents, English eyebrows, watermark titles).
 */

.scr {
  /* Layout queries use the screen box (the app is rotated on portrait phones, so viewport media
   * queries would see the wrong width). */
  container: scr / size;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: var(--sat) var(--sar) 0 var(--sal);
  background:
    radial-gradient(60% 55% at 100% 0%, rgba(207, 174, 118, 0.07), transparent 70%),
    radial-gradient(55% 60% at 0% 100%, rgba(217, 47, 60, 0.06), transparent 70%),
    linear-gradient(180deg, #0b0c10, #07080b);
  animation: scrIn 0.26s var(--ease);
}

/* Watermark: a huge outlined English word behind the content (--wm per screen). */
.scr::before {
  content: var(--wm, none);
  position: absolute;
  z-index: -1;
  right: calc(var(--sar) + 6px);
  bottom: -0.17em;
  font: 700 clamp(84px, 34cqh, 230px)/1 var(--font-d);
  letter-spacing: 0.01em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.05);
  white-space: nowrap;
  pointer-events: none;
}

.scr-store { --wm: 'STORE'; }
.scr-store2 { --wm: 'UPGRADE'; }
.scr-heroShop { --wm: 'HERO'; }
.scr-skills { --wm: 'SKILLS'; }
.scr-inventory { --wm: 'ITEMS'; }
.scr-classSelect { --wm: 'HEROES'; }
.scr-enhance { --wm: 'HERO MODE'; }
.scr-draft { --wm: 'DRAFT'; }
.scr-spiderStats { --wm: 'SPIDER'; }
.scr-options { --wm: 'OPTIONS'; }

@keyframes scrIn {
  from { opacity: 0; transform: translateY(6px); }
}

.scr-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  margin-bottom: 10px;
  padding: 8px 12px;
  box-sizing: border-box;
  flex: none;
}

/* Hairline under the header with a short champagne lead. */
.scr-head::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--acc) 0 40px, var(--line-2) 40px, var(--line) 60%, transparent);
}

.scr-head .scr-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.scr-head .scr-title .eb {
  margin-bottom: 1px;
}

.scr-head .scr-title .eb:empty {
  display: none;
}

.scr-head .scr-title .t {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scr-head .scr-title .s {
  font-size: 12px;
  color: var(--tx-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scr-head .scr-title .s:empty {
  display: none;
}

.spacer {
  flex: 1;
}

.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  counter-reset: sec;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

/* ================================================================ shared screen pieces */

/* Lead icon: glyph inside a hairline diamond. */
.lead-ic {
  --lc: var(--acc);
  position: relative;
  flex: none;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lc);
}

.lead-ic::before {
  content: '';
  position: absolute;
  inset: 7px;
  transform: rotate(45deg);
  border: 1px solid color-mix(in srgb, var(--lc) 55%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--lc) 16%, transparent), transparent);
}

.lead-ic .ic {
  position: relative;
  width: 19px;
  height: 19px;
}

.lead-ic.gold {
  --lc: var(--star);
}

.scr-head .scr-title .s.accent {
  color: var(--star);
  font-weight: 650;
}

/* Section heading: "01 —— TOMES ————" (number from a counter per scroll box). */
.sec {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 2px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tx-2);
}

.sec::before {
  counter-increment: sec;
  content: counter(sec, decimal-leading-zero);
  font: 600 13px/1 var(--font-d);
  letter-spacing: 0.04em;
  color: var(--acc);
}

.sec::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line-2), transparent);
}

.sec:first-child {
  margin-top: 2px;
}

.grid {
  display: grid;
  gap: 8px;
}

.cat-ic {
  --c: var(--acc);
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 20%, transparent), color-mix(in srgb, var(--c) 4%, transparent));
  border: 1px solid color-mix(in srgb, var(--c) 34%, transparent);
}

/* Tappable card: category accent on the top-left edge, price bar at the bottom. */
.tapcard {
  --c: var(--acc);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-height: 108px;
  padding: 12px;
  text-align: left;
  color: var(--tx-1);
  cursor: pointer;
  transition: transform 0.12s var(--ease), border-color 0.15s;
}

.tapcard::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 2px;
  background: var(--c);
}

.tapcard:active {
  transform: scale(0.975);
  --bd: var(--line-3);
}

.tc-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tc-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tc-name b {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.22;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tc-name small {
  font-size: 12px;
  color: var(--tx-3);
}

/* Price bar (the card itself is the button). */
.pill {
  align-self: stretch;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--acc-2), var(--acc));
  color: var(--acc-ink);
  font-weight: 700;
  font-size: 14px;
}

.pill .pv {
  font-size: 16px;
  font-weight: 700;
}

.pill .pi {
  display: flex;
}

.pill[data-kind='free'] {
  background: linear-gradient(180deg, rgba(63, 203, 152, 0.24), rgba(63, 203, 152, 0.12));
  color: #8be8c4;
  box-shadow: inset 0 0 0 1px rgba(63, 203, 152, 0.55);
}

.pill[data-kind='sold'],
.pill[data-kind='locked'],
.tapcard.poor .pill {
  background: rgba(255, 255, 255, 0.035);
  color: var(--tx-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.tapcard.locked > :not(.lockline):not(.pill) {
  opacity: 0.42;
}

.lockline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  color: var(--tx-2);
}

.shake {
  animation: shake 0.35s ease-out;
}

.pop {
  animation: pop 0.3s var(--ease);
}

@keyframes pop {
  40% { transform: scale(1.04); }
}

@keyframes shake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.note {
  margin: 0 2px 12px;
  padding-left: 10px;
  border-left: 2px solid var(--acc-line);
  font-size: 13px;
  color: var(--tx-2);
}

.hdr-btn {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
}

.btn .pv {
  margin-left: 2px;
  font-family: var(--font-d);
  font-size: 1.08em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.btn.poor {
  opacity: 0.5;
}

.btn.off {
  opacity: 0.4;
}

/* ================================================================ skills */

.scr-skills {
  --cat: var(--acc);
}

.sk-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 12px;
  box-sizing: border-box;
  flex: none;
}

.sk-caticon {
  position: relative;
  flex: none;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cat);
}

.sk-caticon::before {
  content: '';
  position: absolute;
  inset: 7px;
  transform: rotate(45deg);
  border: 1px solid color-mix(in srgb, var(--cat) 55%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--cat) 22%, transparent), transparent);
}

.sk-caticon .ic {
  position: relative;
  width: 19px;
  height: 19px;
}

.sk-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 0 1 auto;
}

.sk-title .cat {
  font-size: 19px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sk-title .sub {
  font-size: 12px;
  color: var(--tx-3);
  white-space: nowrap;
}

.sk-stars {
  height: 38px;
  padding: 0 14px 0 12px;
}

.sk-stars .num {
  font-size: 18px;
}

.sk-stars .ic {
  width: 17px;
  height: 17px;
}

.sk-spacer {
  flex: 1;
}

.sk-tabs {
  flex: none;
  position: relative;
  margin: 0 12px 10px;
  border-bottom: 1px solid var(--line);
}

.sk-tabsep {
  flex: none;
  width: 1px;
  margin: 10px 6px;
  background: var(--line-2);
}

.sk-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 2px 12px calc(14px + var(--sab));
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  /* max-content rows: auto rows would collapse (overflow:hidden items have a 0 minimum). */
  grid-auto-rows: max-content;
  align-items: start;
  align-content: start;
  gap: 6px 10px;
}

.sk-row {
  position: relative;
  background: linear-gradient(90deg, color-mix(in srgb, var(--cat) 7%, transparent), transparent 40%), var(--bg-2);
  border: 1px solid var(--line);
  border-left: 2px solid color-mix(in srgb, var(--cat) 70%, transparent);
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}

.sk-row.open {
  border-color: color-mix(in srgb, var(--cat) 36%, transparent);
  border-left-color: var(--cat);
}

.sk-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 8px 0 0;
}

.sk-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 0 0 4px;
  border: none;
  background: none;
  text-align: left;
}

.sk-val {
  flex: none;
  min-width: 58px;
  padding: 4px 8px 4px 6px;
  box-sizing: border-box;
  border-right: 1px solid var(--line-2);
  color: var(--cat);
  font-weight: 600;
  font-size: 19px;
  text-align: center;
}

.sk-name {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sk-name .badge {
  margin-left: 6px;
  vertical-align: 1px;
}

.sk-name .badge.cls {
  background: color-mix(in srgb, var(--cat) 18%, transparent);
  color: var(--cat);
}

.sk-chev {
  flex: none;
  color: var(--tx-3);
  transition: transform 0.2s var(--ease);
}

.sk-row.open .sk-chev {
  transform: rotate(180deg);
}

.sk-buy {
  flex: none;
  min-width: 96px;
  min-height: 44px;
  padding: 0 12px;
  border: none;
  background: linear-gradient(180deg, var(--acc-2), var(--acc));
  color: var(--acc-ink);
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
  transition: transform 0.12s var(--ease), filter 0.12s;
}

.sk-buy .p {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 17px;
}

.sk-buy .p .ic {
  width: 14px;
  height: 14px;
}

.sk-buy .p .num {
  font-weight: 700;
}

.sk-buy small {
  font: 600 11px/1.1 var(--font-d);
  letter-spacing: 0.04em;
  opacity: 0.7;
}

.sk-buy.poor {
  background: rgba(255, 255, 255, 0.04);
  color: var(--tx-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.sk-buy:active {
  transform: scale(0.94);
  filter: brightness(1.1);
}

.sk-row.locked {
  --cat: var(--tx-3);
  background: rgba(255, 255, 255, 0.015);
  border-left-color: var(--line-2);
}

.sk-row.locked .sk-val {
  color: var(--tx-3);
}

.sk-row.locked .sk-name {
  color: var(--tx-3);
  letter-spacing: 0.14em;
}

.sk-lock {
  flex: none;
  min-width: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 650;
  color: var(--tx-3);
}

.sk-desc {
  margin: 0 12px 0 74px;
  padding: 10px 0 12px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--tx-2);
}

.sk-desc p {
  margin: 0;
}

.sk-desc .lv {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--tx-3);
}

.sk-row.flash-ok {
  animation: flashOk 0.5s ease-out;
}

.sk-row.flash-bad {
  animation: shake 0.35s ease-out;
}

@keyframes flashOk {
  from { background: color-mix(in srgb, var(--acc) 26%, var(--bg-2)); }
}

.sk-empty {
  grid-column: 1 / -1;
  padding: 40px 10px;
  text-align: center;
  color: var(--tx-3);
}

@container scr (max-width: 700px) {
  .sk-title .sub {
    display: none;
  }

  .seg button {
    min-width: 40px;
    padding: 0 5px;
  }
}

/* ================================================================ store */

.store-body {
  padding: 0 12px calc(16px + var(--sab));
}

.store-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 16px;
  align-items: start;
}

.store-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 40px;
}

@container scr (max-width: 760px) {
  .store-cols {
    grid-template-columns: minmax(0, 1fr);
  }

  .store-side {
    margin-top: 0;
  }
}

.grid.tomes {
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
}

.tapcard.tome {
  min-height: 0;
  gap: 7px;
  padding: 11px 10px 10px;
}

.tapcard.tome .tc-top {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.tapcard.tome .cat-ic {
  width: 34px;
  height: 34px;
}

.tapcard.tome .tc-name b {
  font-size: 13.5px;
}

.tapcard.tome .pill {
  height: 32px;
  font-size: 13px;
}

.tapcard.tome .lockline {
  font-size: 11px;
}

.grid.shops {
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
}

.tapcard.shop {
  min-height: 0;
  padding: 11px 10px 10px;
}

.tapcard.sold {
  opacity: 0.55;
}

.sc-icons {
  display: flex;
  gap: 6px;
  color: var(--tx-1);
}

.sc-icons .ic {
  width: 26px;
  height: 26px;
}

.sc-icons .ic + .ic {
  color: var(--tx-3);
}

.sc-name {
  font-size: 14px;
  font-weight: 700;
}

.sc-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.sc-next .caption {
  font-size: 10px;
  letter-spacing: 0.1em;
}

.pips {
  display: flex;
  align-items: center;
  gap: 5px;
}

.pips i {
  width: 12px;
  height: 12px;
  display: block;
  transition: opacity 0.2s, transform 0.2s;
}

.pips i.pip-1 { border-radius: 50%; background: #b98557; }
.pips i.pip-2 { width: 10px; height: 10px; transform: rotate(45deg); border-radius: 1px; background: #c3cad6; }
.pips i.pip-3,
.pips i.pip-4 {
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.pips i.pip-3 { background: var(--star); }
.pips i.pip-4 { background: #ef5f73; width: 14px; height: 14px; }

.pips i.done {
  opacity: 0.22;
}

.pips i.next {
  outline: 1px solid var(--acc-2);
  outline-offset: 2px;
}

.pips i.pip-3.next,
.pips i.pip-4.next {
  outline: none;
  transform: scale(1.3);
  filter: drop-shadow(0 0 4px rgba(240, 204, 122, 0.7));
}

/* Hero Mode panel: champagne frame. */
.hero-card {
  --bd: var(--acc-line);
  position: relative;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--corner), linear-gradient(160deg, rgba(207, 174, 118, 0.08), transparent 60%), var(--bg-2);
}

.hero-card.active {
  --bd: color-mix(in srgb, var(--acc) 70%, transparent);
  background: var(--corner), linear-gradient(160deg, rgba(207, 174, 118, 0.17), transparent 65%), var(--bg-2);
}

.hc-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hc-title {
  display: flex;
  flex-direction: column;
}

.hc-title b {
  font-size: 15.5px;
  font-weight: 700;
}

.hc-title small {
  font-size: 12px;
  color: var(--tx-3);
}

.hero-card.active .hc-title small {
  color: var(--acc-2);
  font-weight: 650;
}

.hc-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  font-size: 13px;
  color: var(--tx-2);
}

.hc-shop {
  margin-top: 4px;
  min-height: 42px;
}

.p2card {
  flex-direction: row;
  align-items: center;
  min-height: 70px;
}

.p2-txt {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.p2-txt b {
  font-size: 15px;
  font-weight: 700;
}

.p2-txt small {
  font-size: 12px;
  color: var(--tx-3);
}

.p2card.locked {
  opacity: 0.55;
}

.p2-go {
  color: var(--acc);
}

/* store page 2 + hero shop */

.grid.boost {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.grid.two {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  margin-top: 8px;
}

.grid.bonus {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.tapcard.active {
  --bd: rgba(63, 203, 152, 0.5);
}

.card.wide {
  padding: 14px;
}

.wide-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wide-head b {
  display: block;
  font-size: 15px;
  font-weight: 700;
}

.wide-head small {
  font-size: 13px;
  color: var(--tx-2);
}

.wide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.wide-actions .btn {
  flex: 1 1 auto;
  min-height: 44px;
  font-size: 14px;
}

.chip.uses {
  color: var(--tx-2);
}

/* ================================================================ items (tiles, cards, rarity)
 * Tile = dark slot, rarity glow rising from the bottom, rarity stripe, grade notch top-left,
 * ivory glyph, stars. Tiers: bronze, silver, gold, jade, cyan, violet, ruby, mythic. */

.rt0 { --rc: #b98557; }
.rt1 { --rc: #c3cad6; }
.rt2 { --rc: #e3b94e; }
.rt3 { --rc: #4fd08c; }
.rt4 { --rc: #3fc8de; }
.rt5 { --rc: #a083f0; }
.rt6 { --rc: #ef5f73; }
.rt7 { --rc: #f3a6f0; }

.itile {
  position: relative;
  width: 52px;
  height: 52px;
  flex: none;
  box-sizing: border-box;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: color-mix(in srgb, var(--rc) 22%, #fffaf0);
  background:
    linear-gradient(to top, color-mix(in srgb, var(--rc) 46%, transparent), color-mix(in srgb, var(--rc) 8%, transparent) 62%, transparent),
    radial-gradient(70% 55% at 50% 38%, rgba(255, 255, 255, 0.08), transparent 70%),
    #111317;
  border: 1px solid color-mix(in srgb, var(--rc) 62%, #000);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), inset 0 -2px 0 color-mix(in srgb, var(--rc) 88%, #fff);
}

.itile::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  background: linear-gradient(135deg, var(--rc) 50%, transparent 50%);
}

.itile .ic {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6));
}

.itile.rt7 {
  border-color: transparent;
  background:
    linear-gradient(to top, rgba(243, 166, 240, 0.42), rgba(127, 212, 240, 0.08) 62%, transparent) padding-box,
    radial-gradient(70% 55% at 50% 38%, rgba(255, 255, 255, 0.1), transparent 70%) padding-box,
    linear-gradient(#111317, #111317) padding-box,
    conic-gradient(from 210deg, #f6d27a, #f3a6f0, #7fd4f0, #a083f0, #f6d27a) border-box;
}

.itile.empty {
  --rc: transparent;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--line-2);
  box-shadow: none;
}

.itile.empty::before {
  display: none;
}

.rstars {
  position: absolute;
  bottom: 3px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  color: color-mix(in srgb, var(--rc) 55%, #fff);
}

.rstars .ic {
  width: 8px;
  height: 8px;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9));
}

.itile:has(.rstars) .ic:first-child {
  margin-bottom: 5px;
}

.rbadge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  padding: 0 7px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--rc);
  border: 1px solid color-mix(in srgb, var(--rc) 45%, transparent);
  background: color-mix(in srgb, var(--rc) 9%, transparent);
}

.rbadge .num {
  color: var(--tx-2);
  font-size: 12px;
  font-weight: 600;
}

.icard {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--rc) 9%, transparent), transparent 55%), var(--bg-2);
  border: 1px solid color-mix(in srgb, var(--rc) 26%, var(--line));
  text-align: left;
}

.icard::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--rc), transparent 75%);
}

.icard-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icard-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.icard-title b {
  font-size: 15.5px;
  font-weight: 700;
}

.icard-meta {
  display: flex;
  gap: 14px;
  font-size: 12.5px;
  color: var(--tx-2);
}

.icard-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.icard-meta .ic {
  color: var(--tx-3);
}

.effects {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.fx {
  --fc: var(--tx-3);
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-left: 2px solid var(--fc);
  font-size: 12.5px;
  font-weight: 650;
  color: var(--tx-1);
  background: color-mix(in srgb, var(--fc) 10%, transparent);
}

.fx-def { --fc: var(--c-defense); }
.fx-atk { --fc: var(--c-attack); }
.fx-mag { --fc: var(--c-magic); }
.fx-util { --fc: var(--c-utility); }
.fx-spec { --fc: var(--c-special); }

/* ================================================================ title (lobby) */

.scr.scr-title {
  background:
    radial-gradient(55% 75% at 22% 45%, rgba(217, 47, 60, 0.13), transparent 70%),
    radial-gradient(50% 60% at 100% 0%, rgba(207, 174, 118, 0.09), transparent 70%),
    linear-gradient(180deg, #0b0c10, #07080b);
}

.title-deco {
  position: absolute;
  z-index: -1;
  left: -12%;
  top: 50%;
  width: min(118cqh, 64cqw);
  aspect-ratio: 1;
  transform: translateY(-50%);
  color: var(--acc);
  opacity: 0.07;
  pointer-events: none;
  animation: decoSpin 160s linear infinite;
}

.title-deco svg {
  display: block;
  width: 100%;
  height: 100%;
}

@keyframes decoSpin {
  to { transform: translateY(-50%) rotate(360deg); }
}

.title-actions {
  position: absolute;
  z-index: 2;
  top: calc(var(--sat) + 10px);
  right: calc(var(--sar) + 12px);
  display: flex;
  gap: 8px;
}

.title-body {
  display: flex;
  flex-direction: column;
  padding: 10px 12px calc(12px + var(--sab));
}

.title-body > .title-grid {
  margin: auto 0;
}

.title-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.85fr) minmax(0, 1.15fr);
  gap: 20px;
  align-items: center;
}

.title-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.title-brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tagline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--brand-2);
}

.tagline-row::after {
  content: '';
  width: 36px;
  height: 1px;
  background: linear-gradient(90deg, var(--brand-2), transparent);
}

.tagline {
  font: 600 11px/1 var(--font-d);
  letter-spacing: 0.3em;
  white-space: nowrap;
}

.tagline-row:has(.tagline:empty) {
  visibility: hidden;
}

.brand-lock {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo svg {
  width: 62px;
  height: 62px;
  display: block;
  color: var(--acc);
}

.brand-txt {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-txt .w1 {
  font: 500 13px/1 var(--font-d);
  letter-spacing: 0.52em;
  color: var(--tx-2);
  margin-bottom: 4px;
}

.brand-txt .w2 {
  font: 700 46px/0.92 var(--font-d);
  letter-spacing: 0.04em;
  color: var(--tx-1);
}

.brand-txt em {
  margin-left: 0.18em;
  font-style: normal;
  color: var(--brand);
}

.title-center {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  max-width: 380px;
}

.mode-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: rgba(13, 15, 19, 0.7);
  color: var(--tx-1);
  text-align: left;
}

.mode-chip .ic {
  color: var(--acc);
}

.mc-t {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mc-t .caption {
  font-size: 10px;
}

.mode-l {
  font-size: 15px;
  font-weight: 700;
}

.start-btn {
  min-height: 60px;
  justify-content: space-between;
  padding: 0 22px 0 24px;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: 0.04em;
  overflow: hidden;
}

.start-btn .ic {
  width: 20px;
  height: 20px;
}

/* Light sweep across the Start button. */
.start-btn::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: skewX(-18deg);
  animation: sweep 4.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sweep {
  0%, 62% { left: -40%; }
  100% { left: 120%; }
}

.title-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.deaths {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 12.5px;
  color: var(--tx-3);
}

.deaths span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reset-btn {
  flex: none;
  white-space: nowrap;
  min-height: 40px;
  padding: 0 8px;
  font-size: 12.5px;
  color: var(--tx-3);
}

.ghost-card {
  --bd: rgba(161, 140, 240, 0.32);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
  color: #c6b8fb;
  background: var(--corner), linear-gradient(135deg, rgba(161, 140, 240, 0.12), transparent 70%), var(--bg-2);
}

.ghost-card b {
  display: block;
  color: var(--tx-1);
  font-size: 14px;
}

.ghost-card small {
  display: block;
  font-size: 12px;
  color: var(--tx-2);
}

.ghost-card em {
  font-size: 11px;
  color: #c6b8fb;
}

.title-powers {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  margin-top: 46px;
}

.power {
  position: relative;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--corner), linear-gradient(180deg, color-mix(in srgb, var(--pc) 7%, transparent), transparent 40%), rgba(19, 21, 26, 0.86);
}

.power::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 2px;
  background: var(--pc);
}

.power.star { --pc: var(--star); }
.power.gold { --pc: var(--gold); }

.power.dim .pw-rows {
  opacity: 0.65;
}

.pw-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pw-ic {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pc);
}

.pw-ic::before {
  content: '';
  position: absolute;
  inset: 7px;
  transform: rotate(45deg);
  border: 1px solid color-mix(in srgb, var(--pc) 50%, transparent);
  background: color-mix(in srgb, var(--pc) 10%, transparent);
}

.pw-ic .ic {
  position: relative;
  width: 20px;
  height: 20px;
}

.pw-t {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pw-t .eb {
  color: var(--pc);
  font-size: 9.5px;
}

.pw-name {
  font-size: 12px;
  color: var(--tx-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pw-total {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--tx-1);
}

.pw-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 18px;
  margin-top: -2px;
}

.pw-hint {
  min-width: 0;
  font-size: 11.5px;
  color: var(--tx-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pw-badges {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge.new {
  background: var(--brand);
  color: #fff;
}

.badge.mult {
  background: color-mix(in srgb, var(--pc) 16%, transparent);
  color: var(--pc);
}

.pw-rows {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.pw-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 27px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
  color: var(--tx-2);
}

.pw-row .ic {
  color: var(--tx-3);
}

.pw-row .l {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pw-row b {
  color: var(--tx-1);
  font-size: 14px;
  font-weight: 600;
}

.pw-row .bonus {
  min-width: 42px;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  color: var(--pc);
}

.pw-row.zero .bonus {
  color: var(--tx-3);
}

@container scr (max-width: 700px) {
  .title-grid {
    grid-template-columns: minmax(210px, 0.8fr) minmax(0, 1.2fr);
    gap: 12px;
  }

  .brand-txt .w2 {
    font-size: 36px;
  }

  .brand-logo svg {
    width: 50px;
    height: 50px;
  }

  .pw-row .l {
    font-size: 11.5px;
  }

  .pw-hint {
    display: none;
  }

  .pw-sub {
    justify-content: flex-start;
    min-height: 0;
  }
}

@container scr (max-height: 400px) {
  .title-main {
    gap: 12px;
  }

  .title-powers {
    margin-top: 40px;
  }

  .pw-row {
    min-height: 24px;
  }
}

@container scr (min-height: 560px) {
  .title-main {
    gap: 26px;
  }

  .brand-txt .w2 {
    font-size: 64px;
  }

  .brand-logo svg {
    width: 84px;
    height: 84px;
  }

  .title-powers {
    margin-top: 0;
  }
}

/* mode picker sheet */

.modes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 12px;
  align-items: start;
}

.mode-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 52vh;
  overflow-y: auto;
}

html.rotated .mode-list {
  max-height: 52vw;
}

.mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-left: 2px solid transparent;
  border-radius: 0;
  background: var(--bg-2);
  text-align: left;
}

.mode-row.on {
  border-color: var(--acc-line);
  border-left-color: var(--acc);
  background: linear-gradient(90deg, var(--acc-soft), transparent 80%), var(--bg-2);
}

.mode-row .ic {
  color: var(--acc);
}

.mode-row.locked .mr-t b {
  color: var(--tx-3);
}

.mode-row.locked .ic {
  color: var(--tx-3);
}

.mr-t {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mr-t b {
  font-size: 14px;
  font-weight: 650;
}

.mr-t small {
  font-size: 12px;
  color: var(--tx-3);
}

.mode-detail h4 {
  margin: 4px 0 10px;
  font-size: 18px;
  font-weight: 700;
}

.mode-fx {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mode-fx li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.mode-fx li::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  transform: rotate(45deg);
}

.mode-fx li.good::before { background: var(--ok); }
.mode-fx li.bad::before { background: var(--bad); }
.mode-fx li.bad { color: #f6c6c8; }

/* ================================================================ class select */

.pages button.locked::after {
  content: '';
  width: 4px;
  height: 4px;
  margin-left: 4px;
  transform: rotate(45deg);
  background: var(--tx-3);
  display: inline-block;
  vertical-align: middle;
}

.cls-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  padding: 0 12px calc(12px + var(--sab));
}

.cls-scroll {
  min-height: 0;
}

.cls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 6px;
  padding-bottom: 8px;
}

.cls-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  min-height: 58px;
  padding: 8px 10px 8px 12px;
  border-radius: 0;
  border: 1px solid var(--line);
  background: var(--bg-2);
  text-align: left;
  transition: border-color 0.15s, opacity 0.3s, transform 0.12s var(--ease), background 0.15s;
}

.cls-card:active {
  transform: scale(0.96);
}

.cls-card b {
  font-size: 14px;
  font-weight: 700;
}

.cc-no {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--tx-3);
  opacity: 0.8;
}

.cls-card.sel {
  border-color: var(--acc-line);
  background: linear-gradient(90deg, rgba(207, 174, 118, 0.14), transparent 75%), var(--bg-2);
}

.cls-card.sel::before {
  content: '';
  position: absolute;
  left: -1px;
  top: -1px;
  bottom: -1px;
  width: 2px;
  background: var(--acc);
}

.cls-card.sel .cc-no {
  color: var(--acc);
}

.cls-card.locked {
  background: rgba(255, 255, 255, 0.015);
}

.cls-card.locked b {
  color: var(--tx-3);
}

.cls-card.faded {
  opacity: 0.15;
}

.cls-card.chosen {
  border-color: var(--star);
  box-shadow: 0 0 0 1px var(--star), 0 0 22px rgba(240, 204, 122, 0.25);
}

.cc-dots {
  display: flex;
  gap: 6px;
  padding-left: 2px;
}

.cc-dots i {
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
}

.cc-lock {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--tx-3);
}

.cc-lock .ic {
  width: 13px;
  height: 13px;
}

.cls-detail {
  --bd: var(--line-2);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 14px 14px;
  min-height: 0;
  overflow: hidden;
  background: var(--corner), linear-gradient(180deg, rgba(207, 174, 118, 0.06), transparent 35%), var(--bg-2);
}

.cls-detail::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 2px;
  background: var(--acc);
}

.cls-detail.chosen {
  --bd: rgba(240, 204, 122, 0.45);
}

.cls-detail .eb {
  margin-bottom: -6px;
}

.cd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.cd-name {
  font-size: 22px;
  font-weight: 750;
}

.cd-lock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--tx-3);
}

.cd-skills {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.cd-skill {
  display: flex;
  gap: 10px;
}

.cd-skill .cat-ic {
  width: 30px;
  height: 30px;
}

.cd-st b {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--c);
}

.cd-st p {
  margin: 2px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--tx-2);
}

.cd-go {
  flex: none;
  margin-top: 4px;
}

@container scr (max-width: 640px) {
  /* One scroll for grid + detail; the Choose button stays pinned while the detail is in view. */
  .cls-body {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    overflow-y: auto;
  }

  /* Content-sized rows (min-height: 0 would let the rows shrink to the box and overlap). */
  .cls-scroll,
  .cls-detail,
  .cd-skills {
    min-height: auto;
    overflow: visible;
  }

  .cd-go {
    position: sticky;
    bottom: 8px;
  }
}

/* ================================================================ enhance (Hero Mode) */

.enh-body {
  padding: 0 14px calc(14px + var(--sab));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.lead-text {
  margin: 0;
  color: var(--tx-2);
  font-size: 14px;
}

.enh-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

@container scr (max-width: 600px) {
  .enh-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.enh-card {
  --bd: color-mix(in srgb, var(--c) 30%, var(--line));
  align-items: center;
  text-align: center;
  min-height: 156px;
  justify-content: center;
  gap: 6px;
  background: var(--corner), linear-gradient(180deg, color-mix(in srgb, var(--c) 13%, transparent), transparent 70%), var(--bg-2);
}

.enh-card::after {
  left: 50%;
  width: 40px;
  transform: translateX(-50%);
}

.cat-ic.big {
  position: relative;
  width: 60px;
  height: 60px;
  margin-bottom: 6px;
  background: none;
  border: none;
}

.cat-ic.big::before {
  content: '';
  position: absolute;
  inset: 9px;
  transform: rotate(45deg);
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 24%, transparent), color-mix(in srgb, var(--c) 4%, transparent));
}

.cat-ic.big .ic {
  position: relative;
  width: 26px;
  height: 26px;
}

.enh-card .eb,
.eh-card .eb {
  color: var(--c);
  font-size: 9.5px;
  margin-bottom: -4px;
}

.enh-card b {
  font-size: 18px;
  font-weight: 750;
}

.enh-plus {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--c);
}

.enh-now {
  font-size: 12px;
  color: var(--tx-3);
}

.enh-bonus {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.enh-bonus .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.enh-normal {
  align-self: center;
}

/* ================================================================ draft */

.draft-body {
  padding: 0 12px calc(12px + var(--sab));
}

.draft-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.draft-cards.items {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@container scr (max-width: 640px) {
  .draft-cards,
  .draft-cards.items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.draft-card {
  --c: var(--acc);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
  padding: 14px 14px 12px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--bg-2);
  transition: transform 0.12s var(--ease), border-color 0.15s;
}

.draft-card:active {
  transform: scale(0.975);
}

.draft-card.tome {
  --bd: color-mix(in srgb, var(--c) 32%, var(--line));
  background: var(--corner), linear-gradient(180deg, color-mix(in srgb, var(--c) 12%, transparent), transparent 55%), var(--bg-2);
}

.draft-card.tome::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 2px;
  background: var(--c);
}

.draft-card.item {
  padding: 0;
  border: none;
  background: none;
}

.draft-card.item .icard {
  flex: 1;
}

.dc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dc-top .badge {
  background: color-mix(in srgb, var(--c) 16%, transparent);
  color: var(--c);
}

.dc-top .badge.new {
  background: var(--ok);
  color: #03261a;
}

.dc-name {
  font-size: 16.5px;
  font-weight: 750;
  line-height: 1.22;
}

.dc-vals {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 24px;
  font-weight: 600;
}

.dc-vals .ic {
  color: var(--tx-3);
}

.dc-vals .v0 {
  color: var(--tx-3);
}

.dc-vals .v1 {
  color: var(--c);
}

.dc-info {
  margin: 0;
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
  color: var(--tx-2);
}

.dc-pick {
  align-self: stretch;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tx-1);
  color: var(--tx-inv);
  font-weight: 750;
  font-size: 14px;
  letter-spacing: 0.04em;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.draft-card.item .dc-pick {
  margin-top: 8px;
}

/* ================================================================ inventory */

.inv-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  padding: 0 12px calc(10px + var(--sab));
}

.inv-scroll {
  min-height: 0;
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 6px;
  padding: 4px 4px 8px;
}

.inv-cell {
  padding: 3px;
  border: none;
  background: none;
  display: flex;
  justify-content: center;
}

.inv-cell .itile {
  width: 54px;
  height: 54px;
}

.inv-cell.sel .itile {
  outline: 2px solid var(--acc-2);
  outline-offset: 2px;
}

.inv-empty,
.inv-hint {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 10px;
  color: var(--tx-3);
  text-align: center;
}

.inv-hint {
  border: 1px dashed var(--line-2);
}

.inv-hint p,
.inv-empty p {
  margin: 0;
  font-size: 13px;
}

.inv-more {
  margin: 4px;
  font-size: 12px;
  color: var(--tx-3);
}

.inv-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}

.inv-side > .caption {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--tx-2);
}

.inv-side > .caption::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line-2), transparent);
}

.equip-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.eq-slot {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 14px 0 6px;
  border-radius: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.eq-slot.can {
  border-color: var(--acc-line);
  background: var(--acc-soft);
}

.eq-n {
  position: absolute;
  top: 2px;
  left: 5px;
  z-index: 1;
  font: 600 11px/1 var(--font-d);
  color: var(--tx-3);
}

.eq-hint {
  font-size: 11.5px;
  color: var(--tx-3);
}

.inv-detail {
  flex: 1;
}

.inv-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 6px;
  background: linear-gradient(to top, var(--bg-0) 70%, transparent);
}

.btn.sell {
  color: var(--gold);
}

.btn.destroy {
  color: #f3a5ae;
}

.bulk h3 {
  margin-top: 8px;
}

.type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 2px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  color: var(--tx-3);
  font-weight: 650;
  font-size: 13px;
}

.tchip.on {
  color: var(--tx-1);
  border-color: var(--acc-line);
  background: var(--acc-soft);
}

.tchip.on .ic {
  color: var(--acc-2);
}

.bulk .btn.block {
  margin-top: 10px;
  justify-content: space-between;
}

@container scr (max-width: 640px) {
  .inv-body {
    grid-template-columns: minmax(0, 1fr);
    overflow-y: auto;
  }
}

/* ================================================================ combat */

.scr-combat {
  background: none;
  pointer-events: none !important;
  animation: none;
}

.cb-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(136px, 25%, 214px) minmax(0, 1fr) clamp(136px, 25%, 214px);
  gap: 8px;
  padding: 6px 8px 0;
}

.cb-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  pointer-events: auto;
}

.cb-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.cb-top .ibtn {
  width: 42px;
  height: 42px;
}

.cb-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
}

.cb-stage b {
  font: 600 17px/1.1 var(--font-d);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.cb-stage small {
  font-size: 11px;
  color: var(--acc);
  white-space: nowrap;
}

.cb-card > * {
  flex-shrink: 0;
}

.cb-card {
  --cc: var(--acc);
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 11px 8px;
  background: linear-gradient(180deg, rgba(13, 15, 19, 0.9), rgba(13, 15, 19, 0.74));
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}

.cb-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 2px;
  background: var(--cc);
}

.cb-card.spider {
  --cc: var(--brand);
}

.cb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.cb-ic {
  position: relative;
  flex: none;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cc);
}

.cb-ic::before {
  content: '';
  position: absolute;
  inset: 5px;
  transform: rotate(45deg);
  border: 1px solid color-mix(in srgb, var(--cc) 55%, transparent);
  background: color-mix(in srgb, var(--cc) 12%, transparent);
}

.cb-ic .ic {
  position: relative;
  width: 15px;
  height: 15px;
}

.cb-t {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.cb-t b {
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-t small {
  font-size: 11px;
  color: var(--tx-3);
}

.cb-badge {
  background: rgba(240, 204, 122, 0.14);
  color: var(--star);
}

.cb-card.spider .cb-badge {
  background: rgba(212, 120, 230, 0.16);
  color: var(--c-evil);
}

.cb-stat-h {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
  font-size: 11px;
  color: var(--tx-3);
}

.cb-stat-h .ic {
  width: 13px;
  height: 13px;
}

.cb-stat-h b {
  margin-left: auto;
  font-size: 14px;
  color: var(--tx-1);
  font-weight: 600;
  white-space: nowrap;
}

.cb-stat.sh .ic { color: var(--shield); }
.cb-stat.ar .ic { color: var(--armor); }
.cb-stat.hp .ic { color: var(--hp); }

.cb-stat .bar {
  height: 5px;
}

.cb-stat.hp .bar {
  height: 7px;
}

.bar.ar { --c1: #79828f; --c2: #d3d8e0; }
.bar.atk { --c1: #8d939e; --c2: #f1ede6; }
.bar.mag { --c1: var(--shield); --c2: #b7ecfb; }

.cb-charges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cb-ch {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--tx-3);
}

.cb-ch .ic {
  width: 13px;
  height: 13px;
}

.cb-ch .bar {
  flex: 1;
  height: 3px;
}

.cb-ch .bar > i {
  transition-duration: 0.08s;
}

.cb-dps {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
}

.cb-dps .ic {
  width: 14px;
  height: 14px;
  color: var(--warn);
}

.cb-rage,
.cb-casc {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 1px;
}

.cb-rage { color: #f6b0b3; background: rgba(239, 93, 98, 0.14); }
.cb-casc { color: #b7ecfb; background: rgba(88, 180, 234, 0.14); }
.cb-rage:empty,
.cb-casc:empty { display: none; }

.cb-ail {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 0;
}

.ail {
  --a: var(--tx-2);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 1px;
  border-left: 2px solid var(--a);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--a);
  background: color-mix(in srgb, var(--a) 14%, transparent);
}

.ail.prev {
  --a: #9aa1ae;
}

.ail .ic {
  width: 10px;
  height: 10px;
}

.cb-lines {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--tx-3);
}

.cb-lines > div {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.cb-lines b {
  color: var(--tx-2);
  font-size: 12px;
  font-weight: 600;
}

.cb-total {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--tx-2);
}

.cb-center {
  position: relative;
  min-width: 0;
}

.cb-arena {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cb-banner {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  width: min(340px, 96%);
  box-sizing: border-box;
  padding: 11px 12px 12px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-2);
  border-top: 1px solid var(--acc-line);
  box-shadow: var(--shadow-2);
  pointer-events: auto;
  animation: scrIn 0.25s var(--ease);
}

.bn-t {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.bn-t .ic {
  color: var(--brand-2);
}

.bn-bar {
  height: 3px;
  margin: 9px 0;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bn-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--acc), var(--acc-2));
}

.bn-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 8px;
}

.bn-actions .btn {
  min-height: 42px;
  padding: 0 10px;
  font-size: 14px;
  white-space: nowrap;
}

.cb-pause {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  background: rgba(7, 8, 11, 0.55);
}

.pp-card {
  --bd: var(--line-2);
  position: relative;
  width: min(280px, 94%);
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: scrIn 0.2s var(--ease);
}

.pp-card::after {
  content: 'PAUSED';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  font: 600 10px/1 var(--font-d);
  letter-spacing: 0.3em;
  color: var(--acc);
}

.pp-card h2 {
  margin: 10px 0 6px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}

.pp-card .btn {
  min-height: 44px;
}

.cb-dock {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px calc(6px + var(--sab));
  pointer-events: auto;
  background: linear-gradient(to top, rgba(7, 8, 11, 0.96) 55%, rgba(7, 8, 11, 0));
}

.dock-btn {
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas: 'ic l' 'ic v';
  align-items: center;
  column-gap: 10px;
  min-height: 56px;
  min-width: 108px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), rgba(19, 21, 26, 0.94);
  text-align: left;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: transform 0.12s var(--ease), border-color 0.2s, background 0.2s;
}

.dock-btn:active {
  transform: scale(0.95);
}

.db-ic {
  grid-area: ic;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.db-l {
  grid-area: l;
  font-size: 11px;
  font-weight: 650;
  color: var(--tx-3);
  align-self: end;
}

.db-v {
  grid-area: v;
  font-size: 18px;
  font-weight: 600;
  align-self: start;
  line-height: 1.1;
}

.dock-btn.skills .db-ic { color: var(--star); }
.dock-btn.store .db-ic { color: var(--gold); }
.dock-btn.inv .db-ic { color: var(--tx-3); }

.dock-btn.inv.open {
  border-color: rgba(63, 203, 152, 0.6);
  background: linear-gradient(160deg, rgba(63, 203, 152, 0.16), rgba(19, 21, 26, 0.94));
}

.dock-btn.inv.open .db-ic {
  color: var(--ok);
}

.dock-btn.bump .db-v {
  animation: bump 0.35s var(--ease);
}

@keyframes bump {
  40% { transform: scale(1.22); color: var(--star); }
}

.cb-items {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}

.cb-item {
  position: relative;
  width: 58px;
  height: 58px;
  flex: none;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: none;
  transition: transform 0.12s var(--ease), opacity 0.2s, filter 0.2s, box-shadow 0.2s;
  -webkit-touch-callout: none;
}

.ci-tile .itile {
  width: 58px;
  height: 58px;
}

.ci-tile .itile .ic {
  width: 30px;
  height: 30px;
}

.cb-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: conic-gradient(rgba(5, 6, 9, 0.74) calc(var(--cd, 0) * 360deg), transparent 0);
  pointer-events: none;
}

.ci-cd {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 20px/1 var(--font-d);
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  z-index: 1;
  pointer-events: none;
}

.ci-uses {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  box-sizing: border-box;
  border-radius: 1px;
  background: rgba(5, 6, 9, 0.78);
  color: var(--tx-1);
  font-size: 12px;
  font-weight: 600;
  line-height: 17px;
  z-index: 2;
}

.ci-key {
  position: absolute;
  bottom: 3px;
  left: 5px;
  font: 600 10px/1 var(--font-d);
  color: rgba(255, 255, 255, 0.55);
  z-index: 2;
}

.ci-auto {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 5px;
  border-radius: 1px;
  background: var(--acc);
  color: var(--acc-ink);
  font: 700 9px/1.2 var(--font-d);
  letter-spacing: 0.12em;
  z-index: 2;
  display: none;
}

.cb-item.auto .ci-auto {
  display: block;
}

.cb-item.ready {
  box-shadow: 0 0 0 1px var(--acc-2), 0 0 16px rgba(234, 209, 162, 0.28);
}

.cb-item.broken,
.cb-item.locked {
  filter: grayscale(0.85);
  opacity: 0.5;
}

.cb-item.broken .ci-uses {
  background: var(--bad);
  color: #fff;
}

.cb-item:active,
.cb-item.fire {
  animation: pop 0.25s var(--ease);
}

.cb-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 40%, rgba(200, 0, 12, 0.7) 100%);
  transition: opacity 0.2s;
}

.item-sheet {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tut {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tut-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.tut-row p {
  margin: 0;
  font-size: 14px;
  color: var(--tx-2);
}

.tut-n {
  flex: none;
  width: 22px;
  height: 22px;
  color: var(--acc);
  font: 600 13px/22px var(--font-d);
  text-align: center;
}

@container scr (max-height: 360px) {
  .cb-lines {
    display: none;
  }

  .dock-btn {
    min-height: 50px;
  }

  .cb-item,
  .ci-tile .itile {
    width: 50px;
    height: 50px;
  }
}

@container scr (max-width: 700px) {
  .dock-btn {
    min-width: 0;
    padding: 0 12px 0 10px;
  }

  .dock-btn .db-l {
    display: none;
  }

  .dock-btn {
    grid-template-areas: 'ic v';
  }

  .dock-btn .db-v {
    align-self: center;
  }
}

/* ================================================================ game over, spider stats, options, evil/holy */

.scr-gameOver,
.scr-evilHoly {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(60% 70% at 50% 30%, rgba(200, 24, 40, 0.24), transparent 70%),
    linear-gradient(180deg, #0c0709, #07080b);
  overflow-y: auto;
}

.scr-gameOver {
  --wm: 'GAME OVER';
}

.scr-gameOver::before {
  right: 50%;
  transform: translateX(50%);
  -webkit-text-stroke: 1px rgba(239, 93, 98, 0.08);
}

.scr-evilHoly {
  --wm: 'FATE';
  background:
    radial-gradient(45% 70% at 25% 50%, rgba(212, 120, 230, 0.16), transparent 70%),
    radial-gradient(45% 70% at 75% 50%, rgba(239, 220, 156, 0.14), transparent 70%),
    linear-gradient(180deg, #0b0c10, #07080b);
}

.go-wrap,
.eh-wrap {
  width: min(580px, 92%);
  margin: auto;
  padding: 14px 0 calc(14px + var(--sab));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.go-skull {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bad);
}

.go-skull::before {
  content: '';
  position: absolute;
  inset: 10px;
  transform: rotate(45deg);
  border: 1px solid rgba(239, 93, 98, 0.55);
  background: rgba(239, 93, 98, 0.1);
}

.go-skull .ic {
  position: relative;
  width: 26px;
  height: 26px;
}

.go-eb {
  color: var(--brand-2);
  margin-top: 2px;
}

.go-title {
  margin: 0;
  font-size: 30px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.go-sub {
  margin: -4px 0 4px;
  color: var(--tx-3);
  font-weight: 600;
}

.go-stats {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
}

@container scr (max-width: 520px) {
  .go-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.go-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px;
}

.go-stat + .go-stat {
  border-left: 1px solid var(--line);
}

.go-stat .ic {
  width: 16px;
  height: 16px;
  color: var(--tx-3);
}

.go-stat span {
  font-size: 11px;
  color: var(--tx-3);
}

.go-stat b {
  font-size: 22px;
  font-weight: 600;
}

.go-ghost {
  width: 100%;
  box-sizing: border-box;
}

.go-actions {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
}

.go-continue {
  min-height: 52px;
  font-size: 17px;
}

@container scr (max-height: 440px) {
  .go-wrap {
    gap: 6px;
    padding-top: 8px;
  }

  .go-skull {
    display: none;
  }

  .go-title {
    font-size: 26px;
  }

  .go-stat {
    padding: 6px;
  }

  .go-stat b {
    font-size: 19px;
  }

  .go-ghost {
    padding: 6px 12px;
  }

  .go-actions {
    margin-top: 2px;
  }

  .go-continue {
    min-height: 46px;
  }
}

.ss-body,
.op-body {
  padding: 0 12px calc(14px + var(--sab));
}

.ss-group h3 .ic {
  color: var(--cat);
}

.ss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0 14px;
}

.ss-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--tx-2);
}

.ss-row b {
  color: var(--cat);
  font-size: 15px;
  font-weight: 600;
}

.op-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.op-t {
  display: flex;
  flex-direction: column;
  min-width: 200px;
  flex: 1;
}

.op-t b {
  font-size: 15px;
  font-weight: 650;
}

.op-t small {
  font-size: 12.5px;
  color: var(--tx-3);
}

.op-row .choice {
  min-width: min(320px, 100%);
}

.eh-wrap .caption {
  color: var(--acc);
  font-family: var(--font-d);
  letter-spacing: 0.3em;
}

.eh-cards {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.eh-card {
  --bd: color-mix(in srgb, var(--c) 40%, var(--line));
  align-items: center;
  text-align: center;
  min-height: 180px;
  justify-content: center;
  gap: 6px;
  background: var(--corner), linear-gradient(180deg, color-mix(in srgb, var(--c) 15%, transparent), transparent 70%), var(--bg-2);
}

.eh-card::after {
  left: 50%;
  width: 40px;
  transform: translateX(-50%);
}

.eh-card b {
  font-size: 21px;
  font-weight: 750;
}

.eh-card small {
  font-size: 12.5px;
  color: var(--tx-2);
}
