/* ============================================================================
 * Crownward Bastion v2.5 Sovereign Edition — Commercial Microsoft Store PC Stylesheet
 * Archetype: Modern Bright Strategy / TD (Clash Royale / Kingdom Rush)
 * Locked Concept Palette: #CECB9A, #51543F, #B58036, #727750, #EBEACE, #9E9D63
 * ============================================================================ */

@font-face {
  font-family: 'Lilita One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/LilitaOne-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Lilita One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/LilitaOne-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/Nunito-700-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/Nunito-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../assets/fonts/Nunito-800-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../assets/fonts/Nunito-800-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../assets/fonts/Nunito-800-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../assets/fonts/Nunito-900-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../assets/fonts/Nunito-900-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --pal-sand: #CECB9A;
  --pal-olive-dark: #51543F;
  --pal-amber: #B58036;
  --pal-moss: #727750;
  --pal-parchment: #EBEACE;
  --pal-sage: #9E9D63;

  --ink: #1C1B29;
  --ink-soft: #33302A;
  --gold-bright: #FFD24C;
  --gold-deep: #B58036;
  --royal-blue: #2A6FDB;
  --royal-blue-dark: #1A4794;
  --crimson: #D63638;
  --emerald: #2FB35D;
  --purple-epic: #8747D6;

  --font-display: 'Lilita One', 'Trebuchet MS', 'Segoe UI', 'Arial Black', sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-drag: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #161E31;
  font-family: var(--font-body);
  color: var(--ink);
}

#app-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* CRITICAL RED-DOT & OVERFLOW RULE:
   ALL <button> elements MUST stay overflow: visible so .notify-badge floats cleanly outside! */
button {
  position: relative;
  overflow: visible !important;
  font-family: var(--font-display);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  color: #FFFFFF;
  transition: transform 0.12s cubic-bezier(0.22, 1, 0.36, 1), filter 0.12s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

button:active:not(:disabled) {
  transform: translateY(2px) scale(0.98);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.65) opacity(0.72);
}

/* Anti-clipping button label: overflow visible vertically, size-scaled stroke! */
.btn-label {
  display: inline-block;
  max-width: 100%;
  overflow: visible;
  white-space: nowrap;
  vertical-align: middle;
  font-size: clamp(12px, 1.05vw, 17px);
  line-height: 1.26;
  padding-bottom: 1px;
  letter-spacing: 0.02em;
  color: #FFF9E6;
  paint-order: stroke fill;
  -webkit-text-stroke: 1.6px var(--ink);
  font-weight: 800;
  text-shadow: 0 2px 0 var(--ink);
}

.hud-num {
  font-family: var(--font-display);
  font-size: clamp(14px, 1.1vw, 19px);
  line-height: 1.15;
  color: #FFFFFF;
  paint-order: stroke fill;
  -webkit-text-stroke: 1.8px var(--ink);
  font-weight: 800;
  text-shadow: 0 2px 0 var(--ink);
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* Pre-rasterize combat HUD behind opaque #title-screen (z-index: 90) ONLY after boot finishes so Start Battle transitions at 60 FPS without loading bleed-through */
body.boot-ready #top-hud.hidden,
body.boot-ready #bottom-dock.hidden {
  display: flex !important;
  visibility: visible !important;
  pointer-events: none !important;
  z-index: 1 !important;
}

body.boot-ready #meta-rail.hidden {
  display: grid !important;
  visibility: visible !important;
  pointer-events: none !important;
  z-index: 1 !important;
}

body.boot-ready #top-hud.hidden *,
body.boot-ready #meta-rail.hidden *,
body.boot-ready #bottom-dock.hidden * {
  pointer-events: none !important;
}

/* ============================================================================
 * CSS 9-SLICE ANTI-DISTORTION LAW (Proportional 13px 24px 15px 24px corners!)
 * ============================================================================ */
.btn-9slice, .btn-gold-9s, .btn-emerald-9s, .btn-sapphire-9s, .btn-crimson-9s, .btn-violet-9s {
  background: transparent !important;
  border-style: solid;
  border-color: transparent;
  border-width: 13px 24px 15px 24px;
  border-image-source: url('../assets/ui/btn_gold.png');
  border-image-slice: 170 164 156 164 fill;
  border-image-width: 14px 20px 14px 20px;
  border-image-repeat: stretch;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: drop-shadow(0 4px 0 rgba(28, 27, 41, 0.55));
  padding: 0 8px 2px;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn-md {
  min-height: 48px;
  min-width: 120px;
}

.btn-emerald-9s {
  border-image-source: url('../assets/ui/btn_emerald.png');
}

.btn-sapphire-9s {
  border-image-source: url('../assets/ui/btn_sapphire.png');
}

.btn-crimson-9s {
  border-image-source: url('../assets/ui/btn_crimson.png');
}

.btn-violet-9s {
  border-image-source: url('../assets/ui/btn_violet.png');
}

/* Compact sculpted CSS pill for inline/tight rows (<46px tall — never crushes 215px PNG corners!) */
.action-cta-sm {
  min-height: 38px;
  padding: 4px 14px;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: linear-gradient(180deg, #4FE37A, #259C4B);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 3px 0 var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.action-cta-sm.gold-sm { background: linear-gradient(180deg, #FBBF24, #B45309); }
.action-cta-sm.blue-sm { background: linear-gradient(180deg, #3B82F6, #1D4ED8); }
.action-cta-sm.emerald-sm { background: linear-gradient(180deg, #34D399, #15803D); }
.action-cta-sm.red-sm { background: linear-gradient(180deg, #EF4444, #B91C1C); }
.action-cta-sm.violet-sm { background: linear-gradient(180deg, #A855F7, #6D28D9); }
.action-cta-sm .btn-label {
  font-size: 13px;
  line-height: 1.25;
  -webkit-text-stroke: 1.3px var(--ink);
}

.btn-9slice:hover:not(:disabled), .btn-gold-9s:hover:not(:disabled), .btn-emerald-9s:hover:not(:disabled), .btn-sapphire-9s:hover:not(:disabled), .btn-crimson-9s:hover:not(:disabled), .btn-violet-9s:hover:not(:disabled) {
  filter: brightness(1.07) drop-shadow(0 6px 0 rgba(28, 27, 41, 0.58));
}

.btn-9slice:active:not(:disabled), .btn-gold-9s:active:not(:disabled), .btn-emerald-9s:active:not(:disabled), .btn-sapphire-9s:active:not(:disabled), .btn-crimson-9s:active:not(:disabled), .btn-violet-9s:active:not(:disabled) {
  transform: translateY(3px);
  filter: drop-shadow(0 2px 0 rgba(28, 27, 41, 0.6));
}

.panel-9slice {
  background: transparent !important;
  border: 24px solid transparent;
  border-image: url('../assets/ui/frame_panel_clean.png') 211 116 212 112 fill / 26px 22px stretch;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: drop-shadow(0 16px 32px rgba(15, 14, 22, 0.62));
}

/* ============================================================================
 * BATTLEFIELD CANVAS & OVERLAYS
 * ============================================================================ */
#battle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  touch-action: none;
}

#fx-webgl-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
  pointer-events: none;
}

#screen-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  opacity: 0;
  transition: opacity 0.22s ease;
}

#sky-bonus-layer {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
}

.sky-bonus-entity {
  position: absolute;
  pointer-events: auto;
  width: 76px;
  height: 76px;
  transform: translate(-50%, -50%);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: skyBob 1.3s ease-in-out infinite alternate;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
}

.sky-bonus-entity .sky-aura {
  position: absolute;
  width: 86px;
  height: 86px;
  object-fit: contain;
  mix-blend-mode: screen;
  opacity: 0.9;
  animation: slowSpin 4s linear infinite;
}

.sky-bonus-entity .sky-gem {
  position: relative;
  width: 48px;
  height: 48px;
  object-fit: contain;
  z-index: 2;
}

.sky-bonus-tag {
  position: absolute;
  bottom: -8px;
  background: linear-gradient(180deg, #FFD24C, #B58036);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 1px 7px;
  font-family: var(--font-display);
  font-size: 12px;
  color: #FFF;
  paint-order: stroke fill;
  -webkit-text-stroke: 2.0px var(--ink);
  font-weight: 800;
  z-index: 3;
}

@keyframes skyBob {
  from { margin-top: -7px; }
  to { margin-top: 7px; }
}

@keyframes slowSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ============================================================================
 * TITLE / BOOT OVERLAY
 * ============================================================================ */
.title-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background-color: #161E31;
  background-image:
    url('../assets/art/title_bg.jpg'),
    radial-gradient(ellipse at 50% 34%, #3B6FA6 0%, #1F3559 54%, #11192B 100%);
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(16px, 3.6vh, 36px) 24px clamp(26px, 5.2vh, 52px);
  opacity: 0.999;
  transition: opacity 0.35s ease;
}

.title-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(16, 18, 28, 0.42) 0%, rgba(16, 18, 28, 0.0) 34%, rgba(16, 18, 28, 0.0) 64%, rgba(16, 18, 28, 0.56) 100%);
  pointer-events: none;
}

.title-version-pill {
  position: absolute;
  top: 18px;
  left: 24px;
  z-index: 3;
  background: rgba(28, 27, 41, 0.86);
  border: 2px solid #FFD24C;
  border-radius: 999px;
  padding: 4px 14px;
  font-family: var(--font-display);
  font-size: 13px;
  color: #FFD24C;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}

.title-top-bar {
  position: absolute;
  top: 18px;
  right: 24px;
  display: flex;
  gap: 12px;
  z-index: 3;
}

.title-hero-logo {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-top: 0.5vh;
  max-width: min(680px, 86vw);
}

.title-logo-img {
  display: block;
  margin: 0 auto;
  width: min(560px, 68vw);
  height: auto;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
}

.title-lower-cta {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-logo-sub {
  display: inline-block;
  margin: 4px 0 0;
  padding: 5px 18px;
  border-radius: 999px;
  background: rgba(28, 27, 41, 0.70);
  border: 2px solid var(--pal-sand);
  font-weight: 800;
  font-size: clamp(13px, 1.15vw, 17px);
  color: #FFF9E6;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}

.btn-hero-play {
  min-width: 270px;
  min-height: 66px;
}

.title-play-hidden {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.btn-hero-play .btn-label {
  font-size: clamp(20px, 1.8vw, 27px);
  paint-order: stroke fill;
  -webkit-text-stroke: 3.2px var(--ink);
  font-weight: 900;
}

.boot-progress-wrap {
  margin-top: 8px;
  min-width: min(360px, 84vw);
  padding: 12px 20px 10px;
  border-radius: 16px;
  background: rgba(16, 21, 36, 0.88);
  border: 2px solid #FFD24C;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.boot-progress-bar {
  width: 100%;
  height: 14px;
  margin: 0 auto 8px;
  background: rgba(8, 11, 20, 0.78);
  border: 2px solid var(--ink);
  border-radius: 99px;
  overflow: hidden;
}

.boot-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #F59E0B 0%, #FFD24C 55%, #FFF3B0 100%);
  border-radius: 99px;
  transition: width 0.14s ease-out;
}

.boot-status-text {
  display: block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #FFF9E6;
  text-shadow: 0 1.5px 0 var(--ink);
}

.dps-mini-popover {
  position: fixed;
  top: 66px;
  left: 340px;
  z-index: 95;
  width: 256px;
  padding: 10px 12px;
  background: rgba(20, 18, 31, 0.94);
  border: 2.5px solid #F59E0B;
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
  color: #FFFBEB;
  pointer-events: none;
}
.dps-mini-popover.hidden {
  display: none !important;
}
.dps-mini-head {
  font-family: var(--font-display);
  font-size: 13px;
  color: #FFE066;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}
.dps-mini-row {
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 800;
}
.dps-mini-lbl {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}
.dps-mini-bar-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  overflow: hidden;
}
.dps-mini-bar-fill {
  height: 100%;
  border-radius: 99px;
}

/* ============================================================================
 * TOP WIDESCREEN HUD BAR & MULTI-BIOME SCRIM
 * ============================================================================ */
.hud-top-scrim {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 86px;
  z-index: 30;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(16, 15, 28, 0.56) 0%, rgba(16, 15, 28, 0.18) 58%, rgba(16, 15, 28, 0) 100%);
}

.top-hud {
  position: fixed;
  top: 8px;
  left: 12px;
  right: 12px;
  min-height: 50px;
  z-index: 35;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.hud-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
  flex-wrap: nowrap;
}

.hud-left, .hud-right {
  flex-shrink: 0;
}

.hud-center {
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: min(620px, 46vw);
  flex: 1 1 auto;
}

.keep-hp-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  background: linear-gradient(180deg, #5B5F47, #3E4130);
  border: 2.5px solid var(--ink);
  border-radius: 13px;
  padding: 0 11px;
  box-shadow: 0 4px 0 rgba(28, 27, 41, 0.55);
  contain: layout style;
}

.keep-hp-label {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--pal-parchment);
  -webkit-text-stroke: 0;
  text-shadow: 0 1.5px 0 #14121F, 1px 1px 0 #14121F, -1px -1px 0 #14121F, 1px -1px 0 #14121F, -1px 1px 0 #14121F;
  font-weight: 800;
}

.keep-hp-track {
  position: relative;
  width: 108px;
  height: 21px;
  background: #23221D;
  border: 2px solid var(--ink);
  border-radius: 9px;
  overflow: hidden;
}

.keep-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #4FE37A, #259C4B);
  transition: width 0.2s ease;
}

.keep-hp-nums {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  color: #FFF;
  -webkit-text-stroke: 0;
  text-shadow: 0 1.5px 0 #14121F, 1px 1px 0 #14121F, -1px -1px 0 #14121F, 1px -1px 0 #14121F, -1px 1px 0 #14121F;
  font-weight: 800;
}

.currency-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 12px 0 8px;
  background: linear-gradient(180deg, #585B44, #3B3E2E);
  border: 2.5px solid var(--ink);
  border-radius: 13px;
  box-shadow: 0 4px 0 rgba(28, 27, 41, 0.55);
  contain: layout style;
}

.currency-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.pill-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--emerald);
  border: 1.5px solid var(--ink);
  font-size: 14px;
  line-height: 1;
}

.hud-chip-btn, .hud-pill-btn {
  height: 44px;
  padding: 0 11px;
  background: linear-gradient(180deg, #B58036, #8C5E20);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 4px 0 rgba(28, 27, 41, 0.55);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.telemetry-chip {
  background: linear-gradient(180deg, #334155, #1E293B);
  padding: 0 10px;
}

.telemetry-chip .btn-label {
  font-size: 12.5px;
}

/* Tactical Command Sub-Strip under Stage Banner */
.hud-tactical-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-wrap: nowrap;
}

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

.cmd-portrait-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid #FFD24C;
  outline: 1.5px solid var(--ink);
  background: #1C1B29;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cmd-portrait-btn img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.hud-mini-pill {
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  background: linear-gradient(180deg, #545742, #383B2B);
  border: 2px solid var(--ink);
  box-shadow: 0 3px 0 rgba(28, 27, 41, 0.5);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.hud-mini-pill .btn-label {
  font-size: 12px;
  -webkit-text-stroke: 0;
  text-shadow: 0 1.5px 0 #14121F, 1px 1px 0 #14121F, -1px -1px 0 #14121F, 1px -1px 0 #14121F, -1px 1px 0 #14121F;
}

.hud-mini-pill.ult-pill {
  background: linear-gradient(180deg, #6D28D9, #4C1D95);
}

.hud-mini-pill.ult-pill.ult-ready {
  background: linear-gradient(180deg, #F59E0B, #B45309);
  border-color: #FEF08A;
  animation: pulseGlow 1s infinite;
}

.mini-key {
  background: rgba(20, 20, 30, 0.85);
  border: 1px solid var(--pal-sand);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 10.5px;
  color: #FFF9E6;
}

.mini-pill-ico {
  width: 21px;
  height: 21px;
  object-fit: contain;
}

.hud-relic-icons {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.mini-relic-ico {
  width: 22px;
  height: 22px;
  padding: 2px;
  box-sizing: border-box;
  border-radius: 6px;
  background: rgba(20, 18, 31, 0.65);
  border: 1.5px solid rgba(255, 232, 163, 0.72);
  object-fit: contain;
}

.stage-banner-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  flex-wrap: nowrap;
}

.stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding: 0 14px;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  background: linear-gradient(180deg, #545742, #363829);
  border: 2.5px solid var(--pal-sand);
  outline: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(28, 27, 41, 0.55);
}

.chapter-mini-tag {
  flex-shrink: 0;
  white-space: nowrap;
  background: var(--pal-amber);
  border: 1.5px solid var(--ink);
  border-radius: 7px;
  padding: 2px 8px;
  font-family: var(--font-display);
  font-size: 12.5px;
  color: #FFF;
}

.stage-main-text {
  font-family: var(--font-display);
  font-size: clamp(13.5px, 1.2vw, 19px);
  color: #FFF9E6;
  -webkit-text-stroke: 0;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 #14121F, 1px 1px 0 #14121F, -1px -1px 0 #14121F, 1px -1px 0 #14121F, -1px 1px 0 #14121F;
}

.stage-farm-badge {
  flex-shrink: 0;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 999px;
  background: #F59E0B;
  color: #1C1B29;
  border: 1.5px solid #1C1B29;
  line-height: 1.05;
}

.boss-retry-btn {
  flex-shrink: 0;
  white-space: nowrap;
  background: linear-gradient(180deg, #EF4444, #B91C1C);
  animation: pulseGlow 1.4s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.86; }
}

/* Boss HP + Skill Charge Bar */
.boss-hud-wrap {
  width: min(440px, 34vw);
  background: rgba(28, 27, 41, 0.88);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 5px 8px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.45);
  contain: layout style;
  will-change: transform;
}

.boss-hp-bar {
  position: relative;
  height: 23px;
  background: #2A1215;
  border: 2px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  contain: layout style;
}

.boss-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #DC2626, #F97316);
  transition: width 0.12s linear;
}

.boss-hp-meta {
  position: absolute;
  inset: 0;
  padding: 0 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 13px;
  color: #FFF;
  -webkit-text-stroke: 0;
  text-shadow: 0 1.5px 0 #14121F, 1px 1px 0 #14121F, -1px -1px 0 #14121F;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.boss-rage-bar {
  position: relative;
  margin-top: 4px;
  height: 10px;
  background: #1E1B2E;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
}

.boss-rage-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #A855F7, #FACC15);
  transition: width 0.1s linear;
}

.boss-skill-cast-label {
  margin-top: 3px;
  text-align: right;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  color: #FEF08A;
  text-shadow: 0 1.5px 0 #14121F, 1px 1px 0 #14121F;
  letter-spacing: 0.2px;
}

.boss-skill-cast-label:empty {
  display: none;
}

/* Right-Edge Vertical Meta Rail (2-Column PC Grid -> Enlarged & Readable, clears Boss Spawn!) */
.meta-rail {
  position: fixed;
  top: 60px;
  right: 10px;
  z-index: 36;
  display: grid;
  grid-template-columns: repeat(2, 76px);
  gap: 5px;
  padding: 6px;
  background: linear-gradient(180deg, rgba(72, 75, 55, 0.92), rgba(40, 42, 31, 0.96));
  border: 2.5px solid var(--pal-sand);
  outline: 2px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.48);
}

.rail-btn {
  width: 76px;
  height: 58px;
  padding: 4px 3px;
  background: linear-gradient(180deg, #6E734F, #4A4E36);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.22), 0 3px 0 var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.rail-btn.shop-highlight {
  background: linear-gradient(180deg, #E5A93B, #9E681E);
}

.rail-btn-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.rail-btn .btn-label {
  font-size: 11px;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: 0.2px;
  -webkit-text-stroke: 0;
  text-shadow: 0 1px 0 #14121F, 1px 1px 0 #14121F, -1px -1px 0 #14121F, 1px -1px 0 #14121F, -1px 1px 0 #14121F;
}

.rail-toggle-btn {
  background: linear-gradient(180deg, #4B5563, #334155);
  position: relative;
}

.rail-toggle-arrow {
  font-size: 16px;
  line-height: 1;
  font-weight: 900;
  color: #FEF08A;
  text-shadow: 0 1.5px 0 #14121F;
}

.meta-rail.is-collapsed {
  grid-template-columns: 1fr !important;
  width: auto !important;
  padding: 4px !important;
}

.meta-rail.is-collapsed .rail-btn:not(#btn-rail-toggle) {
  display: none !important;
}

.meta-rail.is-collapsed .rail-toggle-btn.has-hidden-notify::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #EF4444;
  border: 1.5px solid #FFFFFF;
}

.hud-util-btn {
  width: 44px;
  height: 44px;
  background: linear-gradient(180deg, #5E6248, #414432);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 4px 0 rgba(28, 27, 41, 0.55);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hud-util-btn.danger-tint, .hud-pill-btn.danger-tint {
  background: linear-gradient(180deg, #B83B3B, #7F2323);
}

.hud-util-img {
  width: 25px;
  height: 25px;
  object-fit: contain;
}

.svg-slot {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
}

.svg-slot svg {
  width: 100%;
  height: 100%;
}

.feature-locked-preview {
  filter: grayscale(0.85) brightness(0.82);
}

.lock-stage-tag {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  background: #272635;
  border: 1.5px solid var(--pal-sand);
  border-radius: 7px;
  padding: 0 5px;
  font-family: var(--font-display);
  font-size: 9.5px;
  color: var(--pal-parchment);
  white-space: nowrap;
  z-index: 12;
  pointer-events: none;
}

/* ============================================================================
 * REACTIVE RED-DOT NOTIFICATION BADGE (NEVER CLIPPED!)
 * ============================================================================ */
.notify-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #FF6B6B, #DC2626 70%);
  border: 2px solid #FFFFFF;
  outline: 1.5px solid var(--ink);
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 10.5px;
  line-height: 16px;
  text-align: center;
  z-index: 30;
  pointer-events: none;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45);
  animation: badgePop 1.3s ease-in-out infinite;
}

.notify-badge.dot-only {
  min-width: 15px;
  width: 15px;
  height: 15px;
  padding: 0;
  top: -6px;
  right: -6px;
}

@keyframes badgePop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.16); }
}

/* ============================================================================
 * BOTTOM WIDESCREEN TACTICAL COMMAND DOCK
 * ============================================================================ */
.bottom-dock {
  position: fixed;
  bottom: 10px;
  left: 20px;
  right: 20px;
  max-width: 1840px;
  margin: 0 auto;
  z-index: 35;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}

.dock-section {
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
  background: transparent !important;
  border-style: solid;
  border-color: transparent;
  border-width: 9px 20px;
  border-image-source: url('../assets/ui/hud_bar_wood_9s.png');
  border-image-slice: 37 113 37 112 fill;
  border-image-width: 10px 20px;
  border-image-repeat: stretch;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.50));
  padding: 2px 3px;
  min-width: 0;
}

.sculpted-summon-btn {
  min-width: 138px;
  width: clamp(138px, 11.4vw, 186px);
  height: clamp(56px, 5vw, 66px);
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  background: linear-gradient(180deg, #F6B93B 0%, #B58036 62%, #875A1E 100%);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.45), 0 4px 0 var(--ink);
  padding: 0;
}

.sculpted-summon-btn .summon-cd-fill {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  background: linear-gradient(90deg, rgba(255, 238, 150, 0.36), rgba(255, 255, 255, 0.08));
  width: 100%;
  pointer-events: none;
  transition: width 0.08s linear;
}

.summon-btn-inner {
  position: relative;
  z-index: 2;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.summon-top-line, .summon-cost-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.summon-title {
  font-size: clamp(11px, 0.92vw, 14px);
  letter-spacing: 0.01em;
  -webkit-text-stroke: 1.2px var(--ink);
}

.mini-coin {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.tier-pill, .slots-count-tag {
  background: rgba(28, 27, 41, 0.78);
  border: 1.5px solid var(--pal-sand);
  border-radius: 7px;
  padding: 1px 5px;
  font-family: var(--font-display);
  font-size: 11px;
  color: #FFF9E6;
}

.hotkey-tag {
  position: absolute;
  top: -8px;
  left: 5px;
  background: #232230;
  border: 1.5px solid var(--pal-sand);
  border-radius: 6px;
  padding: 0 5px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 10px;
  color: var(--pal-parchment);
  z-index: 15;
  pointer-events: none;
}

.sculpted-summon-btn .hotkey-tag {
  position: static;
}

.dock-card-btn {
  width: clamp(54px, 4.4vw, 72px);
  min-width: 54px;
  height: clamp(56px, 5vw, 66px);
  padding: 3px 3px;
  background: linear-gradient(180deg, #727750, #4E5237);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25), 0 3px 0 var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.dock-card-btn.dock-wide-btn,
.dock-card-btn.mastery-dock-btn,
.dock-card-btn.rampage-btn {
  width: clamp(70px, 5.4vw, 88px);
  min-width: 70px;
  padding: 3px 3px;
}

.dock-card-btn .btn-label {
  font-size: clamp(10px, 0.78vw, 12px);
  letter-spacing: 0;
  -webkit-text-stroke: 0px;
  text-shadow: 0 1.5px 2px rgba(0, 0, 0, 0.94);
}

.dock-card-btn.auto-on {
  background: linear-gradient(180deg, #2FB35D, #1D7D3F);
}

.dock-card-btn.rampage-btn {
  background: linear-gradient(180deg, #E0523C, #9B2819);
}

.dock-card-btn.mastery-dock-btn {
  background: linear-gradient(180deg, #6D28D9, #431887);
}

.dock-icon-img {
  width: clamp(24px, 2vw, 30px);
  height: clamp(24px, 2vw, 30px);
  object-fit: contain;
}

/* Quick Upgrade Cards + Wooden Divider + Sculpted Buy Multiplier Toggle */
.quick-upgrade-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding-left: 8px;
  border-left: 2px solid rgba(255, 249, 230, 0.24);
}

.buy-mult-chip {
  width: clamp(44px, 3.3vw, 52px);
  height: clamp(56px, 5vw, 66px);
  border-radius: 11px;
  background: linear-gradient(180deg, #3B5998, #1E3261);
  border: 2.5px solid var(--ink);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 3px 0 var(--ink);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 2px;
}

.buy-mult-chip .mult-sub {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 900;
  color: #CBD5E1;
  line-height: 1;
  letter-spacing: 0.05em;
}

.buy-mult-chip .mult-val {
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.1;
  color: #FFD24C;
  paint-order: stroke fill;
  -webkit-text-stroke: 1.4px var(--ink);
  text-shadow: 0 1.5px 0 var(--ink);
}

.quick-upg-card {
  width: clamp(60px, 4.9vw, 88px);
  height: clamp(56px, 5vw, 66px);
  padding: 3px 4px;
  background: linear-gradient(180deg, #F5F1DC, #DFD8B0);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.65), 0 3px 0 var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.quick-upg-card.can-afford {
  border-color: #FFD24C;
  box-shadow: 0 0 10px rgba(255, 210, 76, 0.55), 0 3px 0 var(--ink);
}

.quick-upg-card.is-maxed {
  background: linear-gradient(180deg, #FEF3C7, #F59E0B);
  border-color: #FFD24C;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 3px 0 var(--ink);
}

.quick-upg-card.is-maxed .qup-lv {
  color: #78350F;
  font-weight: 900;
}

.quick-upg-card.is-maxed .qup-cost {
  background: #451A03;
  color: #FDE047;
  padding: 1px 7px;
}

.quick-upg-card.is-maxed .qup-cost img {
  display: none;
}

.quick-upg-card.needs-artifact {
  border-color: #C084FC;
  box-shadow: 0 0 8px rgba(192, 132, 252, 0.45), 0 3px 0 var(--ink);
}

.quick-upg-card.needs-artifact .qup-cost {
  background: #3B1F54;
  border-color: #A855F7;
  color: #FDE047;
}

.is-locked-cta {
  opacity: 0.64;
  cursor: pointer;
}

.fuse-shards-btn.is-locked-cta {
  opacity: 0.96;
}

.upg-buy-btn.is-maxed-cta img {
  display: none;
}

.qup-lv {
  font-family: var(--font-display);
  font-size: 10.5px;
  line-height: 1;
  color: var(--royal-blue-dark);
  font-variant-numeric: tabular-nums;
}

/* Crisp dark ink text directly on warm parchment = 14.5:1 contrast, zero muddy halo! */
.qup-name {
  font-family: var(--font-display);
  font-size: clamp(11px, 0.88vw, 13.5px) !important;
  line-height: 1.1 !important;
  color: var(--ink) !important;
  -webkit-text-stroke: 0px !important;
  text-shadow: none !important;
  font-weight: 800;
}

.qup-cost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  gap: 2px;
  background: #3A2D1A;
  border: 1px solid var(--ink);
  border-radius: 7px;
  padding: 1px 4px;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-display);
  font-size: clamp(9.5px, 0.72vw, 10.8px);
  line-height: 1.1;
  white-space: nowrap;
  color: #FFD24C;
}

.quick-upg-card.has-star-cost .qup-cost img {
  display: none;
}

.qup-cost img {
  width: 13px;
  height: 13px;
}

/* 7 Spell Slots + Random Spell Orb */
.spell-bar {
  display: flex;
  align-items: center;
  gap: 3px;
}

.spell-slot-btn {
  width: clamp(44px, 3.6vw, 58px);
  height: clamp(56px, 5vw, 66px);
  padding: 3px 2px;
  background: linear-gradient(180deg, #3A5D8F, #213759);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28), 0 3px 0 var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.spell-slot-btn.spell-auto-active {
  border-color: #4ADE80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6), 0 3px 0 var(--ink);
}
.spell-auto-dot {
  position: absolute;
  left: 3px;
  bottom: 2px;
  padding: 0 3px;
  border-radius: 4px;
  background: rgba(20, 83, 45, 0.92);
  border: 1px solid #4ADE80;
  color: #BBF7D0;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  line-height: 1.25;
  pointer-events: none;
  z-index: 2;
}
.as-vfx-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  margin-top: 6px;
}

.spell-lv-tag {
  position: absolute;
  top: -8px;
  right: 3px;
  background: #7C3AED;
  border: 1px solid #FEF08A;
  border-radius: 5px;
  padding: 0 4px;
  font-size: 9px;
  font-family: var(--font-display);
  color: #FFF;
  z-index: 16;
  pointer-events: none;
}

.spell-slot-btn .spell-cd-mask {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  background: rgba(14, 16, 26, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  color: #FFF;
  pointer-events: none;
  contain: layout style;
}

.spell-slot-btn img {
  width: clamp(24px, 2vw, 28px);
  height: clamp(24px, 2vw, 28px);
  object-fit: contain;
}

.spell-slot-btn .btn-label {
  font-size: clamp(10px, 0.75vw, 11.5px);
  -webkit-text-stroke: 0px;
  text-shadow: 0 1.5px 2px rgba(0, 0, 0, 0.95);
}

.spell-orb-btn {
  position: relative;
  width: clamp(50px, 4.2vw, 60px);
  height: clamp(50px, 4.2vw, 60px);
  border-radius: 50%;
  background: radial-gradient(circle, #432874, #1E113A);
  border: 3px solid var(--pal-sand);
  outline: 2px solid var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.orb-key-tag {
  left: 2px;
  top: -7px;
}

.spell-orb-mask {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.spell-orb-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: linear-gradient(180deg, rgba(216, 180, 254, 0.88), rgba(147, 51, 234, 0.94));
  transition: height 0.22s ease;
}

.spell-orb-btn.orb-ready {
  border-color: #FFD24C;
  box-shadow: 0 0 18px rgba(255, 210, 76, 0.85);
  animation: pulseGlow 1s infinite;
}

.orb-img {
  position: relative;
  z-index: 2;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.orb-pct {
  position: absolute;
  bottom: 2px;
  z-index: 3;
  font-family: var(--font-display);
  font-size: 9.5px;
  color: #FFF;
  paint-order: stroke fill;
  -webkit-text-stroke: 2.0px var(--ink);
  font-weight: 800;
}

/* ============================================================================
 * FLOATING NON-BLOCKING BANNERS
 * ============================================================================ */
.floating-banner-stack {
  position: fixed;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 65;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  contain: layout style;
  will-change: transform;
}

.toast-layer {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 170;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  max-width: min(540px, 92vw);
}

.battle-hover-tip {
  position: fixed;
  z-index: 55;
  pointer-events: none;
  padding: 5px 11px;
  border-radius: 10px;
  background: rgba(20, 18, 31, 0.92);
  border: 1.5px solid #FFD24C;
  color: #FFF9E6;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, calc(-100% - 10px));
}

.float-banner {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: linear-gradient(180deg, #51543F, #353829);
  border: 3px solid #FFD24C;
  outline: 2px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
  color: #FFF9E6;
  animation: bannerIn 0.28s cubic-bezier(0.22, 1.3, 0.36, 1);
}

.float-banner img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

@keyframes bannerIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.88); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================================
 * MODALS & SPRING OVERSHOOT + 720p CONTRACTS FIT
 * ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(14, 16, 22, 0.80);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  animation: scrimFade 0.2s ease;
}

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

.modal-window {
  width: min(990px, 94vw);
  max-height: 88vh;
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  padding: 12px 20px 14px;
  overflow: visible;
  animation: modalSpringIn 0.26s cubic-bezier(0.22, 1.32, 0.36, 1);
}

@keyframes modalSpringIn {
  0% { opacity: 0; transform: scale(0.84); }
  70% { opacity: 1; transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}

.modal-header-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding-bottom: 4px;
  margin-bottom: 6px;
}

.modal-ribbon-wrap {
  box-sizing: border-box;
  margin: -50px auto 0;
  padding: 2px 14px 4px;
  min-width: min(320px, 68%);
  max-width: calc(100% - 108px);
  background: transparent !important;
  border-style: solid;
  border-color: transparent;
  border-width: 12px 46px 14px 46px;
  border-image-source: url('../assets/ui/ui_header_ribbon.png');
  border-image-slice: 24 96 26 96 fill;
  border-image-width: 12px 46px 14px 46px;
  border-image-repeat: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
}

.modal-ribbon-wrap.danger-ribbon {
  border-image-source: url('../assets/ui/ui_header_ribbon_crimson.png');
}

.floating-modal-actions {
  position: absolute;
  right: -2px;
  top: -16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-header-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.modal-title-display {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.1vw, 28px);
  color: #FFF9E6;
  paint-order: stroke fill;
  -webkit-text-stroke: 3.4px var(--ink);
  font-weight: 900;
  text-shadow: 0 3px 0 var(--ink);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-round-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(180deg, #727750, #51543F);
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  font-family: var(--font-display);
  font-size: 19px;
  color: #FFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-round-btn.close-btn {
  background: linear-gradient(180deg, #DC2626, #991B1B);
  min-width: 44px;
  min-height: 44px;
  position: relative;
  z-index: 12;
  cursor: pointer;
}

.modal-content {
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  max-height: calc(86vh - 96px);
  color: var(--ink);
}

.modal-content::-webkit-scrollbar {
  width: 10px;
}

.modal-content::-webkit-scrollbar-track {
  background: rgba(81, 84, 63, 0.18);
  border-radius: 99px;
}

.modal-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #B58036, #784F19);
  border: 2px solid var(--ink);
  border-radius: 99px;
}

.modal-grid-1 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.modal-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

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

.modal-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.daily-day7-card {
  grid-column: span 2;
}

.modal-grid-1 > *, .modal-grid-2 > *, .modal-grid-3 > *, .modal-grid-4 > * {
  min-width: 0;
  max-width: 100%;
}

.game-card {
  background: linear-gradient(180deg, #F6F5E2, #DEDBBE);
  border: 2.5px solid #51543F;
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 7px;
  box-shadow: 0 4px 0 rgba(81, 84, 63, 0.35);
}

.game-card.rarity-legendary {
  border-color: #D69E2E;
  background: linear-gradient(180deg, #FFFBEB, #FDE68A);
}

.game-card.rarity-epic {
  border-color: #805AD5;
  background: linear-gradient(180deg, #FAF5FF, #E9D8FD);
}

.game-card.rarity-rare {
  border-color: #3182CE;
  background: linear-gradient(180deg, #EBF8FF, #BEE3F8);
}

.game-card.rarity-rare,
.game-card.rarity-epic,
.game-card.rarity-legendary {
  position: relative;
  overflow: hidden;
}

.game-card.rarity-rare::after,
.game-card.rarity-epic::after,
.game-card.rarity-legendary::after {
  content: "";
  position: absolute;
  inset: -12% -65%;
  width: 44%;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 251, 235, 0.42) 48%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translateX(-120%) skewX(-24deg);
  animation: cardSheenSweep 4.2s ease-in-out infinite;
}

.game-card.rarity-legendary::after {
  animation-duration: 3.1s;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(254, 240, 138, 0.56) 48%,
    rgba(255, 255, 255, 0) 100%
  );
}

@keyframes cardSheenSweep {
  0%, 58% { transform: translateX(-140%) skewX(-24deg); opacity: 0; }
  70% { opacity: 1; }
  88%, 100% { transform: translateX(360%) skewX(-24deg); opacity: 0; }
}

.shop-card-focused {
  outline: 3px solid #F59E0B;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.55);
}

/* Tightened Contracts layout so 2x2 grid fits 720p cleanly without bottom fold clip! */
.events-compact-card {
  padding: 8px 10px;
  gap: 5px;
}

.events-ms-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.58);
  padding: 3px 7px;
  border-radius: 7px;
  gap: 4px;
}

.card-badge-ribbon {
  align-self: flex-start;
  padding: 2px 9px;
  border-radius: 8px;
  border: 1.5px solid var(--ink);
  font-family: var(--font-display);
  font-size: 11px;
  color: #FFF;
  paint-order: stroke fill;
  -webkit-text-stroke: 1.6px var(--ink);
  font-weight: 800;
}

.badge-starter { background: #16A34A; }
.badge-popular { background: #2563EB; }
.badge-best { background: #D97706; }

.shop-art-img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  margin: 0 auto;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.25));
}

.sub-tabs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.sub-tab-btn {
  padding: 6px 13px;
  border-radius: 11px;
  background: #727750;
  border: 2px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
}

.sub-tab-btn.active {
  background: var(--pal-amber);
}

.action-cta-btn {
  background: transparent !important;
  border-style: solid;
  border-color: transparent;
  border-width: 13px 24px 15px 24px;
  border-image-source: url('../assets/ui/btn_emerald.png');
  border-image-slice: 170 164 156 164 fill;
  border-image-width: 14px 20px 14px 20px;
  border-image-repeat: stretch;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: drop-shadow(0 3px 0 rgba(28, 27, 41, 0.52));
  min-height: 50px;
  padding: 0 8px 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
}

.action-cta-btn.gold-btn {
  border-image-source: url('../assets/ui/btn_gold.png');
}

.action-cta-btn.blue-btn {
  border-image-source: url('../assets/ui/btn_sapphire.png');
}

.action-cta-btn.red-btn {
  border-image-source: url('../assets/ui/btn_crimson.png');
}

.action-cta-btn.violet-btn {
  border-image-source: url('../assets/ui/btn_violet.png');
}

/* Horizontal Compact Upgrade Rows & Sculpted Amethyst Shards Pill */
.modal-grid-2 .upg-row-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.upg-row-card {
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
}

.upg-row-ico {
  width: 50px;
  height: 50px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 5px rgba(28, 27, 41, 0.25));
}

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

.upg-row-title {
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.15;
  color: var(--ink);
}

.upg-row-lv {
  color: #1D4ED8;
  font-size: 14px;
}

.upg-row-delta {
  font-size: 12.5px;
  font-weight: 800;
  color: #15803D;
  margin-top: 2px;
}

.upg-compact-cta {
  min-width: 148px;
  width: auto;
  flex-shrink: 0;
  min-height: 50px;
  padding: 0 12px 2px;
}

.relic-eq-btn {
  min-width: 124px;
  max-width: 152px !important;
  flex-shrink: 0;
}

.upg-compact-cta .btn-label {
  font-size: 15px;
  -webkit-text-stroke: 1.5px var(--ink);
}

.fuse-shards-btn {
  position: relative;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  border: 2.5px solid #7C6CA8;
  background: linear-gradient(180deg, #3B3452, #262138);
  box-shadow: 0 3px 0 var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden !important;
}

.fuse-shards-btn:disabled {
  filter: none !important;
  opacity: 0.96;
  cursor: not-allowed;
}

.fuse-shards-btn .fuse-shards-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #7C3AED, #A855F7);
  opacity: 0.55;
  transition: width 0.25s ease;
}

.fuse-shards-btn.fuse-ready {
  border-color: #FFD24C;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.65), 0 3px 0 var(--ink);
  animation: pulseGlow 1.1s infinite;
}

/* Telemetry Bars */
.telemetry-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
}

.telemetry-bar-bg {
  height: 11px;
  background: #272635;
  border-radius: 99px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
}

.telemetry-bar-fill {
  height: 100%;
  transition: width 0.25s ease;
}

/* Custom Painted Sliders & Inputs */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 12px;
  border-radius: 99px;
  background: #33302A;
  border: 2px solid var(--ink);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FEF08A, #D97706);
  border: 2.5px solid var(--ink);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}

#inp-giftcode, #rev-feedback-txt {
  background: #FFFBEB !important;
  color: var(--ink) !important;
  font-family: var(--font-body);
  font-weight: 800;
}

.tutorial-pointer {
  position: absolute;
  bottom: -18px;
  left: 34px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 16px solid #FFD24C;
  filter: drop-shadow(0 3px 0 var(--ink));
  animation: pointerBounce 0.7s ease-in-out infinite alternate;
}

@keyframes pointerBounce {
  from { transform: translateY(0); }
  to { transform: translateY(6px); }
}

.codex-silhouette {
  filter: brightness(0) opacity(0.5);
}

/* ============================================================================
 * TUTORIAL SPOTLIGHT & FEATURE GUIDE COACH CARDS
 * ============================================================================ */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 105;
  pointer-events: none;
}

.tutorial-spotlight {
  position: absolute;
  border-radius: 18px;
  border: 4px solid #FFD24C;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45), 0 0 24px #FFD24C;
  transition: all 0.25s ease;
  pointer-events: none;
  animation: pulseGlow 1.1s infinite;
}

.tutorial-card {
  position: absolute;
  max-width: 360px;
  background: linear-gradient(180deg, #51543F, #353829);
  border: 3px solid #FFD24C;
  outline: 2px solid var(--ink);
  border-radius: 16px;
  padding: 12px 16px;
  color: #FFF9E6;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.tutorial-text {
  margin: 0;
}

.tutorial-skip-btn {
  position: fixed;
  top: 94px;
  left: 14px;
  pointer-events: auto;
  padding: 8px 18px;
  border-radius: 12px;
  background: rgba(28, 27, 41, 0.92);
  border: 2px solid var(--pal-sand);
}

.coach-modal {
  width: min(520px, 92vw);
  padding: 18px 22px;
}

.coach-modal .modal-header-row {
  justify-content: space-between;
  gap: 12px;
}

.coach-modal .modal-title-display {
  font-size: clamp(18px, 1.7vw, 24px);
}

.fg-body {
  background: rgba(255, 255, 255, 0.55);
  border: 2px solid #727750;
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
}

.fg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fg-step-dots {
  font-family: var(--font-display);
  font-size: 14px;
  color: #51543F;
}

/* ============================================================================
 * 3-BEAT CELEBRATION STAGE (Commercial Chest Reveal + Feathered Sunburst)
 * ============================================================================ */
/* Leave bottom 96px unobstructed so Spell Bar & Arcane Orb are NEVER covered [VPS #482, #545, #592, #485] */
.celebration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 96px;
  z-index: 150;
  background: radial-gradient(circle at 50% 48%, rgba(88, 56, 16, 0.58) 0%, rgba(16, 18, 34, 0.88) 55%, rgba(6, 8, 18, 0.96) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sunburst-spin {
  position: absolute;
  width: min(92vmin, 920px);
  height: min(92vmin, 920px);
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 214, 92, 0.28) 0deg 14deg,
    rgba(255, 214, 92, 0.0) 14deg 28deg
  );
  -webkit-mask-image: radial-gradient(circle, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.85) 32%, rgba(0, 0, 0, 0) 70%);
  mask-image: radial-gradient(circle, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.85) 32%, rgba(0, 0, 0, 0) 70%);
  animation: slowSpin 16s linear infinite;
  pointer-events: none;
}

.chest-beat-box {
  position: relative;
  cursor: pointer;
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.chest-core-bloom {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 224, 102, 0.45) 0%, rgba(255, 210, 76, 0.14) 50%, rgba(255, 210, 76, 0) 75%);
  pointer-events: none;
  animation: pulseGlow 1.1s ease-in-out infinite;
}

.chest-hero-wobble {
  position: relative;
  width: 210px;
  height: 210px;
  object-fit: contain;
  filter: drop-shadow(0 0 26px rgba(255, 210, 76, 0.88)) drop-shadow(0 12px 18px rgba(0, 0, 0, 0.6));
  animation: chestWobble 0.68s ease-in-out infinite;
}

.chest-hero-open-pop {
  position: relative;
  width: 224px;
  height: 224px;
  object-fit: contain;
  filter: drop-shadow(0 0 34px rgba(255, 228, 122, 0.95));
  animation: chestOpenPop 0.36s cubic-bezier(0.22, 1.38, 0.36, 1) forwards;
}

.chest-flash-bloom {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 48%, rgba(255, 248, 210, 0.72), rgba(255, 210, 76, 0.0) 60%);
  animation: chestFlashFade 0.42s ease-out forwards;
}

.chest-prompt-title {
  position: relative;
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 42px);
  letter-spacing: 0.04em;
  color: #FFE066;
  paint-order: stroke fill;
  -webkit-text-stroke: 4.5px var(--ink);
  filter: drop-shadow(0 5px 0 var(--ink)) drop-shadow(0 0 18px rgba(255, 210, 76, 0.65));
  animation: chestPromptPulse 1.05s ease-in-out infinite;
}

.chest-prompt-sub {
  position: relative;
  margin-top: 10px;
  padding: 6px 18px;
  border-radius: 99px;
  background: rgba(28, 27, 41, 0.78);
  border: 2px solid #FFD24C;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.04em;
  color: #FFF9E6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

@keyframes chestWobble {
  0%, 100% { transform: scale(1, 1) rotate(0deg); }
  20% { transform: scale(1.08, 0.92) rotate(-5deg); }
  45% { transform: scale(0.93, 1.10) rotate(5deg); }
  70% { transform: scale(1.06, 0.94) rotate(-4deg); }
  85% { transform: scale(0.97, 1.04) rotate(3deg); }
}

@keyframes chestOpenPop {
  0% { transform: scale(0.84); }
  65% { transform: scale(1.24); }
  100% { transform: scale(1.04); }
}

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

@keyframes chestPromptPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.celeb-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.celeb-stage {
  position: relative;
  z-index: 3;
  width: min(680px, 92vw);
  max-height: 92vh;
  overflow-y: auto;
  padding: 30px 6px 10px;
  text-align: center;
}

.fx-dom-layer {
  position: fixed;
  inset: 0;
  z-index: 165;
  pointer-events: none;
}

.fly-currency-icon {
  position: fixed;
  width: 28px;
  height: 28px;
  object-fit: contain;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.45));
}

.tap-ring-fx {
  position: fixed;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid #FFD24C;
  transform: translate(-50%, -50%) scale(0.25);
  opacity: 1;
  pointer-events: none;
  animation: tapRingExpand 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes tapRingExpand {
  to { transform: translate(-50%, -50%) scale(1.45); opacity: 0; }
}

/* ============================================================================
 * PREVIEW-ONLY [DEV F2] DEBUG PANEL
 * ============================================================================ */
.debug-pill-btn {
  position: fixed;
  top: 60px;
  left: 14px;
  z-index: 180;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(20, 22, 32, 0.88);
  border: 1.5px solid #FACC15;
  color: #FACC15;
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
}

.debug-panel {
  position: fixed;
  top: 90px;
  left: 14px;
  z-index: 180;
  width: 300px;
  background: rgba(17, 20, 30, 0.94);
  border: 2px solid #FACC15;
  border-radius: 12px;
  padding: 10px;
  color: #F8FAFC;
  font-family: var(--font-body);
  font-size: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.65);
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.debug-action-btn {
  padding: 6px 8px;
  border-radius: 7px;
  background: #334155;
  border: 1px solid #64748B;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  color: #F8FAFC;
  cursor: pointer;
}

.debug-action-btn.showcase-cta {
  background: linear-gradient(135deg, #059669, #0d9488);
  border-color: #34d399;
  color: #ecfdf5;
}

/* Preview-Only [DEV F2] 20-Unit Animation Studio Overlay */
.anim-studio-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(6, 10, 20, 0.90);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.anim-studio-overlay.hidden {
  display: none !important;
}

.anim-studio-card {
  width: min(1240px, 96vw);
  max-height: 95vh;
  overflow-y: auto;
  background: #0f172a;
  border: 2px solid #34d399;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #f8fafc;
}

.as-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.as-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.as-badge {
  background: #facc15;
  color: #0f172a;
  font-family: monospace;
  font-weight: 800;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
}

.as-title {
  margin: 0;
  font-family: var(--font-display, sans-serif);
  font-size: 17px;
  letter-spacing: 0.4px;
  color: #f8fafc;
}

.as-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.as-live-pill {
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
}

.as-close-btn {
  background: #dc2626;
  border: 1.5px solid #fca5a5;
  color: #ffffff;
  border-radius: 8px;
  padding: 5px 12px;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.as-cat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.as-veo-summary {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  color: #6ee7b7;
  background: rgba(5, 150, 105, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.45);
  padding: 3px 10px;
  border-radius: 999px;
}

.as-unit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 76px;
  overflow-y: auto;
  padding: 2px 0;
}

.as-unit-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  font-size: 11px;
}

.as-unit-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1.2;
}

.as-unit-badge.veo {
  background: #059669;
  color: #ecfdf5;
}

.as-unit-badge.png {
  background: #475569;
  color: #cbd5e1;
}

.as-canvas-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #0b1120;
  border: 1px solid #334155;
  border-radius: 12px;
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 220px;
}

#as-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(95vh - 305px);
  object-fit: contain;
}

.as-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  justify-content: space-between;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 7px 10px;
}

.as-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.as-group-lbl {
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.6px;
  margin-right: 2px;
}

.as-btn {
  background: #334155;
  border: 1px solid #475569;
  color: #e2e8f0;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.as-btn.active {
  background: #2563eb;
  border-color: #93c5fd;
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.35);
}

.as-btn.as-hit-btn:active {
  background: #dc2626;
}

/* ============================================================================
 * RESPONSIVE NARROW & PORTRAIT VIEWPORT FIX (800x600 & 480x854 — spec §4.1)
 * Guarantees #spell-bar wraps inside 100vw, #bottom-dock <= 28% screen height,
 * and #meta-rail NEVER overlaps #hud-center or #bottom-dock!
 * ============================================================================ */
@media (min-width: 1600px) {
  .top-hud {
    top: 10px;
    left: 16px;
    right: 16px;
    min-height: 56px;
  }
  .keep-hp-pill,
  .currency-pill,
  .hud-chip-btn,
  .hud-pill-btn,
  .stage-pill {
    height: 52px;
  }
  .keep-hp-pill {
    padding: 0 14px;
    gap: 8px;
  }
  .keep-hp-label {
    font-size: 14px;
  }
  .keep-hp-track {
    width: 136px;
    height: 24px;
  }
  .keep-hp-nums {
    font-size: 14px;
  }
  .currency-icon {
    width: 32px;
    height: 32px;
  }
  .hud-util-btn {
    width: 52px;
    height: 52px;
  }
  .hud-util-img {
    width: 30px;
    height: 30px;
  }
  .cmd-portrait-btn {
    width: 46px;
    height: 46px;
  }
  .cmd-portrait-btn img {
    width: 40px;
    height: 40px;
  }
  .hud-mini-pill {
    height: 38px;
    padding: 0 12px;
  }
  .hud-mini-pill .btn-label {
    font-size: 13.5px;
  }
  .chapter-mini-tag {
    font-size: 14px;
  }
  .stage-main-text {
    font-size: 20px;
  }
  .boss-hud-wrap {
    width: min(500px, 32vw);
    padding: 6px 10px;
  }
  .boss-hp-bar {
    height: 26px;
  }
  .boss-hp-meta {
    font-size: 14.5px;
  }
  .boss-rage-bar {
    height: 11px;
  }
  .meta-rail {
    top: 72px;
    right: 14px;
    grid-template-columns: repeat(2, 88px);
    gap: 6px;
    padding: 7px;
  }
  .rail-btn {
    width: 88px;
    height: 68px;
    padding: 5px 4px;
  }
  .rail-btn-img {
    width: 34px;
    height: 34px;
  }
  .rail-btn .btn-label {
    font-size: 12px;
  }
}

@media (max-width: 1680px) and (min-width: 961px) {
  .bottom-dock {
    left: 12px;
    right: 12px;
    max-width: calc(100vw - 24px);
    gap: 4px;
  }
  .dock-section {
    border-width: 8px 13px;
    border-image-width: 8px 13px;
    padding: 2px 2px;
    gap: 3px;
  }
  .sculpted-summon-btn {
    min-width: 132px;
    width: 136px;
    height: 54px;
    flex-shrink: 0;
  }
  .dock-card-btn {
    width: 50px;
    min-width: 50px;
    height: 54px;
    flex-shrink: 0;
  }
  .dock-card-btn.dock-wide-btn,
  .dock-card-btn.mastery-dock-btn,
  .dock-card-btn.rampage-btn {
    width: 60px;
    min-width: 60px;
    height: 54px;
    flex-shrink: 0;
    padding: 3px 2px;
  }
  .buy-mult-chip {
    width: 38px;
    height: 54px;
    flex-shrink: 0;
  }
  .quick-upgrade-strip {
    margin-left: 3px;
    padding-left: 5px;
    gap: 3px;
  }
  .quick-upg-card {
    width: 56px;
    height: 54px;
    padding: 2px;
    flex-shrink: 0;
  }
  .spell-bar {
    gap: 2px;
  }
  .spell-slot-btn {
    width: 42px;
    min-width: 42px;
    height: 54px;
    padding: 2px 1px;
    flex-shrink: 0;
  }
  .spell-slot-btn .btn-label {
    font-size: 10px;
  }
  .spell-orb-btn {
    width: 48px;
    height: 54px;
    flex-shrink: 0;
  }
}

@media (max-width: 1240px) and (min-width: 961px) {
  .telemetry-chip {
    display: none !important;
  }
  .keep-hp-track {
    width: 92px;
  }
  .hud-util-btn {
    width: 38px;
    height: 38px;
  }
  .stage-main-text {
    font-size: 15px;
  }
  .meta-rail {
    grid-template-columns: repeat(2, 66px);
  }
  .rail-btn {
    width: 66px;
    height: 52px;
  }
}

@media (max-width: 1220px) and (min-width: 961px) {
  .bottom-dock {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 4px;
  }
  .dock-section {
    max-width: calc(100vw - 24px);
  }
}

@media (max-width: 960px) {
  .top-hud {
    top: 4px;
    left: 6px;
    right: 6px;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px;
  }
  .telemetry-chip,
  .quick-upgrade-strip {
    display: none !important;
  }
  .keep-hp-pill {
    height: 34px;
    padding: 0 6px;
  }
  .keep-hp-label,
  .keep-hp-nums {
    font-size: 10.5px;
    -webkit-text-stroke: 0;
  }
  .keep-hp-track {
    width: 68px;
    height: 16px;
  }
  .currency-pill,
  .hud-chip-btn {
    height: 34px;
    padding: 0 7px;
  }
  .currency-icon {
    width: 20px;
    height: 20px;
  }
  .hud-util-btn {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }
  .hud-util-img {
    width: 19px;
    height: 19px;
  }
  .hud-center {
    order: 3;
    flex: 0 0 calc(100% - 134px);
    width: calc(100% - 134px);
    max-width: calc(100vw - 138px);
    align-items: flex-start;
    gap: 3px;
  }
  .boss-hud-wrap {
    width: min(320px, calc(100vw - 142px));
  }
  .boss-hp-meta {
    font-size: 10.5px;
    padding: 0 6px;
    white-space: nowrap;
    gap: 4px;
    -webkit-text-stroke: 0;
  }
  .stage-banner-row {
    justify-content: flex-start;
    max-width: 100%;
  }
  .stage-pill {
    height: 32px;
    padding: 0 10px;
    gap: 5px;
  }
  .stage-main-text {
    font-size: 13px;
    -webkit-text-stroke: 0;
  }
  .boss-retry-btn {
    font-size: 11px;
    padding: 0 8px;
  }
  .hud-tactical-strip {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 4px;
  }
  .hud-mini-pill {
    height: 28px;
    padding: 0 7px;
  }
  .hud-mini-pill .btn-label {
    font-size: 10.5px;
    -webkit-text-stroke: 0;
  }
  .cmd-portrait-btn {
    width: 30px;
    height: 30px;
  }
  .cmd-portrait-btn img {
    width: 26px;
    height: 26px;
  }

  /* Compact 2-column Meta Rail anchored strictly between Top HUD and Bottom Dock! */
  .meta-rail {
    top: 118px;
    right: 6px;
    display: grid;
    grid-template-columns: repeat(2, 54px);
    gap: 4px;
    padding: 5px;
    border-radius: 12px;
  }
  .rail-btn {
    width: 54px;
    height: 42px;
    padding: 2px;
    border-radius: 8px;
    gap: 1px;
  }
  .rail-btn-img {
    width: 20px;
    height: 20px;
  }
  .rail-btn .btn-label {
    font-size: 10px;
    -webkit-text-stroke: 0;
    text-shadow: 0 1px 0 #14121F, 1px 1px 0 #14121F, -1px -1px 0 #14121F;
  }

  /* Compact Bottom Dock (<= 27% screen height at 800x600 & 480x854) + wrapped #spell-bar inside 100vw */
  .bottom-dock {
    bottom: 4px;
    left: 4px;
    right: 4px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px;
  }
  .dock-section {
    border-width: 5px;
    border-image-width: 5px;
    padding: 1px 3px;
    gap: 3px;
    max-width: calc(100vw - 8px);
    flex-wrap: wrap;
    justify-content: center;
  }
  .spell-bar {
    flex-wrap: wrap;
    justify-content: center;
    max-width: calc(100vw - 20px);
    gap: 3px;
  }
  .sculpted-summon-btn {
    min-width: 120px;
    width: 126px;
    height: 42px;
  }
  .summon-btn-inner {
    padding: 2px 5px;
    gap: 1px;
  }
  .summon-title {
    font-size: 10px;
    -webkit-text-stroke: 0;
  }
  .dock-card-btn,
  .dock-card-btn.dock-wide-btn {
    width: 54px;
    min-width: 52px;
    height: 42px;
    padding: 2px;
  }
  .dock-icon-img {
    width: 20px;
    height: 20px;
  }
  .dock-card-btn .btn-label {
    font-size: 10px;
    -webkit-text-stroke: 0;
    text-shadow: 0 1px 0 #14121F, 1px 1px 0 #14121F, -1px -1px 0 #14121F;
  }
  .spell-slot-btn {
    width: 46px;
    min-width: 46px;
    height: 42px;
    padding: 1px;
  }
  .spell-slot-btn img {
    width: 20px;
    height: 20px;
  }
  .spell-slot-btn .btn-label {
    font-size: 10px;
    -webkit-text-stroke: 0;
    text-shadow: 0 1px 0 #14121F, 1px 1px 0 #14121F, -1px -1px 0 #14121F;
  }
  .spell-orb-btn {
    width: 42px;
    height: 42px;
  }
  .orb-img {
    width: 22px;
    height: 22px;
  }
  .hotkey-tag {
    display: none;
  }
  .modal-grid-3, .modal-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .hud-center {
    flex: 0 0 calc(100% - 122px);
    width: calc(100% - 122px);
    max-width: calc(100vw - 126px);
  }
  .stage-banner-row {
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .stage-pill {
    height: 30px;
    padding: 0 9px;
    gap: 5px;
  }
  .stage-main-text {
    font-size: 12px;
  }
  .stage-farm-badge {
    font-size: 9.5px;
    padding: 1px 5px;
  }
  .boss-hud-wrap {
    width: min(310px, calc(100vw - 130px));
  }
  .meta-rail {
    top: 122px;
    right: 4px;
    grid-template-columns: repeat(2, 50px);
    gap: 3px;
    padding: 4px;
  }
  .rail-btn {
    width: 50px;
    height: 38px;
  }
  .rail-btn .btn-label {
    font-size: 8.5px;
    letter-spacing: -0.2px;
  }
  .bottom-dock {
    left: 2px;
    right: 2px;
    gap: 3px;
  }
  .dock-section {
    max-width: calc(100vw - 6px);
    padding: 1px 2px;
    gap: 2px;
  }
  .spell-bar {
    max-width: calc(100vw - 14px);
    gap: 2px;
  }
  .spell-slot-btn {
    width: 42px;
    min-width: 42px;
    height: 38px;
  }
  .spell-slot-btn img {
    width: 18px;
    height: 18px;
  }
  .spell-orb-btn {
    width: 38px;
    height: 38px;
  }
  .orb-img {
    width: 20px;
    height: 20px;
  }
  .dock-card-btn,
  .dock-card-btn.dock-wide-btn {
    width: 50px;
    min-width: 48px;
    height: 38px;
  }
  .sculpted-summon-btn {
    min-width: 112px;
    width: 118px;
    height: 38px;
  }
  .modal-header-row {
    justify-content: flex-start;
    padding-right: 92px;
  }
  .modal-ribbon-wrap {
    min-width: 0;
    width: auto;
    max-width: 100%;
    border-width: 8px 26px 10px 26px;
    border-image-width: 8px 26px 10px 26px;
    padding: 1px 8px 3px;
    margin: -42px 0 0 0;
  }
  .modal-title-display {
    font-size: 16px;
    -webkit-text-stroke: 2px var(--ink);
  }
  .floating-modal-actions {
    right: 0;
    top: -12px;
    gap: 5px;
  }
  .modal-grid-2, .modal-grid-3, .modal-grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }
  .daily-day7-card {
    grid-column: span 1;
  }
}

/* ============================================================================
 * ICON-FIRST CURRENCY CHIPS (Zero Redundant Currency Words Across 9 Locales)
 * ============================================================================ */
.cb-chip-strip {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  vertical-align: middle;
}

.cb-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  vertical-align: middle;
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.cb-chip-ico {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(20, 18, 31, 0.35));
}
.cb-chip--sm .cb-chip-ico { width: 16px; height: 16px; }
.cb-chip--md .cb-chip-ico { width: 20px; height: 20px; }
.cb-chip--lg .cb-chip-ico { width: 26px; height: 26px; }

.cb-chip--inline {
  padding: 0 2px;
  font-weight: 800;
}

.cb-chip--pill {
  padding: 2px 7px 2px 5px;
  border-radius: 8px;
  background: rgba(28, 27, 41, 0.88);
  border: 1.5px solid rgba(206, 203, 154, 0.65);
  color: #FFF9E6;
  font-size: 12.5px;
  font-weight: 800;
  text-shadow: 0 1px 0 #14121F;
}

.cb-chip--pill.cb-tone-gold    { border-color: #F59E0B; color: #FDE68A; }
.cb-chip--pill.cb-tone-gems    { border-color: #2DD4BF; color: #99F6E4; }
.cb-chip--pill.cb-tone-shards  { border-color: #A855F7; color: #E9D5FF; }
.cb-chip--pill.cb-tone-scrolls { border-color: #60A5FA; color: #DBEAFE; }
.cb-chip--pill.cb-tone-tickets { border-color: #38BDF8; color: #E0F2FE; }
.cb-chip--pill.cb-tone-banners { border-color: #FBBF24; color: #FEF3C7; }
.cb-chip--pill.cb-tone-vip     { border-color: #FACC15; color: #FEF08A; }

.btn-label .cb-chip--inline,
.action-cta-sm .cb-chip--inline,
.action-cta-btn .cb-chip--inline,
.btn-9slice .cb-chip--inline,
.btn-gold-9s .cb-chip--inline,
.btn-emerald-9s .cb-chip--inline,
.btn-sapphire-9s .cb-chip--inline,
.btn-crimson-9s .cb-chip--inline,
.btn-violet-9s .cb-chip--inline {
  color: inherit;
  font-size: inherit;
  paint-order: stroke fill;
  -webkit-text-stroke: inherit;
  text-shadow: inherit;
}

.cb-exchange {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.cb-arrow {
  font-weight: 900;
  opacity: 0.92;
}

/* Software WebGL/CPU Rasterizer Fast Path (SwiftShader / Basic Render) */
body.sw-renderer *,
body.sw-renderer *::before,
body.sw-renderer *::after {
  animation: none !important;
  transition: none !important;
  filter: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

body.sw-renderer .celebration-overlay {
  background: rgba(10, 12, 24, 0.88) !important;
}

body.sw-renderer .hud-top-scrim {
  display: none !important;
}
