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

html, body {
  height: 100%;
  background: radial-gradient(circle at 50% 30%, #14123a, #03040d 70%);
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  color: #eaf3ff;
  overflow: hidden;
  overscroll-behavior: none;
}

body { display: flex; align-items: center; justify-content: center; }

#stage {
  position: relative;
  height: min(100dvh, 166.667vw);
  aspect-ratio: 3 / 5;
  container-type: size;
  box-shadow: 0 0 0 1px rgba(120, 160, 255, .25), 0 0 60px rgba(90, 80, 255, .35);
  border-radius: min(2cqw, 14px);
  overflow: hidden;
  user-select: none;
  touch-action: none;
}

/* The HUD occupies its own top band; JS fits the 3:5 battlefield below it. */
canvas { position: absolute; top: 64px; left: 0; width: 100%; height: calc(100% - 64px); display: block; touch-action: none; }

.hidden { display: none !important; }

/* --- Smart Top Navbar --- */
.top-navbar {
  position: absolute;
  top: max(1.2cqw, 6px, env(safe-area-inset-top, 6px));
  left: max(1.4cqw, 6px);
  right: max(1.4cqw, 6px);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8cqw;
  padding: 0.8cqw 1.4cqw;
  background: rgba(6, 9, 26, 0.82);
  border: 1px solid rgba(110, 160, 255, 0.28);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 16px rgba(77, 243, 255, 0.1);
  pointer-events: auto;
  transition: opacity .2s ease, transform .2s ease;
  box-sizing: border-box;
}

.nav-cluster {
  display: flex;
  align-items: center;
  gap: 0.8cqw;
  flex-shrink: 0;
}

/* Left controls */
.nav-left {
  flex-shrink: 0;
}
.nav-btn {
  width: 7cqw;
  height: 7cqw;
  min-width: 26px;
  min-height: 26px;
  max-width: 38px;
  max-height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(140, 185, 255, 0.35);
  background: rgba(14, 20, 52, 0.85);
  color: #d8e5ff;
  font-family: inherit;
  font-size: clamp(10px, 2.7cqw, 14px);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease;
}
.nav-btn:hover {
  transform: translateY(-0.2cqw) scale(1.06);
  background: rgba(28, 42, 105, 0.95);
  border-color: #4df3ff;
  color: #fff;
  box-shadow: 0 0 12px rgba(77, 243, 255, 0.45);
}
.nav-btn:active {
  transform: scale(0.95);
}
.nav-btn-speed.fast {
  border-color: #ffb347;
  color: #ffc977;
  box-shadow: 0 0 10px rgba(255, 179, 71, 0.35);
}
.nav-btn-speed.turbo {
  border-color: #ff4d79;
  color: #ff7599;
  box-shadow: 0 0 12px rgba(255, 77, 121, 0.55);
}

/* Center Wave & Enemies status */
.nav-center {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 36cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4cqw;
  padding: 0 0.4cqw;
}
.nav-wave-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2cqw;
  width: 100%;
}
.nav-wave-text {
  font-size: clamp(10px, 2.5cqw, 13px);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #c4d7ff;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(110, 160, 255, 0.5);
}
.nav-wave-text.alert {
  color: #ff6b8b;
  text-shadow: 0 0 10px rgba(255, 107, 139, 0.6);
  animation: pulse 1.6s infinite;
}
.nav-enemy-badge {
  font-size: clamp(9px, 2.1cqw, 11px);
  font-weight: 700;
  padding: 0.2cqw 1cqw;
  border-radius: 999px;
  background: rgba(255, 77, 121, 0.18);
  border: 1px solid rgba(255, 77, 121, 0.38);
  color: #ff94b0;
  white-space: nowrap;
}
.nav-wave-progress-bar {
  width: 100%;
  height: 0.7cqw;
  min-height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}
.nav-wave-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4df3ff, #8a7bff);
  box-shadow: 0 0 6px #4df3ff;
  transition: width 0.25s ease-out;
}

/* Right chips (Crystals, Level, Wall) */
.nav-right {
  flex-shrink: 0;
  gap: 0.8cqw;
}
.nav-res-chip {
  display: flex;
  align-items: center;
  gap: 0.6cqw;
  padding: 0.6cqw 1.2cqw;
  border-radius: 999px;
  background: rgba(14, 18, 48, 0.85);
  border: 1px solid rgba(120, 160, 255, 0.25);
  white-space: nowrap;
}
.nav-res-btn {
  cursor: pointer;
  padding: 0.6cqw 1.8cqw;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.nav-res-btn:hover {
  transform: translateY(-0.2cqw) scale(1.08);
  background: rgba(30, 42, 105, 0.95);
  border-color: #4df3ff;
  box-shadow: 0 0 14px rgba(77, 243, 255, 0.4);
}
.nav-res-btn:active {
  transform: scale(0.95);
}
.nav-res-ico {
  font-size: clamp(9px, 2.3cqw, 12px);
  line-height: 1;
}
.nav-res-val {
  font-size: clamp(10px, 2.4cqw, 13px);
  font-weight: 800;
  color: #ffd36b;
  letter-spacing: 0.02em;
}

/* Level Chip with XP circular meter */
.nav-lv-chip {
  position: relative;
  padding: 0.5cqw 1cqw 0.5cqw 1.4cqw;
  background: rgba(20, 16, 52, 0.88);
  border-color: rgba(182, 109, 255, 0.38);
}
.nav-lv-tag {
  font-size: clamp(8px, 2cqw, 11px);
  font-weight: 800;
  color: #b66dff;
}
.nav-lv-val {
  font-size: clamp(10px, 2.5cqw, 13px);
  font-weight: 800;
  color: #fff;
  min-width: 1.8cqw;
  text-align: center;
}
.nav-xp-ring-wrap {
  width: clamp(12px, 3.2cqw, 16px);
  height: clamp(12px, 3.2cqw, 16px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-xp-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.nav-xp-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 2.5;
}
.nav-xp-meter {
  fill: none;
  stroke: #4df3ff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 59.7;
  stroke-dashoffset: 59.7;
  transition: stroke-dashoffset 0.25s ease-out;
  filter: drop-shadow(0 0 2px #4df3ff);
}

/* Wall HP Mini Chip */
.nav-wall-chip {
  padding: 0.6cqw 1.2cqw;
  background: rgba(12, 22, 45, 0.85);
  border-color: rgba(77, 243, 255, 0.25);
}
.nav-wall-ico {
  font-size: clamp(9px, 2.2cqw, 12px);
  line-height: 1;
}
.nav-wall-mini-bar {
  width: clamp(20px, 5.5cqw, 32px);
  height: 0.9cqw;
  min-height: 4px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 999px;
  overflow: hidden;
  border: 0.5px solid rgba(255, 255, 255, 0.15);
}
.nav-wall-fill {
  height: 100%;
  width: 100%;
  background: #4df3ff;
  transition: width 0.2s ease-out, background 0.2s ease-out;
}
.nav-wall-val {
  font-size: clamp(9px, 2.1cqw, 11px);
  font-weight: 800;
  color: #cfe0ff;
  min-width: clamp(24px, 4.5cqw, 30px);
  text-align: right;
}

@container (max-width: 360px) {
  .nav-btn { width: 25px; height: 25px; font-size: 10px; }
  .nav-res-chip { padding: 0.4cqw 0.8cqw; }
  .nav-wave-text { font-size: 10px; }
  .nav-wall-mini-bar { width: 18px; }
  .top-navbar { padding: 0.6cqw 1cqw; gap: 0.5cqw; }
}

.screen {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3cqw; padding: 6cqw;
  background: radial-gradient(circle at 50% 40%, rgba(30, 20, 80, .55), rgba(3, 4, 16, .88));
  backdrop-filter: blur(5px);
  text-align: center;
  animation: fadeIn .35s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.logo { display: flex; flex-direction: column; font-weight: 800; line-height: .95; letter-spacing: .06em; }
.logo span { font-size: 15cqw; background: linear-gradient(180deg, #fff, #7fd8ff 60%, #8a6bff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 3cqw rgba(110, 120, 255, .7)); }
.logo .g2 { font-size: 11.5cqw; background: linear-gradient(180deg, #ffe08a, #ff6bb0); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 3cqw rgba(255, 90, 170, .6)); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.04); } }

.stage-badge {
  display: inline-block;
  padding: 0.8cqw 3.2cqw;
  font-size: 3.2cqw;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #4df3ff;
  background: rgba(77, 243, 255, 0.12);
  border: 1px solid rgba(77, 243, 255, 0.35);
  border-radius: 999px;
  text-shadow: 0 0 10px rgba(77, 243, 255, 0.4);
  box-shadow: 0 0 16px rgba(77, 243, 255, 0.15);
}

.tagline { font-size: 4cqw; color: #a9b9ff; }
.hint { font-size: 3.1cqw; color: #8294d6; line-height: 1.5; }
.hint b { color: #4df3ff; }
.best { font-size: 3.8cqw; color: #ffd36b; font-weight: 600; min-height: 1em; }

.title { font-size: 9cqw; font-weight: 800; letter-spacing: .05em; background: linear-gradient(90deg, #4df3ff, #b66dff, #ff6bb0); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 2.5cqw rgba(150, 110, 255, .6)); }
.title.over { background: linear-gradient(90deg, #ff9a6b, #ff4d6d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { font-size: 3.8cqw; color: #a9b9ff; }
.score-label { font-size: 3.4cqw; letter-spacing: .3em; color: #8294d6; margin-bottom: -2cqw; }
.score { font-size: 17cqw; font-weight: 800; color: #fff; text-shadow: 0 0 4cqw rgba(77, 243, 255, .6); }

.btn {
  font-family: inherit; font-weight: 700; font-size: 4.6cqw; letter-spacing: .1em;
  padding: 3.2cqw 9cqw; border-radius: 99px; border: none; cursor: pointer; color: #07102a;
  background: linear-gradient(135deg, #4df3ff, #8a7bff);
  box-shadow: 0 0 4cqw rgba(77, 243, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .6);
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-.4cqw) scale(1.04); box-shadow: 0 0 6cqw rgba(110, 160, 255, .8), inset 0 1px 0 rgba(255, 255, 255, .6); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: #cfe0ff; border: 1px solid rgba(160, 200, 255, .45); box-shadow: none; }
.menu-back-btn, .pause-back-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 3.6cqw !important;
  padding: 2.4cqw 6cqw !important;
  border-color: rgba(160, 200, 255, .3) !important;
}
.menu-back-btn:hover, .pause-back-btn:hover {
  border-color: #4df3ff !important;
  color: #fff !important;
}

.cards { display: flex; flex-direction: column; gap: 3cqw; width: 100%; margin-top: 2cqw; }
.card {
  --c: #4df3ff; --rc: #6ec8ff; --d: 0s;
  position: relative; display: flex; align-items: center; gap: 4cqw;
  width: 100%; padding: 3.6cqw 4cqw; text-align: left; cursor: pointer;
  font-family: inherit; color: #eaf3ff;
  border-radius: 3.6cqw; border: .45cqw solid var(--rc);
  background: linear-gradient(135deg, rgba(20, 26, 66, .95), rgba(10, 12, 36, .95));
  box-shadow: 0 0 3.5cqw color-mix(in srgb, var(--rc) 55%, transparent), inset 0 0 6cqw color-mix(in srgb, var(--rc) 14%, transparent);
  animation: dealIn .5s cubic-bezier(.2, 1.3, .4, 1) both;
  animation-delay: var(--d);
  transition: transform .18s, box-shadow .18s;
  overflow: hidden;
}
.card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .13) 50%, transparent 70%); transform: translateX(-120%); }
.card:hover, .card:focus-visible { transform: translateY(-.6cqw) scale(1.025); outline: none; box-shadow: 0 0 6cqw var(--rc), inset 0 0 6cqw color-mix(in srgb, var(--rc) 25%, transparent); }
.card:hover::before { transform: translateX(120%); transition: transform .7s; }
.card.r-epic { animation: dealIn .5s cubic-bezier(.2, 1.3, .4, 1) both, epic 1.8s ease-in-out infinite; animation-delay: var(--d), 0s; }
@keyframes dealIn { from { opacity: 0; transform: translateY(6cqw) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes epic { 50% { box-shadow: 0 0 7cqw var(--rc), inset 0 0 6cqw color-mix(in srgb, var(--rc) 28%, transparent); } }

.card-ico {
  flex: none; width: 15cqw; height: 15cqw; display: grid; place-items: center; border-radius: 3cqw;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 35%, transparent), rgba(0, 0, 0, .25));
  border: .3cqw solid color-mix(in srgb, var(--c) 70%, transparent);
}
.card-ico svg { width: 9cqw; height: 9cqw; fill: var(--c); filter: drop-shadow(0 0 1.2cqw var(--c)); }
.card-body { display: flex; flex-direction: column; gap: .6cqw; min-width: 0; }
.card-tag { font-size: 2.6cqw; font-weight: 700; letter-spacing: .12em; color: var(--rc); }
.card strong { font-size: 5.2cqw; font-weight: 700; }
.card em { font-style: normal; font-size: 3.6cqw; color: #b4c4f5; line-height: 1.3; }
.card kbd { position: absolute; top: 2cqw; right: 3cqw; font-family: inherit; font-size: 2.8cqw; color: #6e80c0; }

/* Hub / Settings Screen */
.hub-screen {
  padding: 4.5cqw 4cqw;
  gap: 2.5cqw;
  justify-content: flex-start;
  background: radial-gradient(circle at 50% 15%, rgba(22, 28, 80, 0.94), rgba(4, 6, 20, 0.98));
  z-index: 10;
  backdrop-filter: blur(12px);
}
.hub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding-bottom: 1.5cqw;
  border-bottom: 1px solid rgba(140, 180, 255, 0.18);
}
.hub-header-left {
  display: flex;
  flex-direction: column;
  text-align: left;
}
.hub-kicker {
  font-size: 2.4cqw;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #4df3ff;
}
.hub-title {
  font-size: 6.8cqw;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, #fff, #90caff, #caa3ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hub-continue-btn {
  display: inline-flex;
  align-items: center;
  gap: 1.2cqw;
  padding: 1.5cqw 3.6cqw;
  border-radius: 999px;
  border: 1px solid rgba(77, 243, 255, 0.45);
  background: linear-gradient(135deg, rgba(77, 243, 255, 0.22), rgba(138, 123, 255, 0.22));
  color: #fff;
  font-family: inherit;
  font-size: 2.9cqw;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(77, 243, 255, 0.25);
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.hub-continue-btn:hover {
  transform: translateY(-0.2cqw) scale(1.05);
  background: linear-gradient(135deg, rgba(77, 243, 255, 0.38), rgba(138, 123, 255, 0.38));
  border-color: #4df3ff;
  box-shadow: 0 0 24px rgba(77, 243, 255, 0.5);
}
.hub-continue-btn:active {
  transform: scale(0.96);
}
.hub-continue-arrow {
  font-size: 2.4cqw;
  color: #4df3ff;
  line-height: 1;
}

.hub-tabs-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.hub-tab-scroll-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.8cqw;
  height: 4.8cqw;
  min-width: 22px;
  min-height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(140, 180, 255, 0.35);
  background: rgba(14, 20, 52, 0.9);
  color: #4df3ff;
  font-family: inherit;
  font-size: 3.6cqw;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
  z-index: 2;
  transition: all .15s ease;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}
.hub-tab-scroll-btn:hover {
  background: rgba(30, 45, 110, 0.95);
  border-color: #4df3ff;
  color: #fff;
  transform: scale(1.12);
  box-shadow: 0 0 12px rgba(77, 243, 255, 0.4);
}
.hub-tab-scroll-btn:active {
  transform: scale(0.95);
}
.hub-tabs {
  display: flex;
  gap: 1.6cqw;
  flex: 1;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 0.6cqw 1cqw;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.hub-tabs::-webkit-scrollbar { display: none; }
.hub-tab {
  flex: 0 0 auto;
  padding: 1.8cqw 3.6cqw;
  border-radius: 999px;
  border: 1px solid rgba(140, 180, 255, 0.22);
  background: rgba(15, 20, 50, 0.65);
  color: #a9b9ff;
  font-family: inherit;
  font-size: 3.1cqw;
  font-weight: 700;
  cursor: pointer;
  transition: all .16s ease;
}
.hub-tab:hover {
  background: rgba(30, 40, 95, 0.8);
  color: #fff;
}
.hub-tab.active {
  background: linear-gradient(135deg, rgba(77, 243, 255, 0.25), rgba(182, 109, 255, 0.25));
  border-color: #4df3ff;
  color: #fff;
  box-shadow: 0 0 14px rgba(77, 243, 255, 0.35);
}

.hub-content {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.5cqw;
  scrollbar-width: thin;
}
.hub-panel {
  display: none;
  flex-direction: column;
  gap: 2.8cqw;
  text-align: left;
  animation: fadeIn .22s ease;
}
.hub-panel.active {
  display: flex;
}
.hub-panel-desc {
  font-size: 3.1cqw;
  color: #8da4e6;
  line-height: 1.4;
  margin-bottom: -0.8cqw;
}

.hub-card {
  background: rgba(16, 22, 60, 0.78);
  border: 1px solid rgba(130, 170, 255, 0.24);
  border-radius: 3.2cqw;
  padding: 3.5cqw;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.hub-card-title {
  font-size: 4.2cqw;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5cqw;
}
.hub-card-sub {
  font-size: 2.9cqw;
  color: #8fa5e6;
  margin-bottom: 2cqw;
  line-height: 1.35;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2.2cqw 0;
  border-top: 1px solid rgba(140, 180, 255, 0.12);
}
.setting-info {
  display: flex;
  flex-direction: column;
  gap: 0.4cqw;
}
.setting-label {
  font-size: 3.4cqw;
  font-weight: 600;
  color: #eaf3ff;
}
.setting-desc {
  font-size: 2.6cqw;
  color: #8096d8;
}
.setting-pill {
  padding: 1cqw 2.4cqw;
  border-radius: 999px;
  font-size: 2.6cqw;
  font-weight: 700;
  background: rgba(140, 180, 255, 0.15);
  color: #8ec5fc;
}
.setting-pill.green {
  background: rgba(56, 239, 125, 0.18);
  color: #38ef7d;
  border: 1px solid rgba(56, 239, 125, 0.35);
}

.hub-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 2cqw;
  padding: 1.8cqw 3.6cqw;
  border-radius: 999px;
  border: 1px solid #38ef7d;
  background: rgba(56, 239, 125, 0.2);
  color: #fff;
  font-family: inherit;
  font-size: 3.2cqw;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(56, 239, 125, 0.3);
  transition: all .16s ease;
}
.hub-toggle-btn.muted {
  border-color: #ff5d73;
  background: rgba(255, 93, 115, 0.2);
  color: #ffa4b2;
  box-shadow: 0 0 12px rgba(255, 93, 115, 0.3);
}
.hub-action-btn {
  padding: 1.8cqw 3.6cqw;
  border-radius: 999px;
  border: 1px solid rgba(140, 180, 255, 0.35);
  background: rgba(30, 40, 100, 0.65);
  color: #cfe0ff;
  font-family: inherit;
  font-size: 3cqw;
  font-weight: 600;
  cursor: pointer;
  transition: all .16s ease;
}
.hub-action-btn:hover {
  background: rgba(50, 70, 150, 0.8);
  color: #fff;
}

/* Speed Toggle Styles */
.card-header-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5cqw;
}
.vip-badge {
  font-size: 2.2cqw;
  font-weight: 800;
  padding: 0.4cqw 1.8cqw;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe08a, #ffb347);
  color: #07102a;
  letter-spacing: 0.08em;
  box-shadow: 0 0 10px rgba(255, 200, 70, 0.4);
}
.speed-toggle-group {
  display: flex;
  gap: 1.2cqw;
  background: rgba(10, 14, 38, 0.85);
  border: 1px solid rgba(140, 180, 255, 0.25);
  border-radius: 999px;
  padding: 0.8cqw;
}
.speed-opt-btn {
  padding: 1.4cqw 3.6cqw;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #8fa5e6;
  font-family: inherit;
  font-size: 3.1cqw;
  font-weight: 800;
  cursor: pointer;
  transition: all .16s ease;
}
.speed-opt-btn:hover {
  color: #fff;
}
.speed-opt-btn.active {
  background: linear-gradient(135deg, #ffc94a, #ff8a3a);
  color: #07102a;
  box-shadow: 0 0 14px rgba(255, 201, 74, 0.5);
}
.speed-hud-btn {
  font-weight: 800;
  font-size: 2.7cqw;
  color: #cfe0ff;
}
.speed-hud-btn.fast {
  background: rgba(77, 243, 255, 0.22);
  border-color: #4df3ff;
  color: #4df3ff;
  box-shadow: 0 0 10px rgba(77, 243, 255, 0.35);
}
.speed-hud-btn.turbo {
  background: rgba(255, 180, 50, 0.28);
  border-color: #ffd36b;
  color: #ffd36b;
  box-shadow: 0 0 12px rgba(255, 180, 50, 0.45);
}

/* Armory Grid */
.armory-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.2cqw;
}
.armory-card {
  display: flex;
  flex-direction: column;
  gap: 1.2cqw;
  padding: 3cqw;
  border-radius: 2.8cqw;
  background: rgba(14, 18, 50, 0.8);
  border: 1px solid rgba(140, 180, 255, 0.2);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.armory-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.armory-card-badge {
  font-size: 2.2cqw;
  color: #8da4e6;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5cqw;
  font-weight: 600;
}
.armory-card-top {
  display: flex;
  align-items: center;
  gap: 2cqw;
}
.armory-ico {
  width: 7.5cqw;
  height: 7.5cqw;
  border-radius: 1.8cqw;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
}
.armory-ico svg {
  width: 4.8cqw;
  height: 4.8cqw;
}
.armory-card strong {
  font-size: 3.2cqw;
  font-weight: 700;
  color: #fff;
}
.armory-card p {
  font-size: 2.6cqw;
  color: #9ab0ed;
  line-height: 1.35;
}

/* Armory Upgrade Matrix */
.armory-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5cqw;
  padding-bottom: 2cqw;
  border-bottom: 1px solid rgba(140, 180, 255, 0.15);
}
.armory-back-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(140, 180, 255, 0.25);
  color: #cfe0ff;
  font-family: inherit;
  font-size: 2.8cqw;
  font-weight: 700;
  padding: 1.4cqw 2.8cqw;
  border-radius: 2cqw;
  cursor: pointer;
  transition: all 0.15s ease;
}
.armory-back-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(140, 180, 255, 0.5);
}
.armory-detail-title {
  display: flex;
  align-items: center;
  gap: 2cqw;
}
.armory-detail-title h3 {
  font-size: 4cqw;
  font-weight: 800;
  color: #fff;
  margin: 0;
}
.armory-matrix-summary {
  font-size: 2.6cqw;
  color: #9ab0ed;
  margin-bottom: 3cqw;
}
.matrix-category {
  margin-bottom: 3cqw;
  background: rgba(10, 14, 40, 0.65);
  border: 1px solid rgba(140, 180, 255, 0.15);
  border-radius: 2.4cqw;
  padding: 2.5cqw;
}
.matrix-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2cqw;
}
.matrix-cat-title {
  font-size: 2.8cqw;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 1.2cqw;
}
.matrix-cat-count {
  font-size: 2.2cqw;
  font-weight: 600;
  padding: 0.4cqw 1.4cqw;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.matrix-cubes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.8cqw;
}
.matrix-cube {
  width: 9cqw;
  height: 9cqw;
  border-radius: 2cqw;
  background: rgba(16, 22, 60, 0.9);
  border: 2px solid var(--cube-color, #4df3ff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease, background 0.15s ease;
  user-select: none;
}
.matrix-cube:hover {
  transform: translateY(-3px) scale(1.08);
  box-shadow: 0 0 16px var(--cube-color, #4df3ff);
  background: color-mix(in srgb, var(--cube-color, #4df3ff) 25%, rgba(16, 22, 60, 0.9));
}
.matrix-cube.active {
  box-shadow: 0 0 20px var(--cube-color, #4df3ff);
  background: color-mix(in srgb, var(--cube-color, #4df3ff) 35%, rgba(16, 22, 60, 0.9));
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.matrix-cube-num {
  font-size: 2.8cqw;
  font-weight: 800;
  color: #fff;
}
.matrix-cube-tier {
  font-size: 1.8cqw;
  font-weight: 700;
  color: var(--cube-color, #4df3ff);
  letter-spacing: 0.05em;
}

/* Card Detail Preview */
.matrix-preview-card {
  position: sticky;
  bottom: 0;
  margin-top: 2.5cqw;
  padding: 3cqw;
  border-radius: 2.6cqw;
  background: linear-gradient(135deg, rgba(16, 24, 68, 0.95), rgba(8, 12, 36, 0.98));
  border: 1px solid var(--preview-color, #4df3ff);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 20px color-mix(in srgb, var(--preview-color, #4df3ff) 25%, transparent);
  backdrop-filter: blur(12px);
}
.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5cqw;
  gap: 2cqw;
}
.preview-name {
  font-size: 3.6cqw;
  font-weight: 800;
  color: #fff;
}
.preview-badge {
  font-size: 2.2cqw;
  font-weight: 700;
  padding: 0.6cqw 1.8cqw;
  border-radius: 999px;
  background: color-mix(in srgb, var(--preview-color, #4df3ff) 20%, transparent);
  color: var(--preview-color, #4df3ff);
  border: 1px solid color-mix(in srgb, var(--preview-color, #4df3ff) 40%, transparent);
}
.preview-desc {
  font-size: 2.8cqw;
  color: #d1dcff;
  line-height: 1.4;
  margin-bottom: 2cqw;
}
.preview-meta-row {
  display: flex;
  gap: 3cqw;
  flex-wrap: wrap;
  font-size: 2.4cqw;
}
.preview-meta-item {
  display: flex;
  align-items: center;
  gap: 0.8cqw;
  color: #8da4e6;
  font-weight: 600;
}
.preview-meta-item b {
  color: #fff;
}

/* Events Sub-navigation */
.events-subnav {
  display: flex;
  gap: 1.4cqw;
  margin-bottom: 0.5cqw;
}
.events-subtab {
  padding: 1.2cqw 3cqw;
  border-radius: 999px;
  border: 1px solid rgba(140, 180, 255, 0.25);
  background: rgba(14, 18, 48, 0.6);
  color: #a9b9ff;
  font-family: inherit;
  font-size: 2.8cqw;
  font-weight: 700;
  cursor: pointer;
  transition: all .16s ease;
}
.events-subtab.active {
  background: linear-gradient(135deg, rgba(255, 77, 109, 0.3), rgba(182, 109, 255, 0.3));
  border-color: #ff5d73;
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 93, 115, 0.35);
}
.eventsub-panel {
  display: none;
  flex-direction: column;
  gap: 2.5cqw;
}
.eventsub-panel.active {
  display: flex;
}

/* Monster Raid Card */
.monster-raid-card {
  border: 1.5px solid rgba(255, 77, 109, 0.45);
  background: radial-gradient(circle at 50% 10%, rgba(55, 18, 40, 0.85), rgba(14, 16, 45, 0.95));
  box-shadow: 0 0 25px rgba(255, 77, 109, 0.25);
}
.boss-tag {
  background: rgba(255, 77, 109, 0.3);
  color: #ff6b8b;
  border: 1px solid rgba(255, 77, 109, 0.5);
}
.boss-diff {
  font-size: 2.6cqw;
  font-weight: 800;
  color: #ff4d6d;
  letter-spacing: 0.05em;
  text-shadow: 0 0 8px rgba(255, 77, 109, 0.6);
}
.monster-header {
  display: flex;
  align-items: center;
  gap: 3cqw;
  margin: 1.5cqw 0 1cqw;
}
.monster-avatar {
  font-size: 9cqw;
  filter: drop-shadow(0 0 12px rgba(255, 77, 109, 0.7));
}
.monster-name {
  font-size: 5.2cqw;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.04em;
}
.monster-sub {
  font-size: 2.7cqw;
  color: #ff9fb2;
}
.monster-lore {
  font-size: 2.7cqw;
  color: #b8c7f2;
  line-height: 1.45;
  margin-bottom: 2cqw;
}
.monster-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5cqw;
  background: rgba(8, 10, 30, 0.75);
  border: 1px solid rgba(140, 180, 255, 0.2);
  border-radius: 2.4cqw;
  padding: 2cqw 1.5cqw;
  margin-bottom: 2.5cqw;
  text-align: center;
}
.mstat {
  display: flex;
  flex-direction: column;
  gap: 0.4cqw;
}
.mstat-k {
  font-size: 2.2cqw;
  font-weight: 700;
  color: #8da4e6;
  letter-spacing: 0.05em;
}
.mstat-v {
  font-size: 2.9cqw;
  font-weight: 800;
  color: #fff;
}
.mstat-v.red { color: #ff5d73; text-shadow: 0 0 8px rgba(255, 93, 115, 0.5); }
.mstat-v.cyan { color: #4df3ff; text-shadow: 0 0 8px rgba(77, 243, 255, 0.5); }
.mstat-v.gold { color: #ffd36b; }

.monster-start-btn {
  width: 100%;
  font-size: 3.8cqw;
  padding: 2.6cqw 4cqw;
  background: linear-gradient(135deg, #ff4d6d, #ff9a6b);
  box-shadow: 0 0 25px rgba(255, 77, 109, 0.5);
  color: #fff;
}
.monster-start-btn:hover {
  box-shadow: 0 0 35px rgba(255, 77, 109, 0.75);
}

/* Events */
.event-card {
  position: relative;
  overflow: hidden;
}
.event-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2cqw;
}
.event-tag {
  font-size: 2.4cqw;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 0.6cqw 2cqw;
  border-radius: 999px;
  background: rgba(140, 180, 255, 0.2);
  color: #cfe0ff;
}
.event-tag.live {
  background: rgba(255, 77, 109, 0.25);
  color: #ff6b8b;
  border: 1px solid rgba(255, 77, 109, 0.4);
}
.event-timer {
  font-size: 2.6cqw;
  color: #ffd36b;
  font-weight: 600;
}

/* Codes */
.code-box {
  display: flex;
  gap: 2cqw;
  margin-top: 1cqw;
}
.hub-input {
  flex: 1;
  background: rgba(10, 12, 35, 0.85);
  border: 1px solid rgba(140, 180, 255, 0.35);
  border-radius: 999px;
  padding: 2.2cqw 4cqw;
  font-family: inherit;
  font-size: 3.2cqw;
  color: #fff;
  outline: none;
}
.hub-input:focus {
  border-color: #4df3ff;
  box-shadow: 0 0 12px rgba(77, 243, 255, 0.35);
}
.hub-btn-sm {
  font-size: 3.2cqw;
  padding: 2.2cqw 5cqw;
}
.code-feedback {
  font-size: 2.8cqw;
  font-weight: 600;
  min-height: 1.4em;
  margin-top: 1.4cqw;
  color: #38ef7d;
}
.code-hints {
  font-size: 2.6cqw;
  color: #7f95d8;
  margin-top: 1cqw;
}
.code-hints b {
  color: #4df3ff;
}

/* Shop Grid */
.shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2cqw;
}
.shop-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4cqw;
  padding: 3.2cqw 2cqw;
  border-radius: 2.8cqw;
  background: rgba(14, 18, 52, 0.8);
  border: 1px solid rgba(140, 180, 255, 0.2);
  text-align: center;
}
.shop-item.featured {
  border-color: #ffd36b;
  box-shadow: 0 0 18px rgba(255, 211, 107, 0.25);
}
.shop-badge {
  position: absolute;
  top: -1.2cqw;
  font-size: 2.2cqw;
  font-weight: 800;
  padding: 0.4cqw 1.8cqw;
  border-radius: 999px;
  background: #ffd36b;
  color: #07102a;
}
.shop-icon {
  font-size: 6.5cqw;
}
.shop-item strong {
  font-size: 2.9cqw;
  font-weight: 700;
  color: #fff;
}
.shop-item em {
  font-style: normal;
  font-size: 2.4cqw;
  color: #9ab0ed;
  line-height: 1.25;
}
.shop-btn {
  margin-top: auto;
  padding: 1.4cqw 3cqw;
  border-radius: 999px;
  border: none;
  font-family: inherit;
  font-size: 3cqw;
  font-weight: 800;
  background: linear-gradient(135deg, #4df3ff, #8a7bff);
  color: #07102a;
  cursor: pointer;
}
.shop-btn.gold {
  background: linear-gradient(135deg, #ffe08a, #ffb347);
}

/* Community Grid */
.comm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.2cqw;
  margin-top: 1cqw;
}
.comm-btn {
  padding: 2.8cqw 3cqw;
  border-radius: 2.6cqw;
  border: 1px solid rgba(140, 180, 255, 0.25);
  background: rgba(20, 28, 75, 0.7);
  color: #cfe0ff;
  font-family: inherit;
  font-size: 3cqw;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all .16s ease;
}
.comm-btn:hover {
  background: rgba(40, 60, 140, 0.8);
  color: #fff;
  border-color: #4df3ff;
}

/* --- PlayIt Crystal Forge Styles --- */
.forge-grid {
  display: flex;
  flex-direction: column;
  gap: 2.5cqw;
  margin-top: 1.5cqw;
  width: 100%;
}
.forge-color-card {
  display: flex;
  flex-direction: column;
  gap: 1.8cqw;
  padding: 2.5cqw;
  border-radius: 2.6cqw;
  background: rgba(10, 14, 42, 0.75);
  border: 1px solid rgba(120, 160, 255, 0.22);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}
.forge-color-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--c-col, #4df3ff);
  box-shadow: 0 0 10px var(--c-col, #4df3ff);
}
.forge-color-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.forge-color-title-wrap {
  display: flex;
  align-items: center;
  gap: 1.4cqw;
}
.forge-glyph {
  font-size: 3.4cqw;
  line-height: 1;
}
.forge-color-name {
  font-size: 3.4cqw;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.04em;
}
.forge-color-sub {
  font-size: 2.3cqw;
  color: #a4b7ed;
  font-weight: 600;
}
.forge-btn-fuse-color {
  padding: 1cqw 2.4cqw;
  border-radius: 999px;
  border: 1px solid rgba(77, 243, 255, 0.4);
  background: rgba(14, 28, 70, 0.8);
  color: #cfe0ff;
  font-family: inherit;
  font-size: 2.4cqw;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
}
.forge-btn-fuse-color:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(77, 243, 255, 0.3), rgba(182, 109, 255, 0.3));
  border-color: #4df3ff;
  color: #fff;
  transform: scale(1.04);
}
.forge-btn-fuse-color:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.1);
}

.forge-tiers-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.4cqw;
  width: 100%;
}
.forge-tier-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1cqw;
  padding: 1.6cqw 1cqw;
  border-radius: 1.8cqw;
  background: rgba(18, 24, 65, 0.6);
  border: 1px solid rgba(140, 180, 255, 0.16);
  position: relative;
  transition: transform .15s ease, border-color .15s ease;
}
.forge-tier-slot.can-fuse {
  border-color: var(--c-col, #4df3ff);
  background: rgba(25, 36, 90, 0.75);
  box-shadow: 0 0 12px color-mix(in srgb, var(--c-col, #4df3ff) 25%, transparent);
}
.forge-tier-label {
  font-size: 2.1cqw;
  font-weight: 700;
  color: #8fa6e8;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.forge-gem-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5cqw;
  height: 5cqw;
  min-width: 28px;
  min-height: 28px;
}
.gem-svg {
  width: 100%;
  height: 100%;
  transition: transform .2s ease;
}
.gem-svg.gem-epic {
  animation: pulse 2s infinite ease-in-out;
}
.forge-tier-slot:hover .gem-svg {
  transform: scale(1.15) rotate(4deg);
}
.forge-tier-count {
  font-size: 3.4cqw;
  font-weight: 800;
  color: #fff;
}
.forge-btn-fuse-step {
  width: 100%;
  padding: 0.8cqw 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 14, 38, 0.8);
  color: #a4b8f0;
  font-family: inherit;
  font-size: 2cqw;
  font-weight: 800;
  cursor: pointer;
  transition: all .15s ease;
}
.forge-btn-fuse-step.ready {
  border-color: #ffd36b;
  background: linear-gradient(135deg, #ffd36b, #ff9a6b);
  color: #07102a;
  box-shadow: 0 0 10px rgba(255, 211, 107, 0.45);
  animation: pulse 1.8s infinite;
}
.forge-btn-fuse-step.ready:hover {
  transform: scale(1.05);
}
.forge-btn-fuse-step:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Loot summary box on Game Over / Victory */
.over-loot-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.2cqw;
  padding: 1.8cqw 2.8cqw;
  background: rgba(14, 18, 52, 0.7);
  border: 1px solid rgba(120, 160, 255, 0.25);
  border-radius: 999px;
  max-width: 90%;
  margin: 1cqw 0;
}
.loot-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.8cqw;
  padding: 0.6cqw 1.8cqw;
  border-radius: 999px;
  background: rgba(18, 24, 65, 0.85);
  border: 1px solid var(--pill-col, #4df3ff);
  box-shadow: 0 0 10px color-mix(in srgb, var(--pill-col, #4df3ff) 25%, transparent);
}
.loot-pill-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.loot-pill-val {
  font-size: 2.8cqw;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.04em;
}

@media (prefers-reduced-motion: reduce) {
  .screen, .card, .logo .g2, .hub-panel { animation: none !important; }
}

/* Persistent turret experience, shared by Armory and combat cards. */
.turret-experience { display: flex; flex-direction: column; gap: 1cqw; width: 100%; margin-top: 1.5cqw; color: #d8e5ff; }
.turret-experience-head { display: flex; justify-content: space-between; gap: 1cqw; font-size: 2.4cqw; }
.turret-experience-head b { color: #ffd36b; }
.turret-experience-head > span { color: #94a3b8; font-size: 2cqw; letter-spacing: .08em; }
.turret-experience-track { display: block; height: 1.2cqw; min-height: 4px; background: #18233c; border-radius: 8px; overflow: hidden; }
.turret-experience-track > span { display: block; height: 100%; background: linear-gradient(90deg, #4df3ff, #b66dff); border-radius: inherit; }
.turret-experience-values { font-size: 2.2cqw; line-height: 1.5; color: #aebfdf; }
.armory-experience-detail { padding: 2.5cqw; margin: 2cqw 0; border: 1px solid rgba(110, 160, 255, .25); border-radius: 2cqw; background: rgba(10, 20, 40, .65); }
.armory-experience-detail .turret-experience { margin-top: 0; }
.armory-experience-detail p { margin-top: 1.5cqw; font-size: 2.3cqw; line-height: 1.5; color: #94a3b8; }

/* Armory research and two crystal purchase options. */
.research-subtitle, .research-owned-summary { font-size: 2.4cqw; color: #9ab0ed; }
.research-notice { padding: 2cqw 2.5cqw; margin-bottom: 3cqw; border-left: 3px solid #ffd36b; background: rgba(255, 211, 107, .06); color: #d9c99e; font-size: 2.6cqw; line-height: 1.5; }
.research-preview { padding: 3cqw; margin-bottom: 3cqw; border: 1px solid rgba(110, 160, 255, .35); border-radius: 3cqw; background: linear-gradient(135deg, #141e43, #090e25); }
.research-preview h3 { font-size: 4cqw; margin-top: 1cqw; }
.research-level { padding: 1.5cqw 2cqw; border-radius: 1.5cqw; font-size: 2.8cqw; background: rgba(255,255,255,.04); }
.research-level.met { color: #38ef7d; }
.research-level.unmet { color: #ffd36b; }
.research-buy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2cqw; margin-top: 2.5cqw; }
.research-buy-option { display: flex; flex-direction: column; gap: 1.5cqw; padding: 2.5cqw; border: 1px solid #334873; border-radius: 2cqw; background: rgba(3,8,25,.45); min-width: 0; }
.research-buy-option.permanent { border-color: #7756b5; background: rgba(69,35,109,.15); }
.research-buy-option h4 { font-size: 3cqw; color: #eaf3ff; }
.research-buy-option p { font-size: 2.5cqw; line-height: 1.5; color: #aebfdf; }
.research-price { display: flex; align-items: center; gap: 1cqw; margin-top: auto; font-size: 2.6cqw; }
.research-price svg { flex-shrink: 0; }
.research-balance { font-size: 2.4cqw; line-height: 1.4; color: #aebfdf; }
.research-buy-btn { border: 1px solid #4df3ff; border-radius: 1.6cqw; padding: 2cqw 1cqw; font-family: inherit; font-size: 2.6cqw; font-weight: 700; color: #b9f8ff; background: rgba(77,243,255,.12); cursor: pointer; min-height: 9cqw; }
.permanent .research-buy-btn { border-color: #b66dff; color: #e6d0ff; background: rgba(182,109,255,.16); }
.research-buy-btn:disabled { border-color: #34405d; background: #131c31; color: #8091b3; cursor: default; }
.research-buy-btn:not(:disabled):hover { filter: brightness(1.25); }
.research-feedback { min-height: 1em; margin-top: 2cqw; color: #ffd36b; font-size: 2.8cqw; line-height: 1.4; }
.research-wallet { display: flex; flex-wrap: wrap; align-items: center; gap: 2cqw; margin-bottom: 3cqw; padding: 2cqw; border-radius: 2cqw; background: rgba(20,30,60,.6); color: #becdef; font-size: 2.5cqw; }
.research-wallet > span { display: inline-flex; align-items: center; gap: .8cqw; }
.research-wallet > span:first-child { width: 100%; font-weight: 700; }
.research-wallet button { margin-left: auto; padding: 1.5cqw; border: 1px solid #44567d; border-radius: 1.2cqw; color: #b9d6ff; background: #18233e; font-family: inherit; font-size: 2.5cqw; cursor: pointer; }
.research-category { margin-bottom: 3cqw; }
.research-category h4 { font-size: 3cqw; color: #becdef; margin-bottom: 1.5cqw; }
.research-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5cqw; }
.research-card { display: flex; flex-direction: column; align-items: flex-start; gap: 1.5cqw; padding: 2.5cqw; border: 1px solid #33415e; border-radius: 2cqw; background: #10172f; text-align: left; color: #eaf3ff; font-family: inherit; cursor: pointer; min-width: 0; }
.research-card strong { font-size: 3cqw; line-height: 1.3; }
.research-card-number { font-size: 2.2cqw; color: #94a8cd; line-height: 1.4; }
.research-card.selected { border-color: #4df3ff; box-shadow: 0 0 0 1px #4df3ff; background: #17264a; }
.research-card:focus-visible, .research-buy-btn:focus-visible, .research-wallet button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.research-status { display: inline-block; font-size: 2.2cqw; padding: .8cqw 1.4cqw; border-radius: 1cqw; background: #223049; color: #b5c6e7; line-height: 1.4; }
.research-card .research-status { margin-top: auto; }
.research-status.locked { color: #d9b982; background: #332b24; }
.research-status.pool { color: #85f7be; background: #153e31; }
.research-status.permanent { color: #dfbbff; background: #392353; }
@container (max-width: 360px) {
  .research-buy-grid { grid-template-columns: 1fr; }
  .research-buy-option p, .research-balance { font-size: 3cqw; }
  .research-buy-btn { font-size: 3.2cqw; }
}

/* Campaign stage selection. */
.campaign-selector-wrap { width: 100%; min-width: 0; }
.campaign-selector-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5cqw; color: #9eb2dc; font-size: 2.5cqw; font-weight: 700; letter-spacing: .08em; }
.campaign-selector-controls { display: flex; align-items: center; gap: 2cqw; }
.campaign-selector-controls button { width: 7cqw; height: 7cqw; min-width: 28px; min-height: 28px; border: 1px solid #34456f; border-radius: 50%; background: #101a35; color: #cde6ff; font-family: inherit; font-size: 5cqw; line-height: 1; cursor: pointer; }
.campaign-selector-controls button:disabled { opacity: .35; cursor: default; }
.campaign-selector { position: relative; display: flex; gap: 2cqw; width: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 3cqw; padding: 1cqw 3cqw 2cqw; touch-action: pan-x; overscroll-behavior-x: contain; scrollbar-width: none; }
.campaign-selector::-webkit-scrollbar { display: none; }
.campaign-swipe-hint { display: block; margin-top: 1cqw; color: #788caf; font-size: 2.3cqw; }
.campaign-stage { flex: 0 0 calc(100% - 6cqw); scroll-snap-align: center; min-width: 0; text-align: left; display: flex; flex-direction: column; gap: 1cqw; padding: 3cqw; border: 1px solid #34456f; border-radius: 2cqw; background: #101a35; color: #b8c9ed; font-family: inherit; cursor: pointer; }
.campaign-stage b { font-size: 3.2cqw; }
.campaign-stage span { font-size: 2.7cqw; }
.campaign-stage.active { border-color: var(--stage-color); color: #e1fcff; background: color-mix(in srgb, var(--stage-color) 12%, #101a35); }
.campaign-stage:disabled { color: #7886a5; background: #121729; cursor: default; }
.campaign-stage:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.campaign-lock-hint { font-size: 2.5cqw; color: #a99ccd; line-height: 1.4; }
.campaign-description { font-size: 2.8cqw; color: #aebfdf; line-height: 1.4; max-width: 48ch; }
#screenMenu { gap: 2.5cqw; }
#screenMenu .logo span { font-size: 12cqw; }
#screenMenu .logo .g2 { font-size: 10cqw; }
#screenMenu .hint { font-size: 2.8cqw; }
#screenMenu .btn, #screenOver .btn { padding: 2.8cqw 7cqw; font-size: 3.8cqw; }

.campaign-stage-top { display: flex; align-items: center; justify-content: space-between; gap: 2cqw; width: 100%; }
.campaign-stage strong { color: var(--stage-color); font-size: 4.5cqw; }
.campaign-stage-status { padding: .6cqw 1.4cqw; border-radius: 1cqw; background: rgba(255,255,255,.06); font-size: 2.4cqw !important; }
.campaign-stage.completed .campaign-stage-status { color: #7df5a9; }
.campaign-stage-reward { color: #ffd36b; font-size: 2.5cqw !important; margin-top: .8cqw; }
#screenMenu { overflow-y: auto; justify-content: safe center; touch-action: pan-y; }
#screenMenu > * { flex-shrink: 0; }
#screenMenu .btn:disabled { color: #7886a5; background: #121729; box-shadow: none; cursor: default; }

/* Full Defender reset lives at the bottom of Settings. */
.reset-card { margin-top: 3cqw; border-color: rgba(255, 93, 115, .35); }
.reset-progress-btn { width: 100%; margin-top: 2cqw; padding: 2.8cqw; border: 1px solid #ff5d73; border-radius: 2cqw; background: rgba(255, 93, 115, .1); color: #ffa6b3; font-family: inherit; font-size: 3.2cqw; font-weight: 800; cursor: pointer; }
.reset-progress-btn:hover { background: rgba(255, 93, 115, .2); }
.reset-progress-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.reset-feedback { color: #ffb1bd; font-size: 2.6cqw; margin-top: 1.5cqw; line-height: 1.4; }
.reset-feedback:empty { display: none; }

/* Settings access on the initial menu. */
.menu-settings-btn { position: absolute; top: max(3cqw, 12px, env(safe-area-inset-top, 12px)); right: max(3cqw, 12px); z-index: 3; }

.activate-stages-btn { width: 100%; margin-top: 2cqw; padding: 2.8cqw; border: 1px solid #4df3ff; border-radius: 2cqw; background: rgba(77, 243, 255, .1); color: #a9f5ff; font-family: inherit; font-size: 3.2cqw; font-weight: 800; cursor: pointer; }
.activate-stages-btn:hover { background: rgba(77, 243, 255, .2); }
.activate-stages-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.activate-stages-hint, .activate-stages-feedback { margin-top: 1.5cqw; font-size: 2.6cqw; color: #aebfdf; line-height: 1.4; }
.activate-stages-feedback { color: #7df5a9; }
.activate-stages-feedback:empty { display: none; }

/* Cards catalog: draft cards first, future Armory effects in readable gray. */
.cards-catalog-intro { color: #9aaac2; font-size: 2.6cqw; line-height: 1.6; margin: 2cqw 0 3cqw; }
.catalog-section + .catalog-section { margin-top: 6cqw; }
.catalog-section-head { display: flex; align-items: center; justify-content: space-between; gap: 2cqw; }
.catalog-section-head h4 { font-size: 3.4cqw; color: #e6edff; }
.catalog-section-head > span { padding: .8cqw 2cqw; border-radius: 3cqw; background: #202c45; color: #bbcae0; font-size: 2.5cqw; }
.cards-catalog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2cqw; }
.catalog-card { min-width: 0; padding: 3cqw; border: 1px solid color-mix(in srgb, var(--card-color) 40%, #29334a); border-radius: 2.5cqw; background: linear-gradient(145deg, color-mix(in srgb, var(--card-color) 10%, #111a2c), #101727); }
.catalog-card-head { display: flex; align-items: center; gap: 1.5cqw; margin-bottom: 2cqw; }
.catalog-card-head svg { width: 5cqw; height: 5cqw; flex-shrink: 0; fill: var(--card-color); }
.catalog-card-status { color: #8be8bc; font-size: 2cqw; line-height: 1.4; }
.catalog-card-category { display: block; color: var(--card-color); font-size: 2.1cqw; line-height: 1.5; }
.catalog-card h4 { color: #eef3ff; font-size: 3cqw; line-height: 1.4; margin: 1cqw 0 1.5cqw; overflow-wrap: anywhere; }
.catalog-card p { color: #bac5d9; font-size: 2.4cqw; line-height: 1.6; }
.catalog-card-variants { display: grid; gap: 1.5cqw; margin-top: 2.5cqw; }
.catalog-card-variants div { display: grid; gap: .5cqw; font-size: 2.2cqw; color: #ced9ed; line-height: 1.5; }
.catalog-card .catalog-card-note { border-top: 1px solid #2c364b; margin-top: 2.5cqw; padding-top: 2cqw; font-size: 2.1cqw; color: #95a6c0; }
.catalog-card.is-inactive { --card-color: #9299a6 !important; border-color: #383e49; background: #191e28; }
.catalog-card.is-inactive .catalog-card-status, .catalog-card.is-inactive h4 { color: #bbc0ca; }
.catalog-card.is-inactive p, .catalog-card.is-inactive .catalog-card-note { color: #9da5b3; }

.cards-filters { display: grid; gap: 3cqw; margin: 3cqw 0 5cqw; }
.cards-turret-filter { display: flex; align-items: center; gap: 3cqw; font-size: 2.8cqw; color: #c7d5eb; }
.cards-turret-filter select { flex: 1; min-width: 0; padding: 2.5cqw 3cqw; border: 1px solid #354866; border-radius: 1.5cqw; background: #121e33; color: #eef3ff; font: inherit; }
.cards-status-filters { display: flex; gap: 1cqw; padding: 1cqw; border: 1px solid #2c3a54; border-radius: 2cqw; background: #0e1728; }
.cards-status-filters button { flex: 1; padding: 2.5cqw 1cqw; border: 1px solid transparent; border-radius: 1.3cqw; background: transparent; color: #a5b5cd; font: inherit; font-size: 2.5cqw; cursor: pointer; }
.cards-status-filters button.active { background: #1b3850; color: #7cefff; border-color: #377488; }
.cards-status-filters button:hover { color: #eef3ff; }
.cards-status-filters button:focus-visible, .cards-turret-filter select:focus-visible { outline: 2px solid #4df3ff; outline-offset: 2px; }
.cards-catalog-empty { padding: 5cqw 2cqw; color: #adbed7; font-size: 2.8cqw; line-height: 1.6; }

.cards-reroll { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 16px; }
.cards-reroll .btn { min-height: 44px; font-size: clamp(12px, 2.8cqw, 15px); }
.cards-reroll .sub { margin: 0; max-width: 90%; font-size: clamp(11px, 2.4cqw, 13px); }
.cards-reroll .btn:disabled { opacity: 0.45; cursor: default; }

.armory-catalog-card { display: flex; flex-direction: column; }
.armory-catalog-card .armory-buy { margin-top: auto; padding-top: 2cqw; }
.armory-buy summary { list-style: none; cursor: pointer; border: 1px solid var(--card-color); border-radius: 1.6cqw; padding: 2cqw; color: #eef3ff; text-align: center; font-size: 2.8cqw; font-weight: 700; background: color-mix(in srgb, var(--card-color) 14%, transparent); }
.armory-buy summary::-webkit-details-marker { display: none; }
.armory-buy summary:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.armory-buy[open] summary { margin-bottom: 2cqw; }
.armory-buy-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1cqw; }
.armory-buy .research-buy-option { padding: 2cqw; }
.armory-buy .research-buy-option h4 { margin: 0; }
.armory-buy .research-price { flex-wrap: wrap; }
.armory-buy .research-feedback:empty { display: none; }

.armory-buy-compact { display: flex; align-items: center; justify-content: center; gap: .7cqw; min-width: 0; min-height: 36px; padding: 1.5cqw .5cqw; font-size: 2.1cqw; }
.armory-buy-compact svg { width: 3.4cqw; height: 3.4cqw; flex-shrink: 0; }
.armory-buy-compact.permanent:not(:disabled) { border-color: #b66dff; color: #e6d0ff; background: rgba(182,109,255,.16); }

.armory-catalog-card.is-unavailable { filter: grayscale(1); background: #191e28; border-color: #414650; }

.armory-catalog-card .catalog-card-status { display: inline-block; padding: .7cqw 1.2cqw; border: 1px solid currentColor; border-radius: 1cqw; font-weight: 700; }
.armory-catalog-card.is-unavailable .catalog-card-status { color: #e0e3e8; }

#screenCards { padding: 4cqw; gap: 2cqw; overflow-y: auto; }
#screenCards .title { font-size: 6cqw; }
#screenCards > .sub { font-size: 3cqw; }
#screenCards .cards { gap: 2cqw; margin: 0; flex-shrink: 0; }
#screenCards .card { padding: 0; gap: 0; border-radius: 2.5cqw; }
#screenCards .card::before { pointer-events: none; }
.draft-select { position: relative; display: flex; align-items: center; gap: 3cqw; width: 100%; padding: 2cqw 11cqw 2cqw 2cqw; border: 0; background: transparent; color: inherit; text-align: left; font: inherit; cursor: pointer; }
#screenCards .card-ico { width: 17cqw; height: 17cqw; }
#screenCards .card-ico svg { width: 12cqw; height: 12cqw; }
#screenCards .card strong { font-size: 4cqw; line-height: 1.2; }
.draft-level { font-size: 2.7cqw; color: #c7d5ef; }
#screenCards .card kbd { top: auto; bottom: 1.5cqw; right: 3cqw; }
.draft-info { position: absolute; top: 1.5cqw; right: 1.5cqw; display: grid; place-items: center; width: 8cqw; height: 8cqw; min-width: 32px; min-height: 32px; border: 1px solid var(--rc); border-radius: 50%; background: #151d38; color: #eef3ff; font-family: inherit; font-size: 4cqw; font-weight: 700; cursor: pointer; }
.draft-select:focus-visible, .draft-info:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
#screenCards .cards-reroll { margin-top: 1cqw; gap: 1cqw; flex-shrink: 0; }
.card-info-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 5cqw; background: rgba(3,6,18,.88); }
.card-info-panel { width: 100%; max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 3cqw; padding: 5cqw; border: 1px solid #607eab; border-radius: 3cqw; background: #101a30; }
.card-info-panel h3 { font-size: 5cqw; }
.card-info-panel > p { font-size: 3.5cqw; line-height: 1.5; color: #d0dbee; }
@media (max-height: 550px) { #screenCards { justify-content: flex-start; } #screenCards .card-ico { width: 11cqw; height: 11cqw; } #screenCards .card-ico svg { width: 8cqw; height: 8cqw; } }

#screenCards { justify-content: center; overflow: hidden; }
#screenCards .cards { flex: 0 1 auto; min-height: 0; overflow-y: auto; padding: 1cqw; }
#screenCards > .title, #screenCards > .sub { flex-shrink: 0; }
#screenCards .draft-select { gap: 2.5cqw; padding: 2.5cqw 10cqw 2.5cqw 2.5cqw; }
#screenCards .card-ico { width: 12cqw; height: 12cqw; }
#screenCards .card-ico svg { width: 8cqw; height: 8cqw; }
#screenCards .card-body { gap: .8cqw; }
#screenCards .card strong { font-size: 3.6cqw; }
#screenCards .card em { font-size: 3cqw; line-height: 1.35; }
#screenCards .card-tag { font-size: 2.2cqw; letter-spacing: .03em; }
#screenCards .draft-level { font-size: 2.3cqw; }
#screenCards .cards-reroll { width: 100%; }
