/* css/game.css — Iron Rail Bastion · Modern Bright Strategy / TD (Clash Royale / Kingdom Rush) */
:root {
  --amber: #D8884E;
  --espresso: #3C2722;
  --sky: #A2C6E7;
  --terracotta: #AA7B62;
  --bronze: #75533F;
  --parchment: #E1D5B2;
  --parchment-light: #FBF0D4;
  --ink: #1C1B29;
  --gold-cta: #FCAB04;
  --ally-blue: #2FA8FF;
  --enemy-red: #FF4D4D;
  --synergy-green: #2ECC71;
  --epic-purple: #A855F7;
  --font-display: 'Lilita One', 'Bangers', Impact, 'Arial Black', sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, 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: #231815;
  font-family: var(--font-body);
  color: var(--ink);
}

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

/* Typography Helpers */
.title-display {
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  color: #FFF9E6;
  -webkit-text-stroke: 2px #1C1B29;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #1C1B29;
}

.hud-num {
  font-family: var(--font-display);
  color: #FFFFFF;
  -webkit-text-stroke: 1.1px #1C1B29;
  paint-order: stroke fill;
  text-shadow: 0 2px 0 #1C1B29;
  font-variant-numeric: tabular-nums;
}

/* STRICT 9-SLICE ANTI-DISTORTION CHROME (NEVER background-size: 100% 100%!) */
.btn-9slice {
  position: relative;
  overflow: visible !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-radius: 0;
  box-shadow: none;
  border-width: 18px 22px 18px 22px;
  border-image: url('../assets/ui/btn_primary.png') 165 161 161 163 fill / 18px 22px 18px 22px / 0 stretch;
  filter: drop-shadow(0 4px 0 rgba(28, 27, 41, 0.65));
  font-family: var(--font-display);
  font-size: clamp(13px, 1.15vw, 17px);
  line-height: 1.1;
  color: #14121F;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
  padding: 2px 10px;
  min-height: 48px;
  transition: transform 0.1s ease, filter 0.12s ease;
}

.btn-9slice:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.06) drop-shadow(0 5px 0 rgba(28, 27, 41, 0.7));
}

.btn-9slice:active:not(:disabled) {
  transform: translateY(2px);
  filter: drop-shadow(0 2px 0 rgba(28, 27, 41, 0.7));
}

.btn-9slice:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  filter: grayscale(0.55) drop-shadow(0 2px 0 rgba(28, 27, 41, 0.45));
}

.panel-9slice {
  position: relative;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-radius: 0;
  box-shadow: none;
  border-width: 56px 64px 62px 64px;
  border-image: url('../assets/ui/frame_panel.png') 293 722 448 719 fill / 56px 64px 62px 64px / 0 stretch;
  filter: drop-shadow(0 14px 28px rgba(15, 10, 8, 0.62));
  color: #1C1B29;
}

/* Sculpted 3D Glossy Tactical Buttons (for HUD pills, secondary actions & Reactor dock) */
button, .btn {
  position: relative;
  overflow: visible !important;
  font-family: var(--font-display);
  cursor: pointer;
}

.btn-tactical {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 12px;
  border: 2.5px solid #1C1B29;
  background: linear-gradient(180deg, #5B4336 0%, #3C2722 100%);
  color: #FFF9E6;
  font-size: clamp(11px, 0.98vw, 14px);
  line-height: 1.15;
  letter-spacing: 0.02em;
  box-shadow: 0 3px 0 #1C1B29, inset 0 2px 0 rgba(255, 240, 210, 0.22);
  transition: transform 0.1s ease, filter 0.12s ease;
}

.btn-tactical:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-tactical:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #1C1B29;
}

.btn-tactical.btn-blue {
  background: linear-gradient(180deg, #4CC9F0 0%, #1D78C1 100%);
  color: #FFFFFF;
  -webkit-text-stroke: 0.8px #1C1B29;
  paint-order: stroke fill;
}

.btn-tactical.btn-green {
  background: linear-gradient(180deg, #52E085 0%, #1F9D55 100%);
  color: #FFFFFF;
  -webkit-text-stroke: 0.8px #1C1B29;
  paint-order: stroke fill;
}

.btn-tactical.btn-amber {
  background: linear-gradient(180deg, #FFB84D 0%, #D87328 100%);
  color: #1C1B29;
}

.btn-tactical.btn-danger {
  background: linear-gradient(180deg, #FF6B6B 0%, #C92A2A 100%);
  color: #FFFFFF;
}

.btn-tactical:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-label {
  display: inline-block;
  white-space: nowrap;
  pointer-events: none;
}

.icon-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
  pointer-events: none;
}

.icon-svg {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  pointer-events: none;
}

/* RED-DOT NOTIFICATION BADGE (NEVER CLIPPED!) */
.notify-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FF7575, #E01E26);
  border: 2px solid #FFF9E6;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.55);
  z-index: 35;
  pointer-events: none;
  animation: pulseDot 1.35s infinite ease-in-out;
}

.notify-badge.hidden {
  display: none !important;
}

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

/* ======================== TITLE SCREEN ======================== */
#title-screen {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 24px 36px 36px;
  background: #2C1D18 url('../assets/art/title_bg.jpg') center center / cover no-repeat;
}

#title-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, rgba(28, 20, 16, 0.14) 0%, rgba(20, 14, 12, 0.68) 100%);
  pointer-events: none;
}

#title-screen.hidden {
  display: none !important;
}

.title-top-bar {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.title-badge-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.feature-pill {
  background: rgba(28, 27, 41, 0.82);
  border: 2px solid var(--amber);
  color: #FFF9E6;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.03em;
}

.title-top-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.title-hero-center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 860px;
  margin-top: auto;
  margin-bottom: auto;
}

.brand-emblem {
  background: linear-gradient(180deg, rgba(60, 39, 34, 0.92), rgba(28, 27, 41, 0.94));
  border: 4px solid #FCAB04;
  border-radius: 24px;
  padding: 18px 40px 22px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), inset 0 3px 0 rgba(255, 255, 255, 0.25);
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(42px, 5.2vw, 76px);
  line-height: 0.98;
  color: #FFF6D6;
  -webkit-text-stroke: 3px #1C1B29;
  paint-order: stroke fill;
  text-shadow: 0 6px 0 #1C1B29, 0 10px 22px rgba(0, 0, 0, 0.55);
}

.brand-sub {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: clamp(15px, 1.5vw, 22px);
  color: #FCAB04;
  -webkit-text-stroke: 1.2px #1C1B29;
  paint-order: stroke fill;
  letter-spacing: 0.08em;
}

.title-boot-area {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(460px, 86vw);
}

.loading-box {
  width: 100%;
  background: rgba(28, 27, 41, 0.88);
  border: 3px solid #1C1B29;
  border-radius: 16px;
  padding: 8px 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.loading-track {
  width: 100%;
  height: 18px;
  background: #14121F;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #3C2722;
}

.loading-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #FF9F1C, #FCAB04, #FFE066);
  transition: width 0.15s ease-out;
}

.loading-text {
  margin-top: 5px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 13px;
  color: #FFF9E6;
  letter-spacing: 0.04em;
}

#btn-title-play {
  min-width: 290px;
  min-height: 66px;
  font-size: clamp(20px, 1.8vw, 26px);
  padding: 6px 26px;
}

#btn-title-play.hidden {
  display: none !important;
}

/* ======================== 16:9 WIDESCREEN ARENA ======================== */
#game-screen {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#arena-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  z-index: 1;
}

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

/* High-Z Unobstructed Flying Bonus Corridor (y = 24%-44%, z-index: 45) */
#flying-corridor {
  position: absolute;
  left: 0;
  right: 0;
  top: 24%;
  height: 20%;
  z-index: 45;
  pointer-events: none;
}

.flying-drone {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: radial-gradient(circle, rgba(252, 171, 4, 0.92), rgba(216, 115, 40, 0.92));
  border: 2.5px solid #1C1B29;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
  animation: bobDrone 1.1s infinite ease-in-out;
}

.flying-drone img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

@keyframes bobDrone {
  0%, 100% { transform: translateY(-4px); }
  50% { transform: translateY(5px); }
}

/* TOP EDGE HUD BAR (Full 16:9 Widescreen >= 96% width) */
#hud-top {
  position: absolute;
  top: 10px;
  left: 14px;
  right: 14px;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

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

.hud-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 4px 12px;
  background: rgba(36, 25, 22, 0.9);
  border: 2.5px solid #1C1B29;
  border-radius: 999px;
  box-shadow: 0 3px 0 #1C1B29;
  color: #FFF9E6;
  white-space: nowrap;
}

.hud-center-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 300px;
  max-width: 480px;
  flex: 1;
  background: rgba(36, 25, 22, 0.88);
  border: 2.5px solid #1C1B29;
  border-radius: 16px;
  padding: 5px 14px 7px;
  box-shadow: 0 4px 0 #1C1B29;
}

.route-header-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  color: #FFF9E6;
}

.wave-nodes {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wave-pip {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #4A3731;
  border: 2px solid #1C1B29;
}

.wave-pip.done {
  background: #52E085;
}

.wave-pip.active {
  background: #FCAB04;
  transform: scale(1.2);
}

.wave-pip.boss {
  width: 16px;
  height: 16px;
  background: #FF4D4D;
}

.xp-bar-wrap {
  width: 100%;
  height: 11px;
  background: #14121F;
  border-radius: 999px;
  border: 1.5px solid #1C1B29;
  overflow: hidden;
  position: relative;
}

.xp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38BDF8, #818CF8, #C084FC);
  transition: width 0.15s ease-out;
}

/* Boss Top HP Banner */
#boss-hud-banner {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  width: min(520px, 56vw);
  background: rgba(44, 18, 18, 0.92);
  border: 3px solid #FF4D4D;
  border-radius: 14px;
  padding: 5px 14px 7px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

#boss-hud-banner.hidden {
  display: none !important;
}

.boss-bar-top {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 14px;
  color: #FFE3E3;
  margin-bottom: 3px;
}

.boss-hp-track {
  width: 100%;
  height: 14px;
  background: #1A0B0E;
  border-radius: 8px;
  border: 2px solid #1C1B29;
  overflow: hidden;
}

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

/* LEFT COMPACT STACK & BUDDY SYNERGY STRIP */
#hud-left-stack {
  position: absolute;
  left: 14px;
  top: 66px;
  z-index: 22;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 196px;
  pointer-events: none;
}

.stack-card-mini {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  background: rgba(36, 25, 22, 0.84);
  border: 2px solid #1C1B29;
  border-left: 5px solid var(--amber);
  border-radius: 10px;
  color: #FFF9E6;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.stack-card-mini:hover {
  filter: brightness(1.12);
}

.stack-card-mini img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.stack-mini-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.synergy-dot {
  color: #52E085;
  font-size: 10px;
}

/* RIGHT META NAVIGATION COLUMN */
#hud-right-meta {
  position: absolute;
  right: 14px;
  top: 66px;
  z-index: 23;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meta-nav-btn {
  min-width: 118px;
  justify-content: flex-start;
  padding: 6px 12px;
}

/* BOTTOM REACTOR & COMMAND RAIL */
#hud-bottom {
  position: absolute;
  bottom: 12px;
  left: 14px;
  right: 14px;
  z-index: 25;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

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

.hull-status-box {
  background: rgba(36, 25, 22, 0.92);
  border: 2.5px solid #1C1B29;
  border-radius: 14px;
  padding: 7px 12px;
  min-width: 235px;
  box-shadow: 0 4px 0 #1C1B29;
}

.hull-bar-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 13px;
  color: #FFF9E6;
  margin-bottom: 4px;
}

.hull-hp-track {
  width: 100%;
  height: 14px;
  background: #14121F;
  border-radius: 8px;
  border: 2px solid #1C1B29;
  overflow: hidden;
  position: relative;
}

.hull-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #2ECC71, #7AE582);
  transition: width 0.14s ease-out;
}

.hull-shield-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: rgba(90, 200, 250, 0.65);
  pointer-events: none;
}

.focus-hint-tag {
  margin-top: 5px;
  font-size: 11px;
  font-weight: 800;
  color: #FCAB04;
}

.reactor-dock {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(36, 25, 22, 0.9);
  border: 2.5px solid #1C1B29;
  border-radius: 16px;
  padding: 7px 12px;
  box-shadow: 0 4px 0 #1C1B29;
}

.reactor-btn {
  position: relative;
  width: 82px;
  height: 62px;
  border-radius: 12px;
  border: 2.5px solid #1C1B29;
  background: linear-gradient(180deg, #4E3A30 0%, #2B1F1B 100%);
  color: #FFF9E6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  box-shadow: 0 3px 0 #1C1B29;
}

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

.reactor-btn .r-name {
  font-size: 10px;
  line-height: 1.05;
  text-align: center;
  white-space: nowrap;
}

.hotkey-badge {
  position: absolute;
  top: -7px;
  left: -6px;
  background: #FCAB04;
  color: #14121F;
  border: 2px solid #1C1B29;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 10px;
  padding: 1px 5px;
  z-index: 5;
}

.cd-overlay {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: rgba(14, 12, 20, 0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  color: #FFF9E6;
  pointer-events: none;
}

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

.quick-upg-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ======================== ULTIMATE CUT-IN PANEL ======================== */
#cutin-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  background: rgba(20, 24, 20, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.12s ease;
}

#cutin-overlay.hidden {
  display: none !important;
}

#cutin-overlay.active {
  opacity: 1;
}

.cutin-banner {
  width: 100%;
  height: 168px;
  background: repeating-linear-gradient(
    -35deg,
    #2B1E1A 0px,
    #2B1E1A 26px,
    #3D2A22 26px,
    #3D2A22 52px
  );
  border-top: 5px solid #FCAB04;
  border-bottom: 5px solid #FCAB04;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  transform: translateX(-100%) skewY(-2deg);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

#cutin-overlay.active .cutin-banner {
  transform: translateX(0) skewY(-2deg);
}

.cutin-portrait {
  height: 188px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 14px #FCAB04) drop-shadow(0 6px 0 #1C1B29);
}

.cutin-text-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cutin-unit-name {
  font-family: var(--font-display);
  font-size: 18px;
  color: #FCAB04;
  letter-spacing: 0.06em;
  -webkit-text-stroke: 1.2px #1C1B29;
  paint-order: stroke fill;
}

.cutin-skill-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.2vw, 46px);
  color: #FFF9E6;
  -webkit-text-stroke: 2.4px #1C1B29;
  paint-order: stroke fill;
  text-shadow: 0 5px 0 #1C1B29;
}

/* ======================== MODALS (SPRING 9-SLICE) ======================== */
.modal-scrim {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: rgba(16, 12, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeScrim 0.18s ease-out;
}

.modal-scrim.hidden {
  display: none !important;
}

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

.modal-card {
  width: min(980px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: popModal 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-card.modal-compact {
  width: min(640px, 92vw);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -12px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px dashed rgba(60, 39, 34, 0.25);
}

.modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(22px, 2vw, 30px);
  color: #FFF9E6;
  -webkit-text-stroke: 2px #1C1B29;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #1C1B29;
}

.modal-body {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 66vh;
  padding: 4px 6px 8px;
}

/* CRITICAL MODAL GRID CONTAINMENT LAW: minmax(0, 1fr) + min-width: 0 */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

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

.game-card {
  background: linear-gradient(180deg, #FFF8E7 0%, #EFE0BE 100%);
  border: 3px solid #3C2722;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 4px 0 rgba(60, 39, 34, 0.35);
}

.game-card.rarity-rare {
  border-color: #2563EB;
  background: linear-gradient(180deg, #EFF6FF 0%, #DBEAFE 100%);
}

.game-card.rarity-epic {
  border-color: #9333EA;
  background: linear-gradient(180deg, #FAF5FF 0%, #F3E8FF 100%);
}

.card-art-slot {
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(60, 39, 34, 0.08);
  border-radius: 12px;
  padding: 6px;
}

.card-art-slot img {
  max-height: 74px;
  max-width: 100%;
  object-fit: contain;
}

.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  color: #1C1B29;
  margin: 0;
}

.card-desc {
  font-size: 12.5px;
  font-weight: 700;
  color: #3C2722;
  margin: 0;
  line-height: 1.3;
}

.badge-ribbon {
  align-self: flex-start;
  background: #FCAB04;
  color: #14121F;
  border: 2px solid #1C1B29;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 11px;
  padding: 2px 9px;
}

/* Settings Rows */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  background: rgba(60, 39, 34, 0.08);
  border-radius: 12px;
  margin-bottom: 8px;
  font-weight: 800;
}

/* Tutorial Non-Blocking Spotlight Banner */
#tutorial-overlay {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(28, 27, 41, 0.94);
  border: 3px solid #FCAB04;
  border-radius: 16px;
  padding: 10px 16px;
  color: #FFF9E6;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);
  max-width: min(680px, 90vw);
}

#tutorial-overlay.hidden {
  display: none !important;
}

#tutorial-overlay img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

/* 3-Beat Chest & Celebration Overlay */
#celebration-overlay {
  position: absolute;
  inset: 0;
  z-index: 120;
  background: rgba(12, 10, 18, 0.78);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

#celebration-overlay.hidden {
  display: none !important;
}

.sunburst-wheel {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(252, 171, 4, 0.28) 0deg 15deg, transparent 15deg 30deg);
  animation: spinSun 12s linear infinite;
  pointer-events: none;
}

@keyframes spinSun {
  to { transform: rotate(360deg); }
}

/* Toast Banner */
#toast-container {
  position: absolute;
  top: 74px;
  right: 150px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.toast-msg {
  background: rgba(28, 27, 41, 0.92);
  border: 2px solid #FCAB04;
  color: #FFF9E6;
  font-family: var(--font-display);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

/* Preview-Only [DEV F2] Pill & Panel */
#dev-f2-pill {
  position: absolute;
  bottom: 88px;
  left: 14px;
  z-index: 130;
  background: #14121F;
  color: #52E085;
  border: 2px solid #52E085;
  border-radius: 8px;
  padding: 3px 9px;
  font-family: monospace;
  font-weight: 700;
  font-size: 11px;
}

#debug-panel {
  position: absolute;
  top: 64px;
  left: 220px;
  z-index: 135;
  width: min(520px, 90vw);
  max-height: 78vh;
  overflow-y: auto;
  background: rgba(18, 18, 28, 0.96);
  border: 2px solid #52E085;
  border-radius: 14px;
  padding: 12px;
  color: #EAEAEA;
  font-size: 12px;
}

#debug-panel.hidden {
  display: none !important;
}

/* Responsive <900px Fallback */
@media (max-width: 900px) {
  #hud-left-stack {
    display: none;
  }
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hud-center-progress {
    min-width: 180px;
  }
  .reactor-btn {
    width: 66px;
    height: 54px;
  }
}
