@font-face {
  font-family: "Passion One";
  src: url("../assets/PassionOne-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #07080d;
  --panel: #12151e;
  --panel-2: #1a1e2a;
  --line: #2c3348;
  --text: #f4f1ea;
  --muted: #a7adbe;
  --pink: #ff4d8d;
  --gold: #ffc857;
  --green: #7dffb3;
  --danger: #ff5d6c;
  --violet: #c49bff;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

button { font: inherit; color: inherit; }

#app {
  height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#toast {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%) translateY(-8px);
  z-index: 7;
  max-width: calc(100% - 24px);
  background: rgba(10, 12, 18, 0.88);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  text-align: center;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#topbar {
  position: relative;
  flex: 0 0 auto;
  z-index: 2;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: calc(3px + env(safe-area-inset-top)) 6px 3px;
  background: #07080d;
  pointer-events: none;
}
#topbar button { pointer-events: auto; }

.stats {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: stretch;
}

.pill {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  background: rgba(18, 21, 30, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1px 3px 4px;
  text-align: center;
}
.pill b {
  display: block;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.pill small {
  display: block;
  font-size: 8px;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill.gold b { color: var(--gold); }
.pill.ash b { color: #d7c4b0; }
.pill.hp b { color: var(--green); }
.pill.hp.low b { color: var(--danger); }
.pill .bar {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 3px;
  height: 4px;
  background: #242833;
  border-radius: 99px;
  overflow: hidden;
}
.pill .bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--green);
  transform-origin: left center;
}
.pill.hp.low .bar i { background: var(--danger); }

/* ---- Top bar controls ---- */
#topbar { min-height: 44px; gap: 4px; }
.stats { max-width: 560px; }
.pill.hp { flex-grow: 1.2; }
#shopBtn { margin-left: auto; }
.tb {
  flex: 0 0 34px;
  width: 34px;
  height: 36px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(18, 21, 30, 0.88);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tb:active { transform: scale(0.96); }
.tb .ico, #shopBtn .ico {
  display: block;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
}
#pauseBtn { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='4' width='5' height='16' rx='1.2'/%3E%3Crect x='14' y='4' width='5' height='16' rx='1.2'/%3E%3C/svg%3E"); }
#pauseBtn.on { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4.5v15a1 1 0 0 0 1.5.86l12-7.5a1 1 0 0 0 0-1.72l-12-7.5A1 1 0 0 0 7 4.5z'/%3E%3C/svg%3E"); color: var(--gold); }
#mute { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9.5h3.5L12 5v14l-4.5-4.5H4z' fill='black'/%3E%3Cpath d='M15.5 9a4.2 4.2 0 0 1 0 6M18.5 6.2a8 8 0 0 1 0 11.6'/%3E%3C/svg%3E"); }
#mute.off { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9.5h3.5L12 5v14l-4.5-4.5H4z' fill='black'/%3E%3Cpath d='M16 9.5l5 5M21 9.5l-5 5'/%3E%3C/svg%3E"); color: var(--muted); }
#restart { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 12a7.5 7.5 0 1 0 2.4-5.5'/%3E%3Cpath d='M4 4v4.5h4.5'/%3E%3C/svg%3E"); color: var(--muted); }

#shopBtn {
  flex: 0 0 auto;
  min-width: 62px;
  height: 36px;
  padding: 0 9px 0 7px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffd77a, #f2b23a);
  color: #1d1406;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 17px;
  letter-spacing: 0.04em;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3) inset;
}
#shopBtn .ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4h2.5l2.2 10.5h10.8L21 7H7'/%3E%3Ccircle cx='9.5' cy='19' r='1.6' fill='black'/%3E%3Ccircle cx='17' cy='19' r='1.6' fill='black'/%3E%3C/svg%3E"); width: 17px; height: 17px; }
#shopBtn.on { background: #2a3142; color: var(--text); box-shadow: 0 0 0 1px var(--gold) inset; }
#shopBtn.on .ico { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E"); width: 14px; height: 14px; }
#shopBtn:active { transform: scale(0.97); }
#shopBtn:disabled { opacity: 0.4; }

#next {
  flex: 0 0 62px;
  width: 62px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #ff6fa4, #ff3d78);
  color: #1a0a12;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 13px;
  line-height: 0.92;
  letter-spacing: 0.03em;
  padding: 1px 4px;
}
#next[hidden] { display: none; }
#next:active { transform: scale(0.97); }

/* ---- Shop drawer (drops over the field, game paused) ---- */
#shopPanel {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: rgba(4, 5, 10, 0.5);
}
#shopPanel.hidden { display: none; }
.shopSheet {
  width: min(640px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(13, 15, 22, 0.97);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 18px 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  animation: shopDrop 0.16s ease-out;
  overflow: hidden;
}
@keyframes shopDrop {
  from { transform: translateY(-16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.shopScroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 10px 12px 8px;
}
.shopHead {
  display: flex;
  align-items: center;
  gap: 8px;
}
.shopTitle { flex: 1 1 auto; min-width: 0; }
.shopTitle .kicker { margin: 0 0 2px; font-size: 11px; }
.shopTitle h2 {
  margin: 0;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 30px;
  line-height: 0.9;
  letter-spacing: 0.03em;
}
.shopWallet { display: flex; gap: 6px; }
.wal {
  min-width: 58px;
  text-align: center;
  background: #10131b;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px 8px 4px;
}
.wal b {
  display: block;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 22px;
  line-height: 1;
}
.wal small { display: block; font-size: 9px; font-weight: 800; letter-spacing: 0.1em; color: var(--muted); }
.wal.gold b { color: var(--gold); }
.wal.ash b { color: #d7c4b0; }
#shopClose {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #1a1e2a;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}
.shopStage {
  margin-top: 10px;
  background: #10131b;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}
.waveTitle { display: flex; align-items: center; gap: 6px; }
.waveTitle b {
  font-family: "Passion One", Impact, sans-serif;
  font-size: 18px;
  letter-spacing: 0.03em;
  line-height: 1;
}
#waveBlurb, #mods { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.3; }
#mods { color: var(--violet); }
#mods:empty { display: none; }
.tag {
  display: none;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  border-radius: 999px;
  padding: 2px 6px;
}
.tag.chal, .tag.boss { display: inline-block; }
.tag.chal { background: #3a2a12; color: var(--gold); }
.tag.boss { background: #3a1430; color: #ff9ec4; }
.shopSec {
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--pink);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.shopSec small { color: var(--muted); letter-spacing: 0.06em; font-size: 11px; }

#roster {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.hire {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 112px;
  padding: 0;
  background: #171b26;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
  overflow: visible;
}
.hireCard {
  position: relative;
  align-self: center;
  margin: 7px 0 0;
  padding: 0;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.hireCard:active { transform: scale(0.95); }
.iBadge {
  position: absolute;
  right: -3px;
  top: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f4f1ea;
  color: #141821;
  font: italic 800 12px/1 Georgia, "Times New Roman", serif;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.hire.due .iBadge { background: #ffe36a; animation: dueGlow 1.1s ease-in-out infinite; }
.hireBuy {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 3px 4px 7px;
  background: none;
  border: 0;
  border-radius: 0 0 12px 12px;
  color: inherit;
  min-height: 52px;
}
.hireBuy:active:not(:disabled) { transform: scale(0.97); }
.hire.broke .hireBuy { opacity: 0.62; }
.hire.locked .hireBuy, .hireBuy:disabled { opacity: 0.42; pointer-events: none; }
.hire.locked .hireCard { opacity: 0.6; }
.face {
  width: 44px;
  height: 48px;
  border-radius: 8px;
  flex: none;
  display: block;
  object-fit: cover;
  object-position: center 12%;
  background-color: #141820;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}
.hire[data-id="vera"] .face { box-shadow: 0 0 0 2px #e7c56a; }
.hire[data-id="roxie"] .face { box-shadow: 0 0 0 2px #ff4d9a; }
.hire[data-id="lila"] .face { box-shadow: 0 0 0 2px #ffb04a; }
.hire[data-id="nyx"] .face { box-shadow: 0 0 0 2px #c49bff; }
.hire[data-id="sable"] .face { box-shadow: 0 0 0 2px #7ec8ff; }
.hire[data-id="wren"] .face { box-shadow: 0 0 0 2px #9be36a; }
.meta { min-width: 0; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.hire .meta b { font-size: 14px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hire .meta small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.price { color: var(--gold); font-weight: 800; font-size: 14px; font-style: normal; line-height: 1.1; }
.hire.locked .price { color: var(--muted); }
.own { font-size: 10px; font-style: normal; color: var(--muted); line-height: 1.1; }
.own.has { color: var(--green); }

#baseShop {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.up {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 62px;
  padding: 7px 8px;
  background: #171b26;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
}
.up:active { transform: scale(0.97); }
.up.broke { opacity: 0.62; }
.up.maxed { opacity: 0.5; }
.up .mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex: none;
  display: block;
  font-size: 0;
  color: transparent;
  overflow: hidden;
  background-color: #141820;
  background-repeat: no-repeat;
  background-size: 170%;
  background-position: center;
  border: 1px solid var(--line);
}
.up[data-id="wall"] .mark { background-image: url("../assets/upgrade-wall.png"); }
.up[data-id="aura"] .mark { background-image: url("../assets/upgrade-aura.png"); }
.up[data-id="turret"] .mark { background-image: url("../assets/upgrade-turret.png"); }
.up[data-id="spikes"] .mark { background-image: url("../assets/upgrade-spikes.png"); }
.up[data-id="mend"] .mark { background-image: url("../assets/upgrade-mend.png"); }
.up[data-id="mines"] .mark { background-image: url("../assets/upgrade-mines.png"); }
.up[data-id="ammo"] .mark { background-image: url("../assets/upgrade-ammo.png"); }
.up[data-id="squad"] .mark { background-image: url("../assets/upgrade-squad.png"); }
.up .meta { align-items: flex-start; }
.up .meta b { font-size: 13px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.up .lv { font-style: normal; font-size: 12px; font-weight: 800; color: var(--gold); line-height: 1.2; }
.up.maxed .lv { color: var(--muted); }
.up .fx { font-style: normal; font-size: 10px; color: var(--muted); line-height: 1.2; }

.shopMore { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
#skillsBtn, #labBtn, #medalsBtn {
  min-height: 56px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #1a1e2a;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
#skillsBtn b, #labBtn b, #medalsBtn b { font-family: "Passion One", Impact, sans-serif; font-size: 20px; letter-spacing: 0.06em; line-height: 1; }
#labBtn b { color: var(--gold); }
#medalsBtn b { color: #ffe36a; }
#skillsBtn small, #labBtn small, #medalsBtn small { font-size: 10px; color: var(--muted); font-weight: 700; }
#skillsBtn:active, #labBtn:active, #medalsBtn:active { transform: scale(0.98); }
.shopFoot {
  flex: 0 0 auto;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #0c0e14;
}
#shopDone {
  display: block;
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffd77a, #f2b23a);
  color: #1d1406;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 22px;
  letter-spacing: 0.05em;
}
#shopDone:active { transform: scale(0.99); }

@media (min-width: 560px) {
  #roster { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #baseShop { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .up { flex-direction: column; text-align: center; align-items: center; min-height: 104px; }
  .up .meta { align-items: center; }
}

#overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: rgba(4, 5, 10, 0.78);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}
#overlay.hidden { display: none; }

.panel {
  width: min(460px, 100%);
  background: #141821;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 14px 12px;
  margin-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
}
.panel h2 {
  margin: 0;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 32px;
  letter-spacing: 0.03em;
  line-height: 0.95;
}
.panel p { color: var(--muted); margin: 8px 0 12px; line-height: 1.35; }

.choice, #ovBtn {
  display: block;
  width: 100%;
  text-align: left;
  margin-top: 8px;
  min-height: 64px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 10px 12px;
}
.choice b, #ovBtn {
  font-family: "Passion One", Impact, sans-serif;
  font-size: 20px;
  letter-spacing: 0.03em;
}
.choice span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}
#ovBtn {
  text-align: center;
  background: linear-gradient(180deg, #ff6fa4, #ff3d78);
  color: #1a0a12;
  border: 0;
  min-height: 52px;
}
.texty {
  display: block;
  width: 100%;
  margin-top: 8px;
  min-height: 44px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-weight: 700;
}

.kicker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--pink);
}

#titleScreen {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 80;
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  justify-content: safe flex-end;
  padding: calc(22px + env(safe-area-inset-top)) 18px calc(22px + env(safe-area-inset-bottom));
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(7, 8, 13, 0.08) 0%, rgba(7, 8, 13, 0.02) 18%, rgba(7, 8, 13, 0.28) 46%, rgba(7, 8, 13, 0.78) 72%, rgba(7, 8, 13, 0.92) 100%),
    url("../assets/title-art.jpg") center top / cover no-repeat;
}
#titleScreen.hidden { display: none; }
.titleCard {
  width: min(460px, 100%);
  margin-top: auto;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 18px;
  padding: 16px 16px 14px;
}
.titleCard h1 {
  margin: 0 0 10px;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 86px;
  line-height: 0.8;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.85);
}
.titleCard h1 span { color: var(--pink); }
.veteranLine {
  margin: -8px 0 14px;
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 0.03em;
  font-size: 15px;
}
.veteranLine[hidden] { display: none !important; }
.tagline {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.35;
  max-width: 22em;
}
#play {
  display: block;
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ff6fa4, #ff3d78);
  color: #1a0a12;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 32px;
  letter-spacing: 0.06em;
}
#play:active { transform: scale(0.99); }
#regionRow {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
}
#regionRow[hidden] { display: none !important; }
.regionPick {
  flex: 1;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(12, 14, 20, 0.7);
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 13px;
}
.regionPick.on {
  border-color: var(--gold);
  color: var(--gold);
}
.regionPick:active { transform: scale(0.98); }

.titleRow { display: flex; gap: 8px; margin-top: 8px; }
.titleRow button { flex: 1 1 0; min-width: 0; }
#titleLab, #titleCards, #titleMedals {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 0;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(12, 14, 20, 0.7);
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 0.14em;
}
#titleCards { color: #f4f1ea; }
#titleMedals { color: #ffe36a; }
#titleLab:active, #titleCards:active, #titleMedals:active { transform: scale(0.98); }

#titleMute {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(12, 14, 20, 0.7);
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.14em;
}

#skillScreen, #labScreen, #medalScreen {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 70;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: rgba(4, 5, 10, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow: auto;
}
#labScreen, #medalScreen { z-index: 90; }
#medalScreen { background: rgba(4, 5, 10, 0.93); }
#skillScreen.hidden, #labScreen.hidden, #medalScreen.hidden { display: none; }
#skillList, #labList, #medalList {
  max-height: min(52dvh, 440px);
  overflow: auto;
}
.skillCard {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 14px;
  padding: 10px 12px;
  margin-top: 8px;
}
.skillCard b {
  display: block;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 22px;
  letter-spacing: 0.03em;
}
.skillCard p { margin: 4px 0 8px; }
.skillNodes { margin: 6px 0 8px; }
.skillNodes div {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.skillNodes .got { color: var(--text); }
.skillFork {
  display: flex;
  gap: 6px;
  align-items: stretch;
  margin: 6px 0;
}
.skillFork .forkOpt {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.skillFork .forkOpt.got {
  color: var(--text);
  border-color: var(--gold);
}
.skillFork .forkOpt.locked { opacity: 0.45; }
.skillFork .miniBuy {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  margin-top: 0;
  min-height: 64px;
  font-size: 15px;
  line-height: 1.05;
  padding: 6px;
  white-space: normal;
}
.ashLine {
  margin: 0;
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 0.08em;
}
.miniBuy, #skillClose, #labClose, #medalClose {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ff6fa4, #ff3d78);
  color: #1a0a12;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 22px;
  letter-spacing: 0.04em;
}
.miniBuy:disabled {
  background: #2a3142;
  color: #8b93a7;
}
#skillClose, #labClose, #medalClose {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.12em;
}

#pauseScreen {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: rgba(4, 5, 10, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
#pauseScreen.hidden { display: none; }
#restartConfirm {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: rgba(4, 5, 10, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
#restartConfirm.hidden { display: none; }
#restartConfirm .panel { max-width: 360px; }
#restartConfirmPrompt { color: var(--text); margin: 0 0 12px; }
.restartConfirmActions { display: flex; gap: 8px; }
.restartConfirmActions button {
  flex: 1;
  min-height: 48px;
  border-radius: 12px;
  border: 0;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 22px;
  letter-spacing: 0.04em;
}
#restartConfirmYes {
  background: linear-gradient(180deg, #ff6fa4, #ff3d78);
  color: #1a0a12;
}
#restartConfirmNo {
  margin-top: 0;
  border: 1px solid var(--line);
  color: var(--muted);
}
#resumeBtn {
  display: block;
  width: 100%;
  min-height: 56px;
  margin-top: 8px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ff6fa4, #ff3d78);
  color: #1a0a12;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 28px;
  letter-spacing: 0.05em;
}
#resumeBtn:active { transform: scale(0.99); }

#overlay.splash {
  align-items: stretch;
  padding: 0;
  background: rgba(4, 5, 10, 0.94);
}
#overlay.splash .panel {
  --splash: none;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 100%;
  max-height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding: calc(22px + env(safe-area-inset-top)) 18px calc(16px + env(safe-area-inset-bottom));
  color: var(--text);
  background-color: #07080d;
  background-image:
    linear-gradient(180deg, rgba(7, 8, 13, 0) 0, rgba(7, 8, 13, 0) 30vh, rgba(7, 8, 13, 0.72) 46vh, rgba(7, 8, 13, 0.94) 60vh, #07080d 74vh),
    var(--splash);
  background-size: 100% 100%, cover;
  background-position: center top, center top;
  background-repeat: no-repeat, no-repeat;
  background-attachment: local, scroll;
}
#overlay.splash .panel::before {
  content: "";
  flex: 1 0 30vh;
  min-height: 30vh;
}
#overlay.splash[data-art="yard"] .panel { --splash: url("../assets/splash-yard.jpg"); }
#overlay.splash[data-art="marsh"] .panel { --splash: url("../assets/splash-marsh.jpg"); }
#overlay.splash[data-art="chapel"] .panel { --splash: url("../assets/splash-chapel.jpg"); }
#overlay.splash[data-art="boss"] .panel { --splash: url("../assets/splash-boss.jpg"); }
#overlay.splash #ovActions {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding-top: 12px;
  background: linear-gradient(180deg, rgba(12, 14, 20, 0), #0c0e14 14px);
}
#overlay.splash #ovBtn { margin-top: 8px; }
#ovBtn:disabled {
  background: #2a3142;
  color: #8b93a7;
}
.debut {
  border: 1px solid #3a3350;
  background: #161222;
  border-radius: 14px;
  padding: 10px 12px;
  margin-top: 8px;
}
.debut b {
  display: block;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 22px;
  letter-spacing: 0.03em;
  color: var(--gold);
}
.debut span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.3;
  margin-top: 2px;
}
#ovPerk { color: var(--text); font-weight: 700; }
#ovHint { font-size: 13px; }
#ovSummary {
  display: flex;
  gap: 8px;
  margin: 4px 0 8px;
}
#ovSummary[hidden], #ovDebut[hidden], #ovPerk[hidden], #ovHint[hidden] { display: none !important; }
.sum {
  flex: 1;
  min-width: 0;
  background: #10131b;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 4px;
  text-align: center;
}
.sum b {
  display: block;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 22px;
  letter-spacing: 0.02em;
}
.sum span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.choice.picked { border-color: var(--gold); }
.choice:disabled { opacity: 0.5; }
.choice.picked:disabled { opacity: 1; }

@media (max-width: 380px) {
  .pill b { font-size: 12px; }
  .pill small { font-size: 7px; letter-spacing: 0.02em; }
  .stats { gap: 3px; }
  #topbar { padding-left: 4px; padding-right: 4px; gap: 3px; }
  .tb { flex-basis: 30px; width: 30px; }
  #shopBtn { min-width: 52px; padding: 0 6px; font-size: 15px; }
  #shopBtn .ico { display: none; }
  #next { flex-basis: 52px; width: 52px; font-size: 12px; }
  #roster { gap: 5px; }
  .hire .meta b { font-size: 13px; }
  .up { gap: 6px; padding: 6px; }
  .up .mark { width: 32px; height: 32px; }
  .wal { min-width: 50px; padding: 3px 5px 4px; }
}

@media (prefers-reduced-motion: reduce) {
  #toast { transition: none; }
}
.up[data-id="spikes"] .mark { background-size: 240%; background-position: 50% 52%; }
.up[data-id="mend"] .mark { background-size: 140%; }
.up[data-id="ammo"] .mark { background-size: 125%; }
.up[data-id="squad"] .mark { background-size: 150%; }

/* ---------- Ability strip: under the field, never on it ---------- */
#abilBar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: calc(46px + env(safe-area-inset-bottom));
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
  background: #07080d;
  border-top: 1px solid #1c2130;
}
#abilBar[hidden] { display: none; }
#abilRow { display: flex; gap: 6px; flex: 0 0 auto; }
.abil {
  --ac: #ffc857;
  --p: 0;
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  border: 2px solid #2c3348;
  background: #12151e;
  overflow: hidden;
  touch-action: none;
  transition: border-color 0.15s, opacity 0.15s;
}
.abil img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 12%;
  pointer-events: none;
}
.abil .cd {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: conic-gradient(rgba(4, 5, 10, 0.78) calc(var(--p) * 1turn), transparent 0);
}
.abil .k {
  position: absolute;
  right: 2px;
  bottom: 0;
  font-size: 9px;
  font-weight: 800;
  color: #f4f1ea;
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}
.abil.ready {
  border-color: var(--ac);
  animation: abilGlow 1.3s ease-in-out infinite;
}
.abil.idle { opacity: 0.5; }
.abil:disabled { cursor: default; }
.abil.fired { animation: abilPop 0.32s ease-out; }
@keyframes abilGlow {
  0%, 100% { box-shadow: 0 0 0 0 var(--ac); }
  50% { box-shadow: 0 0 10px 1px var(--ac); }
}
@keyframes abilPop {
  0% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
#twistTags {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  overflow: hidden;
  max-height: 38px;
}
.twTag {
  --tw: #ffc857;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--tw);
  border: 1px solid var(--tw);
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.03);
}
@media (max-width: 380px) {
  .abil { width: 36px; height: 36px; }
  #abilRow { gap: 4px; }
  #abilBar { gap: 6px; padding-left: 6px; padding-right: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .abil.ready, .abil.fired { animation: none; }
  .abil.ready { box-shadow: 0 0 6px var(--ac); }
}

/* ---------- Twist block on the brief ---------- */
#ovTwist[hidden] { display: none; }
.twist {
  --tw: #ffc857;
  border: 1px solid var(--tw);
  background: #17121a;
  border-radius: 14px;
  padding: 9px 12px;
  margin-top: 8px;
}
.twist em {
  display: block;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.twist b {
  display: block;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 22px;
  letter-spacing: 0.03em;
  color: var(--tw);
}
.twist span { display: block; color: var(--text); font-size: 14px; line-height: 1.3; }
.twist i { display: block; font-style: normal; color: var(--gold); font-size: 12px; margin-top: 3px; }

/* ---------- Boss reward cards ---------- */
.choice.card { border-width: 2px; position: relative; }
.choice.card .rar {
  display: block;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.choice.card.r-common { border-color: #8c96aa; }
.choice.card.r-common .rar { color: #b4bccc; }
.choice.card.r-rare { border-color: #4aa8ff; }
.choice.card.r-rare .rar { color: #7cc0ff; }
.choice.card.r-epic { border-color: #c06bff; box-shadow: 0 0 14px rgba(192, 107, 255, 0.35); }
.choice.card.r-epic .rar { color: #d9a6ff; }
.choice.card.picked { box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(255, 200, 87, 0.35); }

/* ---------- Shop: build row and twist line ---------- */
#buildRow { display: flex; flex-wrap: wrap; gap: 6px; }
.buildEmpty { color: var(--muted); font-size: 13px; }
.buildChip {
  flex: 1 1 140px;
  border: 1px solid #8c96aa;
  border-radius: 10px;
  background: var(--panel-2);
  padding: 6px 9px;
}
.buildChip b { display: block; font-size: 13px; }
.buildChip small { display: block; color: var(--muted); font-size: 11px; line-height: 1.25; }
.buildChip.r-rare { border-color: #4aa8ff; }
.buildChip.r-rare b { color: #9ccfff; }
.buildChip.r-epic { border-color: #c06bff; }
.buildChip.r-epic b { color: #ddb0ff; }
#twistLine { color: var(--gold); font-size: 13px; margin: 4px 0 0; }
#twistLine[hidden] { display: none; }

/* ---------- Heroine cards ---------- */
@keyframes dueGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 227, 106, 0.9); }
  50% { box-shadow: 0 0 10px 3px rgba(255, 227, 106, 0.85); }
}
.hire[data-frame="bronze"] .face { box-shadow: 0 0 0 2px #c98a52, 0 0 8px rgba(201, 138, 82, 0.55); }
.hire[data-frame="silver"] .face { box-shadow: 0 0 0 2px #dfe5ef, 0 0 8px rgba(223, 229, 239, 0.5); }
.hire[data-frame="gold"] .face { box-shadow: 0 0 0 2px #ffcf5a, 0 0 10px rgba(255, 207, 90, 0.65); }
.hire[data-frame="holo"] .face { box-shadow: 0 0 0 2px #ff7ac0, 0 0 0 4px #6ac8ff, 0 0 12px rgba(196, 155, 255, 0.7); }
.shopSec .hint { margin-left: auto; color: #ffe36a; font-weight: 700; letter-spacing: 0.02em; }
.abil.due { border-color: #ffe36a; }
.abil.due::after {
  content: "\2605";
  position: absolute;
  left: 2px;
  top: -1px;
  font-size: 12px;
  line-height: 1;
  color: #ffe36a;
  text-shadow: 0 0 4px #000, 0 0 6px #ffb800;
  pointer-events: none;
}
.abil { -webkit-touch-callout: none; }

#heroCard {
  --ac: #ffc857;
  --frameBg: linear-gradient(160deg, var(--ac), #2a2f40 42%, #1b1f2c 58%, var(--ac));
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 8px calc(8px + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 38%, rgba(34, 26, 54, 0.9), rgba(4, 5, 10, 0.96) 70%);
  touch-action: none;
}
#heroCard.hidden { display: none; }
#heroCard[data-frame="bronze"] { --frameBg: linear-gradient(160deg, #f6c08a, #7a4520 38%, #d8955a 58%, #5a3012); }
#heroCard[data-frame="silver"] { --frameBg: linear-gradient(160deg, #ffffff, #8a94a6 38%, #e8edf5 58%, #66707f); }
#heroCard[data-frame="gold"] { --frameBg: linear-gradient(160deg, #fff4bf, #b8860b 38%, #ffd75a 58%, #7f5a06); }
#heroCard[data-frame="holo"] { --frameBg: linear-gradient(120deg, #ff5ea8, #ffd36a, #7dffb3, #6ac8ff, #c49bff, #ff5ea8, #ffd36a); }
.hcStage {
  position: relative;
  width: min(384px, 94vw);
  /* Fit above the button bar on every phone, including PWA fullscreen with notch/gesture-bar insets. */
  height: min(calc(100vh - 86px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), 640px);
  height: min(calc(100dvh - 86px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), 640px);
  min-height: 0;
  perspective: 1100px;
  flex: 0 0 auto;
}
.hcTilt {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hcTilt.live { transition: transform 0.07s linear; }
#heroCard.opening .hcTilt { animation: hcIn 0.42s cubic-bezier(0.2, 0.9, 0.25, 1.15); }
@keyframes hcIn {
  from { transform: translateY(40px) rotateX(18deg) scale(0.86); opacity: 0; }
  to { transform: translateY(0) rotateX(0) scale(1); opacity: 1; }
}
.hcFlip {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.62s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.hcFlip.flipped { transform: rotateY(180deg); }
.hcFace {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 20px;
  padding: 5px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--frameBg);
  background-size: 300% 300%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7), 0 24px 60px rgba(0, 0, 0, 0.65), 0 0 40px color-mix(in srgb, var(--ac) 25%, transparent);
}
#heroCard[data-frame="holo"] .hcFace { animation: holoShift 5s linear infinite; }
@keyframes holoShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}
.hcBack { transform: rotateY(180deg); }
/* The face turned away is hidden outright (swapped at the flip's midpoint). backface-visibility alone
   still lets the turned-away face catch touch scrolling in Chrome, which froze the front body. */
.hcFront, .hcBack { transition: visibility 0s linear 0.3s; }
.hcBack { visibility: hidden; }
.hcFlip.flipped .hcBack { visibility: visible; }
.hcFlip.flipped .hcFront { visibility: hidden; }
.hcArt {
  position: relative;
  flex: 0 0 47%;
  min-height: 0;
  overflow: hidden;
  border-radius: 15px 15px 5px 5px;
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--ac) 38%, #1a1d29), #0a0b10 78%);
  touch-action: none;
  cursor: pointer;
}
.hcArt img {
  position: absolute;
  left: var(--al, -20%);
  top: var(--at, -3%);
  width: var(--aw, 140%);
  height: auto;
  max-width: none;
  transform: translate(calc(var(--px, 0) * -10px), calc(var(--py, 0) * -7px)) scale(1.03);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}
.hcTilt.live .hcArt img { transition: transform 0.07s linear; }
#heroCard[data-kind="sable"] .hcArt img { --aw: 78%; --al: 11%; --at: 2%; }
#heroCard[data-kind="wren"] .hcArt img { --aw: 66%; --al: 17%; --at: 2%; }
#heroCard[data-kind="nyx"] .hcArt img { --aw: 132%; --al: -16%; --at: -2%; }
.hcFoil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at var(--mx, 50%) var(--my, 30%), rgba(255, 255, 255, 0.32), transparent 42%),
    linear-gradient(115deg, transparent 18%, rgba(255, 94, 168, 0.22) 34%, rgba(106, 200, 255, 0.22) 50%, rgba(125, 255, 179, 0.2) 64%, transparent 82%);
  background-size: 100% 100%, 260% 260%;
  background-position: 0 0, var(--fx, 50%) var(--fy, 50%);
  mix-blend-mode: color-dodge;
  opacity: 0.5;
}
#heroCard[data-frame="standard"] .hcFoil { opacity: 0.28; }
#heroCard[data-frame="holo"] .hcFoil { opacity: 0.85; }
.hcShine {
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: -60%;
  width: 60%;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.42) 50%, rgba(255, 255, 255, 0) 70%, transparent 100%);
  transform: skewX(-12deg);
  animation: hcSweep 3.4s ease-in-out infinite;
  mix-blend-mode: screen;
}
@keyframes hcSweep {
  0% { left: -70%; }
  55%, 100% { left: 130%; }
}
.hcRar {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(8, 9, 14, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #f4f1ea;
}
#heroCard[data-frame="bronze"] .hcRar { color: #f6c08a; border-color: #c98a52; }
#heroCard[data-frame="silver"] .hcRar { color: #eef2f8; border-color: #cfd6e2; }
#heroCard[data-frame="gold"] .hcRar { color: #ffd75a; border-color: #ffcf5a; }
#heroCard[data-frame="holo"] .hcRar { color: #ffb6dc; border-color: #c49bff; }
.hcLv {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, #2b3044, #0b0d14);
  border: 2px solid var(--ac);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.hcLv b { font-family: "Passion One", Impact, sans-serif; font-size: 24px; line-height: 0.9; color: #fff; }
.hcLv small { font-size: 8px; font-weight: 800; letter-spacing: 0.16em; color: var(--ac); }
.hcLv.due { border-color: #ffe36a; animation: dueGlow 1.1s ease-in-out infinite; }
.hcPlate {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 26px 12px 8px;
  background: linear-gradient(180deg, transparent, rgba(6, 7, 11, 0.86) 55%);
}
.hcPlate h2 {
  margin: 0;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 32px;
  line-height: 0.9;
  letter-spacing: 0.03em;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}
.hcPlate p {
  margin: 2px 0 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ac);
}
.hcBody, .hcIn {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 5px 5px 15px 15px;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--ac) 12%, transparent), transparent 55%),
    #11131b;
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
}
.hcBody {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 9px 11px 28px;
}
.hcIn {
  border-radius: 15px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding-bottom: 22px;
  cursor: pointer;
}
.hcIn > * { position: relative; flex-shrink: 0; }
.hcGhost {
  position: absolute !important;
  right: -18%;
  bottom: -6%;
  height: 92%;
  opacity: 0.1;
  filter: grayscale(1) contrast(1.2);
  pointer-events: none;
}
.hcRole { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.hcChip {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.hcChip.ac { color: var(--ac); border-color: var(--ac); }
.hcChip.ok { color: var(--green); border-color: #2f6a4b; }
.hcBio { margin: 0 0 8px; color: #d9d4ca; font-style: italic; font-size: 13px; }
.hcStats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: 6px 0; }
.hcStat {
  background: #0b0d13;
  border: 1px solid #232838;
  border-radius: 8px;
  padding: 5px 2px 4px;
  text-align: center;
}
.hcStat b { display: block; font-family: "Passion One", Impact, sans-serif; font-size: 19px; line-height: 1; color: #fff; }
.hcStat small { display: block; font-size: 9px; font-weight: 800; letter-spacing: 0.1em; color: var(--muted); margin-top: 2px; }
.hcXp { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; color: var(--muted); margin: 2px 0 4px; }
.hcBar { flex: 1; height: 6px; border-radius: 999px; background: #22283a; overflow: hidden; }
.hcBar i { display: block; height: 100%; width: var(--w, 0%); background: linear-gradient(90deg, var(--ac), #fff3c4); border-radius: inherit; }
.hcSec {
  margin: 10px 0 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--pink);
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.hcSec small { color: var(--muted); letter-spacing: 0.04em; font-weight: 700; }
.hcBox {
  border: 1px solid #262c3e;
  background: #0d0f16;
  border-radius: 10px;
  padding: 7px 9px;
  margin-top: 4px;
}
.hcBox b { color: #fff; }
.hcBox .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.hcBox.on { border-color: color-mix(in srgb, var(--ac) 70%, #262c3e); }
.hcBox.off { opacity: 0.55; }
.hcBox.syn.on { border-color: #c49bff; box-shadow: inset 0 0 12px rgba(196, 155, 255, 0.15); }
.hcBox .right { float: right; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; color: var(--gold); }
.hcBox.r-rare { border-color: #4aa8ff; }
.hcBox.r-epic { border-color: #c06bff; }
.hcPick {
  border: 2px solid #ffe36a;
  border-radius: 12px;
  padding: 8px;
  margin: 2px 0 8px;
  background: linear-gradient(180deg, rgba(255, 227, 106, 0.1), rgba(255, 227, 106, 0.02));
  animation: dueGlow 1.4s ease-in-out infinite;
}
.hcPick > p { margin: 0 0 6px; font-weight: 800; color: #ffe36a; font-size: 12px; letter-spacing: 0.06em; }
.hcPickRow { display: flex; gap: 6px; }
.traitBtn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 74px;
  border-radius: 10px;
  border: 1px solid #4b4220;
  background: #1a1810;
  color: var(--text);
  text-align: left;
  padding: 7px 8px;
}
.traitBtn b { display: block; font-family: "Passion One", Impact, sans-serif; font-size: 18px; letter-spacing: 0.03em; color: #ffe36a; line-height: 1; }
.traitBtn span { display: block; font-size: 11.5px; color: #d6d0c2; margin-top: 3px; line-height: 1.25; }
/* No press-scale inside the 3D card: a transform on :active knocks the button out of the tap's hit test. */
.hcFace button:active { transform: none !important; filter: brightness(1.25); }
.hcPick.done { border-color: var(--ac); animation: none; background: color-mix(in srgb, var(--ac) 12%, transparent); }
.hcPick.done > p { color: var(--ac); font-size: 13px; margin-bottom: 3px; }
.hcPick.done .sub { display: block; font-size: 12px; color: #d6d0c2; }
.hcPick.done .next { color: var(--muted); margin-top: 3px; }
#hcToast {
  position: absolute;
  left: 50%;
  top: calc(14px + env(safe-area-inset-top));
  transform: translate(-50%, -10px);
  z-index: 3;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.94);
  border: 1px solid var(--ac);
  color: var(--ac);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
#hcToast.show { opacity: 1; transform: translate(-50%, 0); }
.hcTrait { display: flex; gap: 8px; align-items: center; }
.hcTrait .tier {
  flex: 0 0 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  border: 1px solid #2c3348;
}
.hcTrait.got .tier { color: #1a1406; background: var(--ac); border-color: var(--ac); }
.hcTrait.wait .tier { color: #1a1406; background: #ffe36a; border-color: #ffe36a; }
.hcTrait > div { min-width: 0; }
.hcActions {
  width: min(384px, 94vw);
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}
.hcActions button {
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #161a25;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.12em;
}
#hcPrev, #hcNext { flex: 0 0 48px; font-size: 26px; line-height: 1; letter-spacing: 0; }
#hcFlipBtn { flex: 1 1 0; color: var(--ac); border-color: var(--ac); }
#hcClose { flex: 1 1 0; background: linear-gradient(180deg, #ffd77a, #f2b23a); color: #1d1406; border: 0; font-family: "Passion One", Impact, sans-serif; font-size: 20px; letter-spacing: 0.06em; }
.hcActions button:active { transform: scale(0.97); }
.hcBig { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.hcBig div { background: rgba(8, 9, 14, 0.75); border: 1px solid #262c3e; border-radius: 12px; padding: 8px 4px; text-align: center; }
.hcBig b { display: block; font-family: "Passion One", Impact, sans-serif; font-size: 28px; line-height: 1; color: #fff; }
.hcBig small { display: block; font-size: 9px; font-weight: 800; letter-spacing: 0.12em; color: var(--muted); margin-top: 3px; }
.hcBond { display: flex; gap: 12px; align-items: center; }
.hcBond .medal {
  flex: 0 0 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--frameBg);
  background-size: 300% 300%;
  box-shadow: 0 0 0 3px #0b0d13, 0 0 18px color-mix(in srgb, var(--ac) 40%, transparent);
}
.hcBond .medal b { font-family: "Passion One", Impact, sans-serif; font-size: 34px; line-height: 0.9; color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8); }
.hcBond .medal small { font-size: 8px; font-weight: 800; letter-spacing: 0.16em; color: #fff; text-shadow: 0 1px 3px #000; }
.hcBond > div:last-child { flex: 1; min-width: 0; }
.hcBond .sub { display: block; }
.hcFrames { display: flex; gap: 4px; flex-wrap: wrap; }
.hcFrames span {
  flex: 1 1 0;
  text-align: center;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 5px 2px;
  border-radius: 8px;
  border: 1px solid #2c3348;
  color: #6c7387;
}
.hcFrames span.on { color: #fff; border-color: var(--fc); box-shadow: inset 0 0 10px color-mix(in srgb, var(--fc) 35%, transparent); }
.hcQuote { margin: auto 0 0; color: #b9b2a4; font-style: italic; font-size: 13px; }
.hcTapHint { font-size: 10px; letter-spacing: 0.14em; font-weight: 800; color: #6c7387; text-align: center; }
@media (max-height: 760px) {
  .hcArt { flex-basis: 40%; }
  .hcPlate h2 { font-size: 26px; }
}
@media (max-height: 660px) {
  .hcArt { flex-basis: 33%; }
  .hcPlate h2 { font-size: 22px; }
  #heroCard { gap: 6px; }
  .hcActions button { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .hcShine, #heroCard[data-frame="holo"] .hcFace, .hcPick, .hire.due .iBadge, .hcLv.due { animation: none; }
  .hcFlip { transition-duration: 0.01s; }
  .hcFront, .hcBack { transition-delay: 0s; }
  #heroCard.opening .hcTilt { animation: none; }
}

/* ---------- Callouts: medals, synergies, level ups ---------- */
#callout {
  position: absolute;
  left: 50%;
  top: 52px;
  z-index: 8;
  transform: translateX(-50%) scale(0.92);
  max-width: calc(100% - 28px);
  min-width: 210px;
  padding: 7px 14px 8px;
  border-radius: 14px;
  background: rgba(14, 12, 22, 0.92);
  border: 1px solid #ffe36a;
  color: var(--text);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
#callout.show { opacity: 1; transform: translateX(-50%) scale(1); }
#callout em { display: block; font-style: normal; font-size: 9.5px; font-weight: 800; letter-spacing: 0.2em; color: #ffe36a; }
#callout b { display: block; font-family: "Passion One", Impact, sans-serif; font-size: 21px; letter-spacing: 0.04em; line-height: 1.05; }
#callout span { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.25; }
#callout.syn { border-color: #c49bff; box-shadow: 0 0 22px rgba(196, 155, 255, 0.35); }
#callout.syn em { color: #d9c2ff; }
#callout.medal { border-color: #ffcf5a; box-shadow: 0 0 22px rgba(255, 207, 90, 0.35); }
#callout.lv { border-color: #7dffb3; }
#callout.lv em { color: #7dffb3; }
#callout.bond { border-color: #ff8ad0; }
#callout.bond em { color: #ff8ad0; }

/* ---------- Synergies in the BUILD row ---------- */
.buildChip.syn { border-color: #c49bff; background: linear-gradient(180deg, #1d1630, #171a26); }
.buildChip.syn b { color: #dcc6ff; }
.buildChip.syn b::before { content: "\2726  "; color: #c49bff; }

/* ---------- Medals ---------- */
.medalRow {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 12px;
  padding: 8px 10px;
  margin-top: 6px;
}
.medalRow .mIco {
  flex: 0 0 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 18px;
  color: #6c7387;
  border: 2px dashed #39405a;
}
.medalRow.got .mIco {
  color: #2a1a02;
  border: 0;
  background: radial-gradient(circle at 35% 30%, #fff4bf, #ffcf5a 45%, #b8860b);
  box-shadow: 0 0 12px rgba(255, 207, 90, 0.45);
}
.medalRow > div { flex: 1; min-width: 0; }
.medalRow b { display: block; font-size: 14px; }
.medalRow span { display: block; color: var(--muted); font-size: 12px; line-height: 1.25; }
.medalRow .mAsh { flex: 0 0 auto; font-size: 12px; font-weight: 800; color: #d7c4b0; }
.medalRow.got .mAsh { color: var(--green); }
.endlessLine { margin: -8px 0 12px; color: #ff8ad0; font-weight: 800; letter-spacing: 0.03em; font-size: 14px; }
.endlessLine[hidden] { display: none !important; }
#ovEndless {
  display: block;
  width: 100%;
  min-height: 56px;
  margin-top: 8px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffe58a, #f2b23a);
  color: #1d1406;
  font-family: "Passion One", Impact, sans-serif;
  font-size: 24px;
  letter-spacing: 0.06em;
}
#ovEndless small { display: block; font-family: "Segoe UI", Roboto, Arial, sans-serif; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
#ovEndless[hidden] { display: none; }
@media (max-width: 380px) {
  .shopMore { grid-template-columns: 1fr 1fr 1fr; }
  #skillsBtn b, #labBtn b, #medalsBtn b { font-size: 17px; }
  .hcStat b { font-size: 16px; }
}

/* =====================================================================
   Roguelike layer: shop stock, card picks, curses, map, relics, loadouts
   ===================================================================== */

/* ---- Stock header and reroll ---- */
.shopSec.stockHead { align-items: center; flex-wrap: wrap; row-gap: 4px; }
#stockInfo { flex: 1 1 auto; min-width: 0; }
#rerollBtn {
  margin-left: auto;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid #6ac8ff;
  background: linear-gradient(180deg, #1c2a3d, #152031);
  color: #bfe5ff;
}
#rerollBtn b { font-family: "Passion One", Impact, sans-serif; font-size: 18px; letter-spacing: 0.05em; color: inherit; }
#rerollBtn:active:not(:disabled) { transform: scale(0.97); }
#rerollBtn:disabled { opacity: 0.45; }
.stockNote { margin: -2px 0 6px; color: var(--muted); font-size: 11.5px; }
.stockSub {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 8px 0 5px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--text);
}
.stockSub small { color: var(--muted); letter-spacing: 0.06em; font-size: 11px; font-weight: 700; }
.stockSub .hint { margin-left: auto; color: #ffe36a; letter-spacing: 0.02em; }
.stockEmpty { grid-column: 1 / -1; margin: 2px 0; padding: 10px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 12.5px; text-align: center; }

/* Offer tiles share a lock strip along the bottom. */
.offer { transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.offer.held { border-color: #6ac8ff; box-shadow: 0 0 0 1px #6ac8ff inset, 0 0 12px rgba(106, 200, 255, 0.25); }
.offer.kept::after {
  content: "KEPT";
  position: absolute;
  left: 6px;
  top: 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #6ac8ff;
  pointer-events: none;
}
.offer.sold { opacity: 0.45; }
.offer.sold .hireBuy, .offer.sold .upBuy { pointer-events: none; }
.offer.sold .price, .offer.sold .lv { color: var(--green) !important; }
.lockBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  min-height: 32px;
  margin: 0;
  padding: 0 6px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 11px 11px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.lockBtn[hidden] { display: none; }
.lockBtn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.lockBtn svg .shackle { transform-origin: 16px 11px; transition: transform 0.15s ease; transform: translateY(-1.5px) rotate(28deg); }
.lockBtn[aria-pressed="true"] { background: rgba(106, 200, 255, 0.16); color: #bfe5ff; }
.lockBtn[aria-pressed="true"] svg .shackle { transform: none; }
.lockBtn:active { background: rgba(106, 200, 255, 0.24); }

#roster { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hire.offer { min-height: 0; }
.hire.offer .hireBuy { min-height: 50px; border-radius: 0; }

#baseShop { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.up.offer {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  min-height: 0;
  text-align: center;
}
.up.offer:active { transform: none; }
.up.offer.broke { opacity: 1; }
.up.offer.broke .upBuy { opacity: 0.62; }
.upBuy {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  min-height: 98px;
  padding: 8px 5px 6px;
  background: none;
  border: 0;
  color: inherit;
  text-align: center;
}
.upBuy:active { transform: scale(0.97); }
.up.offer .meta { align-items: center; }
.up.offer .meta b { font-size: 13px; }
.up.offer .lv { font-size: 11.5px; }

#ownedRow { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 2px; }
.ownChip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #121620;
  font-size: 11px;
}
.ownChip .mark {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #141820;
  background-size: 170%;
  background-position: center;
}
.ownChip[data-id="wall"] .mark { background-image: url("../assets/upgrade-wall.png"); }
.ownChip[data-id="aura"] .mark { background-image: url("../assets/upgrade-aura.png"); }
.ownChip[data-id="turret"] .mark { background-image: url("../assets/upgrade-turret.png"); }
.ownChip[data-id="spikes"] .mark { background-image: url("../assets/upgrade-spikes.png"); }
.ownChip[data-id="mend"] .mark { background-image: url("../assets/upgrade-mend.png"); }
.ownChip[data-id="mines"] .mark { background-image: url("../assets/upgrade-mines.png"); }
.ownChip[data-id="ammo"] .mark { background-image: url("../assets/upgrade-ammo.png"); }
.ownChip[data-id="squad"] .mark { background-image: url("../assets/upgrade-squad.png"); }
.ownChip b { font-size: 11px; }
.ownChip small { color: var(--gold); font-weight: 800; }
.ownChip.max small { color: var(--green); }

@media (min-width: 560px) {
  #roster { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #baseShop { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
  .up.offer { min-height: 0; }
}

/* ---- Card picks, tags, curses ---- */
.tagRow { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.tagPill, .stackPill, .setPill {
  display: inline-block;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
}
.tagPill { color: var(--tc); border: 1px solid var(--tc); background: color-mix(in srgb, var(--tc) 14%, transparent); }
.stackPill { color: #d5dae6; border: 1px solid #4a5268; background: #1d2230; }
.setPill { color: #1a1406; background: linear-gradient(180deg, #ffe58a, #ffc857); }
.choice.card .down { color: #ff8aa8; font-weight: 700; }
.choice.card.cursed {
  border-color: #b0306a;
  background: linear-gradient(160deg, #2a0f2a 0%, #1d0d1e 55%, #2a0d14 100%);
  box-shadow: 0 0 0 1px rgba(255, 74, 120, 0.25) inset, 0 0 18px rgba(170, 40, 120, 0.4);
}
.choice.card.cursed .rar { color: #ff6a8a; letter-spacing: 0.22em; }
.choice.card.cursed b { color: #ffc2dc; }
.choice.card.cursed::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(255, 60, 120, 0.06) 0 6px, transparent 6px 14px);
}
.choice.skip {
  min-height: 48px;
  border-style: dashed;
  background: transparent;
  text-align: center;
}
.choice.skip b { font-size: 17px; color: var(--muted); }
.choice.skip span { display: inline; margin-left: 6px; color: var(--gold); }
.choice:disabled:not(.picked) { opacity: 0.4; }
.choice.picked { box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(255, 200, 87, 0.35); }

/* ---- Relics ---- */
.relic {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 2px solid var(--rc);
  background: linear-gradient(160deg, color-mix(in srgb, var(--rc) 30%, #10131b), #10131b 70%);
  color: var(--rc);
  font-family: "Passion One", Impact, sans-serif;
  font-size: 16px;
  letter-spacing: 0.02em;
  line-height: 1;
  box-shadow: 0 0 10px color-mix(in srgb, var(--rc) 30%, transparent);
  transform: rotate(-3deg);
  padding: 0;
}
button.relic:active { transform: rotate(-3deg) scale(0.94); }
.choice.relicOpt {
  display: flex;
  align-items: center;
  gap: 12px;
  border-color: var(--rc);
}
.choice.relicOpt .relic { width: 48px; height: 48px; font-size: 22px; }
.relicTxt { min-width: 0; }
.relicTxt b { color: var(--rc); }
.relicTxt span { color: var(--text) !important; opacity: 0.85; }

/* ---- Map ---- */
#ovMap[hidden] { display: none; }
#ovMap { margin: 2px 0 4px; }
.mapGrid {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  border-radius: 14px;
  background: radial-gradient(ellipse at 50% 100%, rgba(255, 200, 87, 0.06), transparent 70%), rgba(10, 12, 18, 0.72);
  border: 1px solid var(--line);
}
.mapLines { position: absolute; inset: 0; width: 100%; height: 100%; }
.mapLines line { stroke-width: 2; stroke-linecap: round; }
.mapLines line.go { stroke: #ffc857; stroke-dasharray: 5 5; animation: mapDash 0.9s linear infinite; }
.mapLines line.on { stroke: rgba(200, 204, 216, 0.45); }
.mapLines line.off { stroke: rgba(200, 204, 216, 0.12); }
@keyframes mapDash { to { stroke-dashoffset: -10; } }
.mapStage {
  position: absolute;
  left: 4px;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #6c7389;
}
.mapNode {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 16px;
  border: 2px solid color-mix(in srgb, var(--nc) 45%, #2c3348);
  background: #121620;
  color: color-mix(in srgb, var(--nc) 60%, #6c7389);
  opacity: 0.55;
}
.mapNode svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mapNode small { font-size: 8.5px; font-weight: 800; letter-spacing: 0.08em; }
.mapNode.reach { opacity: 0.9; color: var(--nc); }
.mapNode.big { width: 66px; height: 62px; }
.mapNode.here { opacity: 1; border-color: #f4f1ea; color: #f4f1ea; background: #1d2230; }
.mapNode.pick {
  opacity: 1;
  color: var(--nc);
  border-color: var(--nc);
  background: color-mix(in srgb, var(--nc) 16%, #121620);
  box-shadow: 0 0 14px color-mix(in srgb, var(--nc) 45%, transparent);
  animation: nodePulse 1.3s ease-in-out infinite;
  cursor: pointer;
}
.mapNode.pick:active { transform: translate(-50%, -50%) scale(0.94); }
.mapNode.chosen { opacity: 1; color: var(--nc); border-color: #ffc857; box-shadow: 0 0 0 3px #ffc857, 0 0 20px rgba(255, 200, 87, 0.55); animation: none; }
.mapNode.passed { opacity: 0.25; animation: none; }
@keyframes nodePulse { 50% { box-shadow: 0 0 22px color-mix(in srgb, var(--nc) 70%, transparent); } }
.choice.nodeOpt {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  border-color: color-mix(in srgb, var(--nc) 55%, #2c3348);
}
.nGlyph {
  flex: none;
  display: grid !important;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: 0 !important;
  border-radius: 12px;
  border: 2px solid var(--nc);
  color: var(--nc) !important;
}
.nGlyph svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nTxt { min-width: 0; margin: 0 !important; }
.nTxt b { color: var(--nc); }
.nTxt span { font-size: 12.5px; }
.choice.myst { border-color: #6b4fa0; }
.choice.myst b { color: #dcc6ff; }
#overlay.splash[data-step="map"] .panel::before { flex-basis: 6vh; min-height: 6vh; }
#overlay.splash[data-step="cards"] .panel::before,
#overlay.splash[data-step="relic"] .panel::before,
#overlay.splash[data-step="mystery"] .panel::before { flex-basis: 16vh; min-height: 16vh; }
#overlay[data-step="map"] .choice.nodeOpt { margin-top: 6px; }
.tag.node { display: inline-block; background: #22283a; color: #d5dae6; }
.tag.node.t-elite { background: #3a1418; color: #ff9a9a; }
.tag.node.t-shop { background: #3a2a12; color: var(--gold); }
.tag.node.t-rest { background: #12301f; color: var(--green); }
.tag.node.t-mystery { background: #251a3a; color: #dcc6ff; }
.tag.node.t-treasure { background: #3a3212; color: #ffe066; }

/* ---- BUILD row: sets, relics, cards ---- */
#buildRow { display: block; }
.buildLbl { margin: 6px 0 4px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.16em; color: var(--muted); }
.buildLbl:first-child { margin-top: 0; }
.setRow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.setChip {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  row-gap: 3px;
  min-height: 40px;
  padding: 5px 7px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--tc) 45%, #2c3348);
  background: #121620;
  color: var(--text);
  text-align: left;
}
.setChip b { font-size: 12px; color: var(--tc); }
.setChip em { font-style: normal; font-size: 12px; font-weight: 800; color: var(--text); }
.setChip .pips { grid-column: 1 / -1; display: flex; gap: 2px; }
.setChip .pips i { flex: 1; height: 4px; border-radius: 2px; background: #2a3042; }
.setChip .pips i.mk { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25); }
.setChip .pips i.f { background: var(--tc); }
.setChip.none { opacity: 0.5; }
.setChip.on { background: color-mix(in srgb, var(--tc) 14%, #121620); box-shadow: 0 0 10px color-mix(in srgb, var(--tc) 30%, transparent); }
.setChip.max { border-color: var(--tc); }
.relicRow { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; min-height: 36px; }
.chipRow { display: flex; flex-wrap: wrap; gap: 5px; }
.chipRow .buildChip { flex: 1 1 140px; }
.cardChip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid #8c96aa;
  background: #171b26;
  color: var(--text);
  font-size: 11.5px;
}
.cardChip b { font-size: 11.5px; font-weight: 700; }
.cardChip em { font-style: normal; font-weight: 800; color: var(--gold); font-size: 11px; }
.cardChip .dot { width: 7px; height: 7px; border-radius: 50%; }
.cardChip.r-rare { border-color: #4aa8ff; }
.cardChip.r-epic { border-color: #c06bff; }
.cardChip.cursed { border-color: #ff4a78; background: #2a0f1e; color: #ffc2dc; }
.cardChip.more { border-style: dashed; color: var(--muted); }
.buildDetail {
  margin-top: 7px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #10131b;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  min-height: 34px;
}
.buildDetail b { display: block; font-size: 13px; color: var(--text); margin-bottom: 2px; }
.buildDetail span { line-height: 1.3; }
#callout.set { border-color: #ffc857; box-shadow: 0 0 22px rgba(255, 200, 87, 0.35); }
#callout.set em { color: #ffc857; }
#callout.relic { border-color: #ff9a3c; box-shadow: 0 0 22px rgba(255, 154, 60, 0.35); }
#callout.relic em { color: #ffb36a; }
.hcBox.cursed { border-color: #ff4a78; }

/* ---- Loadouts ---- */
#loadoutBtn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  margin: 0 0 10px;
  padding: 6px 12px 6px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(12, 14, 20, 0.78);
  color: var(--text);
  text-align: left;
}
#loadoutBtn:active { transform: scale(0.99); }
.loLbl { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.loLbl small { font-size: 10px; font-weight: 800; letter-spacing: 0.18em; color: var(--muted); }
.loLbl b { font-family: "Passion One", Impact, sans-serif; font-size: 22px; letter-spacing: 0.04em; line-height: 1; color: var(--gold); }
.loGo { font-size: 26px; color: var(--muted); }
.loFaces { display: inline-flex; flex: none; }
.loFace, .loQ {
  width: 38px;
  height: 42px;
  border-radius: 9px;
  object-fit: cover;
  object-position: center 12%;
  background: #141820;
  box-shadow: 0 0 0 2px var(--ac, #8c96aa);
}
.loFace + .loFace, .loFaces > * + * { margin-left: -6px; }
.loQ { display: grid; place-items: center; font-family: "Passion One", Impact, sans-serif; font-size: 24px; color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
#loadoutScreen {
  position: fixed;
  inset: 0;
  z-index: 90;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: rgba(4, 5, 10, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow: auto;
}
#loadoutScreen.hidden { display: none; }
#loadoutAsh { color: var(--gold); margin-left: 6px; }
#loadoutList { max-height: min(60dvh, 520px); overflow: auto; }
.loRow {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: center;
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}
.loRow.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.loRow.locked { opacity: 0.62; filter: grayscale(0.7); }
.loRow.locked .loBtn:not(:disabled) { filter: none; }
.loTxt { min-width: 0; }
.loTxt b { display: block; font-family: "Passion One", Impact, sans-serif; font-size: 20px; letter-spacing: 0.03em; line-height: 1.05; }
.loTxt span { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.loRow .loBtn { grid-column: 1 / -1; min-height: 42px; margin-top: 4px; font-size: 18px; }
.loRow.on .loBtn:disabled { background: #2a2414; color: var(--gold); }
#loadoutClose {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.12em;
}
.choice .relic { display: inline-grid; margin: 0; color: var(--rc); font-size: 22px; }

/* ---------- v24: late game ---------- */
/* Overdrive: thin meter along the top of the ability strip, plus a button. */
#abilBar { position: relative; }
#odLine {
  --od: 0;
  position: absolute;
  left: 0;
  top: -1px;
  height: 2px;
  width: calc(var(--od) * 100%);
  background: linear-gradient(90deg, #ff7a3c, #ffd36a);
  box-shadow: 0 0 6px rgba(255, 160, 60, 0.6);
  pointer-events: none;
  transition: width 0.2s linear;
}
#odBtn {
  --od: 0;
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  border: 2px solid #3a3020;
  background: linear-gradient(0deg, rgba(255, 140, 50, 0.55) calc(var(--od) * 100%), #12151e 0);
  color: #ffe2b0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  overflow: hidden;
}
#odBtn b { font-family: "Passion One", Impact, sans-serif; font-size: 15px; letter-spacing: 0.03em; }
#odBtn small { font-size: 6.5px; font-weight: 800; letter-spacing: 0.08em; color: #ffb877; margin-top: 1px; }
#odBtn.idle { opacity: 0.55; }
#odBtn.full { border-color: #ffb03a; color: #fff; animation: odGlow 0.9s ease-in-out infinite; }
#odBtn.on { border-color: #ffd36a; background: linear-gradient(0deg, #ff8a2a calc(var(--od) * 100%), #3a1a08 0); color: #fff; }
#abilBar.od { background: linear-gradient(180deg, #2a1206, #07080d); }
@keyframes odGlow {
  0%, 100% { box-shadow: 0 0 0 0 #ffb03a; }
  50% { box-shadow: 0 0 12px 2px #ffb03a; }
}
@media (max-width: 380px) {
  #odBtn { width: 40px; height: 36px; }
  #odBtn small { font-size: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  #odBtn.full { animation: none; box-shadow: 0 0 8px #ffb03a; }
}

/* Placement / selected-defense strip replaces the ability row. */
#modeBar { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; }
#modeBar[hidden] { display: none; }
#abilBar[data-mode] > #abilRow,
#abilBar[data-mode] > #odBtn,
#abilBar[data-mode] > #twistTags { display: none; }
#abilBar[data-mode] { background: #0d1018; }
.mbTxt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.mbTxt b { font-size: 13.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mbTxt small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mbOk, .mbSell, .mbX {
  flex: 0 0 auto;
  height: 36px;
  border-radius: 10px;
  border: 0;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
}
.mbOk { min-width: 84px; background: linear-gradient(180deg, #7dffb3, #36c47a); color: #062012; }
.mbOk:disabled { background: #2a3042; color: #6b7286; }
.mbSell { min-width: 84px; background: linear-gradient(180deg, #ffd36a, #e0a53a); color: #2a1a04; }
.mbX { width: 36px; background: #1c2130; color: #f4f1ea; font-size: 15px; }

/* Shop: defenses, promotions, fortify, Black Market. */
#defShop { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.defTile {
  --dc: #c2a36a;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 64px;
  padding: 5px 7px 5px 4px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--dc) 40%, #2c3348);
  background: #121620;
  color: var(--text);
  text-align: left;
}
.defTile .defIco { width: 46px; height: 46px; flex: none; border-radius: 9px; background: radial-gradient(circle at 50% 70%, #2a2f22, #10130e); }
.defTxt { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.defTxt b { font-size: 12.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.defTxt small { font-size: 10px; color: var(--muted); }
.defTxt em { font-style: normal; font-size: 12.5px; font-weight: 800; color: var(--gold); margin-top: 2px; }
.defTile.locked { opacity: 0.5; }
#promoRow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.promo {
  --ac: #ffc857;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 54px;
  padding: 4px 6px 4px 4px;
  border-radius: 12px;
  border: 1px solid #2c3348;
  background: #121620;
  color: var(--text);
  text-align: left;
}
.promo .face { width: 34px; height: 40px; box-shadow: 0 0 0 2px var(--ac); }
.pTxt { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.pTxt b { font-size: 12px; color: #fff; }
.pTxt .stars { font-style: normal; font-size: 10px; color: #ffd36a; letter-spacing: -0.02em; white-space: nowrap; }
.pTxt .stars.elite { color: #ff7ad0; font-weight: 800; }
.pTxt em { font-style: normal; font-size: 12px; font-weight: 800; color: var(--gold); }
.sinkTile, .bmItem {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 5px 9px 5px 5px;
  border-radius: 12px;
  border: 1px solid #2c3348;
  background: #121620;
  color: var(--text);
  text-align: left;
}
.sinkTile .mark { width: 42px; height: 42px; flex: none; border-radius: 9px; background: #1b202c url("../assets/upgrade-wall.png") center / cover no-repeat; box-shadow: inset 0 0 0 2px #a9c2dd; }
.sinkTxt { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sinkTxt b { font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sinkTxt small { font-size: 10.5px; color: var(--muted); }
.sinkPrice { flex: none; font-style: normal; font-weight: 800; font-size: 13px; color: var(--gold); }
.sinkTile.locked, .bmItem.locked { opacity: 0.5; }
.broke .sinkPrice, .broke .defTxt em, .broke.promo .pTxt em { color: #ff7a8a; }
.bmHead { color: #ff9ad0; }
#marketRow { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 14px; background: repeating-linear-gradient(135deg, #140e18, #140e18 10px, #170f1c 10px, #170f1c 20px); border: 1px solid #3a2448; }
.bmItem { background: #1a1220; border-color: #3a2448; }
.bmItem .face { width: 36px; height: 42px; }
.bmItem .relicBadge { flex: none; }
.bmGlyph { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 9px; font-size: 20px; font-weight: 800; background: #2a1a34; color: #ff9ad0; }
.bmGlyph.g-cleanse { color: #ff6a8a; }
.bmGlyph.g-stim { color: #7dffb3; }
#marketRow .stockEmpty { border-color: #3a2448; }
#objLine { color: #ffe9a0; font-size: 12.5px; margin: 4px 0 0; }
#objLine[hidden] { display: none; }

/* Brief: bonus objective. */
#ovObj { margin: 10px 0 0; padding: 9px 12px; border-radius: 12px; border: 1px dashed #ffd36a; background: rgba(255, 211, 106, 0.07); text-align: left; }
#ovObj[hidden] { display: none; }
#ovObj em { display: block; font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: 0.18em; color: #ffd36a; }
#ovObj b { display: block; font-size: 15px; color: #fff; margin-top: 2px; }
#ovObj i { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Title: Daily Run. */
#dailyBtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid #ffd36a;
  background: linear-gradient(180deg, #2a2210, #15110a);
  color: #ffe9a0;
}
#dailyBtn b { font-family: "Passion One", Impact, sans-serif; font-size: 21px; letter-spacing: 0.06em; line-height: 1; }
#dailyBtn small { font-size: 11px; color: #d8c48a; margin-top: 3px; }

/* Card: promotion stars. */
.hcStars {
  position: absolute;
  right: 8px;
  top: 58px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(8, 9, 14, 0.82);
  color: #ffd36a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hcStars[hidden] { display: none; }
.hcStars.elite { color: #ff7ad0; }
.hcPromo { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 8px; }
.hcPromo .hcStarsTxt { color: #ffd36a; font-size: 15px; }
.hcPromo .hcStarsTxt.elite { color: #ff7ad0; }
.hcPromo .right { grid-column: 2; grid-row: 1; }
.promoBtn {
  grid-column: 1 / -1;
  height: 36px;
  border-radius: 10px;
  border: 0;
  background: linear-gradient(180deg, #ffd36a, #e0a53a);
  color: #2a1a04;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
}
.promoBtn:disabled { background: #2a3042; color: #6b7286; }

/* Legendary cards: gold foil. */
.choice.card.r-legendary {
  border-color: #ffd36a;
  background: linear-gradient(115deg, #2a210c 0%, #3c2f10 30%, #fff0b0 45%, #3c2f10 55%, #2a210c 100%);
  background-size: 300% 100%;
  animation: foil 3.2s linear infinite;
  box-shadow: 0 0 18px rgba(255, 211, 106, 0.5);
}
.choice.card.r-legendary .rar { color: #ffe9a0; }
.choice.card.r-legendary b { color: #fff6d4; }
.buildChip.r-legendary, .cardChip.r-legendary { border-color: #ffd36a; background: linear-gradient(90deg, #2a210c, #4a3a14); }
.cardChip.r-legendary b, .buildChip.r-legendary b { color: #ffe9a0; }
@keyframes foil { 0% { background-position: 100% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .choice.card.r-legendary { animation: none; background-position: 50% 0; } }
#callout.legend { border-color: #ffd36a; box-shadow: 0 0 26px rgba(255, 211, 106, 0.55); background: linear-gradient(180deg, #2a210c, #0d0b06); }
#callout.legend em { color: #ffd36a; }
#callout.obj { border-color: #7dffb3; }
#callout.obj em { color: #7dffb3; }
.setChip.cap { border-color: #fff; box-shadow: 0 0 12px color-mix(in srgb, var(--tc) 55%, transparent); }

/* v25: link to the frozen classic build. */
.versionLink { display: block; margin: 12px auto 0; width: max-content; padding: 6px 10px; font-size: 12px; letter-spacing: 0.06em; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; opacity: 0.8; }
.versionLink:hover, .versionLink:focus-visible { color: #fff; opacity: 1; }
.hcSoft { margin: 4px 0 0; font-size: 11px; line-height: 1.3; color: #ffcf8a; opacity: 0.9; }

/* v27: installable app. Title-screen install button + iOS hint. */
.installBtn { display: block; margin: 12px auto 0; padding: 9px 18px; border: 1px solid rgba(255, 200, 87, 0.55); border-radius: 999px; background: rgba(255, 200, 87, 0.1); color: var(--gold); font-size: 13px; font-weight: 700; letter-spacing: 0.1em; cursor: pointer; }
.installBtn:hover, .installBtn:focus-visible { background: rgba(255, 200, 87, 0.2); color: #fff; }
.installBtn span { margin-right: 4px; }
.installBtn[hidden], .installHint[hidden] { display: none; }
.installHint { margin: 12px auto 0; max-width: 300px; font-size: 12px; line-height: 1.35; text-align: center; color: var(--muted); }
.installHint b { color: var(--text); }
/* Notch / rounded corners on side edges (landscape or cutouts) when running edge-to-edge. */
#app { box-sizing: border-box; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
html.pwa #titleScreen { padding-left: calc(18px + env(safe-area-inset-left)); padding-right: calc(18px + env(safe-area-inset-right)); }

/* Outfit picker on the heroine card */
.hcOutfits {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 7px 0 7px;
}
.hcOfLbl {
  flex: none;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.ofBtn {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 3px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.ofBtn.on {
  border-color: var(--ac);
  background: color-mix(in srgb, var(--ac) 20%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--ac) 35%, transparent);
}
.ofBtn:active { filter: brightness(1.2); }
.ofThumb {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  object-fit: cover;
  background: #141820;
}
.ofBtn.on .ofThumb { box-shadow: 0 0 0 2px var(--ac); }
.ofName {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ofBtn.on .ofName { color: var(--ac); }
.ofNew {
  position: absolute;
  top: -6px;
  right: -3px;
  padding: 1px 4px;
  border-radius: 6px;
  background: #ff4d6a;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
}
/* Outfit portraits are square 720px paintings: frame them like the classic squares. */
#heroCard[data-kind][data-art="cute"] .hcArt img,
#heroCard[data-kind][data-art="spooky"] .hcArt img { --aw: 140%; --al: -20%; --at: -3%; }
/* v30: save and resume. CONTINUE sits above PLAY when a run is saved. */
#continueBtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 64px;
  margin: 0 0 10px;
  padding: 9px 10px 8px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffe07a, #f0b53a);
  color: #1d1406;
  box-shadow: 0 0 0 2px rgba(255, 224, 122, 0.25), 0 6px 22px rgba(240, 181, 58, 0.28);
}
#continueBtn[hidden] { display: none !important; }
#continueBtn b { font-family: "Passion One", Impact, sans-serif; font-size: 32px; letter-spacing: 0.06em; line-height: 1; }
#continueBtn small { font-size: 12px; font-weight: 800; color: #4a3610; margin-top: 4px; letter-spacing: 0.02em; }
#continueBtn:active { transform: scale(0.99); }
#continueBtn:not([hidden]) ~ #play {
  min-height: 52px;
  font-size: 26px;
  background: linear-gradient(180deg, #3a1d2a, #24121b);
  color: #ff8fb6;
  border: 1px solid #ff3d78;
}
.saveNote { margin: 0 0 10px; font-size: 13px; color: var(--muted); line-height: 1.35; }
.saveNote[hidden] { display: none !important; }

/* Portrait phones: the wide paintings would be cover-cropped to a sliver. Show the whole painting at
   full width near the top and fill the rest with a blurred, darkened copy of the same art. */
@media (orientation: portrait) and (max-aspect-ratio: 4/5) {
  #titleScreen {
    isolation: isolate;
    background: #07080d;
  }
  #titleScreen::before,
  #titleScreen::after {
    content: "";
    position: fixed;
    z-index: -1;
    pointer-events: none;
  }
  #titleScreen::before {
    inset: -40px;
    background: #07080d url("../assets/title-art.jpg") center / cover no-repeat;
    filter: blur(22px) brightness(0.42) saturate(1.1);
  }
  #titleScreen::after {
    inset: 0;
    background:
      linear-gradient(180deg, rgba(7, 8, 13, 0) 0, rgba(7, 8, 13, 0) calc(56.25vw - 40px), rgba(7, 8, 13, 0.35) 56.25vw, rgba(7, 8, 13, 0.55) 100%),
      url("../assets/title-art.jpg") center top / 100% auto no-repeat;
  }
  #overlay.splash {
    isolation: isolate;
    background: #07080d;
  }
  #overlay.splash::before {
    content: "";
    position: fixed;
    inset: -40px;
    z-index: -1;
    background-image: var(--splashBg, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(22px) brightness(0.4) saturate(1.1);
    pointer-events: none;
  }
  #overlay.splash .panel {
    background-color: transparent;
    background-image:
      linear-gradient(180deg, rgba(7, 8, 13, 0) 0, rgba(7, 8, 13, 0) calc(56.25vw - 36px), rgba(7, 8, 13, 0.25) 56.25vw, rgba(7, 8, 13, 0.5) calc(56.25vw + 60px), rgba(7, 8, 13, 0.62) 100%),
      var(--splash);
    background-size: 100% 100%, 100% auto;
    background-position: center top, center top;
  }
  #overlay.splash .panel::before { flex: 0 0 calc(56.25vw - 28px); min-height: calc(56.25vw - 28px); }
  #overlay.splash[data-step="map"] .panel::before { flex-basis: 6vh; min-height: 6vh; }
  #overlay.splash[data-step="cards"] .panel::before,
  #overlay.splash[data-step="relic"] .panel::before,
  #overlay.splash[data-step="mystery"] .panel::before { flex-basis: calc(56.25vw - 28px); min-height: calc(56.25vw - 28px); }
}

/* ---------- v35: difficulty, settings, help, credits, tour, itch.io fit ---------- */
#diffRow {
  display: flex;
  gap: 6px;
  margin: 0 0 4px;
}
#diffRow button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(12, 14, 20, 0.7);
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.12em;
}
#diffRow button.on { color: #1a0a12; background: linear-gradient(180deg, #ffd988, #ffc857); border-color: #ffc857; }
#diffRow button[data-d="easy"].on { background: linear-gradient(180deg, #a6ffd0, #7dffb3); border-color: #7dffb3; }
#diffRow button[data-d="hard"].on { background: linear-gradient(180deg, #ff9aa6, #ff5d6c); border-color: #ff5d6c; }
.diffNote { margin: 0 0 8px; min-height: 16px; font-size: 12px; color: var(--muted); letter-spacing: 0.03em; text-align: center; }
.pauseDiff { margin: -4px 0 10px !important; font-size: 13px; font-weight: 800; letter-spacing: 0.08em; color: var(--gold) !important; }
#titleHow, #titleSettings, #titleCredits {
  display: block;
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(12, 14, 20, 0.7);
  color: var(--muted);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 0 4px;
}
#titleHow:active, #titleSettings:active, #titleCredits:active { transform: scale(0.98); }
.fsBtn {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: calc(10px + env(safe-area-inset-right));
  z-index: 3;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(7, 8, 13, 0.6);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}
.fsBtn[hidden] { display: none !important; }

.metaScreen {
  position: fixed;
  inset: 0;
  z-index: 95;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: rgba(4, 5, 10, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow: auto;
}
.metaScreen.hidden { display: none; }
.metaScreen .panel { max-height: calc(100dvh - 28px); overflow: auto; margin-bottom: 0; }
.setRow {
  display: grid;
  grid-template-columns: 74px 1fr 46px;
  align-items: center;
  gap: 8px;
  min-height: 48px;
}
.setRow label { font-weight: 800; letter-spacing: 0.06em; font-size: 14px; }
.setRow output { text-align: right; color: var(--gold); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.setRow input[type="range"] { width: 100%; height: 36px; accent-color: var(--pink); margin: 0; touch-action: pan-y; }
.setToggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  text-align: left;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.setToggle small { display: block; font-weight: 600; font-size: 11px; letter-spacing: 0; color: var(--muted); margin-top: 1px; }
.setToggle b { min-width: 44px; text-align: center; padding: 4px 8px; border-radius: 999px; background: #2a3142; color: #8b93a7; font-size: 12px; letter-spacing: 0.08em; }
.setToggle.on b { background: var(--green); color: #07130c; }
.setBtn, .metaClose {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.12em;
}
.setBtn[hidden] { display: none !important; }
.setBtn.danger { color: var(--danger); border-color: #5a2a33; background: rgba(255, 93, 108, 0.08); }
#helpTour { background: linear-gradient(180deg, #ff6fa4, #ff3d78); color: #1a0a12; border: 0; }
.kofiBtn {
  display: flex; align-items: center; justify-content: center; text-decoration: none; text-transform: none;
  background: linear-gradient(180deg, #ffd27a, #f5a623); color: #2a1604; border: 0; font-size: 15px; letter-spacing: 0.06em;
  box-shadow: 0 2px 10px rgba(245, 166, 35, 0.35); touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.kofiBtn:active { transform: scale(0.98); }
.kofiInline { color: var(--gold); font-weight: 800; }
.metaClose { background: transparent; color: var(--muted); }
.helpScroll { max-height: min(56dvh, 460px); overflow: auto; margin: 6px 0 4px; padding-right: 4px; -webkit-overflow-scrolling: touch; }
.helpScroll h3 { margin: 12px 0 2px; font-size: 12px; letter-spacing: 0.16em; color: var(--pink); font-weight: 800; text-transform: uppercase; }
.helpScroll p, .helpScroll li { color: var(--text); font-size: 14px; line-height: 1.4; margin: 4px 0; }
.helpScroll ul { margin: 4px 0; padding-left: 18px; }
.panel .helpScroll p { color: var(--text); }
.kbTable { border-collapse: collapse; width: 100%; font-size: 13px; }
.kbTable td { padding: 5px 4px; vertical-align: top; border-bottom: 1px solid var(--line); line-height: 1.3; }
.kbTable td:first-child { white-space: nowrap; width: 1%; padding-right: 10px; }
.kbTable kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 6px; border: 1px solid #44506b; background: #1e2433; color: var(--text); font: 700 12px/1.5 inherit; text-align: center; }

/* Guided tour. The dim layer never blocks taps; only the card does. */
#tut {
  position: fixed;
  inset: 0;
  z-index: 120;
  overflow: hidden;
  pointer-events: none;
}
#tut.hidden { display: none; }
#tut.noSpot { background: rgba(4, 5, 10, 0.66); }
#tutSpot {
  position: absolute;
  border: 2px solid var(--gold);
  border-radius: 14px;
  box-shadow: 0 0 0 150vmax rgba(4, 5, 10, 0.66), 0 0 18px 2px rgba(255, 200, 87, 0.65);
  pointer-events: none;
  animation: tutPulse 1.4s ease-in-out infinite;
}
#tut.noSpot #tutSpot { display: none; }
#tut.live #tutSpot { box-shadow: 0 0 18px 3px rgba(255, 200, 87, 0.7); }
@keyframes tutPulse { 0%, 100% { border-color: rgba(255, 200, 87, 1); } 50% { border-color: rgba(255, 200, 87, 0.35); } }
#tutCard {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(340px, calc(100% - 20px));
  padding: 12px 14px 10px;
  border-radius: 16px;
  background: #141821;
  border: 1px solid #3a4260;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}
#tut[data-place="bot"] #tutCard { bottom: calc(14px + env(safe-area-inset-bottom)); }
#tut[data-place="top"] #tutCard { top: calc(52px + env(safe-area-inset-top)); }
#tut[data-place="mid"] #tutCard { top: 50%; transform: translate(-50%, -50%); }
#tutCard h3 { margin: 0; font-family: "Passion One", Impact, sans-serif; font-size: 26px; letter-spacing: 0.03em; line-height: 1; }
#tutCard p { margin: 4px 0 8px; color: var(--muted); font-size: 14px; line-height: 1.35; }
#tutCard p.kicker { margin: 0 0 4px; color: var(--pink); }
.tutBtns { display: flex; gap: 8px; }
.tutBtns button { min-height: 44px; border-radius: 12px; font-weight: 800; letter-spacing: 0.08em; font-size: 14px; border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 0 12px; }
.tutBtns #tutNext { flex: 1; border: 0; background: linear-gradient(180deg, #ff6fa4, #ff3d78); color: #1a0a12; font-family: "Passion One", Impact, sans-serif; font-size: 20px; letter-spacing: 0.04em; }
#tut.live #tutCard { padding: 8px 12px 8px; }
#tut.live #tutCard p { margin-bottom: 6px; }
#tut.live #tutCard h3 { font-size: 22px; }
@media (max-height: 640px) {
  #tutCard { padding: 8px 12px 8px; }
  #tutCard h3 { font-size: 22px; }
  #tutCard p { font-size: 13px; margin-bottom: 6px; }
  .tutBtns button { min-height: 38px; }
}

/* itch.io (or any non-GitHub embed): no install prompt, no link to the classic copy that is not in the zip. */
html.itch #installBtn, html.itch #installHint, html.itch #versionLink { display: none !important; }

/* Reduce flashes (Settings) mirrors prefers-reduced-motion for CSS animation. */
html.rf *, html.rf *::before, html.rf *::after {
  animation-duration: 0.001s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001s !important;
}

/* Wide, short embeds (itch.io landscape iframes, small laptops): keep the title card inside the frame. */
@media (min-aspect-ratio: 1/1) and (max-height: 640px) {
  #titleScreen { justify-content: flex-start; justify-content: safe center; }
  .titleCard h1 { font-size: 56px; margin-bottom: 6px; }
  .tagline { margin-bottom: 10px; font-size: 14px; }
}
/* Short desktop windows and itch.io embeds: tighten the title card so the whole menu stays in view. */
@media (min-width: 600px) and (max-height: 860px) {
  .titleCard { padding: 12px 14px 10px; }
  .titleCard h1 { font-size: 60px; margin-bottom: 6px; }
  .tagline { margin: 0 0 10px; font-size: 14px; }
  #play { min-height: 56px; font-size: 28px; }
  #titleLab, #titleCards, #titleMedals, #titleMute { min-height: 42px; }
  #titleHow, #titleSettings, #titleCredits { min-height: 38px; }
  #titleMute { margin-top: 6px; }
}
@media (max-width: 400px) {
  #titleHow, #titleSettings, #titleCredits { font-size: 10px; letter-spacing: 0.04em; }
}
@media (max-height: 560px) {
  .setToggle, .setBtn, .metaClose, .setRow { min-height: 40px; }
  .setToggle small { display: none; }
  .helpScroll { max-height: calc(100dvh - 200px); }
}
