/* ============================================================================
   Tiny Warriors Rush — Hand-Crafted Glossy Fantasy Mobile PWA Stylesheet
   Zero external CSS dependencies; optimized for portrait mobile & PWA.
   ============================================================================ */

:root {
  --ink: #171421;
  --ink-soft: rgba(23, 20, 33, 0.72);
  --panel-top: #556585;
  --panel-bot: #3c4863;
  --panel-deep: #242c3f;
  --gold-hi: #fde047;
  --gold-mid: #f59e0b;
  --gold-lo: #b45309;
  --sky-hi: #7dd3fc;
  --sky-mid: #0ea5e9;
  --sky-lo: #0369a1;
  --evo-hi: #f0abfc;
  --evo-mid: #9333ea;
  --evo-lo: #581c87;
  --emerald-hi: #a3e635;
  --emerald-mid: #22c55e;
  --emerald-lo: #15803d;
  --crimson-hi: #fb7185;
  --crimson-mid: #ef4444;
  --crimson-lo: #b91c1c;
  --font-display: 'Lilita One', 'Fredoka', 'Trebuchet MS', 'Arial Rounded MT Bold', Impact, sans-serif;
  --font-ui: 'Fredoka', 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: radial-gradient(circle at 50% 15%, #28334e 0%, #141928 55%, #0b0e17 100%);
  font-family: var(--font-ui);
  color: #ffffff;
  touch-action: manipulation;
}

button {
  font-family: inherit;
  color: inherit;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

/* ---------- Portrait App Shell (full-bleed on phones, 430px centered on desktop) ---------- */
#app-shell {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #1a2234;
  box-shadow: 0 0 48px rgba(0, 0, 0, 0.8);
}

@media (min-width: 450px) {
  #app-shell {
    border-left: 3px solid var(--ink);
    border-right: 3px solid var(--ink);
  }
}

.hidden {
  display: none !important;
}

.font-title {
  font-family: var(--font-display);
  letter-spacing: 0.025em;
}

.text-outline {
  text-shadow:
    -2px -2px 0 var(--ink),
     2px -2px 0 var(--ink),
    -2px  2px 0 var(--ink),
     2px  2px 0 var(--ink),
     0px  3px 0 var(--ink);
}

.text-outline-sm {
  text-shadow:
    -1.4px -1.4px 0 var(--ink),
     1.4px -1.4px 0 var(--ink),
    -1.4px  1.4px 0 var(--ink),
     1.4px  1.4px 0 var(--ink),
     0px    2px   0 var(--ink);
}

/* ---------- Shared SVG Icon Sizing ---------- */
.icon-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ico-xs { width: 15px; height: 15px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ico-sm { width: 19px; height: 19px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ico-md { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ico-lg { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ico-xl { width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---------- Glossy Toon Containers & Bevelled Buttons ---------- */
.toon-box {
  border: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink), inset 0 2px 0 rgba(255, 255, 255, 0.22);
}

.toon-box-sm {
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink), inset 0 1.5px 0 rgba(255, 255, 255, 0.2);
}

.toon-btn {
  position: relative;
  border: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink), inset 0 3px 0 rgba(255, 255, 255, 0.36), inset 0 -3px 0 rgba(0, 0, 0, 0.18);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toon-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink), inset 0 2px 0 rgba(255, 255, 255, 0.2);
}

.toon-btn:disabled {
  opacity: 0.48;
  filter: grayscale(0.45);
  cursor: not-allowed;
}

.btn-emerald { background: linear-gradient(180deg, var(--emerald-hi) 0%, var(--emerald-mid) 45%, var(--emerald-lo) 100%); color: #ffffff; }
.btn-gold    { background: linear-gradient(180deg, var(--gold-hi) 0%, var(--gold-mid) 70%, #d97706 100%); color: #171421; }
.btn-sky     { background: linear-gradient(180deg, var(--sky-hi) 0%, var(--sky-mid) 55%, var(--sky-lo) 100%); color: #ffffff; }
.btn-evo     { background: linear-gradient(180deg, var(--evo-hi) 0%, var(--evo-mid) 55%, var(--evo-lo) 100%); color: #ffffff; }
.btn-crimson { background: linear-gradient(180deg, var(--crimson-hi) 0%, var(--crimson-mid) 55%, var(--crimson-lo) 100%); color: #ffffff; }
.btn-slate   { background: linear-gradient(180deg, #64748b 0%, #475569 60%, #334155 100%); color: #ffffff; }
.btn-cream   { background: linear-gradient(180deg, #f1f5f9 0%, #cbd5e1 100%); color: var(--ink); }
.btn-lime    { background: linear-gradient(180deg, #d9f99d 0%, #a3e635 100%); color: var(--ink); }

/* ---------- Holographic Foil Sheen Sweep (Epic Evolutions) ---------- */
@keyframes foilSweep {
  0%   { transform: translateX(-140%) skewX(-22deg); }
  55%  { transform: translateX(220%) skewX(-22deg); }
  100% { transform: translateX(220%) skewX(-22deg); }
}

.foil-shine {
  position: relative;
  overflow: hidden;
}

.foil-shine::after {
  content: '';
  position: absolute;
  top: -20%;
  left: 0;
  width: 42%;
  height: 140%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.48) 50%, transparent 100%);
  animation: foilSweep 2.8s infinite ease-in-out;
  pointer-events: none;
}

/* ---------- Scrollable Internal Container ---------- */
.inner-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.inner-scroll::-webkit-scrollbar {
  display: none;
}

/* ---------- Toast Pill ---------- */
#toast {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + 48px);
  left: 50%;
  transform: translateX(-50%) translateY(-14px);
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  background: rgba(15, 23, 42, 0.96);
  color: var(--gold-hi);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============================================================================
   LOBBY SCREEN
   ============================================================================ */
#lobby-screen {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #38bdf8 0%, #60a5fa 22%, #3a4763 45%, #212a3e 100%);
}

.lobby-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 12px 4px;
  z-index: 5;
}

.lobby-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.84);
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  padding: 4px 11px 4px 6px;
  font-weight: 800;
  font-size: 14px;
  transition: transform 0.14s ease;
}

.pill-counter.pulse {
  transform: scale(1.1);
}

.icon-btn-sq {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  padding: 7px;
}

.install-pill {
  height: 36px;
  border-radius: 12px;
  padding: 0 10px;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
}

/* Title Crest & Live Clash Banner */
.lobby-hero-band {
  padding: 2px 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.title-crest {
  position: relative;
  text-align: center;
  margin-bottom: 6px;
}

.title-kicker {
  display: inline-block;
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg, #334155 0%, #0f172a 100%);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--gold-hi);
  margin-bottom: -8px;
}

.title-ribbon {
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 65%, #d97706 100%);
  border: 3px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 rgba(255, 255, 255, 0.5);
  border-radius: 18px;
  padding: 6px 20px 4px;
  transform: rotate(-1deg);
}

.title-ribbon h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.05;
  color: #ffffff;
  letter-spacing: 0.03em;
}

.title-ribbon h1 span {
  color: #ef4444;
}

.lobby-preview-frame {
  position: relative;
  width: 100%;
  height: 92px;
  border-radius: 18px;
  overflow: hidden;
  background: #77b538;
}

#lobby-preview-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.lobby-badge {
  position: absolute;
  top: 7px;
  right: 8px;
  background: rgba(15, 23, 42, 0.84);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold-hi);
}

/* Lobby Tab Switcher */
.lobby-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 0 12px 8px;
}

.lobby-tab-btn {
  border-radius: 13px;
  padding: 8px 6px;
  font-size: 12.5px;
  font-weight: 800;
  gap: 5px;
  letter-spacing: 0.01em;
}

.lobby-tab-btn.active {
  background: linear-gradient(180deg, var(--gold-hi) 0%, var(--gold-mid) 100%);
  color: var(--ink);
}

.lobby-tab-btn:not(.active) {
  background: linear-gradient(180deg, #52617d 0%, #39455d 100%);
  color: #dbeafe;
}

/* Lobby Body Content */
.lobby-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 12px 10px;
}

.lobby-card {
  background: linear-gradient(180deg, var(--panel-top) 0%, var(--panel-bot) 100%);
  border-radius: 18px;
  padding: 11px;
  margin-bottom: 10px;
}

.card-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-label {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #bae6fd;
}

.biome-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 999px;
  border: 2px solid var(--ink);
}

.biome-meadow { background: #a3e635; color: var(--ink); }
.biome-dusk   { background: #a78bfa; color: var(--ink); }
.biome-volcanic { background: #f97316; color: #ffffff; }
.biome-endless  { background: #e879f9; color: var(--ink); }

.stage-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-arrow {
  width: 40px;
  height: 44px;
  border-radius: 13px;
  padding: 10px;
  flex-shrink: 0;
}

.stage-readout {
  flex: 1;
  min-width: 0;
  background: var(--panel-deep);
  border: 2.5px solid var(--ink);
  border-radius: 13px;
  padding: 6px 10px;
  text-align: center;
}

.stage-title {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--gold-hi);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-sub {
  font-size: 11px;
  color: #cbd5e1;
  font-weight: 600;
  margin-top: 2px;
}

.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 9px;
}

.mode-btn {
  padding: 7px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  gap: 5px;
}

/* Skill Picker */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.skill-choice-btn {
  border-radius: 14px;
  padding: 8px 6px;
  flex-direction: column;
  gap: 4px;
}

.skill-choice-btn .sk-lbl {
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.1;
}

.skill-desc {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: #e2e8f0;
  line-height: 1.35;
  font-weight: 500;
}

/* Meta Upgrades Grid */
.upgrades-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.upgrade-tile {
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  border-radius: 15px;
  padding: 9px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  text-align: left;
  gap: 5px;
}

.upg-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.upg-lv {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: #0f172a;
  color: #7dd3fc;
  border: 1.5px solid var(--ink);
}

.upg-name {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
}

.upg-desc {
  font-size: 10.5px;
  font-weight: 700;
  color: #bef264;
  line-height: 1.25;
}

.upg-prog-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: #0f172a;
  overflow: hidden;
  border: 1px solid var(--ink);
}

.upg-prog-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #a3e635);
}

.upg-cost-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 9px;
  border: 2px solid var(--ink);
  font-size: 11.5px;
  font-weight: 900;
}

.upg-cost-pill.buyable { background: linear-gradient(180deg, #fde047, #f59e0b); color: var(--ink); }
.upg-cost-pill.locked  { background: #475569; color: #fde68a; opacity: 0.75; }
.upg-cost-pill.maxed   { background: #334155; color: #94a3b8; }

/* Barracks Hero Codex */
.barracks-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.evo-toggle-btn {
  padding: 6px 11px;
  border-radius: 11px;
  font-size: 11.5px;
  font-weight: 800;
  gap: 5px;
}

.barracks-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.codex-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 16px;
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  background: linear-gradient(180deg, #3b4761 0%, #273044 100%);
}

.codex-row.evo-mode {
  background: linear-gradient(135deg, #581c87 0%, #7e22ce 55%, #b45309 100%);
}

.codex-portrait {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  background: rgba(15, 23, 42, 0.45);
  flex-shrink: 0;
  overflow: hidden;
}

.codex-info {
  flex: 1;
  min-width: 0;
}

.codex-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.codex-name {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--gold-hi);
}

.codex-role {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #bae6fd;
}

.codex-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 700;
  color: #f8fafc;
}

.codex-stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.codex-desc {
  margin-top: 3px;
  font-size: 10.5px;
  color: #cbd5e1;
  line-height: 1.3;
}

.codex-row.evo-mode .codex-desc {
  color: #fef08a;
  font-weight: 700;
}

/* Sticky Bottom Play Footer */
.lobby-footer {
  padding: 8px 12px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(24, 31, 47, 0.92) 0%, #141a29 100%);
  border-top: 3px solid var(--ink);
}

#start-battle-btn {
  width: 100%;
  padding: 12px 16px;
  border-radius: 18px;
  font-family: var(--font-display);
  font-size: 25px;
  letter-spacing: 0.06em;
  gap: 9px;
}

/* ============================================================================
   BATTLE SCREEN
   ============================================================================ */
#battle-screen {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#battle-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: max(9px, env(safe-area-inset-top)) 8px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  pointer-events: none;
}

#battle-hud > * {
  pointer-events: auto;
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

#hud-coins-pill {
  padding: 3px 9px 3px 5px;
  font-size: 13px;
  gap: 4px;
}

.hud-stage-pill {
  background: rgba(15, 23, 42, 0.84);
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--gold-hi);
  white-space: nowrap;
}

.hud-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  padding: 5px;
}

.hud-speed-btn {
  height: 32px;
  min-width: 44px;
  padding: 0 7px;
  border-radius: 10px;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 900;
}

/* Battlefield Canvas Wrap */
#canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

#battle-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Dramatic Boss Warning Banner */
#boss-banner {
  position: absolute;
  top: 26%;
  left: 0;
  right: 0;
  z-index: 26;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(127, 29, 29, 0.94) 0%, rgba(220, 38, 38, 0.98) 50%, rgba(127, 29, 29, 0.94) 100%);
  border-top: 3.5px solid var(--ink);
  border-bottom: 3.5px solid var(--ink);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
  padding: 9px 12px;
  text-align: center;
  transform: scaleY(0);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.2, 1.35, 0.4, 1), opacity 0.24s ease;
}

#boss-banner.show {
  transform: scaleY(1);
  opacity: 1;
}

.boss-banner-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 21px;
  color: var(--gold-hi);
  letter-spacing: 0.04em;
}

.boss-banner-sub {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ffffff;
  margin-top: 2px;
}

/* Floating Ornate Active Skill Shield (Bottom-Left) */
#skill-btn-wrap {
  position: absolute;
  left: 11px;
  bottom: 20px;
  z-index: 18;
}

.skill-shield {
  position: relative;
  width: 68px;
  height: 78px;
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  border: 3px solid var(--ink);
  border-radius: 15px 15px 34px 34px;
  box-shadow: 0 4px 0 var(--ink), 0 8px 16px rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 7px 6px 8px;
  overflow: hidden;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.skill-shield:active {
  transform: scale(0.92) translateY(2px);
}

.skill-shield.ready {
  background: linear-gradient(180deg, #38bdf8 0%, #1d4ed8 100%);
  border-color: #fde047;
  box-shadow: 0 0 0 2px var(--ink), 0 4px 0 var(--ink), 0 0 20px rgba(56, 189, 248, 0.9);
  animation: skillReadyPulse 1.15s infinite ease-in-out;
}

@keyframes skillReadyPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 2px var(--ink), 0 4px 0 var(--ink), 0 0 14px rgba(56, 189, 248, 0.8); }
  50%      { transform: scale(1.045); box-shadow: 0 0 0 2px var(--ink), 0 4px 0 var(--ink), 0 0 26px rgba(250, 204, 21, 0.95); }
}

.skill-charge-track {
  width: 100%;
  height: 8px;
  background: #0f172a;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
}

#skill-charge-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8 0%, #fde047 100%);
  transition: width 0.12s linear;
}

#skill-charge-text {
  font-size: 10px;
  font-weight: 900;
  color: #ffffff;
  margin-top: 2px;
  line-height: 1;
}

/* ============================================================================
   BOTTOM DECK PANEL
   ============================================================================ */
#deck-panel {
  position: relative;
  z-index: 24;
  background: linear-gradient(180deg, #647493 0%, #4b5975 55%, #3b465e 100%);
  border-top: 3.5px solid var(--ink);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  margin-top: -14px;
  padding: 9px 8px max(11px, env(safe-area-inset-bottom));
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.25), 0 -6px 16px rgba(0, 0, 0, 0.35);
}

.xp-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
}

.xp-star-badge {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.16s ease;
}

.xp-star-badge.pulse {
  transform: scale(1.18);
}

#xp-level-num {
  position: absolute;
  font-family: var(--font-display);
  font-size: 15px;
  color: #ffffff;
  line-height: 1;
}

.xp-bar-track {
  position: relative;
  flex: 1;
  height: 20px;
  background: #1a2130;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.55);
}

#xp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(180deg, #7dd3fc 0%, #0ea5e9 55%, #0284c7 100%);
  transition: width 0.15s ease-out;
}

#xp-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 800;
  color: #ffffff;
}

/* 6-Slot Card Grid */
#deck-slots {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin-top: 8px;
}

.deck-slot {
  position: relative;
  aspect-ratio: 3 / 4.15;
  border-radius: 11px;
  border: 2.5px solid var(--ink);
  background: #364158;
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.deck-slot.empty-plus {
  color: rgba(203, 213, 225, 0.48);
  font-weight: 900;
  font-size: 20px;
}

.deck-slot.filled {
  background: linear-gradient(180deg, #38bdf8 0%, #0369a1 100%);
  border: 2.5px solid #fde047;
  box-shadow: 0 0 0 2px var(--ink), 0 3px 0 var(--ink);
  cursor: pointer;
}

.deck-slot.evolved {
  background: linear-gradient(180deg, #d946ef 0%, #6b21a8 100%);
  border: 2.5px solid #fde047;
  box-shadow: 0 0 0 2px var(--ink), 0 0 10px rgba(250, 204, 21, 0.78);
}

.deck-slot.spawn-pop {
  animation: slotPop 0.26s ease-out;
}

@keyframes slotPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.11); }
  100% { transform: scale(1); }
}

.slot-portrait-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

.slot-lv-badge {
  position: absolute;
  top: 2px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 900;
  color: var(--gold-hi);
  pointer-events: none;
  z-index: 2;
}

.slot-count-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid var(--gold-hi);
  border-radius: 5px;
  color: var(--gold-hi);
  font-size: 9px;
  font-weight: 900;
  padding: 0 3px;
  line-height: 1.25;
  pointer-events: none;
  z-index: 2;
}

/* GPU-composited Cooldown Overlay */
.cooldown-mask {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 25, 0.64);
  transform-origin: bottom center;
  transform: scaleY(0);
  will-change: transform;
  pointer-events: none;
  z-index: 1;
}

/* ============================================================================
   MODALS (Draft, Roster, Pause, Result)
   ============================================================================ */
.modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(11, 15, 26, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-panel {
  width: 100%;
  max-width: 392px;
  background: linear-gradient(180deg, #4b5a78 0%, #2d374e 100%);
  border-radius: 26px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  max-height: 90dvh;
}

.modal-panel-sm {
  max-width: 336px;
  text-align: center;
  gap: 11px;
}

.modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.modal-hdr h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--gold-hi);
}

.draft-header {
  text-align: center;
  margin-bottom: 10px;
}

.draft-badge {
  display: inline-block;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
}

.draft-header h2 {
  margin: 5px 0 0;
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--gold-hi);
  line-height: 1.1;
}

.draft-cards-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 1px;
}

@keyframes draftPopIn {
  0%   { opacity: 0; transform: translateY(16px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.draft-card {
  position: relative;
  width: 100%;
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 5px 0 var(--ink), inset 0 2px 0 rgba(255, 255, 255, 0.35);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  transition: transform 0.1s ease;
  animation: draftPopIn 0.14s cubic-bezier(0.2, 1.35, 0.4, 1) backwards;
}

.draft-card:nth-child(1) { animation-delay: 0s; }
.draft-card:nth-child(2) { animation-delay: 0.03s; }
.draft-card:nth-child(3) { animation-delay: 0.06s; }

.draft-card:active {
  transform: scale(0.97) translateY(3px);
}

.draft-card.type-recruit { background: linear-gradient(135deg, #38bdf8 0%, #1d4ed8 100%); color: #ffffff; }
.draft-card.type-evolve  { background: linear-gradient(135deg, #a855f7 0%, #c026d3 52%, #f59e0b 100%); color: #ffffff; }
.draft-card.type-heal    { background: linear-gradient(135deg, #34d399 0%, #059669 100%); color: #ffffff; }
.draft-card.type-upgrade { background: linear-gradient(135deg, #fde047 0%, #f59e0b 100%); color: var(--ink); }

.draft-portrait {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  background: rgba(15, 23, 42, 0.35);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.draft-info {
  flex: 1;
  min-width: 0;
}

.draft-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 3px;
}

.draft-card.type-evolve .draft-tag  { background: #fde047; color: var(--ink); }
.draft-card.type-recruit .draft-tag,
.draft-card.type-heal .draft-tag    { background: rgba(15, 23, 42, 0.55); color: #fef08a; }
.draft-card.type-upgrade .draft-tag { background: rgba(15, 23, 42, 0.85); color: #fde047; }

.draft-name {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.1;
}

.draft-desc {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 3px;
  opacity: 0.96;
}

#draft-reroll-btn {
  margin-top: 11px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  gap: 7px;
}

/* Roster List */
.roster-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.roster-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 16px;
  border: 2.5px solid var(--ink);
  background: #1e293b;
}

.roster-row.evolved {
  background: linear-gradient(135deg, #581c87 0%, #7e22ce 100%);
}

/* Pause & Result Modals */
.pause-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--gold-hi);
}

.pause-sub {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: #cbd5e1;
}

.modal-btn-stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 4px;
}

.modal-btn-stack .toon-btn {
  width: 100%;
  padding: 11px 14px;
  border-radius: 16px;
  font-family: var(--font-display);
  font-size: 19px;
}

.result-emblem {
  width: 66px;
  height: 66px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#result-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1;
}

.res-victory { color: var(--gold-hi); }
.res-defeat  { color: #fb7185; }

.result-stats-box {
  background: rgba(15, 23, 42, 0.78);
  border: 2.5px solid var(--ink);
  border-radius: 18px;
  padding: 11px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: left;
}

.res-stat-lbl {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}

.res-stat-val {
  font-family: var(--font-display);
  font-size: 18px;
  margin-top: 1px;
}

.result-row-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.result-row-btns .toon-btn {
  padding: 10px;
  border-radius: 15px;
  font-family: var(--font-display);
  font-size: 17px;
}
