:root {
  color-scheme: dark;
  --bg-0: #050b12;
  --bg-1: #08131f;
  --bg-2: #0e1c29;
  --panel: rgba(12, 25, 38, 0.9);
  --panel-strong: rgba(13, 28, 43, 0.98);
  --panel-soft: rgba(23, 41, 56, 0.66);
  --line: rgba(178, 222, 245, 0.14);
  --line-bright: rgba(180, 229, 250, 0.3);
  --text: #eef8fd;
  --muted: #9cb0bd;
  --muted-2: #6f8796;
  --cyan: #68dcff;
  --cyan-2: #2bbbe8;
  --violet: #ad8bff;
  --orange: #ffb35d;
  --red: #ff7868;
  --green: #6ef0b0;
  --yellow: #ffd06b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --shadow-small: 0 12px 32px rgba(0, 0, 0, 0.24);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 15px;
  --radius-sm: 10px;
  --header-height: 74px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg-0);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 16% -10%, rgba(58, 185, 230, 0.16), transparent 35%),
    radial-gradient(circle at 86% 4%, rgba(154, 97, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #07111b, #050a11 55%, #03070c);
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
}

p,
h1,
h2,
h3 {
  margin-top: 0;
}

#screen {
  min-height: 100vh;
}

.app-shell {
  min-height: 100vh;
  position: relative;
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
  z-index: 0;
}

.content-main,
.home-main {
  position: relative;
  z-index: 1;
}

.content-main {
  width: min(1500px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.text-button,
.icon-button,
.nav-button,
.brand-button,
.battle-icon-button,
.mission-play,
.filter-tabs button {
  border: 0;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  min-height: 44px;
  border-radius: 12px;
  padding: 0 18px;
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(135deg, #6ee5ff, #54b9ef 58%, #9d8dff);
  color: #04101a;
  box-shadow: 0 10px 34px rgba(75, 199, 244, 0.22);
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(75, 199, 244, 0.3);
}

.primary-button:disabled {
  opacity: 0.35;
}

.secondary-button {
  color: var(--text);
  background: rgba(121, 196, 230, 0.1);
  border: 1px solid rgba(150, 222, 250, 0.24);
}

.secondary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: rgba(121, 196, 230, 0.17);
  border-color: rgba(150, 222, 250, 0.42);
}

.ghost-button {
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
}

.ghost-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.danger-button {
  color: #ffd8d1;
  background: rgba(255, 94, 78, 0.12);
  border: 1px solid rgba(255, 121, 104, 0.3);
}

.text-button {
  color: var(--cyan);
  padding: 5px 0;
  background: transparent;
  font-weight: 700;
}

.text-button:hover {
  color: #d7f8ff;
}

.text-button.danger {
  color: #ff9a8d;
}

.large {
  min-height: 62px;
  min-width: 190px;
  padding: 10px 22px;
  text-align: left;
}

.large span,
.large small {
  display: block;
}

.large span {
  font-size: 17px;
}

.large small {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 650;
  opacity: 0.72;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 22px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 12, 19, 0.82);
  backdrop-filter: blur(22px);
}

.app-header.is-transparent {
  position: absolute;
  width: 100%;
  background: linear-gradient(180deg, rgba(5, 11, 18, 0.92), rgba(5, 11, 18, 0.1));
  border-bottom-color: transparent;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right {
  justify-content: flex-end;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.nav-button {
  height: 38px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 750;
}

.nav-button:hover,
.nav-button.is-active {
  color: var(--text);
  background: rgba(102, 217, 255, 0.1);
}

.nav-button.is-active {
  box-shadow: inset 0 0 0 1px rgba(104, 220, 255, 0.15);
}

.brand-button {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0;
  text-align: left;
  background: transparent;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(110, 223, 255, 0.38);
  border-radius: 12px;
  color: #07111a;
  background: linear-gradient(135deg, #75e7ff, #9f8dff);
  font-size: 12px;
  font-weight: 950;
  box-shadow: 0 0 24px rgba(93, 210, 255, 0.2);
}

.brand-button strong,
.brand-button small {
  display: block;
}

.brand-button strong {
  font-size: 15px;
  letter-spacing: 0.05em;
}

.brand-button small {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.icon-button,
.battle-icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
}

.icon-button:hover,
.battle-icon-button:hover {
  color: var(--text);
  background: rgba(109, 216, 255, 0.12);
  border-color: rgba(123, 221, 255, 0.3);
}

.progress-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 11px;
  line-height: 34px;
}

.progress-chip b {
  color: var(--cyan);
  font-size: 15px;
}

/* Home */
.home-main {
  width: min(1540px, calc(100% - 54px));
  margin: 0 auto;
  padding: 0 0 46px;
}

.hero-panel {
  position: relative;
  min-height: min(830px, 100vh);
  display: grid;
  grid-template-columns: 1.03fr 0.97fr;
  align-items: center;
  gap: 44px;
  padding: 128px 5vw 78px;
  overflow: hidden;
}

.hero-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.45;
  background:
    radial-gradient(circle at 72% 46%, rgba(82, 210, 255, 0.14), transparent 24%),
    radial-gradient(circle at 80% 50%, rgba(164, 118, 255, 0.1), transparent 35%),
    linear-gradient(rgba(105, 212, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(105, 212, 255, 0.035) 1px, transparent 1px);
  background-size: auto, auto, 46px 46px, 46px 46px;
  mask-image: linear-gradient(90deg, transparent, black 25%, black 90%, transparent);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 760px;
}

.hero-copy h1 {
  margin: 16px 0 22px;
  font-size: clamp(66px, 7vw, 118px);
  line-height: 0.92;
  letter-spacing: -0.07em;
  text-shadow: 0 0 50px rgba(91, 214, 255, 0.15);
}

.hero-copy h1 span {
  color: transparent;
  -webkit-text-stroke: 1px rgba(173, 229, 250, 0.48);
}

.hero-subtitle {
  max-width: 680px;
  color: #b4c5cf;
  font-size: 18px;
  line-height: 1.82;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.hero-visual {
  position: relative;
  z-index: 2;
  min-height: 580px;
  display: grid;
  place-items: center;
}

.hero-core {
  position: absolute;
  width: 176px;
  height: 176px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(124, 226, 255, 0.7);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #eefcff, #62d7fa 16%, #316f97 35%, #0b1a27 72%);
  box-shadow:
    0 0 0 18px rgba(83, 208, 246, 0.035),
    0 0 80px rgba(87, 211, 250, 0.28),
    inset 0 0 50px rgba(211, 248, 255, 0.2);
}

.hero-core::before,
.hero-core::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  animation: spin 18s linear infinite;
}

.hero-core::after {
  inset: 42px;
  animation-direction: reverse;
  animation-duration: 12s;
}

.hero-core span {
  position: relative;
  z-index: 2;
  color: #051018;
  font-size: 32px;
  font-weight: 950;
  letter-spacing: -0.08em;
}

.hero-core i {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 18px 8px rgba(255, 255, 255, 0.75);
  animation: corePulse 2.4s ease-in-out infinite;
}

.core-orbit {
  position: absolute;
  border: 1px solid rgba(129, 221, 255, 0.22);
  border-radius: 50%;
}

.orbit-a {
  width: 360px;
  height: 360px;
  animation: spin 22s linear infinite;
}

.orbit-a::before,
.orbit-b::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 16px var(--cyan);
}

.orbit-b {
  width: 500px;
  height: 500px;
  border-style: dashed;
  animation: spin 38s linear reverse infinite;
}

.hero-lane {
  position: absolute;
  width: 520px;
  height: 76px;
  display: flex;
  align-items: center;
  padding: 0 28px;
  border: 1px solid rgba(141, 223, 255, 0.18);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(84, 206, 247, 0.12), rgba(255, 255, 255, 0.025), rgba(255, 129, 107, 0.1));
  transform: rotate(-8deg);
}

.hero-lane b {
  margin-right: auto;
  color: var(--cyan);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.hero-lane i {
  width: 25px;
  height: 25px;
  margin-left: 32px;
  border: 2px solid #bdefff;
  border-radius: 50%;
  background: #317c9f;
  box-shadow: 0 0 17px rgba(91, 213, 255, 0.42);
  animation: march 3.4s ease-in-out infinite alternate;
}

.hero-lane i:nth-of-type(2) {
  animation-delay: -1s;
}

.hero-lane i:nth-of-type(3) {
  animation-delay: -2s;
}

.lane-a {
  top: 175px;
}

.lane-b {
  bottom: 165px;
  transform: rotate(7deg);
}

.hero-stage {
  position: absolute;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  color: #07111a;
  font-size: 20px;
  font-weight: 950;
  box-shadow: var(--shadow-small);
}

.stage-one {
  left: 1%;
  top: 39%;
  background: var(--cyan);
}

.stage-two {
  right: 2%;
  top: 28%;
  background: var(--violet);
}

.stage-three {
  right: 8%;
  bottom: 24%;
  background: var(--orange);
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: -34px 0 54px;
  position: relative;
  z-index: 3;
}

.home-stats article {
  min-height: 136px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(17, 34, 48, 0.94), rgba(10, 20, 30, 0.86));
  box-shadow: var(--shadow-small);
}

.home-stats article > span,
.home-stats article > p {
  color: var(--muted);
  font-size: 12px;
}

.home-stats article > strong {
  display: block;
  margin: 9px 0 7px;
  color: var(--text);
  font-size: 36px;
  line-height: 1;
}

.home-stats article > strong small {
  margin-left: 5px;
  color: var(--muted-2);
  font-size: 15px;
}

.home-stats article > p {
  margin-bottom: 0;
}

.thin-progress {
  height: 5px;
  margin-top: 15px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.thin-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 84px;
}

.mode-card {
  position: relative;
  min-height: 310px;
  overflow: hidden;
  padding: 30px;
  text-align: left;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(155deg, rgba(21, 41, 56, 0.92), rgba(8, 18, 28, 0.94));
  box-shadow: var(--shadow-small);
  cursor: pointer;
}

.mode-card::before {
  content: "";
  position: absolute;
  inset: auto -60px -80px auto;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  opacity: 0.14;
  filter: blur(2px);
}

.campaign-mode::before { background: var(--cyan); }
.rogue-mode::before { background: var(--violet); }
.deck-mode::before { background: var(--orange); }

.mode-card:hover {
  transform: translateY(-5px);
  border-color: rgba(142, 226, 255, 0.34);
  box-shadow: 0 28px 74px rgba(0, 0, 0, 0.38);
}

.mode-index {
  position: absolute;
  top: 24px;
  right: 26px;
  color: rgba(255, 255, 255, 0.12);
  font-size: 50px;
  font-weight: 950;
}

.mode-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 40px;
  border: 1px solid rgba(141, 226, 255, 0.2);
  border-radius: 18px;
  color: var(--cyan);
  background: rgba(98, 218, 255, 0.07);
  font-size: 26px;
}

.mode-card small {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.14em;
}

.mode-card h2 {
  margin: 7px 0 14px;
  font-size: 26px;
}

.mode-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.75;
}

.mode-arrow {
  position: absolute;
  right: 28px;
  bottom: 24px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 28px;
}

.mechanics-section {
  margin-bottom: 64px;
  padding: 58px 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 50% -30%, rgba(91, 210, 255, 0.11), transparent 42%),
    rgba(9, 20, 31, 0.9);
}

.section-heading {
  margin-bottom: 28px;
}

.section-heading > span {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.section-heading h2 {
  margin: 8px 0 10px;
  font-size: clamp(28px, 3vw, 44px);
}

.section-heading p {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.phase-showcase {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: stretch;
  gap: 14px;
}

.phase-card {
  position: relative;
  min-height: 220px;
  padding: 26px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
}

.phase-card::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -50px;
  bottom: -70px;
  border-radius: 50%;
  opacity: 0.14;
  background: currentColor;
}

.phase-1 { color: var(--cyan); }
.phase-2 { color: var(--violet); }
.phase-3 { color: var(--orange); }

.phase-card small {
  color: var(--muted-2);
  font-weight: 800;
}

.phase-card h3 {
  margin: 14px 0 10px;
  color: var(--text);
  font-size: 23px;
}

.phase-card p {
  color: var(--muted);
  line-height: 1.72;
}

.phase-rate {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  float: right;
  border: 1px solid currentColor;
  border-radius: 18px;
  font-size: 19px;
  font-weight: 950;
}

.phase-connector {
  display: grid;
  place-items: center;
  color: var(--muted-2);
  font-size: 23px;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  color: var(--muted-2);
  font-size: 11px;
}

/* Shared page hero */
.page-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 50px;
  min-height: 280px;
  padding: 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 80% 20%, rgba(98, 218, 255, 0.11), transparent 30%),
    linear-gradient(145deg, rgba(19, 38, 53, 0.94), rgba(7, 16, 25, 0.96));
  box-shadow: var(--shadow-small);
}

.page-hero::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -160px;
  top: -180px;
  border: 1px dashed rgba(136, 226, 255, 0.15);
  border-radius: 50%;
}

.page-hero > * {
  position: relative;
  z-index: 1;
}

.page-hero h1 {
  margin: 12px 0 15px;
  font-size: clamp(40px, 5vw, 72px);
  letter-spacing: -0.05em;
}

.page-hero p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.compact-hero {
  min-height: 240px;
}

/* Campaign */
.campaign-progress-card,
.deck-summary {
  min-width: 260px;
  padding: 24px;
  border: 1px solid var(--line-bright);
  border-radius: 22px;
  background: rgba(5, 14, 22, 0.62);
}

.campaign-progress-card > span,
.deck-summary > span {
  color: var(--muted);
  font-size: 11px;
}

.campaign-progress-card > strong,
.deck-summary > strong {
  display: block;
  margin: 8px 0 10px;
  font-size: 42px;
}

.campaign-progress-card > strong small,
.deck-summary > strong small {
  margin-left: 5px;
  color: var(--muted-2);
  font-size: 15px;
}

.campaign-progress-card .text-button {
  margin-top: 12px;
}

.campaign-note {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  margin: 20px 0;
  padding: 18px 22px;
  border: 1px solid rgba(105, 219, 255, 0.2);
  border-radius: 16px;
  background: rgba(72, 192, 236, 0.06);
}

.campaign-note > span {
  color: var(--cyan);
}

.campaign-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.campaign-note strong {
  color: var(--text);
}

.mission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
}

.mission-card {
  position: relative;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  padding: 26px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(21, 40, 54, 0.94), rgba(8, 17, 26, 0.97));
  box-shadow: var(--shadow-small);
}

.mission-card::before {
  content: "";
  position: absolute;
  width: 210px;
  height: 210px;
  top: -100px;
  right: -75px;
  border-radius: 50%;
  background: var(--mission-accent, var(--cyan));
  opacity: 0.12;
  filter: blur(1px);
}

.mission-card.biome-ice { --mission-accent: #8de5ff; }
.mission-card.biome-jungle { --mission-accent: #65df86; }
.mission-card.biome-magma { --mission-accent: #ff884d; }
.mission-card.biome-steel { --mission-accent: #ff78a2; }
.mission-card.biome-mirror { --mission-accent: #d98cff; }
.mission-card.biome-core { --mission-accent: #ffd06d; }

.mission-card.is-complete {
  border-color: rgba(107, 234, 176, 0.28);
}

.mission-card.is-locked {
  filter: saturate(0.35);
  opacity: 0.52;
}

.mission-topline {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.mission-number {
  position: absolute;
  right: 22px;
  top: 44px;
  color: rgba(255, 255, 255, 0.08);
  font-size: 76px;
  font-weight: 950;
  line-height: 1;
}

.mission-biome-icon {
  position: relative;
  z-index: 1;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin: 27px 0 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 17px;
  color: var(--mission-accent, var(--cyan));
  background: rgba(255, 255, 255, 0.04);
  font-size: 24px;
}

.mission-card h3 {
  margin: 0 0 6px;
  font-size: 25px;
}

.mission-subtitle {
  margin-bottom: 16px;
  color: var(--mission-accent, var(--cyan));
  font-size: 12px;
  font-weight: 750;
}

.mission-brief {
  color: var(--muted);
  line-height: 1.65;
}

.mission-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
}

.mission-tags span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 10px;
  font-weight: 700;
}

.mission-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.mission-time {
  color: var(--muted-2);
  font-size: 11px;
}

.mission-play {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  color: #051018;
  background: var(--mission-accent, var(--cyan));
  font-size: 12px;
  font-weight: 850;
}

.mission-play:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.mission-play:disabled {
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.08);
}

.difficulty-dots {
  display: inline-flex;
  gap: 3px;
}

.difficulty-dots i {
  width: 4px;
  height: 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.09);
}

.difficulty-dots i.is-filled {
  background: var(--mission-accent, var(--cyan));
}

.stars {
  display: inline-flex;
  gap: 4px;
  color: rgba(255, 255, 255, 0.12);
  font-size: 17px;
}

.stars .is-lit {
  color: var(--yellow);
  text-shadow: 0 0 12px rgba(255, 209, 104, 0.45);
}

/* Deck builder */
.deck-main {
  width: min(1740px, calc(100% - 36px));
}

.deck-summary > p {
  color: var(--muted);
  font-size: 12px;
}

.deck-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.deck-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.deck-rules span {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 11px;
}

.deck-builder-layout {
  display: grid;
  grid-template-columns: minmax(470px, 0.88fr) minmax(650px, 1.35fr);
  gap: 18px;
  align-items: start;
}

.deck-groups-column {
  display: grid;
  gap: 12px;
}

.deck-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(10, 23, 35, 0.9);
}

.deck-group.is-active {
  border-color: var(--group-color);
  box-shadow: 0 0 0 1px var(--group-color), 0 18px 50px rgba(0, 0, 0, 0.22);
}

.deck-group-heading {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 17px 18px;
  text-align: left;
  color: var(--text);
  border: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.045), transparent);
  cursor: pointer;
}

.deck-group-heading > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--group-color);
  border-radius: 10px;
  color: var(--group-color);
  font-weight: 950;
}

.deck-group-heading strong,
.deck-group-heading small {
  display: block;
}

.deck-group-heading strong {
  font-size: 15px;
}

.deck-group-heading small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 10px;
}

.deck-group-heading > b {
  color: var(--group-color);
  font-size: 18px;
}

.deck-group-stats {
  display: flex;
  justify-content: space-between;
  padding: 9px 18px;
  color: var(--muted-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}

.deck-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 10px;
}

.deck-slot {
  position: relative;
  min-height: 86px;
  padding: 11px 6px 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.deck-slot:hover {
  border-color: rgba(255, 126, 111, 0.45);
  background: rgba(255, 101, 85, 0.08);
}

.deck-slot > b,
.deck-slot > strong,
.deck-slot > small {
  display: block;
}

.deck-slot > b {
  margin: 3px 0 5px;
  color: var(--group-color);
  font-size: 20px;
}

.deck-slot > strong {
  overflow: hidden;
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.deck-slot > small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 8px;
}

.slot-cost {
  position: absolute;
  top: 5px;
  left: 6px;
  color: var(--yellow);
  font-size: 10px;
  font-weight: 900;
}

.deck-slot.is-empty {
  display: grid;
  place-items: center;
  border-style: dashed;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.018);
}

.deck-slot.is-empty span,
.deck-slot.is-empty small {
  display: block;
  text-align: center;
}

.card-library {
  position: sticky;
  top: calc(var(--header-height) + 18px);
  max-height: calc(100vh - var(--header-height) - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(9, 21, 32, 0.94);
  box-shadow: var(--shadow-small);
}

.library-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.library-heading span,
.library-heading strong {
  display: block;
}

.library-heading span {
  color: var(--muted-2);
  font-size: 10px;
}

.library-heading strong {
  margin-top: 4px;
  color: var(--cyan);
  font-size: 13px;
}

.filter-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.filter-tabs button {
  min-height: 30px;
  padding: 0 9px;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 750;
}

.filter-tabs button.is-active,
.filter-tabs button:hover {
  color: var(--text);
  background: rgba(99, 218, 255, 0.1);
}

.card-library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  padding: 12px;
  overflow-y: auto;
}

.card-tile {
  position: relative;
  min-height: 224px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 12px;
  overflow: hidden;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  background:
    linear-gradient(160deg, rgba(34, 58, 73, 0.94), rgba(8, 18, 28, 0.97));
  cursor: pointer;
}

.card-tile::after {
  content: "";
  position: absolute;
  inset: auto -50px -75px auto;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--rarity-color, var(--cyan));
  opacity: 0.11;
}

.rarity-common { --rarity-color: #70cfe8; }
.rarity-rare { --rarity-color: #ad8bff; }
.rarity-epic { --rarity-color: #ffad5e; }
.rarity-legendary { --rarity-color: #ffd65f; }

.card-tile:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: var(--rarity-color);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
}

.card-tile:disabled {
  opacity: 0.36;
  filter: saturate(0.35);
}

.card-cost {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  color: #09121a;
  background: var(--yellow);
  font-size: 14px;
  font-weight: 950;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
}

.card-art {
  height: 82px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.11), transparent 60%),
    rgba(255, 255, 255, 0.025);
}

.card-art span {
  color: var(--rarity-color);
  font-size: 37px;
  text-shadow: 0 0 20px var(--rarity-color);
}

.card-name {
  position: relative;
  z-index: 1;
  font-size: 13px;
  font-weight: 850;
}

.card-meta {
  margin-top: 4px;
  color: var(--rarity-color);
  font-size: 9px;
  font-weight: 750;
}

.card-desc {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.card-count {
  position: absolute;
  top: 12px;
  right: 12px;
  min-width: 26px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(4, 10, 16, 0.72);
  font-size: 10px;
  font-weight: 850;
  line-height: 22px;
  text-align: center;
}

/* Rogue */
.rogue-intro-hero {
  min-height: 410px;
  align-items: center;
  background:
    radial-gradient(circle at 80% 55%, rgba(169, 128, 255, 0.18), transparent 31%),
    linear-gradient(145deg, rgba(30, 25, 55, 0.94), rgba(8, 15, 27, 0.97));
}

.rogue-hero-copy {
  max-width: 850px;
}

.rogue-route-preview {
  min-width: 390px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rogue-route-preview i,
.run-route span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(193, 162, 255, 0.42);
  border-radius: 50%;
  color: #e8dcff;
  background: rgba(164, 121, 255, 0.12);
  font-style: normal;
  font-weight: 900;
}

.rogue-route-preview b,
.run-route i {
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, rgba(182, 151, 255, 0.6), rgba(182, 151, 255, 0.15));
}

.rogue-route-preview .boss-node {
  width: 62px;
  height: 62px;
  color: #0d1220;
  background: linear-gradient(135deg, var(--violet), var(--orange));
  box-shadow: 0 0 36px rgba(173, 139, 255, 0.3);
}

.rogue-explainer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0 70px;
}

.rogue-explainer-grid article {
  min-height: 230px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(12, 25, 38, 0.84);
}

.rogue-explainer-grid article > span {
  color: rgba(255, 255, 255, 0.12);
  font-size: 44px;
  font-weight: 950;
}

.rogue-explainer-grid h3 {
  margin: 15px 0 10px;
  font-size: 21px;
}

.rogue-explainer-grid p {
  color: var(--muted);
  line-height: 1.72;
}

.relic-gallery {
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(11, 22, 34, 0.84);
}

.relic-grid,
.relic-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.relic-card {
  min-height: 130px;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 17px;
  text-align: left;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(33, 47, 62, 0.82), rgba(10, 19, 29, 0.94));
  cursor: pointer;
}

.relic-card:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: var(--rarity-color);
  box-shadow: 0 15px 38px rgba(0, 0, 0, 0.25);
}

.relic-icon {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rarity-color);
  border-radius: 14px;
  color: var(--rarity-color);
  background: rgba(255, 255, 255, 0.035);
  font-size: 21px;
}

.relic-copy strong,
.relic-copy small {
  display: block;
}

.relic-copy strong {
  font-size: 13px;
}

.relic-copy small {
  margin-top: 3px;
  color: var(--rarity-color);
  font-size: 9px;
}

.relic-copy p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.run-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 30px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 85% 30%, rgba(174, 133, 255, 0.14), transparent 30%),
    rgba(11, 21, 34, 0.9);
}

.run-header h1 {
  margin: 9px 0 8px;
  font-size: 44px;
}

.run-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.run-route {
  display: flex;
  align-items: center;
}

.run-route span {
  width: 36px;
  height: 36px;
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
  font-size: 11px;
}

.run-route span.is-done {
  color: #06131a;
  border-color: var(--green);
  background: var(--green);
}

.run-route span.is-current {
  color: #090d18;
  border-color: var(--violet);
  background: var(--violet);
  box-shadow: 0 0 24px rgba(173, 139, 255, 0.3);
}

.run-relics-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 22px;
  align-items: center;
  margin: 16px 0 42px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
}

.run-relics-panel > div:first-child {
  min-width: 120px;
  padding-right: 20px;
  border-right: 1px solid var(--line);
}

.run-relics-panel > div:first-child span,
.run-relics-panel > div:first-child strong {
  display: block;
}

.run-relics-panel > div:first-child span {
  color: var(--muted);
  font-size: 10px;
}

.run-relics-panel > div:first-child strong {
  margin-top: 5px;
  font-size: 26px;
}

.owned-relics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.owned-relics span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(180, 149, 255, 0.22);
  border-radius: 999px;
  color: #d9c8ff;
  background: rgba(173, 139, 255, 0.07);
  font-size: 10px;
}

.owned-relics span b {
  color: var(--violet);
}

.owned-relics em {
  color: var(--muted-2);
  font-size: 11px;
  font-style: normal;
}

.owned-relics.centered {
  justify-content: center;
  margin: 20px 0;
}

.encounter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 17px;
}

.encounter-card {
  position: relative;
  min-height: 440px;
  display: flex;
  flex-direction: column;
  padding: 28px;
  overflow: hidden;
  text-align: left;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(155deg, rgba(27, 44, 58, 0.94), rgba(7, 17, 27, 0.98));
  cursor: pointer;
  --encounter-color: var(--cyan);
}

.encounter-card.biome-ice { --encounter-color: #8ce4ff; }
.encounter-card.biome-jungle { --encounter-color: #70e28a; }
.encounter-card.biome-magma { --encounter-color: #ff8c51; }
.encounter-card.biome-steel { --encounter-color: #ff78a2; }
.encounter-card.biome-mirror { --encounter-color: #d98cff; }

.encounter-card::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -100px;
  top: -110px;
  border-radius: 50%;
  background: var(--encounter-color);
  opacity: 0.12;
}

.encounter-card:hover {
  transform: translateY(-5px);
  border-color: var(--encounter-color);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

.encounter-index {
  position: absolute;
  top: 22px;
  right: 24px;
  color: rgba(255, 255, 255, 0.08);
  font-size: 56px;
  font-weight: 950;
}

.encounter-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin: 22px 0 28px;
  border: 1px solid var(--encounter-color);
  border-radius: 20px;
  color: var(--encounter-color);
  background: rgba(255, 255, 255, 0.035);
  font-size: 28px;
}

.encounter-card > small {
  color: var(--encounter-color);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.1em;
}

.encounter-card h3 {
  margin: 8px 0 12px;
  font-size: 25px;
}

.encounter-card > p {
  color: var(--muted);
  line-height: 1.65;
}

.encounter-modifier {
  margin-top: auto;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.encounter-modifier span {
  color: var(--encounter-color);
  font-size: 11px;
  font-weight: 850;
}

.encounter-modifier p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.encounter-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  color: var(--muted-2);
  font-size: 10px;
}

.encounter-footer b {
  color: var(--encounter-color);
}

.reward-backdrop-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(170, 131, 255, 0.18), transparent 26%),
    #070d16;
}

.reward-backdrop-core {
  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
  border: 1px solid var(--violet);
  border-radius: 50%;
  color: var(--violet);
  font-size: 48px;
  box-shadow: 0 0 50px rgba(173, 139, 255, 0.2);
  animation: corePulse 2s ease-in-out infinite;
}

.reward-backdrop-screen h1 {
  margin: 24px 0 8px;
}

.reward-backdrop-screen p {
  color: var(--muted);
}

/* Guide */
.guide-keyboard {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 430px;
  color: var(--muted);
  font-size: 10px;
}

kbd {
  min-width: 28px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  border: 1px solid rgba(164, 222, 245, 0.25);
  border-bottom-width: 3px;
  border-radius: 7px;
  color: #dff7ff;
  background: rgba(255, 255, 255, 0.06);
  font-size: 10px;
  font-family: inherit;
  font-weight: 850;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.guide-card {
  position: relative;
  min-height: 280px;
  padding: 30px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(11, 23, 35, 0.86);
}

.guide-card.wide {
  grid-column: 1 / -1;
}

.guide-number {
  position: absolute;
  right: 24px;
  top: 16px;
  color: rgba(255, 255, 255, 0.08);
  font-size: 54px;
  font-weight: 950;
}

.guide-card h2 {
  font-size: 25px;
}

.guide-card p,
.guide-card li {
  color: var(--muted);
  line-height: 1.72;
}

.guide-card li {
  margin-bottom: 9px;
}

.guide-card strong {
  color: var(--text);
}

.guide-flow {
  display: grid;
  grid-template-columns: repeat(7, auto);
  align-items: stretch;
  gap: 12px;
}

.guide-flow > div {
  flex: 1;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}

.guide-flow > div b {
  color: var(--cyan);
}

.guide-flow > div p {
  margin: 9px 0 0;
  font-size: 11px;
}

.guide-flow > i {
  display: grid;
  place-items: center;
  color: var(--muted-2);
  font-style: normal;
}

.key-list {
  display: grid;
  gap: 12px;
}

.key-list span {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.biome-manual {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.biome-manual > div {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.025);
}

.biome-manual b {
  display: block;
  margin-bottom: 9px;
}

.biome-manual p {
  margin-bottom: 0;
  font-size: 10px;
}

.biome-manual .ice b { color: #8ce4ff; }
.biome-manual .jungle b { color: #70e28a; }
.biome-manual .magma b { color: #ff8c51; }
.biome-manual .steel b { color: #ff78a2; }
.biome-manual .mirror b { color: #d98cff; }

/* Battle */
.battle-screen {
  --battle-accent: #67d9ff;
  min-height: 100vh;
  height: 100vh;
  display: grid;
  grid-template-rows: 68px 52px minmax(0, 1fr) 176px;
  overflow: hidden;
  background: #03080e;
}

.battle-screen.biome-ice { --battle-accent: #8ce4ff; }
.battle-screen.biome-jungle { --battle-accent: #70e28a; }
.battle-screen.biome-magma { --battle-accent: #ff8c51; }
.battle-screen.biome-steel { --battle-accent: #ff78a2; }
.battle-screen.biome-mirror { --battle-accent: #d98cff; }
.battle-screen.biome-core { --battle-accent: #ffd06d; }

.battle-topbar {
  display: grid;
  grid-template-columns: 44px 1fr auto 1fr 44px;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 12, 19, 0.98);
}

.battle-icon-button {
  width: 40px;
  height: 40px;
}

.core-hud {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 12px;
}

.enemy-core-hud {
  direction: rtl;
}

.enemy-core-hud > * {
  direction: ltr;
}

.core-label {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
}

.core-label b {
  color: var(--text);
}

.core-bar {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.core-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #52c9ef, #80e5ff);
  transition: width 120ms linear;
}

.enemy-core-hud .core-bar i {
  margin-left: auto;
  background: linear-gradient(90deg, #ff9a7f, #ff665d);
}

.outpost-dots {
  display: flex;
  gap: 5px;
}

.outpost-dots i {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(96, 216, 255, 0.5);
}

.outpost-dots.enemy i {
  background: var(--red);
  box-shadow: 0 0 8px rgba(255, 107, 93, 0.5);
}

.outpost-dots i.is-destroyed {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.battle-title-block {
  min-width: 230px;
  text-align: center;
}

.battle-title-block small,
.battle-title-block strong,
.battle-title-block span {
  display: block;
}

.battle-title-block small {
  color: var(--battle-accent);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.battle-title-block strong {
  margin-top: 2px;
  font-size: 14px;
}

.battle-title-block span {
  margin-top: 2px;
  color: var(--yellow);
  font-size: 16px;
  font-weight: 900;
}

.stage-timeline {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 185px 0 48px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 24, 0.98);
}

.stage-progress-line {
  position: absolute;
  left: 48px;
  right: 190px;
  top: 24px;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.stage-progress-line i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--orange));
  transition: width 80ms linear;
}

.stage-node {
  position: absolute;
  top: 8px;
  transform: translateX(-50%);
  z-index: 2;
}

.stage-node[data-stage-node="0"] {
  left: 48px !important;
}

.stage-node span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 10px;
  color: var(--muted);
  background: #0b1824;
  font-size: 9px;
  font-weight: 900;
}

.stage-node small {
  display: none;
}

.stage-node.is-active span {
  color: #061018;
  border-color: var(--battle-accent);
  background: var(--battle-accent);
  box-shadow: 0 0 18px rgba(106, 220, 255, 0.28);
}

.stage-node.is-past span {
  color: #07131a;
  border-color: var(--green);
  background: var(--green);
}

.stage-current {
  position: absolute;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.stage-current span,
.stage-current b {
  display: block;
}

.stage-current span {
  color: var(--muted);
  font-size: 10px;
}

.stage-current b {
  color: var(--battle-accent);
  font-size: 12px;
}

.battle-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 230px minmax(520px, 1fr) 248px;
  gap: 10px;
  padding: 10px;
  background: #02070c;
}

.supply-sidebar,
.intel-sidebar {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(8, 19, 29, 0.96);
}

.supply-sidebar {
  padding: 14px;
}

.sidebar-heading span,
.sidebar-heading small {
  display: block;
}

.sidebar-heading span {
  font-size: 13px;
  font-weight: 850;
}

.sidebar-heading small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 9px;
}

.supply-buttons {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.supply-button {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 10px;
  text-align: left;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.supply-button:hover,
.supply-button.is-active {
  border-color: var(--group-color);
  background: rgba(255, 255, 255, 0.06);
}

.supply-button.is-active {
  box-shadow: inset 3px 0 0 var(--group-color);
}

.supply-button.is-empty {
  opacity: 0.42;
}

.supply-button kbd {
  color: var(--group-color);
}

.supply-button strong,
.supply-button small {
  display: block;
}

.supply-button strong {
  font-size: 11px;
}

.supply-button small {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 8px;
  line-height: 1.35;
}

.supply-button > b {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--group-color);
  background: rgba(255, 255, 255, 0.05);
  font-size: 10px;
}

.draw-module {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.progress-ring {
  --progress: 0;
  position: relative;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--battle-accent) calc(var(--progress) * 1turn), rgba(255, 255, 255, 0.08) 0);
}

.progress-ring::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: #091725;
}

.progress-ring span,
.progress-ring b {
  position: relative;
  z-index: 1;
  display: block;
  text-align: center;
}

.progress-ring span {
  align-self: end;
  color: var(--muted-2);
  font-size: 8px;
}

.progress-ring b {
  align-self: start;
  font-size: 10px;
}

.draw-module p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.archive-button {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  padding: 10px;
  text-align: left;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(173, 139, 255, 0.06);
  cursor: pointer;
}

.archive-button:hover:not(:disabled) {
  border-color: rgba(182, 148, 255, 0.36);
  background: rgba(173, 139, 255, 0.11);
}

.archive-button:disabled {
  opacity: 0.35;
}

.archive-button > span {
  color: var(--violet);
  font-size: 20px;
}

.archive-button strong,
.archive-button small {
  display: block;
}

.archive-button strong {
  font-size: 10px;
}

.archive-button small {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 8px;
}

.archive-button > b {
  color: var(--violet);
  font-size: 10px;
}

.battlefield-column,
.battlefield-frame {
  min-width: 0;
  min-height: 0;
}

.battlefield-frame {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(160, 224, 248, 0.18);
  border-radius: 17px;
  background: #07111a;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.36);
}

#battle-canvas {
  display: block;
  width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  cursor: crosshair;
  touch-action: none;
}

.battlefield-help {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  max-width: calc(100% - 28px);
  padding: 5px 11px;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  color: rgba(226, 243, 250, 0.58);
  background: rgba(3, 9, 14, 0.68);
  backdrop-filter: blur(8px);
  font-size: 8px;
}

.battle-banner-stack {
  position: absolute;
  top: 12px;
  left: 50%;
  width: min(520px, calc(100% - 30px));
  transform: translateX(-50%);
  display: grid;
  gap: 7px;
  pointer-events: none;
}

.battle-banner {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 11px 15px;
  border: 1px solid rgba(112, 220, 255, 0.28);
  border-radius: 13px;
  background: rgba(7, 17, 25, 0.9);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
  opacity: 0;
  transform: translateY(-12px) scale(0.98);
  transition: opacity 240ms ease, transform 240ms ease;
}

.battle-banner.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.battle-banner strong {
  color: var(--battle-accent);
  font-size: 11px;
}

.battle-banner span {
  color: var(--muted);
  font-size: 9px;
}

.battle-banner.warning,
.battle-banner.danger {
  border-color: rgba(255, 132, 93, 0.42);
}

.battle-banner.warning strong,
.battle-banner.danger strong {
  color: #ff9f75;
}

.battle-banner.boss {
  border-color: rgba(255, 191, 90, 0.5);
  background: rgba(37, 21, 10, 0.92);
}

.battle-banner.boss strong {
  color: var(--orange);
}

.battle-banner.success {
  border-color: rgba(110, 239, 176, 0.42);
}

.battle-banner.success strong {
  color: var(--green);
}

.battle-banner.stage {
  border-color: rgba(173, 139, 255, 0.42);
}

.battle-banner.stage strong {
  color: var(--violet);
}

.tutorial-checklist {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 200px;
  padding: 13px;
  border: 1px solid rgba(102, 218, 255, 0.26);
  border-radius: 14px;
  background: rgba(5, 15, 23, 0.82);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-small);
}

.tutorial-checklist > span {
  display: block;
  margin-bottom: 8px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 850;
}

.tutorial-checklist p {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 5px 0;
  color: var(--muted);
  font-size: 9px;
}

.tutorial-checklist p i {
  color: var(--muted-2);
  font-style: normal;
}

.tutorial-checklist p.is-done {
  color: var(--green);
  text-decoration: line-through;
  opacity: 0.72;
}

.intel-sidebar {
  display: flex;
  flex-direction: column;
  padding: 13px;
  gap: 9px;
}

.objective-panel,
.selected-card-panel,
.event-log-panel {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
}

.objective-panel > span,
.selected-card-panel > span,
.event-log-panel > span {
  display: block;
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.objective-panel > strong,
.selected-card-panel > strong {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.4;
}

.objective-panel > p,
.selected-card-panel > p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.52;
}

.selected-card-panel > strong {
  color: var(--battle-accent);
}

.event-log-panel {
  flex: 1;
  min-height: 90px;
  overflow: hidden;
}

#battle-event-log {
  margin-top: 6px;
}

#battle-event-log p {
  margin: 0;
  padding: 5px 0;
  color: var(--muted);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  font-size: 8px;
  line-height: 1.35;
}

.battle-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.battle-controls button {
  min-height: 35px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}

.battle-controls button:hover {
  color: var(--text);
  border-color: rgba(129, 221, 255, 0.3);
}

.battle-handbar {
  min-width: 0;
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: rgba(5, 12, 19, 0.99);
}

.energy-module {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.025);
}

.energy-orb {
  width: 67px;
  height: 67px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding-top: 20px;
  border: 1px solid rgba(255, 213, 108, 0.4);
  border-radius: 50%;
  color: #071018;
  background: radial-gradient(circle at 35% 25%, #fff9ca, #ffd468 30%, #b67526 68%, #28170b);
  box-shadow: 0 0 26px rgba(255, 201, 91, 0.2);
}

.energy-orb span {
  font-size: 20px;
  font-weight: 950;
}

.energy-orb small {
  font-size: 8px;
  font-weight: 900;
}

.energy-module > div:last-child > strong {
  display: block;
  font-size: 11px;
}

.energy-module > div:last-child > small {
  display: block;
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 8px;
}

.energy-bar {
  height: 7px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.energy-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f4b94e, #ffe480);
  transition: width 80ms linear;
}

.hand-container {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
}

.hand-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 7px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background:
    linear-gradient(160deg, rgba(31, 54, 68, 0.95), rgba(8, 17, 26, 0.98));
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.hand-card::after {
  content: "";
  position: absolute;
  width: 80px;
  height: 80px;
  right: -40px;
  bottom: -44px;
  border-radius: 50%;
  background: var(--rarity-color);
  opacity: 0.12;
}

.hand-card:hover {
  transform: translateY(-5px);
  border-color: var(--rarity-color);
}

.hand-card.is-selected {
  transform: translateY(-8px);
  border-color: var(--battle-accent);
  box-shadow: 0 0 0 1px var(--battle-accent), 0 12px 28px rgba(0, 0, 0, 0.3);
}

.hand-card.is-unaffordable {
  opacity: 0.42;
  filter: saturate(0.45);
}

.hand-hotkey {
  position: absolute;
  top: 5px;
  right: 6px;
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 850;
}

.hand-cost {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #071018;
  background: var(--yellow);
  font-size: 10px;
  font-weight: 950;
}

.hand-cost.is-discounted {
  background: var(--green);
}

.hand-icon {
  display: block;
  margin: 24px 0 7px;
  color: var(--rarity-color);
  font-size: 23px;
  text-align: center;
  text-shadow: 0 0 14px var(--rarity-color);
}

.hand-name {
  display: block;
  overflow: hidden;
  font-size: 9px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hand-type {
  display: block;
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 7px;
  text-align: center;
}

.empty-hand {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  align-content: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
}

.empty-hand span,
.empty-hand small {
  display: block;
}

.empty-hand small {
  margin-top: 4px;
  color: var(--muted-2);
}

/* Modal */
#modal-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}

#modal-root.is-open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 7, 12, 0.78);
  backdrop-filter: blur(12px);
  animation: fadeIn 180ms ease both;
}

.modal-positioner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
}

.modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 34px;
  border: 1px solid rgba(164, 226, 250, 0.22);
  border-radius: 28px;
  background:
    radial-gradient(circle at 90% -20%, rgba(92, 211, 251, 0.1), transparent 35%),
    linear-gradient(145deg, rgba(18, 35, 49, 0.99), rgba(6, 15, 24, 0.99));
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.5);
  animation: modalIn 220ms ease both;
}

.modal-heading {
  position: relative;
}

.modal-heading h2 {
  margin: 8px 0 0;
  font-size: 34px;
}

.modal-close {
  position: absolute;
  right: 0;
  top: 0;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.confirm-modal {
  width: min(520px, 100%);
  text-align: center;
}

.confirm-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 28px;
}

.confirm-modal h2 {
  font-size: 30px;
}

.confirm-modal > p {
  color: var(--muted);
  line-height: 1.7;
}

.dialogue-modal {
  width: min(940px, 100%);
  padding: 0;
  overflow: hidden;
}

.dialogue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.dialogue-header span {
  color: var(--cyan);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.dialogue-header strong {
  font-size: 12px;
}

.dialogue-body {
  min-height: 310px;
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: center;
  gap: 34px;
  padding: 44px;
}

.dialogue-portrait {
  position: relative;
  width: 180px;
  height: 180px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border: 1px solid rgba(105, 218, 255, 0.38);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #eafaff, #4bbcdf 19%, #16415a 42%, #08131e 75%);
  box-shadow: 0 0 60px rgba(84, 204, 244, 0.2);
}

.dialogue-portrait::before,
.dialogue-portrait::after {
  content: "";
  position: absolute;
  inset: -14px;
  border: 1px dashed rgba(133, 224, 255, 0.25);
  border-radius: 50%;
  animation: spin 18s linear infinite;
}

.dialogue-portrait::after {
  inset: 20px;
  animation-direction: reverse;
  animation-duration: 10s;
}

.dialogue-portrait span {
  position: relative;
  z-index: 2;
  color: #07121a;
  font-size: 58px;
  font-weight: 950;
}

.dialogue-copy small {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 850;
}

.dialogue-copy > p {
  margin: 15px 0 0;
  color: #dbe8ef;
  font-size: 21px;
  line-height: 1.8;
}

.dialogue-briefing {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding: 14px 16px;
  border: 1px solid rgba(110, 219, 255, 0.2);
  border-radius: 14px;
  background: rgba(85, 201, 242, 0.06);
}

.dialogue-briefing b {
  flex: 0 0 auto;
  color: var(--cyan);
  font-size: 10px;
}

.dialogue-briefing span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.dialogue-footer,
.tutorial-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.dialogue-footer > span {
  color: var(--muted-2);
  font-size: 10px;
}

.dialogue-dots {
  display: flex;
  gap: 5px;
  margin-right: auto;
}

.dialogue-dots i {
  width: 19px;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
}

.dialogue-dots i.is-active {
  background: var(--cyan);
}

.tutorial-modal {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  padding: 0;
  overflow: hidden;
}

.tutorial-visual {
  position: relative;
  min-height: 430px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(103, 219, 255, 0.2), transparent 34%),
    rgba(5, 15, 24, 0.72);
}

.tutorial-visual > span {
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cyan);
  border-radius: 36px;
  color: var(--cyan);
  background: rgba(92, 209, 250, 0.07);
  font-size: 54px;
  font-weight: 950;
  box-shadow: 0 0 50px rgba(95, 215, 255, 0.15);
}

.tutorial-visual i {
  position: absolute;
  width: 280px;
  height: 280px;
  border: 1px dashed rgba(117, 220, 255, 0.22);
  border-radius: 50%;
  animation: spin 24s linear infinite;
}

.tutorial-visual i:nth-of-type(2) {
  width: 380px;
  height: 380px;
  animation-direction: reverse;
  animation-duration: 40s;
}

.tutorial-copy {
  padding: 48px 42px;
}

.tutorial-copy > small {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.tutorial-copy h2 {
  margin: 10px 0 22px;
  font-size: 36px;
}

.tutorial-copy p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.tutorial-copy strong {
  color: var(--text);
}

.tutorial-footer {
  grid-column: 1 / -1;
}

.tutorial-phase-mini,
.tutorial-supply-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

.tutorial-phase-mini span,
.tutorial-supply-mini span {
  flex: 1;
  min-height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 14px;
  color: var(--cyan);
  background: rgba(255, 255, 255, 0.035);
  font-weight: 900;
}

.tutorial-phase-mini span:nth-of-type(2),
.tutorial-supply-mini span:nth-of-type(2) {
  color: var(--violet);
}

.tutorial-phase-mini span:nth-of-type(3),
.tutorial-supply-mini span:nth-of-type(3) {
  color: var(--orange);
}

.tutorial-phase-mini i {
  color: var(--muted-2);
  font-style: normal;
}

.tutorial-lane-mini {
  position: relative;
  height: 70px;
  display: flex;
  align-items: center;
  gap: 50px;
  margin-top: 24px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(96, 216, 255, 0.13), rgba(255, 255, 255, 0.03), rgba(255, 111, 95, 0.12));
}

.tutorial-lane-mini b {
  margin-right: auto;
  color: var(--cyan);
}

.tutorial-lane-mini strong {
  margin-left: auto;
  color: var(--red);
}

.tutorial-lane-mini i {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cyan);
}

.tutorial-tip {
  padding: 13px;
  border: 1px solid rgba(107, 235, 177, 0.24);
  border-radius: 12px;
  color: var(--green) !important;
  background: rgba(107, 235, 177, 0.05);
  font-size: 12px !important;
}

.result-modal {
  width: min(720px, 100%);
  text-align: center;
}

.result-emblem {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  border: 1px solid var(--green);
  border-radius: 50%;
  color: var(--green);
  font-size: 38px;
  box-shadow: 0 0 42px rgba(103, 237, 176, 0.18);
}

.result-modal.defeat .result-emblem {
  color: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 42px rgba(255, 109, 92, 0.18);
}

.result-modal h2,
.rogue-complete-modal h2 {
  margin: 8px 0;
  font-size: 42px;
}

.result-reason,
.rogue-complete-modal > p,
.relic-choice-modal > p {
  color: var(--muted);
  line-height: 1.7;
}

.result-modal > .stars {
  margin: 14px 0 4px;
  font-size: 27px;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 24px;
}

.result-stats div {
  padding: 14px 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
}

.result-stats span,
.result-stats strong {
  display: block;
}

.result-stats span {
  color: var(--muted-2);
  font-size: 9px;
}

.result-stats strong {
  margin-top: 5px;
  font-size: 18px;
}

.result-reward {
  margin-top: 16px;
  padding: 15px;
  border: 1px solid rgba(255, 208, 107, 0.25);
  border-radius: 14px;
  background: rgba(255, 208, 107, 0.06);
}

.result-reward span {
  color: var(--yellow);
  font-size: 11px;
  font-weight: 850;
}

.result-reward p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.relic-choice-modal {
  width: min(1050px, 100%);
  text-align: center;
}

.relic-choice-modal h2 {
  margin: 8px 0;
  font-size: 34px;
}

.relic-choice-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 24px;
}

.relic-choice-grid .relic-card {
  min-height: 190px;
}

.rogue-complete-modal {
  text-align: center;
}

.settings-modal {
  width: min(760px, 100%);
}

.settings-list {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.setting-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px;
  text-align: left;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}

.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row strong {
  font-size: 13px;
}

.setting-row small {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 10px;
}

.toggle {
  width: 48px;
  height: 27px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.toggle i {
  display: block;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--muted-2);
  transition: transform 160ms ease, background 160ms ease;
}

.toggle.is-on {
  background: rgba(102, 219, 255, 0.2);
}

.toggle.is-on i {
  transform: translateX(21px);
  background: var(--cyan);
}

.save-code-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.save-code-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
}

.save-code-panel textarea {
  width: 100%;
  height: 104px;
  resize: vertical;
  padding: 11px;
  color: #cae8f4;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.24);
  font-size: 9px;
  line-height: 1.4;
}

.save-code-panel > div {
  display: flex;
  gap: 8px;
  margin-top: 9px;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(255, 112, 94, 0.2);
  border-radius: 14px;
  background: rgba(255, 83, 67, 0.045);
}

.danger-zone strong,
.danger-zone small {
  display: block;
}

.danger-zone small {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 10px;
}

/* Toast */
#toast-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
  width: min(380px, calc(100vw - 44px));
  display: grid;
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-bright);
  border-radius: 13px;
  background: rgba(8, 19, 29, 0.94);
  box-shadow: var(--shadow-small);
  backdrop-filter: blur(14px);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast > span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--cyan);
  background: rgba(97, 216, 255, 0.09);
  font-weight: 900;
}

.toast p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.toast.success {
  border-color: rgba(104, 236, 176, 0.32);
}

.toast.success > span {
  color: var(--green);
  background: rgba(104, 236, 176, 0.08);
}

.toast.warning {
  border-color: rgba(255, 151, 111, 0.34);
}

.toast.warning > span {
  color: var(--orange);
  background: rgba(255, 151, 111, 0.08);
}

.noscript-message {
  max-width: 620px;
  margin: 80px auto;
  padding: 24px;
  border: 1px solid var(--line-bright);
  border-radius: 18px;
  color: var(--text);
  background: var(--panel-strong);
}

/* Animations */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes corePulse {
  0%, 100% { transform: scale(0.94); opacity: 0.72; }
  50% { transform: scale(1.05); opacity: 1; }
}

@keyframes march {
  from { transform: translateX(-12px); }
  to { transform: translateX(20px); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.reduced-motion *,
.reduced-motion *::before,
.reduced-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
  transition-duration: 0.001ms !important;
}

/* Responsive */
@media (max-width: 1320px) {
  .header-nav {
    display: none;
  }

  .app-header {
    grid-template-columns: 1fr 1fr;
  }

  .header-right {
    grid-column: 2;
  }

  .hero-panel {
    grid-template-columns: 1fr 0.85fr;
  }

  .mission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .deck-builder-layout {
    grid-template-columns: 430px minmax(0, 1fr);
  }

  .card-library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .battle-layout {
    grid-template-columns: 190px minmax(480px, 1fr) 205px;
  }

  .supply-sidebar,
  .intel-sidebar {
    padding: 10px;
  }

  .supply-button small,
  .objective-panel > p {
    display: none;
  }

  .battle-handbar {
    grid-template-columns: 175px minmax(0, 1fr);
  }

  .hand-card {
    padding-left: 2px;
    padding-right: 2px;
  }

  .hand-name {
    font-size: 8px;
  }
}

@media (max-width: 1050px) {
  .home-main,
  .content-main,
  .deck-main {
    width: min(100% - 28px, 900px);
  }

  .hero-panel {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 135px 0 80px;
  }

  .hero-visual {
    min-height: 460px;
  }

  .home-stats,
  .mode-grid,
  .rogue-explainer-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .mode-grid .mode-card:last-child {
    grid-column: 1 / -1;
  }

  .phase-showcase {
    grid-template-columns: 1fr;
  }

  .phase-connector {
    transform: rotate(90deg);
  }

  .page-hero,
  .run-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .campaign-progress-card,
  .deck-summary {
    min-width: 0;
    width: 100%;
  }

  .deck-builder-layout {
    grid-template-columns: 1fr;
  }

  .card-library {
    position: relative;
    top: 0;
    max-height: none;
  }

  .card-library-grid {
    max-height: none;
  }

  .encounter-grid,
  .relic-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .run-header {
    gap: 18px;
  }

  .run-header .text-button {
    justify-self: start;
  }

  .guide-flow {
    grid-template-columns: 1fr;
  }

  .guide-flow > i {
    transform: rotate(90deg);
  }

  .biome-manual {
    grid-template-columns: repeat(2, 1fr);
  }

  .battle-screen {
    grid-template-rows: 64px 48px minmax(0, 1fr) 164px;
  }

  .battle-layout {
    grid-template-columns: 172px minmax(460px, 1fr);
  }

  .intel-sidebar {
    display: none;
  }

  .battle-handbar {
    grid-template-columns: 150px minmax(0, 1fr);
  }

  .energy-orb {
    width: 58px;
    height: 58px;
    padding-top: 17px;
  }

  .energy-module > div:last-child > small {
    display: none;
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: 64px;
  }

  .app-header {
    padding: 0 14px;
  }

  .progress-chip,
  .brand-button small {
    display: none;
  }

  .home-main,
  .content-main,
  .deck-main {
    width: min(100% - 20px, 680px);
  }

  .hero-copy h1 {
    font-size: 62px;
  }

  .hero-subtitle {
    font-size: 15px;
  }

  .hero-visual {
    min-height: 390px;
    transform: scale(0.78);
    margin: -45px 0;
  }

  .home-stats,
  .mode-grid,
  .rogue-explainer-grid,
  .mission-grid,
  .encounter-grid,
  .relic-grid,
  .guide-grid,
  .result-stats,
  .relic-choice-grid {
    grid-template-columns: 1fr;
  }

  .mode-grid .mode-card:last-child,
  .guide-card.wide {
    grid-column: auto;
  }

  .mechanics-section,
  .page-hero,
  .run-header,
  .relic-gallery {
    padding: 26px 20px;
  }

  .page-hero h1,
  .run-header h1 {
    font-size: 38px;
  }

  .mission-card {
    min-height: 360px;
  }

  .rogue-route-preview {
    min-width: 0;
    transform: scale(0.82);
  }

  .run-route {
    transform-origin: left center;
    transform: scale(0.82);
  }

  .run-relics-panel {
    grid-template-columns: 1fr;
  }

  .run-relics-panel > div:first-child {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 12px;
  }

  .deck-slots {
    grid-template-columns: repeat(2, 1fr);
  }

  .card-library-grid {
    grid-template-columns: 1fr;
  }

  .library-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .biome-manual {
    grid-template-columns: 1fr;
  }

  .dialogue-body {
    grid-template-columns: 1fr;
    padding: 26px;
  }

  .dialogue-portrait {
    width: 120px;
    height: 120px;
  }

  .dialogue-portrait span {
    font-size: 40px;
  }

  .dialogue-copy > p {
    font-size: 16px;
  }

  .dialogue-footer {
    flex-wrap: wrap;
  }

  .dialogue-dots {
    order: 3;
    width: 100%;
  }

  .tutorial-modal {
    grid-template-columns: 1fr;
  }

  .tutorial-visual {
    min-height: 180px;
  }

  .tutorial-visual i {
    display: none;
  }

  .tutorial-copy {
    padding: 28px 22px;
  }

  .tutorial-footer {
    grid-column: auto;
    flex-wrap: wrap;
  }

  .battle-screen {
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto auto auto;
    overflow: auto;
  }

  .battle-topbar {
    grid-template-columns: 38px 1fr 38px;
  }

  .core-hud {
    display: none;
  }

  .battle-title-block {
    min-width: 0;
  }

  .stage-timeline {
    height: 48px;
    padding-right: 128px;
  }

  .stage-progress-line {
    right: 132px;
  }

  .stage-current {
    right: 8px;
    padding-left: 8px;
  }

  .battle-layout {
    grid-template-columns: 1fr;
  }

  .supply-sidebar {
    order: 2;
    overflow: visible;
  }

  .supply-buttons {
    grid-template-columns: repeat(3, 1fr);
  }

  .supply-button {
    grid-template-columns: 26px 1fr;
  }

  .supply-button > b,
  .supply-button small {
    display: none;
  }

  .draw-module,
  .archive-button {
    display: none;
  }

  .battlefield-frame {
    min-height: 420px;
  }

  .battle-handbar {
    grid-template-columns: 1fr;
  }

  .energy-module {
    grid-template-columns: auto 1fr;
  }

  .hand-container {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .hand-card {
    min-height: 110px;
  }

  #toast-root {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }
}

/* V1.1 宽战区与拖拽部署 */
.battle-map-meta {
  display: grid;
  gap: 3px;
  margin-top: 10px;
  padding: 8px 9px;
  border: 1px solid rgba(112, 220, 255, 0.14);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(83, 198, 231, 0.08), rgba(255, 255, 255, 0.015));
}

.battle-map-meta b,
.battle-map-meta small,
.battle-map-meta em {
  display: block;
}

.battle-map-meta b {
  color: var(--battle-accent);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.battle-map-meta small {
  color: rgba(220, 243, 251, 0.74);
  font-size: 7px;
  line-height: 1.35;
}

.battle-map-meta em {
  color: var(--muted-2);
  font-size: 7px;
  font-style: normal;
  line-height: 1.4;
}

.hand-card {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.hand-card:active {
  cursor: grabbing;
}

body.is-card-dragging,
body.is-card-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

body.is-card-dragging #battle-canvas {
  filter: brightness(1.04);
}

.card-drag-ghost {
  position: fixed !important;
  z-index: 10020;
  min-width: 82px !important;
  min-height: 92px;
  margin: 0 !important;
  pointer-events: none !important;
  transform: translate(-50%, -82%) rotate(-2deg) scale(1.04) !important;
  transform-origin: 50% 90%;
  opacity: 0.96 !important;
  border-width: 2px !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
  filter: saturate(1.08) !important;
  transition: border-color 90ms linear, box-shadow 90ms linear, filter 90ms linear !important;
  animation: card-drag-float 680ms ease-in-out infinite alternate;
}

.card-drag-ghost:hover,
.card-drag-ghost.is-selected {
  transform: translate(-50%, -82%) rotate(-2deg) scale(1.04) !important;
}

.card-drag-ghost .hand-hotkey {
  display: none;
}

.card-drag-ghost .drag-route {
  position: absolute;
  left: 50%;
  top: calc(100% + 9px);
  width: max-content;
  max-width: 260px;
  overflow: hidden;
  padding: 6px 10px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: rgba(226, 244, 250, 0.78);
  background: rgba(3, 10, 16, 0.94);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.38);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-drag-ghost.is-over-field {
  transform: translate(-50%, -96%) rotate(0deg) scale(0.92) !important;
}

.card-drag-ghost.is-valid {
  border-color: #7df1ff !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42), 0 0 0 2px rgba(125, 241, 255, 0.24), 0 0 28px rgba(85, 220, 255, 0.28) !important;
}

.card-drag-ghost.is-valid .drag-route {
  color: #d9fbff;
  border-color: rgba(125, 241, 255, 0.52);
  background: rgba(4, 36, 46, 0.96);
}

.card-drag-ghost.is-invalid {
  border-color: #ff776a !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.44), 0 0 0 2px rgba(255, 119, 106, 0.22), 0 0 26px rgba(255, 81, 70, 0.22) !important;
  filter: saturate(0.72) brightness(0.88) !important;
}

.card-drag-ghost.is-invalid .drag-route {
  color: #ffd8d1;
  border-color: rgba(255, 119, 106, 0.55);
  background: rgba(55, 13, 15, 0.97);
}

@keyframes card-drag-float {
  from { margin-top: -2px; }
  to { margin-top: 2px; }
}

/* V1.3.0 generated unit art */
.card-art.has-image {
  height: 118px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: inset 0 -34px 34px rgba(3, 8, 13, 0.44);
}
.card-tile.has-generated-art {
  min-height: 270px;
}
.card-tile.has-generated-art .card-name {
  font-size: 14px;
}
.card-tile.is-treasure {
  border-color: rgba(255, 214, 107, 0.65);
  box-shadow: 0 0 0 1px rgba(255, 205, 92, 0.18), 0 14px 36px rgba(255, 178, 56, 0.12);
}
.card-tile.is-treasure::before {
  content: "TREASURE";
  position: absolute;
  top: 12px;
  right: 10px;
  z-index: 2;
  padding: 4px 7px;
  border-radius: 999px;
  color: #fff1bd;
  background: rgba(88, 54, 7, 0.88);
  border: 1px solid rgba(255, 219, 118, 0.42);
  font-size: 7px;
  font-weight: 950;
  letter-spacing: 0.08em;
}
.hand-art {
  display: grid;
  place-items: center;
  height: 50px;
  margin: 22px 0 6px;
  overflow: hidden;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--rarity-color);
  background:
    radial-gradient(circle at center, rgba(255,255,255,.12), transparent 60%),
    rgba(255,255,255,.025);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: inset 0 -20px 24px rgba(4, 9, 14, .38);
}
.hand-art b {
  font-size: 23px;
  text-shadow: 0 0 14px var(--rarity-color);
}
.hand-card.has-generated-art {
  padding-top: 6px;
}
.hand-card.is-treasure {
  border-color: rgba(255, 216, 103, .72);
  box-shadow: inset 0 0 20px rgba(255, 190, 64, .08);
}
.hand-card.is-treasure .hand-cost {
  background: linear-gradient(180deg, #fff0a2, #e9a936);
}

/* V1.3 faction selection cards */
.faction-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
  align-items: stretch;
}
.faction-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(147, 216, 255, 0.14);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(15, 28, 42, 0.96), rgba(7, 14, 23, 0.98));
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
}
.faction-card > img {
  display: block;
  width: 100%;
  height: 320px;
  object-fit: cover;
  object-position: center 28%;
}
.faction-card .faction-copy {
  padding: 18px 18px 20px;
}
.faction-card .faction-copy > small {
  color: #83ddff;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
}
.faction-card .faction-copy h3 {
  margin: 5px 0 8px;
  font-size: 24px;
}
.faction-card .faction-copy p {
  margin: 0;
  color: #b3c6d5;
  font-size: 13px;
  line-height: 1.55;
}
.faction-card .faction-passive {
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.045);
  color: #dceaf3;
  font-size: 12px;
  line-height: 1.55;
}
.faction-card .starter-deck-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.faction-card .starter-deck-list span {
  max-width: 100%;
  padding: 5px 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #c9d9e4;
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.faction-card .primary-button {
  width: 100%;
}
@media (max-width: 1050px) {
  .faction-grid { grid-template-columns: 1fr; }
  .faction-card { display: grid; grid-template-columns: minmax(230px, 38%) 1fr; }
  .faction-card > img { height: 100%; min-height: 320px; }
}
@media (max-width: 650px) {
  .faction-card { display: block; }
  .faction-card > img { height: 260px; }
}

/* V1.6.1 battle command surface */
.battle-screen {
  position: relative;
  isolation: isolate;
  grid-template-rows: 56px 34px minmax(0, 1fr) 132px;
  background:
    radial-gradient(circle at 50% -24%, color-mix(in srgb, var(--battle-accent) 16%, transparent), transparent 43%),
    #02060a;
}

.battle-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(155, 209, 229, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(155, 209, 229, .025) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}

.battle-topbar {
  position: relative;
  z-index: 6;
  grid-template-columns: 40px minmax(200px, 1fr) minmax(190px, auto) minmax(200px, 1fr) 40px;
  gap: 16px;
  padding: 6px 12px;
  border-color: rgba(161, 216, 237, .11);
  background: linear-gradient(180deg, rgba(7, 15, 23, .98), rgba(3, 9, 14, .94));
  box-shadow: 0 12px 34px rgba(0, 0, 0, .2);
}

.battle-icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(166, 218, 238, .13);
  border-radius: 10px;
  color: rgba(223, 242, 249, .75);
  background: rgba(151, 211, 233, .04);
}

.battle-icon-button:hover {
  color: #fff;
  border-color: color-mix(in srgb, var(--battle-accent) 42%, transparent);
  background: color-mix(in srgb, var(--battle-accent) 9%, transparent);
}

.core-hud {
  grid-template-columns: minmax(90px, 1fr) auto;
  gap: 5px 10px;
}

.core-label {
  align-items: baseline;
  font-size: 8px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.core-label b {
  font-size: 10px;
}

.core-bar {
  height: 6px;
  border-radius: 2px;
  background: rgba(185, 226, 241, .07);
}

.core-bar i {
  position: relative;
  border-radius: inherit;
  box-shadow: 0 0 12px rgba(81, 206, 245, .25);
}

.enemy-core-hud .core-bar i {
  box-shadow: 0 0 12px rgba(255, 105, 91, .22);
}

.outpost-dots i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  transform: rotate(45deg);
}

.battle-title-block {
  min-width: 190px;
}

.battle-title-block small {
  font-size: 7px;
  letter-spacing: .18em;
}

.battle-title-block strong {
  margin-top: 1px;
  font-size: 13px;
  letter-spacing: .04em;
}

.battle-title-block span {
  position: absolute;
  left: 50%;
  top: 37px;
  z-index: 8;
  min-width: 54px;
  margin: 0;
  padding: 2px 9px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 213, 108, .25);
  border-radius: 999px;
  color: #ffe19a;
  background: rgba(7, 13, 18, .92);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  font-size: 11px;
}

.stage-timeline {
  z-index: 5;
  min-height: 34px;
  padding: 0 140px 0 34px;
  border-color: rgba(161, 216, 237, .09);
  background: rgba(4, 10, 16, .93);
}

.stage-progress-line {
  left: 34px;
  right: 148px;
  top: 16px;
  height: 2px;
  background: rgba(184, 224, 240, .075);
}

.stage-progress-line i {
  background: linear-gradient(90deg, var(--battle-accent), #a899ff 55%, #ffc172);
  box-shadow: 0 0 12px color-mix(in srgb, var(--battle-accent) 45%, transparent);
}

.stage-node {
  top: 5px;
}

.stage-node[data-stage-node="0"] {
  left: 34px !important;
}

.stage-node span {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border-color: rgba(164, 215, 235, .16);
  background: #08131d;
  font-size: 7px;
}

.stage-current {
  right: 10px;
  gap: 5px;
  padding-left: 10px;
}

.stage-current span,
.stage-current b {
  font-size: 8px;
}

.battle-layout {
  position: relative;
  z-index: 1;
  grid-template-columns: 164px minmax(560px, 1fr) 184px;
  gap: 8px;
  padding: 8px;
  background: transparent;
}

.supply-sidebar,
.intel-sidebar {
  border-color: rgba(154, 211, 233, .13);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(9, 20, 29, .94), rgba(4, 11, 17, .96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025), 0 12px 34px rgba(0, 0, 0, .17);
  scrollbar-width: thin;
  scrollbar-color: rgba(127, 197, 221, .25) transparent;
}

.supply-sidebar {
  padding: 12px;
}

.sidebar-heading {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(155, 210, 231, .1);
}

.sidebar-heading span {
  font-size: 11px;
  letter-spacing: .03em;
}

.sidebar-heading small {
  font-size: 7px;
}

.supply-buttons {
  gap: 6px;
  margin-top: 10px;
}

.supply-button {
  grid-template-columns: 28px 1fr auto;
  gap: 7px;
  padding: 8px;
  border-color: rgba(157, 211, 232, .1);
  border-radius: 9px;
  background: rgba(153, 211, 233, .025);
}

.supply-button.is-active {
  border-color: color-mix(in srgb, var(--group-color) 45%, transparent);
  background: color-mix(in srgb, var(--group-color) 8%, transparent);
  box-shadow: inset 2px 0 0 var(--group-color);
}

.supply-button strong {
  font-size: 9px;
}

.supply-button small {
  font-size: 7px;
}

.draw-module {
  grid-template-columns: 48px 1fr;
  gap: 9px;
  margin-top: 10px;
  padding: 10px 3px;
  border: 0;
  border-top: 1px solid rgba(155, 210, 231, .09);
  border-radius: 0;
  background: transparent;
}

.progress-ring {
  width: 46px;
  height: 46px;
}

.progress-ring::before {
  inset: 4px;
  background: #07121b;
}

.archive-button {
  margin-top: 0;
  padding: 9px;
  border-radius: 9px;
}

.battlefield-frame {
  position: relative;
  grid-template-rows: minmax(0, 1fr);
  border: 1px solid rgba(159, 218, 240, .29);
  border-radius: 0;
  background: #050d14;
  clip-path: polygon(0 12px, 12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px));
  box-shadow: inset 0 0 48px rgba(0, 0, 0, .38), 0 0 0 1px rgba(41, 151, 190, .06), 0 18px 44px rgba(0, 0, 0, .24);
  animation: battle-field-in 520ms cubic-bezier(.2, .8, .2, 1) both;
}

.battlefield-frame::before,
.battlefield-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.battlefield-frame::before {
  background:
    linear-gradient(90deg, rgba(89, 208, 247, .2), transparent 4%, transparent 96%, rgba(255, 102, 89, .16)),
    repeating-linear-gradient(180deg, rgba(220, 246, 255, .02) 0 1px, transparent 1px 4px),
    radial-gradient(circle at center, transparent 55%, rgba(1, 5, 9, .42));
  mix-blend-mode: screen, normal, normal;
}

.battlefield-frame::after {
  inset: -45% 0 auto;
  height: 34%;
  background: linear-gradient(180deg, transparent, rgba(111, 224, 255, .08), transparent);
  animation: battlefield-scan 7s linear infinite;
}

#battle-canvas {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  place-self: center;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  filter: saturate(1.06) contrast(1.035);
}

.battlefield-chrome {
  position: absolute;
  inset: 9px 12px auto;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .12em;
  text-shadow: 0 2px 8px #000;
}

.battlefield-chrome span::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 1px;
  margin-right: 6px;
  vertical-align: middle;
  background: currentColor;
  opacity: .55;
}

.battlefield-chrome .is-friendly {
  color: rgba(129, 229, 255, .72);
}

.battlefield-chrome .is-contested {
  color: rgba(222, 241, 248, .48);
  text-align: center;
}

.battlefield-chrome .is-hostile {
  color: rgba(255, 141, 125, .7);
  text-align: right;
}

.battlefield-help {
  z-index: 4;
  bottom: 7px;
  padding: 4px 10px;
  border-color: rgba(174, 220, 237, .11);
  border-radius: 6px;
  color: rgba(218, 239, 247, .52);
  background: rgba(3, 9, 14, .78);
  font-size: 7px;
  letter-spacing: .02em;
}

.battle-banner-stack,
.tutorial-checklist {
  z-index: 6;
}

.tutorial-checklist {
  width: 180px;
  padding: 11px;
  border-radius: 10px;
  border-color: rgba(102, 218, 255, .22);
  background: rgba(4, 13, 20, .86);
}

.intel-sidebar {
  gap: 0;
  padding: 0 12px;
}

.objective-panel,
.selected-card-panel,
.event-log-panel {
  padding: 12px 2px;
  border: 0;
  border-bottom: 1px solid rgba(157, 212, 233, .09);
  border-radius: 0;
  background: transparent;
}

.objective-panel > span,
.selected-card-panel > span,
.event-log-panel > span {
  color: rgba(149, 190, 207, .62);
  font-size: 7px;
  letter-spacing: .14em;
}

.objective-panel > strong,
.selected-card-panel > strong {
  margin-top: 7px;
  font-size: 10px;
}

.objective-panel > p,
.selected-card-panel > p {
  font-size: 8px;
}

.battle-map-meta {
  margin-top: 9px;
  padding: 8px 0 0;
  border: 0;
  border-top: 1px solid rgba(112, 220, 255, .1);
  border-radius: 0;
  background: transparent;
}

.event-log-panel {
  min-height: 68px;
}

#battle-event-log p {
  padding: 4px 0;
  font-size: 7px;
}

.battle-controls {
  gap: 6px;
  padding: 9px 0 10px;
}

.battle-controls button {
  min-height: 30px;
  border-radius: 7px;
  font-size: 8px;
}

.battle-handbar {
  position: relative;
  z-index: 7;
  grid-template-columns: 174px minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  border-color: rgba(157, 214, 235, .13);
  background: linear-gradient(180deg, rgba(5, 12, 18, .97), rgba(3, 8, 13, .995));
  box-shadow: 0 -16px 42px rgba(0, 0, 0, .22);
}

.energy-module {
  gap: 9px;
  padding: 8px;
  border-color: rgba(255, 210, 101, .15);
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(255, 196, 69, .055), transparent);
}

.energy-orb {
  width: 54px;
  height: 54px;
  padding-top: 16px;
  border-color: rgba(255, 219, 125, .34);
  background: radial-gradient(circle at 35% 25%, #fff9d2, #ffd36a 29%, #a96b22 67%, #201207);
  box-shadow: 0 0 24px rgba(255, 197, 76, .16), inset 0 0 12px rgba(255, 255, 255, .22);
}

.energy-orb span {
  font-size: 17px;
}

.energy-module > div:last-child > strong {
  font-size: 9px;
  letter-spacing: .05em;
}

.energy-module > div:last-child > small {
  margin-top: 4px;
  font-size: 7px;
}

.energy-bar {
  height: 5px;
  margin-top: 7px;
}

.hand-container {
  gap: 5px;
}

.hand-card {
  padding: 5px 4px 4px;
  border-color: rgba(156, 211, 232, .12);
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(22, 43, 56, .96), rgba(6, 14, 21, .99));
  clip-path: polygon(0 7px, 7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%);
  transition: transform 160ms cubic-bezier(.2, .8, .2, 1), border-color 140ms ease, opacity 140ms ease, filter 140ms ease;
}

.hand-card:hover {
  transform: translateY(-4px);
  filter: brightness(1.08);
}

.hand-card.is-selected {
  transform: translateY(-6px);
  box-shadow: 0 0 0 1px var(--battle-accent), 0 10px 22px rgba(0, 0, 0, .32), 0 0 22px color-mix(in srgb, var(--battle-accent) 18%, transparent);
}

.hand-art {
  height: 42px;
  margin: 18px 0 4px;
  border-radius: 6px;
}

.hand-cost {
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 9px;
}

.hand-hotkey {
  top: 4px;
  right: 5px;
  font-size: 7px;
}

.hand-name {
  font-size: 8px;
}

.hand-type {
  margin-top: 2px;
  font-size: 6px;
}

@keyframes battle-field-in {
  from { opacity: 0; transform: scale(.985); filter: brightness(.72); }
  to { opacity: 1; transform: scale(1); filter: brightness(1); }
}

@keyframes battlefield-scan {
  from { transform: translateY(0); }
  to { transform: translateY(430%); }
}

@media (max-width: 1200px) {
  .battle-layout {
    grid-template-columns: 150px minmax(520px, 1fr) 170px;
  }

  .supply-sidebar,
  .intel-sidebar {
    padding-left: 9px;
    padding-right: 9px;
  }

  .supply-button small,
  .objective-panel > p {
    display: none;
  }
}

@media (max-width: 1050px) {
  .battle-layout {
    grid-template-columns: 150px minmax(500px, 1fr);
  }

  .intel-sidebar {
    display: none;
  }
}

@media (max-width: 760px) {
  .battle-screen {
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto auto auto;
    overflow: auto;
  }

  .battle-topbar {
    grid-template-columns: 36px 1fr 36px;
  }

  .battle-title-block span {
    position: static;
    transform: none;
    display: inline-block;
    margin-top: 2px;
  }

  .stage-timeline {
    min-height: 42px;
    padding-right: 118px;
  }

  .stage-progress-line {
    right: 122px;
    top: 20px;
  }

  .battle-layout {
    grid-template-columns: 1fr;
  }

  .battlefield-frame {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .supply-sidebar {
    order: 2;
  }

  .supply-buttons {
    grid-template-columns: repeat(3, 1fr);
  }

  .battle-handbar {
    grid-template-columns: 1fr;
  }

  .hand-container {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .battlefield-chrome .is-contested {
    display: none;
  }

  .battlefield-chrome {
    grid-template-columns: 1fr 1fr;
  }
}
