:root {
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Menlo, Consolas, monospace;

  --bg-ink: #070B16;
  --bg-surface: #0D1324;
  --bg-card: #121A30;
  --line-soft: rgba(148, 163, 184, 0.22);
  --line-strong: rgba(248, 250, 252, 0.34);

  --ivory: #F4F1EA;
  --ocean: #38BDF8;
  --ocean-deep: #1D4ED8;
  --gold: #F59E0B;
  --crimson: #F43F5E;
  --mint: #34D399;
  --violet: #D946EF;

  --text-main: #F8FAFC;
  --text-sub: #94A3B8;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #04070F;
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.hidden { display: none !important; }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }

.cabinet-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg-ink);
  transform-origin: top left;
}

@media (orientation: landscape) and (min-width: 560px) {
  .cabinet-shell {
    max-width: min(470px, calc(100dvh * 0.57));
    border-left: 1px solid var(--line-soft);
    border-right: 1px solid var(--line-soft);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.72);
  }
}

/* =========================================================================
   SCREEN 1: EDITORIAL ANIME TITLE COVER
   ========================================================================= */
.title-screen {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.title-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 12%;
  opacity: 0.92;
  filter: saturate(1.08) contrast(1.05);
  z-index: 0;
}

.title-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(6, 14, 34, 0.42) 0%, rgba(6, 14, 34, 0.04) 22%, rgba(6, 14, 34, 0.08) 44%, rgba(6, 14, 34, 0.86) 66%, rgba(5, 11, 24, 0.97) 84%);
}

.title-hero-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.title-screen.is-mystery-skin .title-bg {
  filter: brightness(0.18) saturate(0.2);
}
.title-screen.is-mystery-skin .title-scrim {
  background: radial-gradient(circle at 60% 34%, rgba(16, 22, 42, 0.55) 0%, rgba(2, 3, 8, 0.94) 68%, #020308 100%);
}
.title-screen.is-mystery-skin .title-hero-img {
  filter: brightness(0) drop-shadow(0 0 20px rgba(250, 204, 21, 0.45));
  opacity: 0.94;
}
.hero-nav-arrow {
  position: absolute;
  top: 32%;
  z-index: 4;
  pointer-events: auto;
  width: 28px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(125, 211, 252, 0.25);
  background: rgba(5, 11, 24, 0.55);
  color: rgba(224, 242, 254, 0.85);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.hero-nav-arrow.left { left: 8px; }
.hero-nav-arrow.right { right: 8px; }
.hero-nav-arrow:active { transform: scale(0.92); }
.hero-mystery-pill {
  position: absolute;
  left: 50%;
  top: 41%;
  transform: translateX(-50%);
  z-index: 4;
  pointer-events: auto;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.65);
  background: rgba(3, 5, 12, 0.88);
  color: #FDE047;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.72), 0 0 14px rgba(250, 204, 21, 0.22);
  cursor: pointer;
}

.title-bg-word {
  position: absolute;
  left: -6px;
  top: 46px;
  font-family: var(--font-mono);
  font-size: 64px;
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 0.85;
  color: rgba(224, 242, 254, 0.1);
  white-space: nowrap;
}

.title-hero-img {
  position: absolute;
  right: -6px;
  top: 46px;
  height: 53%;
  width: auto;
  max-width: 92%;
  object-fit: contain;
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 14px 28px rgba(4, 12, 32, 0.72)) drop-shadow(0 0 18px rgba(56, 189, 248, 0.28));
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 84%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 84%, transparent 100%);
  animation: heroBreath 3.8s ease-in-out infinite;
  transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes heroBreath {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.title-hero-img.switching {
  opacity: 0;
  animation: none;
  transform: translateX(18px) scale(0.97);
}

.title-top-bar, .title-bottom-deck {
  position: relative;
  z-index: 3;
}

.title-top-bar {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.title-kicker {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #E0F2FE;
  padding: 5px 9px;
  border-radius: 5px;
  background: rgba(8, 22, 48, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(125, 211, 252, 0.28);
  border-left: 3px solid var(--ocean);
}

.title-top-actions {
  display: flex;
  flex-shrink: 0;
  gap: 5px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border: 1px solid rgba(125, 211, 252, 0.32);
  border-radius: 5px;
  background: rgba(8, 22, 48, 0.74);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #F0F9FF;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.nav-btn:active { background: rgba(29, 78, 216, 0.55); }

.title-bottom-deck {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.title-lockup {
  padding-left: 11px;
  border-left: 4px solid var(--ocean);
}

.title-eyebrow {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.11em;
  color: #7DD3FC;
  text-shadow: 0 2px 8px rgba(4, 12, 32, 0.9);
}

.title-main {
  margin: 3px 0 0;
  font-size: 29px;
  line-height: 1.08;
  font-weight: 900;
  color: #FFFFFF;
  letter-spacing: 0.03em;
  text-shadow: 0 4px 16px rgba(4, 12, 32, 0.95), 0 0 20px rgba(56, 189, 248, 0.25);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.title-sub-accent {
  font-size: 13px;
  font-weight: 900;
  color: #07142B;
  background: #7DD3FC;
  padding: 3px 9px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-shadow: none;
}

/* 5-Skin Horizontal Avatar Rail (Crisp Frosted Sapphire Cards) */
.skin-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 1px 0 2px;
  touch-action: pan-x;
  scrollbar-width: none;
}
.skin-bar::-webkit-scrollbar { display: none; }

.skin-tab {
  --skin-accent: #7DD3FC;
  flex: 0 0 auto;
  min-width: 112px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(125, 211, 252, 0.22);
  background: rgba(10, 24, 52, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-sub);
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.skin-tab-ava {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  object-fit: contain;
  background: rgba(6, 12, 28, 0.78);
  border: 1px solid rgba(125, 211, 252, 0.28);
  flex-shrink: 0;
}

.skin-tab-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.skin-tab .skin-code {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #94A3B8;
}

.skin-tab strong {
  font-size: 11.5px;
  font-weight: 900;
  color: #CBD5E1;
  white-space: nowrap;
}

.skin-tab.active {
  border-color: var(--skin-accent);
  border-left: 3px solid var(--skin-accent);
  background: linear-gradient(135deg, rgba(14, 58, 128, 0.85), rgba(10, 28, 64, 0.88));
  box-shadow: inset 0 1px 0 rgba(186, 230, 253, 0.32), 0 4px 16px rgba(14, 165, 233, 0.2);
}

.skin-tab.active .skin-tab-ava { border-color: var(--skin-accent); }
.skin-tab.active .skin-code { color: var(--skin-accent); }
.skin-tab.active strong { color: #FFFFFF; }
.skin-tab.locked {
  border-style: dashed;
  border-color: rgba(250, 204, 21, 0.45);
  background: linear-gradient(135deg, #04060C, #090D1A);
}
.skin-tab.locked .skin-tab-ava {
  background: #030509;
  border-radius: 6px;
  filter: brightness(0) drop-shadow(0 0 4px rgba(250, 204, 21, 0.55));
  opacity: 0.92;
}
.skin-lock-tag {
  margin-left: 3px;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(250, 204, 21, 0.18);
  border: 1px solid rgba(250, 204, 21, 0.52);
  color: #FDE047;
  font-size: 8.5px;
  font-weight: 900;
}

.follow-box { display: flex; flex-direction: column; gap: 11px; }
.follow-previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.follow-prev-card {
  position: relative;
  padding: 10px 8px;
  border-radius: 8px;
  background: #080D1A;
  border: 1px solid rgba(250, 204, 21, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
  overflow: hidden;
}
.follow-prev-card.mystery {
  background: radial-gradient(circle at 50% 38%, #12182B 0%, #03050A 72%);
  border-color: rgba(250, 204, 21, 0.48);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.9);
}
.follow-prev-wrap {
  position: relative;
  width: 78px;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.follow-prev-card img { width: 74px; height: 74px; object-fit: contain; }
.follow-prev-card.mystery img {
  filter: brightness(0) drop-shadow(0 0 8px rgba(250, 204, 21, 0.42));
  opacity: 0.95;
}
.mystery-q {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  color: #FDE047;
  text-shadow: 0 0 12px rgba(250, 204, 21, 0.75);
  pointer-events: none;
}
.follow-prev-card strong { font-size: 11.5px; color: #FFFFFF; }
.follow-prev-card span { font-size: 9.5px; color: #FDE047; font-weight: 800; line-height: 1.35; }
.follow-desc {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: #CBD5E1;
}
.follow-desc b { color: #FDE047; }
.egg-code-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.egg-code-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: #080D1A;
  color: #F8FAFC;
  font-size: 12px;
  font-weight: 700;
  outline: none;
}
.egg-code-input:focus {
  border-color: #FACC15;
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.16);
}
.btn-egg-redeem {
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid rgba(250, 204, 21, 0.55);
  background: rgba(250, 204, 21, 0.15);
  color: #FDE047;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.btn-egg-redeem:active { transform: scale(0.97); }
.nav-btn-egg {
  border-color: rgba(250, 204, 21, 0.45);
  color: #FDE047;
}
.follow-actions { display: flex; flex-direction: column; gap: 7px; }

/* Unlock Poster Reveal Modal */
.reveal-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: radial-gradient(circle at 50% 25%, #111936 0%, #050812 80%);
  border-color: rgba(250, 204, 21, 0.52);
}
.reveal-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.reveal-tab {
  height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(8, 13, 26, 0.85);
  color: #94A3B8;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.reveal-tab.active {
  border-color: #FACC15;
  background: rgba(250, 204, 21, 0.14);
  color: #FDE047;
}
.reveal-stage {
  position: relative;
  height: 248px;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 45%, #17213F 0%, #03050A 78%);
  border: 1px solid rgba(250, 204, 21, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.reveal-spotlight {
  position: absolute;
  inset: -20%;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(250, 204, 21, 0.12) 25deg, transparent 55deg, rgba(56, 189, 248, 0.1) 180deg, transparent 220deg);
  animation: revealSpin 10s linear infinite;
  pointer-events: none;
}
@keyframes revealSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.reveal-poster-img {
  position: relative;
  z-index: 2;
  max-height: 224px;
  max-width: 92%;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.78)) drop-shadow(0 0 18px rgba(250, 204, 21, 0.28));
  animation: revealPop 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-stage.locked {
  background: radial-gradient(circle at 50% 45%, #111626 0%, #020307 74%);
  border-color: rgba(250, 204, 21, 0.42);
}
.reveal-stage.locked .reveal-poster-img {
  filter: brightness(0) drop-shadow(0 0 16px rgba(250, 204, 21, 0.38));
  opacity: 0.94;
}
.reveal-mystery-mark {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
}
.reveal-mystery-mark strong {
  font-size: 46px;
  line-height: 1;
  color: #FDE047;
  text-shadow: 0 0 20px rgba(250, 204, 21, 0.72);
}
.reveal-mystery-mark span {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(2, 4, 10, 0.85);
  border: 1px solid rgba(250, 204, 21, 0.45);
  color: #FDE047;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.reveal-unlock-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.reveal-box .reveal-stage { height: 224px; }
.reveal-box .reveal-poster-img { max-height: 202px; }
@keyframes revealPop {
  from { opacity: 0; transform: scale(0.86) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.reveal-badge-row {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.reveal-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(5, 8, 18, 0.85);
  border: 1px solid rgba(250, 204, 21, 0.45);
  color: #FDE047;
  font-size: 10px;
  font-weight: 800;
}
.reveal-desc {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: #CBD5E1;
  text-align: center;
}

/* Starter Loadouts: Segmented Stream Selector + Active Pipeline Deck */
.starter-section {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.section-micro-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  color: #BAE6FD;
}

.link-micro-btn {
  border: none;
  background: transparent;
  color: #7DD3FC;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.starter-deck {
  --deck-accent: #38BDF8;
  width: 100%;
  min-width: 0;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.28);
  background: rgba(9, 22, 48, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 22px rgba(2, 10, 28, 0.36), inset 0 1px 0 rgba(186, 230, 253, 0.12);
}

.starter-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: rgba(5, 13, 30, 0.62);
  border-bottom: 1px solid rgba(125, 211, 252, 0.16);
}

.starter-tab {
  position: relative;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 8px 4px;
  color: #94A3B8;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: color 0.14s ease, background 0.14s ease;
}

.starter-tab + .starter-tab {
  border-left: 1px solid rgba(125, 211, 252, 0.12);
}

.st-tab-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.45);
  flex-shrink: 0;
  transition: background 0.14s ease, box-shadow 0.14s ease;
}

.st-tab-lbl {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.starter-tab.active {
  color: #FFFFFF;
  background: linear-gradient(180deg, rgba(16, 52, 112, 0.68) 0%, rgba(11, 30, 68, 0.45) 100%);
}

.starter-tab.active::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--tab-accent, #38BDF8);
}

.starter-tab.active .st-tab-dot {
  background: var(--tab-accent, #38BDF8);
  box-shadow: 0 0 7px var(--tab-accent, #38BDF8);
}

.starter-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  min-height: 64px;
  background: linear-gradient(90deg, rgba(14, 46, 102, 0.28) 0%, rgba(9, 22, 48, 0.1) 55%, transparent 100%);
  animation: starterSwap 0.16s ease-out;
}

@keyframes starterSwap {
  from { opacity: 0.45; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

.st-chain {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.st-node {
  width: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.st-node-frame {
  width: 36px;
  height: 36px;
  border-radius: 5px;
  overflow: hidden;
  border: 1.5px solid rgba(148, 163, 184, 0.48);
  background: #071022;
  box-shadow: 0 3px 10px rgba(2, 8, 22, 0.45);
}

.st-node.kind-core .st-node-frame {
  border-color: #38BDF8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2), 0 3px 10px rgba(2, 8, 22, 0.5);
}

.st-node.kind-mod .st-node-frame {
  border-color: #64748B;
}

.st-node.kind-trigger .st-node-frame {
  border-color: #F59E0B;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.22), 0 3px 10px rgba(2, 8, 22, 0.5);
}

.st-node-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.st-node-lbl {
  font-size: 9.5px;
  font-weight: 800;
  color: #CBD5E1;
  line-height: 1.1;
  white-space: nowrap;
}

.st-node.kind-core .st-node-lbl { color: #BAE6FD; }
.st-node.kind-trigger .st-node-lbl { color: #FDE68A; }

.st-chev {
  color: rgba(125, 211, 252, 0.75);
  flex-shrink: 0;
  margin-bottom: 13px;
}

.st-divider {
  width: 1px;
  align-self: stretch;
  margin: 2px 0;
  background: linear-gradient(180deg, transparent, rgba(125, 211, 252, 0.26), transparent);
  flex-shrink: 0;
}

.st-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.st-meta-tag {
  font-size: 11px;
  font-weight: 900;
  color: var(--deck-accent, #7DD3FC);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.st-meta-desc {
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.38;
  color: #CBD5E1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Difficulty + CTA */
.title-cta-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.diff-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 5px;
}

.diff-pill {
  min-width: 0;
  padding: 6px 4px;
  border-radius: 5px;
  border: 1px solid rgba(125, 211, 252, 0.22);
  background: rgba(10, 24, 52, 0.72);
  backdrop-filter: blur(8px);
  color: #94A3B8;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.diff-pill.active {
  border-color: #7DD3FC;
  color: #FFFFFF;
  background: rgba(14, 116, 194, 0.42);
  box-shadow: inset 0 1px 0 rgba(186, 230, 253, 0.35);
}

.diff-pill.nightmare.active {
  border-color: var(--crimson);
  color: #FFE4E6;
  background: rgba(190, 18, 60, 0.45);
  box-shadow: inset 0 1px 0 rgba(253, 164, 175, 0.35);
}

.btn-arcade-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: none;
  border-left: 5px solid #0EA5E9;
  border-radius: 6px;
  background: linear-gradient(180deg, #FFFFFF 0%, #E8F1FA 100%);
  color: #07142B;
  font-size: 15.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(2, 10, 28, 0.55), 0 0 18px rgba(56, 189, 248, 0.25);
}

.btn-arcade-primary:active { transform: scale(0.985); filter: brightness(0.95); }
.btn-arrow { font-family: var(--font-mono); font-size: 18px; color: #0284C7; }

.title-control-tip {
  text-align: center;
  font-size: 10.5px;
  color: #94A3B8;
  font-weight: 600;
}

@media (max-width: 390px) {
  .title-kicker {
    font-size: 8.5px;
    letter-spacing: 0.05em;
    padding: 5px 7px;
  }
  .nav-btn {
    padding: 5px 7px;
    font-size: 11px;
  }
  .title-eyebrow {
    font-size: 8.5px;
    letter-spacing: 0.06em;
  }
}

@media (max-height: 810px) {
  .title-hero-img {
    top: 42px;
    height: 47%;
  }
}

/* =========================================================================
   SCREEN 2: FULL-VIEWPORT BATTLEFIELD & POLISHED FROSTED OCEAN HUD
   ========================================================================= */
.battle-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.battle-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: max(5px, env(safe-area-inset-top)) 8px 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bhud-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px 8px 8px;
  border-radius: 8px;
  background: rgba(7, 17, 38, 0.84);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(125, 211, 252, 0.24);
  border-left: 3px solid var(--ocean);
  box-shadow: 0 5px 16px rgba(2, 8, 22, 0.45), inset 0 1px 0 rgba(186, 230, 253, 0.14);
  overflow: hidden;
  pointer-events: auto;
}

.bhud-top-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.bhud-stage-group {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.bhud-wave {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 900;
  color: #7DD3FC;
  flex-shrink: 0;
}

.bhud-stage-name {
  font-size: 11.5px;
  font-weight: 900;
  color: #F8FAFC;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 82px;
}

.bhud-diff-tag {
  flex-shrink: 0;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.25;
  color: #BAE6FD;
  background: rgba(14, 116, 194, 0.24);
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.bhud-diff-tag[data-diff="easy"] {
  color: #6EE7B7;
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(52, 211, 153, 0.4);
}
.bhud-diff-tag[data-diff="nightmare"] {
  color: #FDA4AF;
  background: rgba(244, 63, 94, 0.22);
  border-color: rgba(251, 113, 133, 0.48);
}

.bhud-score {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 900;
  color: #FFFFFF;
  flex-shrink: 0;
  padding-right: 2px;
}

.bhud-vitals-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bhud-hp-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.bhud-meta-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.bhud-lv {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 900;
  color: #BAE6FD;
}

.bar-lbl {
  font-size: 9.5px;
  font-weight: 800;
  color: #BAE6FD;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.hud-art-icon {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  border: 1px solid rgba(186, 230, 253, 0.35);
  object-fit: cover;
  display: block;
}

.hud-btn-art {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  object-fit: cover;
  display: block;
}

.bar-track {
  position: relative;
  flex: 1;
  height: 7px;
  border-radius: 3px;
  background: rgba(4, 10, 24, 0.88);
  border: 1px solid rgba(148, 210, 252, 0.24);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.72);
  overflow: hidden;
}

.bar-trail {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  display: block;
  border-radius: 2px;
  background: linear-gradient(180deg, #FEF9C3 0%, #F59E0B 100%);
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-fill {
  position: relative;
  display: block;
  height: 100%;
  transition: width 0.12s linear;
}

.bar-fill.hp {
  border-radius: 2px;
  background: linear-gradient(180deg, #6EE7B7 0%, #10B981 48%, #059669 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 0 8px rgba(16, 185, 129, 0.38);
}
.bar-fill.hp::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.85);
}
.bar-fill.hp[data-low="1"] {
  background: linear-gradient(180deg, #FDA4AF 0%, #F43F5E 48%, #BE123C 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 0 10px rgba(244, 63, 94, 0.65);
  animation: hpLowPulse 0.85s ease-in-out infinite;
}
@keyframes hpLowPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.22); }
}

.bhud-exp-rail {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(4, 10, 24, 0.85);
}

.bar-fill.exp {
  background: linear-gradient(90deg, #0284C7, var(--exp-color, #38BDF8), #FEF08A);
  box-shadow: 0 0 8px color-mix(in srgb, var(--exp-color, #38BDF8) 70%, transparent);
}

.bar-val {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  color: #E2E8F0;
  white-space: nowrap;
  flex-shrink: 0;
}

.bar-dps {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  color: #FDE047;
  min-width: 48px;
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}

.bhud-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.hud-sq-btn {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid rgba(125, 211, 252, 0.3);
  background: rgba(14, 34, 68, 0.85);
  color: #E0F2FE;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.hud-sq-btn.active {
  border-color: #7DD3FC;
  color: #7DD3FC;
  background: rgba(14, 116, 194, 0.35);
}

/* Compact Boss HUD Strip (leaves generous open sky for Boss sprite!) */
.boss-hud {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(24, 9, 22, 0.84);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(251, 113, 133, 0.42);
  border-left: 3px solid var(--crimson);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.42);
}

.boss-portrait {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  object-fit: contain;
  background: radial-gradient(circle, rgba(30, 58, 138, 0.42), rgba(8, 13, 26, 0.95));
  border: 1px solid rgba(253, 164, 175, 0.52);
  flex-shrink: 0;
}

.boss-hud-body { flex: 1; min-width: 0; }
.boss-hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-weight: 900;
  color: var(--ivory);
  margin-bottom: 3px;
}

.boss-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.boss-badge {
  flex-shrink: 0;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(244, 63, 94, 0.25);
  border: 1px solid rgba(251, 113, 133, 0.55);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #FDA4AF;
}

.boss-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.boss-hp-num { font-family: var(--font-mono); font-size: 10.5px; color: #FDA4AF; flex-shrink: 0; }
.boss-bar-track {
  position: relative;
  height: 7px;
  border-radius: 3px;
  background: rgba(8, 5, 14, 0.88);
  border: 1px solid rgba(251, 113, 133, 0.3);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.75);
  overflow: hidden;
}
.boss-bar-trail {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  display: block;
  border-radius: 2px;
  background: linear-gradient(180deg, #FEF9C3 0%, #F59E0B 100%);
  transition: width 0.46s cubic-bezier(0.22, 1, 0.36, 1);
}
.boss-bar-fill {
  position: relative;
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(180deg, #FDA4AF 0%, #E11D48 46%, #9F1239 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), 0 0 10px rgba(225, 29, 72, 0.45);
  transition: width 0.09s linear;
}
.boss-bar-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.9);
}
.boss-enrage-tick {
  position: absolute;
  left: 45%;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: rgba(254, 240, 138, 0.85);
  box-shadow: 0 0 4px rgba(253, 224, 71, 0.8);
  pointer-events: none;
  z-index: 2;
}
.boss-hud.enraged .boss-bar-fill {
  background: linear-gradient(180deg, #FEF08A 0%, #F97316 42%, #DC2626 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 0 12px rgba(249, 115, 22, 0.72);
}

/* Wave Banner */
.wave-banner {
  position: absolute;
  left: 50%;
  top: 23%;
  transform: translateX(-50%);
  z-index: 14;
  text-align: center;
  padding: 9px 22px;
  background: rgba(7, 11, 22, 0.92);
  border-top: 2px solid var(--ocean);
  border-bottom: 1px solid var(--line-soft);
  pointer-events: none;
  animation: bannerIn 0.24s ease-out both;
}

@keyframes bannerIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.wave-banner-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: var(--ocean);
}

.wave-banner-title {
  font-size: 16.5px;
  font-weight: 900;
  color: var(--ivory);
  margin-top: 2px;
  white-space: nowrap;
}

/* EX Anime Ultimate Cut-in */
.cutin-overlay {
  --ult-c1: #38BDF8;
  --ult-c2: #E0F2FE;
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
  background: rgba(5, 9, 20, 0.8);
  animation: cutinIn 0.2s ease-out both;
}
.cutin-overlay[data-theme="thunder"] { --ult-c1: #60A5FA; --ult-c2: #FDE047; }
.cutin-overlay[data-theme="melt"] { --ult-c1: #FB923C; --ult-c2: #22D3EE; }
.cutin-overlay[data-theme="prism"] { --ult-c1: #F43F5E; --ult-c2: #38BDF8; }
.cutin-overlay.leaving { animation: cutinOut 0.26s ease-in forwards; }

.cutin-speedlines {
  position: absolute;
  inset: -40%;
  background: repeating-conic-gradient(from 0deg, transparent 0deg 10deg, rgba(56, 189, 248, 0.06) 10deg 11.2deg);
  animation: spinSlow 9s linear infinite;
}

.cutin-flash {
  position: absolute;
  inset: 0;
  background: rgba(186, 230, 253, 0.22);
  animation: flashOut 0.24s ease-out forwards;
}

.cutin-strip {
  position: relative;
  width: 108%;
  height: 244px;
  overflow: hidden;
  border-top: 3px solid var(--ult-c2);
  border-bottom: 3px solid var(--ult-c1);
  transform: skewY(-3.5deg);
  animation: stripIn 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.cutin-overlay.leaving .cutin-strip { animation: stripOut 0.24s ease-in forwards; }

.cutin-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 26%;
  animation: kenBurns 1.5s ease-out both;
}

.cutin-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(112deg, transparent 30%, rgba(255, 255, 255, 0.45) 48%, transparent 64%);
  animation: shineSweep 0.58s ease-out 0.2s both;
}

.cutin-caption {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 11, 22, 0.08) 0%, rgba(7, 11, 22, 0.88) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  padding: 14px 24px 15px;
}

.cutin-tag-row { display: flex; align-items: center; gap: 8px; }
.cutin-badge {
  padding: 2px 8px;
  background: var(--ult-c1);
  color: #070B16;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.05em;
}
.cutin-sub-en { font-family: var(--font-mono); font-size: 10px; font-weight: 900; color: var(--ult-c2); letter-spacing: 0.16em; }
.cutin-title { font-size: 23px; font-weight: 900; color: #FFF; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9); }
.cutin-desc { font-size: 11.5px; font-weight: 700; color: #E2E8F0; }

@keyframes cutinIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cutinOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes spinSlow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes flashOut { from { opacity: 0.7; } to { opacity: 0; } }
@keyframes stripIn { from { transform: translateX(-110%) skewY(-3.5deg); } to { transform: translateX(0) skewY(-3.5deg); } }
@keyframes stripOut { from { transform: translateX(0) skewY(-3.5deg); } to { transform: translateX(110%) skewY(-3.5deg); } }
@keyframes kenBurns { from { transform: scale(1.16); } to { transform: scale(1.03); } }
@keyframes shineSweep { from { transform: translateX(-120%); } to { transform: translateX(140%); } }

/* Bottom Touch-Safe Wand Skill Rail + Precision SVG EX Ultimate Orb */
.battle-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  padding: 0 8px max(8px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.wand-dock-panel {
  flex: 1;
  min-width: 0;
  padding: 5px 8px 6px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(10, 24, 52, 0.88) 0%, rgba(6, 15, 34, 0.92) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(125, 211, 252, 0.28);
  box-shadow: 0 10px 26px rgba(2, 8, 22, 0.55), inset 0 1px 0 rgba(186, 230, 253, 0.16);
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.14s ease;
}

.wand-dock-panel:active {
  transform: scale(0.985);
  border-color: rgba(125, 211, 252, 0.72);
}

.wand-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 20px;
}

.wand-head-left {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.wand-dock-tag {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 900;
  color: #E0F2FE;
  letter-spacing: 0.04em;
}

.wand-graze-pill {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.24);
  font-size: 9.5px;
  font-weight: 800;
  color: #94A3B8;
}

.wand-graze-pill.hot {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(125, 211, 252, 0.45);
  color: #7DD3FC;
}

.wand-syn-pill {
  --syn-color: #38BDF8;
  min-width: 0;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(14, 46, 98, 0.7);
  border: 1px solid var(--syn-color);
  font-size: 9.5px;
  font-weight: 900;
  color: #F8FAFC;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wand-warn {
  min-width: 0;
  font-size: 9.5px;
  font-weight: 800;
  color: #FBBF24;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wand-edit-btn {
  flex-shrink: 0;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  height: 21px;
  border: 1px solid rgba(125, 211, 252, 0.55);
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(14, 116, 194, 0.48), rgba(12, 74, 148, 0.52));
  color: #F0F9FF;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.wand-edit-btn:active { transform: scale(0.95); }

.wand-strip-slots {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.mini-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(148, 163, 184, 0.26);
}

.mini-link.linked {
  color: rgba(125, 211, 252, 0.85);
}

.mini-chev { display: block; }

.mini-slot {
  flex: 1 1 0;
  min-width: 0;
  height: 46px;
  border-radius: 6px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 2px 2px 3px;
  transition: transform 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease;
}

.wand-strip-slots.compact .mini-slot {
  flex: 0 0 38px;
}

.mini-slot.filled {
  background: linear-gradient(180deg, rgba(14, 34, 72, 0.92), rgba(7, 17, 38, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.mini-slot.filled.kind-core {
  border-color: rgba(56, 189, 248, 0.78);
  background: linear-gradient(180deg, rgba(14, 52, 108, 0.88), rgba(8, 22, 50, 0.95));
}

.mini-slot.filled.kind-mod {
  border-color: rgba(100, 116, 139, 0.65);
}

.mini-slot.filled.kind-trigger {
  border-color: rgba(245, 158, 11, 0.82);
  background: linear-gradient(180deg, rgba(78, 44, 14, 0.72), rgba(26, 16, 12, 0.94));
}

.mini-slot.filled.firing {
  border-color: #FFFFFF;
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.9), inset 0 0 8px rgba(186, 230, 253, 0.35);
  transform: translateY(-2px);
}

.mini-ico-box {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  overflow: hidden;
  background: #060E21;
  flex-shrink: 0;
}

.mini-ico-box .art-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mini-lbl {
  width: 100%;
  text-align: center;
  font-size: 8.5px;
  font-weight: 800;
  line-height: 1.05;
  color: #CBD5E1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-slot.kind-core .mini-lbl { color: #BAE6FD; }
.mini-slot.kind-trigger .mini-lbl { color: #FDE68A; }

.mini-slot .lv-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 0 2.5px;
  border-top-left-radius: 3px;
  background: rgba(6, 12, 26, 0.88);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 900;
  color: #FDE047;
  line-height: 1.25;
}

.mini-slot.empty {
  background: rgba(6, 15, 34, 0.45);
  border: 1px dashed rgba(125, 211, 252, 0.16);
  box-shadow: inset 0 2px 6px rgba(2, 6, 16, 0.45);
}

.mini-empty-plus {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: rgba(125, 211, 252, 0.24);
}

.mini-empty-num {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  color: rgba(148, 163, 184, 0.3);
  line-height: 1;
}

/* Precision SVG Orbital EX Ultimate Button */
.ult-btn {
  --ult-pct: 0;
  position: relative;
  width: 78px;
  height: 78px;
  padding: 0;
  flex-shrink: 0;
  pointer-events: auto;
  touch-action: manipulation;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle, rgba(10, 24, 54, 0.92) 60%, rgba(6, 14, 32, 0.96) 100%);
  cursor: not-allowed;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(2, 8, 24, 0.68), inset 0 0 0 1px rgba(125, 211, 252, 0.2);
}

.ult-btn::before { content: ''; position: absolute; inset: -8px; border-radius: 50%; }

.ult-svg-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

.ult-track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.2);
  stroke-width: 4;
}

.ult-arc {
  fill: none;
  stroke: #38BDF8;
  stroke-width: 4.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.14s linear, stroke 0.2s ease;
  filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.65));
}

.ult-core {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #060E21;
  border: 1.5px solid rgba(186, 230, 253, 0.28);
  overflow: hidden;
  display: block;
}

.ult-icon {
  position: absolute;
  inset: 0;
  opacity: 0.88;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ult-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.06) translateY(-3px);
}

.ult-vignette {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 14, 32, 0.05) 0%, rgba(6, 14, 32, 0.08) 46%, rgba(4, 10, 24, 0.92) 86%, rgba(4, 10, 24, 0.98) 100%);
  pointer-events: none;
}

.ult-readout {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
}

.ult-sub-tag {
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #7DD3FC;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
}

.ult-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.95);
}

.ult-btn.ready {
  cursor: pointer;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.55), 0 8px 24px rgba(2, 8, 24, 0.72);
  animation: ultPulse 0.95s ease-in-out infinite;
}

.ult-btn.ready .ult-arc {
  stroke: #FDE047;
  filter: drop-shadow(0 0 6px rgba(253, 224, 71, 0.9));
}

.ult-btn.ready::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px dashed rgba(253, 224, 71, 0.85);
  pointer-events: none;
  animation: spinSlow 6s linear infinite;
}

.ult-btn.ready .ult-core {
  border-color: rgba(253, 224, 71, 0.85);
}

.ult-btn.ready .ult-icon { opacity: 1; }
.ult-btn.ready .ult-sub-tag { color: #FDE047; }
.ult-btn.ready .ult-label {
  color: #FEF08A;
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.ult-btn.ready:active { transform: scale(0.93); }
@keyframes ultPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* =========================================================================
   MODALS: EDITORIAL SHARP-EDGE DIALOGS
   ========================================================================= */
.modal-mask {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(4, 7, 15, 0.82);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.modal-box {
  width: 100%;
  max-height: calc(100% - 12px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(13, 28, 58, 0.96) 0%, rgba(7, 15, 34, 0.98) 100%);
  border: 1px solid rgba(125, 211, 252, 0.34);
  border-top: 3px solid var(--ocean);
  padding: 14px;
  box-shadow: 0 24px 60px rgba(2, 8, 22, 0.8), inset 0 1px 0 rgba(186, 230, 253, 0.16);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-eyebrow {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.13em;
  color: var(--ocean);
}

.modal-title { margin: 2px 0 0; font-size: 17px; font-weight: 900; color: var(--ivory); }

.upgrade-chain-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 7px 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
  font-size: 11px;
  color: #CBD5E1;
}

.upgrade-cards { display: flex; flex-direction: column; gap: 7px; }

.up-card {
  width: 100%;
  padding: 10px;
  border-radius: 3px;
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--ocean);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.up-card:active { background: #1B2746; }
.up-card.kind-core { border-left-color: var(--ocean); }
.up-card.kind-mod { border-left-color: var(--mint); }
.up-card.kind-trigger { border-left-color: var(--gold); }
.up-card.kind-relic { border-left-color: var(--crimson); }

.up-icon {
  width: 48px;
  height: 48px;
  border-radius: 2px;
  border: 1px solid var(--line-soft);
  background: #080D1A;
  flex-shrink: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.up-icon .art-icon { width: 100%; height: 100%; object-fit: cover; display: block; }

.up-body { flex: 1; min-width: 0; }
.up-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.up-top strong { font-size: 14px; font-weight: 900; color: var(--ivory); }
.up-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold);
}
.up-desc { margin-top: 3px; font-size: 11px; color: #CBD5E1; line-height: 1.38; }
.up-impact {
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ocean);
}
.up-impact.hot { color: #FBBF24; }

/* Workshop */
.ws-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.btn-resume-sm {
  border: none;
  border-radius: 3px;
  padding: 7px 12px;
  background: var(--ivory);
  color: #080D1A;
  font-size: 12.5px;
  font-weight: 900;
  cursor: pointer;
}

.ws-rule-tip {
  padding: 7px 9px;
  background: rgba(56, 189, 248, 0.08);
  border-left: 3px solid var(--ocean);
  font-size: 11px;
  line-height: 1.4;
  color: #CBD5E1;
}
.ws-rule-tip code {
  background: rgba(255, 255, 255, 0.12);
  padding: 1px 4px;
  font-family: var(--font-mono);
  color: var(--ivory);
}

.ws-circuit-box {
  padding: 8px 9px;
  background: #080D1A;
  border: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ws-circuit-head {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-sub);
}
.ws-est-dps { font-family: var(--font-mono); color: var(--ocean); }

.ws-circuit-groups {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ws-group-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 2px solid var(--ocean);
  font-size: 11px;
}
.ws-g-tag {
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.16);
  color: var(--ivory);
}
.ws-g-tag.trig { background: rgba(245, 158, 11, 0.22); color: #FDE68A; }
.ws-g-stat { font-family: var(--font-mono); font-size: 10px; color: var(--text-sub); margin-left: auto; }

.ws-synergy-row { display: flex; flex-wrap: wrap; gap: 5px; }
.ws-syn-pill {
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.16);
  border-left: 3px solid var(--ocean);
  color: var(--ivory);
}

.ws-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-sub);
}

.ws-tools { display: flex; gap: 5px; }

.ws-tool-btn {
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  color: var(--ivory);
  border-radius: 3px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.ws-tool-btn.gold { border-color: var(--gold); color: #FDE68A; background: rgba(245, 158, 11, 0.18); }

.ws-wand-grid, .ws-bag-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.ws-slot {
  position: relative;
  min-height: 66px;
  border-radius: 3px;
  border: 1px dashed rgba(148, 163, 184, 0.32);
  background: #0A1020;
  color: var(--ivory);
  padding: 5px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: grab;
  touch-action: none;
}
.ws-slot.filled { border-style: solid; }
.ws-slot.kind-core { border-color: var(--ocean); background: #10203B; }
.ws-slot.kind-mod { border-color: #64748B; background: #131B2E; }
.ws-slot.kind-trigger { border-color: var(--gold); background: #261C12; }
.ws-slot.selected { border-color: #FFF !important; box-shadow: inset 0 0 0 1px #FFF; transform: translateY(-2px); }
.ws-slot.drag-over { border-color: var(--ocean) !important; background: rgba(56, 189, 248, 0.22); }

.ws-slot .slot-idx {
  position: absolute;
  left: 4px;
  top: 2px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--text-sub);
}
.ws-slot .slot-lv {
  position: absolute;
  right: 4px;
  top: 2px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 900;
  color: var(--gold);
}
.ws-slot .slot-ico-img { width: 34px; height: 34px; border-radius: 2px; object-fit: cover; margin-top: 8px; }
.ws-slot .slot-nm { font-size: 10px; font-weight: 800; text-align: center; }

.ws-inspect {
  padding: 8px 9px;
  background: #080D1A;
  border: 1px solid var(--line-soft);
  font-size: 11px;
  color: #CBD5E1;
  line-height: 1.4;
}
.ws-inspect-row { display: flex; align-items: center; gap: 9px; }
.ws-inspect-ico { width: 34px; height: 34px; border-radius: 2px; object-fit: cover; flex-shrink: 0; }
.ws-sel-hint { font-size: 10px; color: var(--ocean); }

.btn-outline-sm {
  width: 100%;
  padding: 9px;
  border-radius: 3px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ivory);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}

/* =========================================================================
   DEFEAT OVERLAY (EDITORIAL ANIME CURTAIN)
   ========================================================================= */
.defeat-mask { padding: 0; background: rgba(5, 8, 18, 0.88); }
.defeat-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px 16px max(24px, env(safe-area-inset-bottom));
}

.defeat-bg-hero {
  position: absolute;
  right: -20px;
  top: 4%;
  height: 64%;
  width: auto;
  object-fit: contain;
  opacity: 0.65;
  filter: saturate(0.75) contrast(1.06);
  pointer-events: none;
}

.defeat-vignette {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(16, 6, 14, 0.35) 0%, rgba(7, 11, 22, 0.16) 28%, rgba(7, 11, 22, 0.9) 56%, rgba(7, 11, 22, 0.99) 78%);
  pointer-events: none;
}

.defeat-panel { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 12px; }
.defeat-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding-left: 11px; border-left: 4px solid var(--crimson); }
.defeat-h-left { display: flex; flex-direction: column; gap: 2px; }
.defeat-kicker { font-family: var(--font-mono); font-size: 10.5px; font-weight: 800; letter-spacing: 0.14em; color: #FB7185; }
.defeat-title { margin: 0; font-family: var(--font-mono); font-size: 26px; line-height: 1; font-weight: 900; color: var(--ivory); }
.defeat-rank-sub { font-size: 12px; font-weight: 700; color: #CBD5E1; }

.defeat-seal {
  flex-shrink: 0;
  min-width: 52px;
  height: 52px;
  padding: 0 8px;
  border: 2.5px solid var(--crimson);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 900;
  color: #FDA4AF;
  background: rgba(159, 18, 57, 0.22);
  transform: rotate(-7deg);
}

.defeat-killer-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(13, 19, 36, 0.85);
  border-top: 1px solid rgba(244, 63, 94, 0.42);
  border-bottom: 1px solid var(--line-soft);
}
.defeat-boss-thumb { width: 46px; height: 46px; object-fit: contain; background: #070B16; border: 1px solid var(--line-soft); flex-shrink: 0; }
.defeat-killer-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; text-align: left; }
.defeat-killer-lbl { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-sub); }
.defeat-cause-val { font-size: 13px; font-weight: 900; color: #FDE047; }
.defeat-nemesis-sub { font-size: 11px; color: #CBD5E1; font-weight: 700; }

.defeat-ledger {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(11, 16, 30, 0.72);
}
.d-cell { padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.d-cell + .d-cell { border-left: 1px solid var(--line-soft); }
.d-k { font-size: 9.5px; color: var(--text-sub); font-weight: 700; }
.d-v { font-family: var(--font-mono); font-size: 14px; font-weight: 900; color: var(--ivory); }

.defeat-wand-row { display: flex; align-items: center; gap: 8px; }
.defeat-wand-lbl { flex-shrink: 0; font-size: 10.5px; font-weight: 800; color: var(--text-sub); }
.defeat-wand-chain { display: flex; flex-wrap: wrap; gap: 4px; }
.defeat-rune-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 2px;
  background: #0F172A;
  border: 1px solid var(--line-soft);
}
.defeat-rune-chip.kind-core { border-color: var(--ocean); }
.defeat-rune-chip.kind-trigger { border-color: var(--gold); }
.defeat-rune-ico { width: 20px; height: 20px; object-fit: cover; display: block; }
.defeat-rune-name { font-size: 10.5px; font-weight: 800; color: var(--ivory); }

.defeat-actions { display: flex; flex-direction: column; gap: 8px; }
.btn-arcade-retry {
  width: 100%;
  border: none;
  border-left: 5px solid var(--crimson);
  border-radius: 3px;
  padding: 12px 16px;
  background: var(--ivory);
  color: #080D1A;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}
.defeat-sub-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.btn-arcade-sub {
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 9px 6px;
  background: rgba(13, 19, 36, 0.85);
  color: var(--ivory);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

/* =========================================================================
   SCREEN 3: RESULT & ARCHIVAL POSTER STAGE (CLEAN MATTE, ZERO PINK GLOW)
   ========================================================================= */
.result-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: max(14px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom));
  background: #0A0E1B;
}

.result-panel { display: flex; flex-direction: column; gap: 10px; }
.result-head { padding-left: 10px; border-left: 4px solid var(--ocean); }
.result-kicker { font-family: var(--font-mono); font-size: 10px; font-weight: 800; letter-spacing: 0.14em; color: var(--ocean); }
.result-title { margin: 2px 0; font-size: 19px; font-weight: 900; color: var(--ivory); }
.result-sub { margin: 0; font-size: 12px; color: var(--text-sub); font-weight: 700; }

.poster-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  border-radius: 14px;
}
.poster-stage::after {
  content: '';
  position: absolute;
  inset: -10% -60%;
  background: linear-gradient(
    115deg,
    transparent 34%,
    rgba(253, 224, 71, 0.22) 44%,
    rgba(255, 255, 255, 0.42) 50%,
    rgba(232, 121, 249, 0.24) 56%,
    transparent 66%
  );
  pointer-events: none;
  mix-blend-mode: screen;
  animation: posterHoloSweep 3.4s ease-in-out infinite;
}
@keyframes posterHoloSweep {
  0% { transform: translateX(-65%); }
  45%, 100% { transform: translateX(65%); }
}
.poster-img {
  width: 100%;
  display: block;
  border-radius: 12px;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.72),
    0 0 26px rgba(56, 189, 248, 0.34),
    0 0 46px rgba(253, 224, 71, 0.22);
  animation: posterAuraPulse 2.8s ease-in-out infinite;
}
@keyframes posterAuraPulse {
  0%, 100% {
    box-shadow:
      0 18px 42px rgba(0, 0, 0, 0.72),
      0 0 22px rgba(56, 189, 248, 0.32),
      0 0 40px rgba(253, 224, 71, 0.2);
  }
  50% {
    box-shadow:
      0 18px 44px rgba(0, 0, 0, 0.76),
      0 0 34px rgba(232, 121, 249, 0.45),
      0 0 58px rgba(253, 224, 71, 0.36);
  }
}
.poster-tip { text-align: center; font-size: 11px; color: var(--text-sub); }

.name-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  background: var(--bg-surface);
  border: 1px solid var(--line-soft);
}
.name-row label { font-size: 11.5px; font-weight: 800; color: var(--text-sub); }
.name-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line-soft);
  background: #070B16;
  color: var(--ivory);
  padding: 6px 8px;
  font-size: 12.5px;
  font-weight: 700;
}

.result-btn-stack { display: flex; flex-direction: column; gap: 7px; }
.result-btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }

.btn-result-copy {
  border: none;
  border-radius: 3px;
  padding: 11px;
  background: var(--ocean-deep);
  color: #FFF;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.btn-sec {
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 10px;
  background: var(--bg-card);
  color: var(--ivory);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}

/* =========================================================================
   CODEX & LEADERBOARD & IMPORT MODALS
   ========================================================================= */
#codexModal { z-index: 42; }
#guideModal { z-index: 44; }
.codex-box { height: calc(100% - 12px); overflow: hidden; }
.codex-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.codex-scroll::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.codex-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.codex-tab {
  padding: 6px 4px;
  border-radius: 4px;
  border: 1px solid rgba(125, 211, 252, 0.22);
  background: #080D1A;
  color: var(--text-sub);
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.codex-tab.active {
  border-color: var(--ocean);
  background: rgba(14, 116, 194, 0.34);
  color: #FFFFFF;
}

.codex-detail-mask {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: rgba(4, 8, 20, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.codex-detail {
  width: 100%;
  max-width: 374px;
  padding: 14px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(16, 33, 68, 0.98) 0%, rgba(8, 15, 32, 0.99) 100%);
  border: 1px solid rgba(56, 189, 248, 0.65);
  border-top: 3px solid var(--ocean);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(186, 230, 253, 0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: modalPopIn 0.16s ease-out both;
}

@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

.codex-detail-stage {
  position: relative;
  width: 100%;
  height: 216px;
  border-radius: 8px;
  background: radial-gradient(circle at 50% 48%, rgba(28, 54, 108, 0.55) 0%, #050914 78%);
  border: 1px solid rgba(125, 211, 252, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
}

.codex-detail-art {
  width: 100%;
  height: 100%;
  max-height: 200px;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.72)) drop-shadow(0 0 14px rgba(56, 189, 248, 0.22));
}

.codex-detail-badge-art {
  width: 112px;
  height: 112px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.45);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 900;
  color: #7DD3FC;
}

.codex-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.codex-detail-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 900;
  color: #7DD3FC;
}

.codex-detail-name {
  font-size: 15px;
  font-weight: 900;
  color: #FFFFFF;
  line-height: 1.2;
}

.codex-detail-sub {
  font-size: 11px;
  font-weight: 700;
  color: #FDE047;
}

.codex-detail-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.codex-stat-pill {
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(4, 10, 24, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.28);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  color: #E2E8F0;
}

.codex-detail-desc {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: #CBD5E1;
}

.codex-detail-foot {
  display: flex;
  justify-content: flex-end;
}

.codex-syn-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.codex-syn-tag {
  padding: 3px 7px;
  font-size: 10.5px;
  font-weight: 800;
  background: #080D1A;
  border: 1px solid var(--line-soft);
  color: var(--text-sub);
  cursor: pointer;
}
.codex-syn-tag.unlocked {
  border-color: var(--ocean);
  color: var(--ivory);
  background: rgba(56, 189, 248, 0.14);
}

.codex-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.codex-card {
  padding: 7px 6px;
  background: #080D1A;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.14s ease, transform 0.12s ease;
}
.codex-card:active { transform: scale(0.97); }
.codex-card.active {
  border-color: #FDE047;
  background: rgba(250, 204, 21, 0.08);
  box-shadow: inset 0 0 0 1px rgba(253, 224, 71, 0.35);
}
.codex-card.cleared { border-color: rgba(56, 189, 248, 0.55); }
.codex-img { width: 64px; height: 64px; object-fit: contain; display: block; border-radius: 4px; }
.codex-card.locked .codex-img { filter: grayscale(0.55) brightness(0.78); opacity: 0.9; }
.codex-syn-ico {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 900;
  color: #E0F2FE;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.42);
}
.codex-wave { font-family: var(--font-mono); font-size: 9px; color: var(--ocean); font-weight: 800; }
.codex-name { font-size: 11px; font-weight: 900; color: var(--ivory); line-height: 1.2; }
.codex-stat { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-sub); }

/* Pause Menu Modal */
.pause-box { display: flex; flex-direction: column; gap: 11px; }
.pause-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.pause-stat-cell {
  padding: 7px 5px;
  border-radius: 5px;
  background: #080D1A;
  border: 1px solid var(--line-soft);
  text-align: center;
}
.pause-stat-cell b {
  display: block;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 900;
  color: var(--ocean);
}
.pause-stat-cell span {
  font-size: 9.5px;
  color: var(--text-sub);
  font-weight: 700;
}
.pause-chain-wrap {
  padding: 8px 9px;
  border-radius: 5px;
  background: #080D1A;
  border: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pause-chain-lbl {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-sub);
}
.pause-actions { display: flex; flex-direction: column; gap: 8px; }
.pause-btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.pause-btn-row.three { grid-template-columns: repeat(3, 1fr); }
.btn-outline-sm.danger {
  border-color: rgba(244, 63, 94, 0.55);
  color: #FDA4AF;
  background: rgba(159, 18, 57, 0.16);
}

/* How-to-Play Guide Modal */
.guide-box { display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.guide-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  padding-right: 2px;
}
.guide-card {
  padding: 9px 10px;
  border-radius: 6px;
  background: #080D1A;
  border: 1px solid rgba(125, 211, 252, 0.22);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.guide-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #FFFFFF;
}
.guide-num {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #7DD3FC;
}
.guide-formula {
  padding: 5px 8px;
  border-radius: 4px;
  background: rgba(14, 116, 194, 0.2);
  border: 1px dashed rgba(125, 211, 252, 0.42);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  color: #FDE047;
  text-align: center;
}
.guide-list {
  margin: 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  line-height: 1.48;
  color: #CBD5E1;
}
.guide-list b { color: #F8FAFC; }
.guide-list code {
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(56, 189, 248, 0.14);
  color: #7DD3FC;
  font-family: var(--font-mono);
  font-size: 10px;
}

.rank-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--text-sub); }
.rank-status { padding: 6px 9px; background: rgba(245, 158, 11, 0.15); color: #FDE68A; font-size: 11px; }
.rank-list { display: flex; flex-direction: column; gap: 5px; max-height: 46dvh; overflow-y: auto; }
.rank-item { display: flex; align-items: center; gap: 9px; padding: 8px 9px; background: #080D1A; border: 1px solid var(--line-soft); }
.rank-item.me { border-color: var(--ocean); background: rgba(56, 189, 248, 0.12); }
.rank-num { width: 24px; height: 24px; background: #1E293B; display: grid; place-items: center; font-family: var(--font-mono); font-size: 11.5px; font-weight: 900; }
.rank-item:nth-child(1) .rank-num { background: #EAB308; color: #080D1A; }
.rank-item:nth-child(2) .rank-num { background: #CBD5E1; color: #080D1A; }
.rank-item:nth-child(3) .rank-num { background: #EA580C; color: #FFF; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-size: 12.5px; font-weight: 900; }
.rank-build { font-size: 10px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-score { font-family: var(--font-mono); font-size: 13px; font-weight: 900; color: var(--ocean); }
.rank-my-foot { text-align: center; font-size: 11px; color: var(--text-sub); padding-top: 6px; border-top: 1px solid var(--line-soft); }

.import-desc { margin: 0; font-size: 11.5px; color: #CBD5E1; line-height: 1.45; }
.import-input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  background: #070B16;
  color: var(--ivory);
  font-family: var(--font-mono);
  font-size: 13px;
}
.import-preview {
  padding: 8px 10px;
  background: #080D1A;
  border: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--ocean);
  min-height: 36px;
  line-height: 1.45;
  border-radius: 6px;
}
.import-textarea {
  resize: none;
  line-height: 1.45;
  font-size: 12px;
  border-radius: 6px;
}
.import-actions {
  display: grid;
  grid-template-columns: 0.95fr 1.35fr;
  gap: 8px;
  align-items: center;
}
.st-node.editable {
  cursor: pointer;
}
.st-node.editable:hover .st-node-frame {
  border-color: #FDE047;
}
.st-edit-pill {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.55);
  background: rgba(250, 204, 21, 0.14);
  color: #FDE047;
  font-size: 9.5px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.custom-starter-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.custom-slot-wrap {
  padding: 9px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(22, 39, 74, 0.95) 0%, rgba(12, 23, 48, 0.96) 100%);
  border: 1px solid rgba(250, 204, 21, 0.42);
  box-shadow: inset 0 1px 0 rgba(250, 204, 21, 0.16);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.custom-pool-wrap {
  padding: 9px;
  border-radius: 10px;
  background: #040812;
  border: 1px solid rgba(56, 189, 248, 0.22);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.custom-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.custom-sec-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.16);
  border: 1px solid rgba(250, 204, 21, 0.5);
  color: #FDE047;
  font-size: 10px;
  font-weight: 900;
}
.custom-sec-badge.pool {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.45);
  color: #7DD3FC;
}
.custom-sec-tip {
  font-size: 10px;
  color: #94A3B8;
  font-weight: 700;
}
.custom-slot-bar {
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.custom-slot-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(250, 204, 21, 0.75);
  font-size: 12px;
  font-weight: 900;
  flex-shrink: 0;
}
.custom-slot-btn {
  flex: 1;
  min-width: 0;
  position: relative;
  padding: 8px 4px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(7, 13, 28, 0.9);
  color: #E2E8F0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}
.custom-slot-btn.kind-core { border-color: rgba(56, 189, 248, 0.45); }
.custom-slot-btn.kind-mod { border-color: rgba(52, 211, 153, 0.45); }
.custom-slot-btn.kind-trigger { border-color: rgba(232, 121, 249, 0.45); }
.custom-slot-btn.active {
  border-color: #FACC15;
  background: rgba(250, 204, 21, 0.14);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.45), 0 4px 14px rgba(250, 204, 21, 0.16);
}
.custom-chain-live {
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(4, 9, 22, 0.78);
  border: 1px solid rgba(125, 211, 252, 0.2);
  font-size: 10px;
  color: #BAE6FD;
  line-height: 1.35;
}
.custom-filter-tabs {
  display: flex;
  gap: 4px;
}
.custom-filter-tab {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.75);
  color: #94A3B8;
  font-size: 9.5px;
  font-weight: 800;
  cursor: pointer;
}
.custom-filter-tab.active {
  border-color: #38BDF8;
  background: rgba(56, 189, 248, 0.18);
  color: #F8FAFC;
}
.custom-pool-btn.kind-core .custom-pool-kind { color: #38BDF8; }
.custom-pool-btn.kind-mod .custom-pool-kind { color: #34D399; }
.custom-pool-btn.kind-trigger .custom-pool-kind { color: #E879F9; }
.custom-foot-actions {
  display: grid;
  grid-template-columns: 0.72fr 0.78fr 1.5fr;
  gap: 6px;
  align-items: center;
}
.custom-slot-editing {
  position: absolute;
  top: -7px;
  right: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #FACC15;
  color: #090D16;
  font-size: 8.5px;
  font-weight: 900;
}
.custom-slot-btn img,
.custom-pool-btn img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}
.custom-slot-btn span { font-size: 9px; color: #94A3B8; font-weight: 800; }
.custom-slot-btn strong { font-size: 10.5px; color: #FFFFFF; white-space: nowrap; }
.custom-rune-pool {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 248px;
  overflow-y: auto;
}
.custom-pool-btn {
  padding: 7px 8px;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #070C18;
  color: #CBD5E1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  cursor: pointer;
  text-align: left;
}
.custom-pool-btn.selected {
  border-color: #38BDF8;
  background: rgba(56, 189, 248, 0.14);
}
.custom-pool-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.custom-pool-head img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
}
.custom-pool-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.custom-pool-btn span { font-size: 8.5px; color: #7DD3FC; font-weight: 800; }
.custom-pool-btn strong { font-size: 11px; color: #F8FAFC; line-height: 1.15; }
.custom-pool-desc {
  margin: 0;
  font-size: 9.5px;
  line-height: 1.38;
  color: #94A3B8;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 112px;
  transform: translateX(-50%);
  z-index: 60;
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(7, 11, 22, 0.96);
  border: 1px solid var(--ocean);
  color: var(--ivory);
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================================
   5-STAGE EVOLUTION FORM & ULTIMATE TIER UPGRADE UI
   ========================================================================= */
.hud-form-pill {
  --form-color: #38BDF8;
  flex-shrink: 0;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.03em;
  color: var(--form-color);
  background: rgba(8, 18, 38, 0.85);
  border: 1px solid color-mix(in srgb, var(--form-color) 65%, transparent);
  line-height: 1.25;
}
.hud-form-pill[data-tier="4"],
.hud-form-pill[data-tier="5"] {
  color: #070B16;
  background: linear-gradient(135deg, var(--form-color), #FDE047);
  border-color: #FEF08A;
  box-shadow: 0 0 8px color-mix(in srgb, var(--form-color) 70%, transparent);
}

.evo-banner {
  --evo-c1: #38BDF8;
  --evo-c2: #FDE047;
  padding: 8px 10px;
  border-radius: 7px;
  background: linear-gradient(135deg, rgba(10, 22, 48, 0.94), rgba(20, 14, 42, 0.94));
  border: 1px solid color-mix(in srgb, var(--evo-c1) 75%, transparent);
  border-left: 3px solid var(--evo-c2);
  box-shadow: 0 0 18px color-mix(in srgb, var(--evo-c1) 24%, transparent);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.evo-banner-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.evo-banner-tag {
  padding: 1px 6px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--evo-c1), var(--evo-c2));
  color: #070B16;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 900;
}
.evo-banner-head strong {
  font-size: 12.5px;
  font-weight: 900;
  color: #FFFFFF;
}
.evo-banner-perk {
  font-size: 10.5px;
  font-weight: 700;
  color: #E2E8F0;
}
.evo-banner-ult {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--evo-c2);
}
.evo-banner.is-progress {
  padding: 6px 9px;
  background: rgba(10, 20, 42, 0.78);
  border-left-color: var(--evo-c1);
  box-shadow: none;
}
.evo-banner.is-progress .evo-banner-head strong {
  font-size: 11px;
  color: #E2E8F0;
}
.evo-banner-remain {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 900;
  color: var(--evo-c2);
}

.cutin-tier-pill {
  padding: 2px 7px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--evo-c1, #F59E0B), var(--evo-c2, #FDE047));
  color: #070B16;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.06em;
  box-shadow: 0 0 12px rgba(253, 224, 71, 0.55);
}
.cutin-overlay[data-tier="3"] .cutin-strip {
  box-shadow: 0 0 28px rgba(129, 140, 248, 0.45);
}
.cutin-overlay[data-tier="4"] .cutin-strip {
  border-top-width: 4px;
  border-bottom-width: 4px;
  border-top-color: #FDE047;
  border-bottom-color: #F59E0B;
  box-shadow: 0 0 38px rgba(245, 158, 11, 0.62);
}
.cutin-overlay[data-tier="5"] .cutin-strip {
  border-top-width: 4px;
  border-bottom-width: 4px;
  border-top-color: #FDE047;
  border-bottom-color: #E879F9;
  box-shadow: 0 0 48px rgba(232, 121, 249, 0.72), 0 0 22px rgba(253, 224, 71, 0.6);
}
.cutin-overlay[data-tier="5"] .cutin-speedlines {
  background: repeating-conic-gradient(from 0deg, transparent 0deg 8deg, rgba(232, 121, 249, 0.14) 8deg 9.5deg, rgba(253, 224, 71, 0.1) 9.5deg 10.2deg);
}

.ult-btn.ready[data-tier="4"] .ult-arc {
  stroke: #F59E0B;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.9));
}
.ult-btn.ready[data-tier="5"] .ult-arc {
  stroke: #E879F9;
  filter: drop-shadow(0 0 8px rgba(232, 121, 249, 0.95));
}


/* =====================================================================
   BOOT LOADER & LOW-BANDWIDTH SAFE IMAGE REVEAL
   ===================================================================== */
.boot-loader {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: radial-gradient(circle at 50% 34%, rgba(20, 48, 102, 0.96) 0%, #070C1A 72%);
  transition: opacity 0.34s ease, visibility 0.34s ease;
}
.boot-loader.leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boot-loader-inner {
  width: 100%;
  max-width: 310px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.boot-emblem {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.16) 0%, rgba(15, 23, 42, 0.2) 70%);
  box-shadow: 0 0 28px rgba(56, 189, 248, 0.25);
  animation: bootFloat 2.2s ease-in-out infinite;
}
.boot-emblem svg circle:first-child {
  transform-origin: 40px 40px;
  animation: bootSpin 7s linear infinite;
}
@keyframes bootFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes bootSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.boot-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #7DD3FC;
  opacity: 0.88;
}
.boot-title {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.03em;
  color: #F8FAFC;
  text-shadow: 0 2px 12px rgba(56, 189, 248, 0.35);
}
.boot-bar-track {
  width: 100%;
  height: 7px;
  margin-top: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.32);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}
.boot-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0284C7 0%, #38BDF8 55%, #FACC15 100%);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
  transition: width 0.22s ease-out;
}
.boot-meta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #94A3B8;
}
.boot-meta #bootPct {
  font-family: var(--font-mono);
  color: #7DD3FC;
}

/* Smooth fade-in for images — prevents ugly browser broken-photo icons on slow networks */
img.img-lazy,
img.img-retrying {
  opacity: 0 !important;
  transition: opacity 0.2s ease-out;
}
img.img-ready {
  opacity: 1;
  transition: opacity 0.22s ease-out;
}
