/* ==========================================================================
   Candy Bridge Race 3D — Web PC Desktop & Responsive Portrait/Landscape Stylesheet
   Uses generated UI chrome assets from ../assets/ui/**
   ========================================================================== */

:root {
  --pink-primary: #ff5ca8;
  --pink-dark: #c92a76;
  --cream-bg: #fff8f2;
  --text-dark: #4a2138;
  --text-muted: #875470;
  --cyan-accent: #18b8f0;
  --gold-accent: #ffae19;
  --focus-ring: 0 0 0 3px rgba(255, 255, 255, 0.95), 0 0 0 6px #ff2e93;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-drag: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1cc5dc;
  font-family: 'Fredoka', 'Lilita One', 'Segoe UI Rounded', 'Segoe UI', 'Nunito', system-ui, sans-serif;
  color: var(--text-dark);
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #7beeff 0%, #1ec8e2 70%, #0ea5c0 100%);
}

#webgl-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

#ui-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.interactive, button, .ui-btn, .hub-card, .shop-card, .hero-card, .quest-row, input {
  pointer-events: auto;
}

button:focus-visible, .ui-btn:focus-visible, .hub-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* --------------------------------------------------------------------------
   Top Currency & Stage Progress Bar (matches Screenshot 2)
   -------------------------------------------------------------------------- */
#top-hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  gap: 12px;
  pointer-events: none;
  z-index: 25;
}

.currency-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.currency-pill {
  position: relative;
  min-width: 158px;
  height: 52px;
  background: linear-gradient(180deg, #fffdf9 0%, #ffeef6 60%, #ffd8ea 100%);
  border: 2.5px solid #ff9ec8;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(74, 18, 48, 0.22), inset 0 2px 0 rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  padding: 0 16px 2px 12px;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.14s ease;
}

.currency-pill:hover {
  transform: translateY(-2px) scale(1.03);
}

.currency-pill img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.15));
}

.currency-pill .val {
  font-size: 20px;
  font-weight: 800;
  color: #5c2842;
  letter-spacing: 0.3px;
}

.currency-pill .plus-chip {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ff7ebb, #ff3d96);
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Center Stage Nodes (1 - 2 - 3 - 4 - 5) */
.stage-nodes {
  display: flex;
  align-items: center;
  gap: 0;
  pointer-events: auto;
}

.stage-node {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ffd1a6;
  border: 4px solid #ffb870;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.16);
  transition: all 0.2s ease;
}

.stage-node.active {
  width: 58px;
  height: 58px;
  background: #ffffff;
  border-color: #ffc266;
  color: #ff5ca8;
  font-size: 24px;
  transform: scale(1.06);
}

.stage-node.completed {
  background: #ff7ebb;
  border-color: #ffffff;
  color: #ffffff;
}

.stage-connector {
  width: 22px;
  height: 10px;
  background: #ffd1a6;
}

.top-right-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.icon-btn {
  width: 54px;
  height: 54px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease;
}

.icon-btn:hover {
  transform: scale(1.08) rotate(6deg);
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* --------------------------------------------------------------------------
   Crisp 3D Glossy Candy Pill Buttons (Zero Bitmap Stretching at Any Width!)
   -------------------------------------------------------------------------- */
.ui-btn {
  position: relative;
  border: 2.5px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  background-image: linear-gradient(180deg, #ff85c2 0%, #ff479b 52%, #e01e79 100%);
  background-color: #ff479b;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.65),
    inset 0 -3px 0 rgba(120, 10, 60, 0.32),
    0 4px 0 #a81058,
    0 7px 14px rgba(90, 15, 55, 0.28);
  color: #ffffff;
  font-family: inherit;
  font-weight: 900;
  letter-spacing: 0.25px;
  text-shadow: 0 2px 3px rgba(95, 12, 52, 0.65);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 22px 11px;
  min-height: 46px;
  line-height: 1.15;
  white-space: nowrap;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

.ui-btn:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.06);
}

.ui-btn:active {
  transform: translateY(2px) scale(0.98);
}

.ui-btn-primary {
  background-image: linear-gradient(180deg, #ff85c2 0%, #ff479b 52%, #e01e79 100%);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.68),
    inset 0 -3px 0 rgba(120, 10, 60, 0.32),
    0 4px 0 #a81058,
    0 7px 14px rgba(168, 16, 88, 0.32);
  text-shadow: 0 2px 3px rgba(105, 12, 55, 0.68);
}

.ui-btn-secondary {
  background-image: linear-gradient(180deg, #6be4ff 0%, #20b2f7 52%, #0084d6 100%);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.72),
    inset 0 -3px 0 rgba(0, 60, 120, 0.32),
    0 4px 0 #005b99,
    0 7px 14px rgba(0, 91, 153, 0.28);
  text-shadow: 0 2px 3px rgba(8, 55, 105, 0.68);
}

.ui-btn-buy {
  background-image: linear-gradient(180deg, #72ef88 0%, #29c75c 52%, #139a3e 100%);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.72),
    inset 0 -3px 0 rgba(10, 85, 30, 0.32),
    0 4px 0 #0d6e2b,
    0 7px 14px rgba(13, 110, 43, 0.30);
  text-shadow: 0 2px 3px rgba(10, 75, 30, 0.68);
}

.ui-btn-hot {
  background-image: linear-gradient(180deg, #ffbe0b 0%, #fb5607 52%, #e0004d 100%) !important;
  border: 2.5px solid #fff3b0 !important;
  color: #ffffff !important;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.75),
    inset 0 -3px 0 rgba(130, 15, 0, 0.38),
    0 4px 0 #9e0031,
    0 7px 16px rgba(251, 86, 7, 0.42) !important;
  text-shadow: 0 2px 3px rgba(110, 10, 30, 0.78) !important;
}

.ui-btn-danger {
  background-image: linear-gradient(180deg, #ff6b8b 0%, #ef233c 52%, #b80d27 100%);
  border: 2.5px solid #ffd6de;
  color: #ffffff;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.65),
    inset 0 -3px 0 rgba(90, 5, 20, 0.38),
    0 4px 0 #800619,
    0 7px 14px rgba(184, 13, 39, 0.34);
  text-shadow: 0 2px 3px rgba(85, 5, 18, 0.72);
}

.ui-btn-tab {
  background-image: linear-gradient(180deg, #fff5f9 0%, #ffd6e8 100%);
  border: 2.5px solid #ff9ec7;
  color: #6e1f47;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    0 3px 0 #e08ab1,
    0 5px 10px rgba(110, 31, 71, 0.14);
  min-height: 44px;
  padding: 8px 18px 9px;
}

.ui-btn-tab.active {
  background-image: linear-gradient(180deg, #ff85c2 0%, #ff479b 52%, #e01e79 100%);
  border-color: #ffffff;
  color: #ffffff;
  text-shadow: 0 2px 3px rgba(110, 20, 65, 0.65);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.68),
    0 4px 0 #a81058,
    0 7px 14px rgba(224, 30, 121, 0.32);
}

.ui-btn-draw1 {
  background-image: linear-gradient(180deg, #6be4ff 0%, #20b2f7 52%, #0084d6 100%);
}

.ui-btn-draw10 {
  background-image: linear-gradient(180deg, #ffd43b 0%, #f59f00 52%, #d97706 100%);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.75),
    0 4px 0 #9c4f00,
    0 7px 14px rgba(217, 119, 6, 0.35);
  text-shadow: 0 2px 3px rgba(105, 50, 0, 0.68);
}

.btn-close-img {
  width: 48px;
  height: 48px;
  border: none;
  background: url("../assets/ui/btn_close.png") no-repeat center / contain;
  cursor: pointer;
  transition: transform 0.14s ease;
}

.btn-close-img:hover {
  transform: scale(1.1);
}

/* --------------------------------------------------------------------------
   Screen / Panel Visibility
   -------------------------------------------------------------------------- */
.screen-panel {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
}

.screen-panel.active {
  display: flex;
}

/* --------------------------------------------------------------------------
   1. Boot Loading Screen
   -------------------------------------------------------------------------- */
#bootPanel {
  z-index: 100;
  pointer-events: auto;
  background: url('../assets/ui/bg_hub.png') no-repeat center / cover;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#bootPanel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 45, 75, 0.25) 0%, rgba(45, 15, 40, 0.68) 100%);
}

.boot-card {
  position: relative;
  z-index: 2;
  width: min(560px, 90vw);
  padding: 36px 32px;
  background: linear-gradient(180deg, #fffcf8 0%, #fff0f7 68%, #ffddeb 100%);
  border: 3px solid #ff9ec8;
  border-radius: 26px;
  box-shadow: 0 10px 28px rgba(64, 16, 44, 0.28), inset 0 3px 0 rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.game-logo-title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 900;
  color: #ff479b;
  text-shadow: 0 3px 0 #ffffff, 0 6px 14px rgba(120, 20, 70, 0.35);
  margin: 0 0 6px;
  letter-spacing: 0.5px;
}

.game-logo-sub {
  font-size: 15px;
  font-weight: 700;
  color: #7c3f5e;
  margin-bottom: 20px;
}

.boot-progress-wrap {
  width: 100%;
  height: 36px;
  background: rgba(52, 16, 42, 0.85);
  border: 2.5px solid #ffb3d9;
  border-radius: 999px;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.35), 0 3px 10px rgba(0, 0, 0, 0.18);
  padding: 6px 10px;
  display: flex;
  align-items: center;
}

.boot-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 14px;
  background: linear-gradient(90deg, #ff6bb5, #ffae2b, #38d6ff);
  transition: width 0.15s ease;
}

/* --------------------------------------------------------------------------
   2. Main Hub Panel (matches Screenshot 2 layout over live 3D track!)
   -------------------------------------------------------------------------- */
#mainPanel {
  flex-direction: column;
  justify-content: space-between;
  padding: 76px 24px 26px;
}

.hub-middle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  flex: 1;
}

.hub-side-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  pointer-events: auto;
}

.hub-card {
  position: relative;
  width: 132px;
  height: 146px;
  background: linear-gradient(180deg, #ffffff 0%, #fff2f8 64%, #ffd8ea 100%);
  border: 3px solid #ff9ec8;
  border-radius: 24px;
  box-shadow: 0 6px 16px rgba(74, 18, 48, 0.22), inset 0 2px 0 #ffffff;
  overflow: visible;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 14px 10px 16px;
  transition: transform 0.15s ease;
}

.hub-card:hover {
  transform: translateY(-4px) scale(1.05);
}

.hub-card:active {
  transform: scale(0.96);
}

.hub-card .red-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff6b8b, #e6194b);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.hub-card .card-art {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.hub-card .card-label-pill {
  width: 92%;
  padding: 4px 6px;
  border-radius: 12px;
  background: rgba(255, 215, 195, 0.78);
  color: #6b3b2b;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.hub-card .card-label-pill img {
  width: 18px;
  height: 18px;
}

.hub-bottom-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

#btn-start-game {
  width: min(440px, 84vw);
  height: 78px;
  font-size: 28px;
  letter-spacing: 1px;
}

.hub-controls-hint {
  background: rgba(255, 255, 255, 0.88);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  color: #612947;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* --------------------------------------------------------------------------
   3. Gameplay HUD Panel (gamePanel)
   -------------------------------------------------------------------------- */
#gamePanel {
  flex-direction: column;
  justify-content: space-between;
  padding: 76px 24px 22px;
}

.battle-top-strip {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  gap: 16px;
}

.rank-hud-card {
  background: linear-gradient(180deg, #fffcf8 0%, #fff0f7 68%, #ffddeb 100%);
  border: 3px solid #ff9ec8;
  border-radius: 26px;
  box-shadow: 0 10px 28px rgba(64, 16, 44, 0.28), inset 0 3px 0 rgba(255, 255, 255, 0.95);
  padding: 12px 20px;
  min-width: 220px;
  pointer-events: auto;
}

.rank-badge-big {
  font-size: 26px;
  font-weight: 900;
  color: #ff3892;
}

.progress-bars-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 280px;
}

.hud-bar-row {
  position: relative;
  width: 280px;
  height: 32px;
  background: rgba(45, 14, 34, 0.82);
  border: 2.5px solid rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45), 0 3px 8px rgba(0, 0, 0, 0.2);
  padding: 4px 6px;
  display: flex;
  align-items: center;
}

.hud-bar-hp { border-color: #ff9ec8; }
.hud-bar-xp { border-color: #81d4fa; }
.hud-bar-energy { border-color: #ffd166; }

.hud-bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: none !important;
}

.hud-bar-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Countdown & Finger/Steer Guide Overlay */
#countdown-overlay {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

#countdown-text {
  font-size: 86px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 4px 0 #ff3892, 0 10px 24px rgba(0,0,0,0.35);
}

#steer-guide {
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 20px;
  border-radius: 24px;
  font-weight: 800;
  color: #5a2241;
  font-size: 15px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

/* Bottom Skill Action Bar */
.skill-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  pointer-events: auto;
}

.skill-btn {
  position: relative;
  width: 74px;
  height: 74px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.skill-btn:hover {
  transform: translateY(-4px) scale(1.06);
}

.skill-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.skill-btn .key-hint {
  position: absolute;
  top: -6px;
  left: -4px;
  background: #4a2138;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 8px;
  border: 2px solid #fff;
}


.skill-btn .skill-label {
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #3b172e 0%, #240b1c 100%);
  color: #fff6d6;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.3px;
  padding: 1px 7px;
  border-radius: 7px;
  border: 1.5px solid rgba(255, 215, 102, 0.85);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  pointer-events: none;
}

.skill-btn .cd-overlay {
  position: absolute;
  inset: 4px;
  border-radius: 16px;
  background: rgba(25, 10, 20, 0.68);
  color: #fff;
  font-weight: 900;
  font-size: 20px;
  display: none;
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   4. Modal Dialogs (Shop, Roster/Heroes, Gacha, Quests, Resurrection, GameOver, Settings)
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 12, 26, 0.58);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: auto;
  padding: 16px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-window {
  position: relative;
  width: min(960px, 95vw);
  max-height: 88vh;
  background: linear-gradient(180deg, #fffdf9 0%, #fff2f8 68%, #ffe0ef 100%);
  border: 4px solid #ff85c0;
  border-radius: 28px;
  box-shadow: 0 20px 54px rgba(42, 8, 32, 0.42), inset 0 3px 0 #ffffff;
  padding: 24px 30px 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.modal-shop {
  width: min(1160px, 95vw);
  border-color: #ff9ec8;
}
.modal-hero { border-color: #a78bfa; }
.modal-quest { border-color: #fbbf24; }
.modal-dialog {
  width: min(620px, 94vw);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 2px dashed rgba(255, 115, 165, 0.35);
}

.modal-title {
  font-size: 26px;
  font-weight: 900;
  color: #6a1b46;
  margin: 0;
}

.tab-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-body-scroll {
  overflow-y: auto;
  flex: 1;
  padding-right: 6px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  padding: 6px 2px;
}

.item-card {
  position: relative;
  background: linear-gradient(180deg, #ffffff 0%, #fff5fa 70%, #ffe6f2 100%);
  border: 3px solid #f7a8d0;
  border-radius: 22px;
  box-shadow: 0 6px 16px rgba(68, 16, 46, 0.16), inset 0 2px 0 #ffffff;
  padding: 16px 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  min-height: 250px;
}

/* [art_cut_v2] Measured pixel-exact 9-slice borders for Rarity Cards (no corner distortion) */
.rarity-1 { background: transparent; border: 18px solid transparent; border-image: url('../assets/ui/frame_rarity_1.png') 29 27 31 28 fill / 18px stretch; }
.rarity-2 { background: transparent; border: 18px solid transparent; border-image: url('../assets/ui/frame_rarity_2.png') 30 29 33 30 fill / 18px stretch; }
.rarity-3 { background: transparent; border: 18px solid transparent; border-image: url('../assets/ui/frame_rarity_3.png') 30 28 33 29 fill / 18px stretch; }
.rarity-4 { background: transparent; border: 18px solid transparent; border-image: url('../assets/ui/frame_rarity_4.png') 30 28 33 29 fill / 18px stretch; }

.item-card .badge-tag {
  position: absolute;
  top: 8px;
  right: 10px;
  background: #ff3892;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 10px;
}

.item-card .art-thumb {
  width: 88px;
  height: 88px;
  object-fit: contain;
  margin-top: 6px;
}

.item-card h4 {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 800;
  color: #4a1c35;
}

.item-card p {
  margin: 0;
  font-size: 12px;
  color: #6e3c56;
  line-height: 1.3;
  flex: 1;
}

/* Hero Preview Split inside Roster Modal */
.hero-modal-split {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 18px;
  overflow: hidden;
  flex: 1;
}

.hero-stage-preview {
  background: rgba(255, 255, 255, 0.72);
  border: 3px solid #e1b8ff;
  border-radius: 22px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

#hero-anim-canvas {
  width: 170px;
  height: 170px;
  background: radial-gradient(circle, rgba(255,220,240,0.8) 0%, rgba(255,255,255,0) 70%);
}

/* --------------------------------------------------------------------------
   5. GameOver / Multiplier Roulette Panel (matches Screenshot 1!)
   -------------------------------------------------------------------------- */
.result-banner-img {
  width: min(440px, 82vw);
  height: 92px;
  border-radius: 999px;
  border: 4px solid #ffffff;
  box-shadow: 0 8px 22px rgba(45, 10, 34, 0.35), inset 0 3px 0 rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  margin: 0 auto;
}

.banner-win { background: linear-gradient(180deg, #ffd166 0%, #ff851b 55%, #e8590c 100%); }
.banner-lose { background: linear-gradient(180deg, #ff7eb9 0%, #f03e3e 60%, #a61e4d 100%); }

.roulette-container {
  position: relative;
  width: 360px;
  height: 200px;
  margin: 4px auto 6px;
  user-select: none;
  filter: drop-shadow(0 8px 18px rgba(74, 14, 46, 0.25));
}

.roulette-wheel-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.roulette-wedge {
  transition: filter 0.08s ease, transform 0.08s ease;
  transform-origin: 180px 182px;
}

.roulette-wedge.active-wedge {
  filter: brightness(1.18) saturate(1.25) drop-shadow(0 0 10px rgba(255, 214, 10, 0.85));
}

.roulette-needle {
  position: absolute;
  bottom: 14px;
  left: 50%;
  width: 38px;
  height: 122px;
  margin-left: -19px;
  background: url('../assets/ui/roulette_pointer.png') no-repeat center / contain;
  transform-origin: 50% 84%;
  transform: rotate(0deg);
  z-index: 3;
  filter: drop-shadow(0 4px 8px rgba(35, 5, 24, 0.55));
  will-change: transform;
}

.roulette-hub-cap {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 58px;
  height: 36px;
  border-radius: 36px 36px 12px 12px;
  background: linear-gradient(180deg, #ffbe0b 0%, #fb5607 100%);
  border: 3px solid #ffffff;
  box-shadow: 0 4px 10px rgba(74, 14, 46, 0.45), inset 0 2px 3px rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  font-weight: 900;
  font-size: 16px;
  color: #ffffff;
  text-shadow: 0 2px 3px rgba(74, 14, 46, 0.75);
  font-variant-numeric: tabular-nums;
}

/* Rock-solid Fixed Width Spin Claim Button — ZERO UI jumping while rolling! */
#btn-claim-roulette,
.roulette-spin-claim-btn {
  width: 304px !important;
  min-width: 304px !important;
  max-width: 304px !important;
  height: 52px !important;
  min-height: 52px !important;
  padding: 0 14px !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  font-variant-numeric: tabular-nums !important;
  font-size: 15.5px !important;
  background: linear-gradient(180deg, #ff479b 0%, #d6136b 55%, #9b0b4d 100%) !important;
  border: 2.5px solid #ffd166 !important;
  box-shadow: 0 6px 0 #690532, 0 10px 20px rgba(214, 19, 107, 0.42), inset 0 2px 2px rgba(255, 255, 255, 0.55) !important;
}

.roulette-spin-claim-btn .r-claim-prefix {
  font-weight: 900;
  letter-spacing: 0.3px;
  color: #ffffff;
}

.roulette-spin-claim-btn .r-claim-mult {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  height: 26px;
  background: linear-gradient(180deg, #fff3b0, #ffbe0b);
  color: #4a0e2e;
  font-weight: 900;
  font-size: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  font-variant-numeric: tabular-nums;
}

.roulette-spin-claim-btn .r-claim-gems-pill {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  background: rgba(36, 4, 24, 0.42);
  border: 1.5px solid rgba(255, 240, 246, 0.55);
  border-radius: 999px;
  padding: 3px 9px 3px 8px;
  min-width: 82px;
  font-variant-numeric: tabular-nums;
}

.roulette-spin-claim-btn #roulette-live-gems {
  display: inline-block;
  min-width: 46px;
  text-align: right;
  font-weight: 900;
  color: #72efdd;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   6. FlyReward & Toast Notifications
   -------------------------------------------------------------------------- */
#toast-container {
  position: absolute;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 140;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(520px, 92vw);
}

.toast-msg {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(58, 16, 42, 0.94) 0%, rgba(102, 24, 68, 0.94) 100%);
  border: 2.5px solid #ff9ec8;
  border-radius: 999px;
  padding: 8px 20px 8px 12px;
  font-weight: 800;
  font-size: 14px;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
  box-shadow: 0 10px 26px rgba(24, 4, 18, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
  animation: toastSlideIn 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.15);
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: 100%;
}

.toast-msg.toast-warn {
  background: linear-gradient(135deg, rgba(110, 18, 36, 0.95) 0%, rgba(168, 28, 52, 0.95) 100%);
  border-color: #ffd166;
}

.toast-msg.toast-success {
  background: linear-gradient(135deg, rgba(16, 82, 58, 0.95) 0%, rgba(26, 128, 88, 0.95) 100%);
  border-color: #8ef0b8;
}

.toast-msg .toast-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.4);
}

@keyframes toastSlideIn {
  from { transform: translateY(-18px) scale(0.88); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Screen-Space VFX Flash & Aura Overlay */
#vfx-screen-flash {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}
#vfx-screen-flash.vfx-hit {
  opacity: 1;
  background: radial-gradient(circle, rgba(255,0,60,0) 45%, rgba(255,0,65,0.52) 100%);
}
#vfx-screen-flash.vfx-dash {
  opacity: 1;
  background: radial-gradient(circle, rgba(255,215,0,0) 55%, rgba(255,140,200,0.38) 100%);
}
#vfx-screen-flash.vfx-shield {
  opacity: 1;
  background: radial-gradient(circle, rgba(0,245,212,0) 55%, rgba(0,210,255,0.35) 100%);
}

@keyframes toastPop {
  from { transform: translateY(16px) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.fly-gem {
  position: fixed;
  width: 36px;
  height: 36px;
  z-index: 150;
  pointer-events: none;
  transition: transform 0.75s cubic-bezier(0.2, 0.85, 0.3, 1), opacity 0.75s ease;
}

/* --------------------------------------------------------------------------
   Portrait & Small Window Responsiveness
   -------------------------------------------------------------------------- */
@media (max-width: 820px), (orientation: portrait) {
  #top-hud-bar {
    flex-wrap: wrap;
    padding: 10px 12px;
  }
  .currency-pill {
    min-width: 126px;
    height: 44px;
  }
  .stage-node {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }
  .stage-node.active {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  .hub-card {
    width: 104px;
    height: 118px;
  }
  .hub-card .card-art {
    width: 50px;
    height: 50px;
  }
  .hero-modal-split {
    grid-template-columns: 1fr;
  }
  .modal-window {
    padding: 20px 18px 24px;
  }
}

/* 12-Stage Compact Progress Bar & Shop Z-Index Priority */
#hud-stage-nodes {
  max-width: 54vw;
  overflow-x: auto;
  padding: 4px 6px;
  scrollbar-width: none;
}
#hud-stage-nodes::-webkit-scrollbar {
  display: none;
}
#hud-stage-nodes .stage-node {
  width: 36px;
  height: 36px;
  font-size: 13px;
  flex-shrink: 0;
  cursor: pointer;
}
#hud-stage-nodes .stage-node.active {
  width: 44px;
  height: 44px;
  font-size: 15px;
}
#hud-stage-nodes .stage-connector {
  width: 10px;
  height: 6px;
  flex-shrink: 0;
}
#shopModal {
  z-index: 85 !important;
}
#iapConfirmModal {
  z-index: 95 !important;
}

/* ==========================================================================
   v6 Polish: 3D Inline Icons, Top HUD Boss Crown Badge, Gacha Ceremony & World Map
   ========================================================================== */
.inline-ui-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: middle;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

.hub-power-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(35, 12, 28, 0.86);
  color: #ffe066;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  border: 2.5px solid #ff9ec8;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

/* Fix Screenshot 1: Stage Node Number & Floating 3D Boss Crown Badge */
#hud-stage-nodes {
  max-width: 56vw;
  overflow: visible;
  padding: 12px 8px 4px;
  display: flex;
  align-items: center;
}
#hud-stage-nodes .stage-node {
  position: relative;
  width: 38px;
  height: 38px;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
#hud-stage-nodes .stage-node.active {
  width: 46px;
  height: 46px;
  font-size: 17px;
}
#hud-stage-nodes .stage-node .node-num {
  display: block;
  text-align: center;
  line-height: 1;
  z-index: 2;
}
#hud-stage-nodes .stage-node .node-crown-badge {
  position: absolute;
  top: -13px;
  right: -7px;
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
  pointer-events: none;
  z-index: 4;
  animation: crownFloat 2s ease-in-out infinite;
}
@keyframes crownFloat {
  0%, 100% { transform: translateY(0) rotate(8deg); }
  50% { transform: translateY(-3px) rotate(14deg); }
}

/* Fix Screenshot 3: Lucky Draw Gacha Stage, Shaking Chest, Magic Halo & 3D Card Flip */
.gacha-odds-strip {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.gacha-rate-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.85);
  color: #5a1e40;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  border: 2px solid #f3b6d4;
}
.gacha-stage-box {
  position: relative;
  min-height: 245px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px;
  background: radial-gradient(circle at 50% 45%, #5e1b6b 0%, #2a0c38 65%, #160521 100%);
  border: 3px solid #ffd54f;
  border-radius: 24px;
  box-shadow: inset 0 0 36px rgba(255, 105, 180, 0.38), 0 8px 24px rgba(30, 5, 25, 0.35);
  overflow: hidden;
}
.gacha-idle-showcase {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  z-index: 2;
}
.gacha-chest-pedestal {
  position: relative;
  width: 155px;
  height: 155px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gacha-magic-halo {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 3px dashed rgba(255, 215, 75, 0.72);
  box-shadow: 0 0 28px rgba(255, 110, 195, 0.65);
  animation: gachaSpinHalo 9s linear infinite;
}
.gacha-idle-chest-img {
  width: 138px;
  height: 138px;
  object-fit: contain;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 8px 18px rgba(255, 190, 40, 0.55));
  animation: gachaChestFloat 2.4s ease-in-out infinite;
}
.gacha-chest-opening-anim {
  width: 150px;
  height: 150px;
  object-fit: contain;
  position: relative;
  z-index: 3;
  filter: drop-shadow(0 0 28px #ffd54f) drop-shadow(0 0 48px #ff2e93);
  animation: gachaChestShake 0.14s ease-in-out infinite;
}
@keyframes gachaSpinHalo {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes gachaChestFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.04); }
}
@keyframes gachaChestShake {
  0% { transform: translate(-4px, -2px) rotate(-6deg) scale(1.08); }
  25% { transform: translate(5px, 2px) rotate(6deg) scale(1.12); }
  50% { transform: translate(-5px, 3px) rotate(-8deg) scale(1.15); }
  75% { transform: translate(4px, -3px) rotate(7deg) scale(1.12); }
  100% { transform: translate(0, 0) rotate(0deg) scale(1.1); }
}
.gacha-burst-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, #ffffff 0%, #ffe066 40%, rgba(255, 46, 147, 0) 80%);
  z-index: 10;
  pointer-events: none;
  animation: gachaFlashOut 0.65s ease-out forwards;
}
@keyframes gachaFlashOut {
  0% { opacity: 1; transform: scale(0.6); }
  40% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0; transform: scale(1.5); }
}
.gacha-reward-card {
  position: relative;
  width: 146px;
  min-height: 196px;
  padding: 14px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  background: linear-gradient(180deg, #fffdf9 0%, #ffe8f6 65%, #f8c6e4 100%);
  border: 3px solid #ffd54f;
  border-radius: 18px;
  opacity: 0;
  transform: perspective(600px) rotateY(90deg) scale(0.7);
  animation: gachaCardFlipIn 0.48s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  z-index: 3;
}
.gacha-reward-card.jackpot-glow {
  filter: drop-shadow(0 0 14px rgba(255, 215, 0, 0.85));
}
@keyframes gachaCardFlipIn {
  0% { opacity: 0; transform: perspective(600px) rotateY(90deg) translateY(24px) scale(0.7); }
  65% { opacity: 1; transform: perspective(600px) rotateY(-10deg) translateY(-4px) scale(1.05); }
  100% { opacity: 1; transform: perspective(600px) rotateY(0deg) translateY(0) scale(1); }
}
.gacha-sparkle-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 8;
  transition: transform 0.75s cubic-bezier(0.15, 0.85, 0.3, 1), opacity 0.75s ease;
}

/* Fix Screenshot 4: Clean 10-Chapter 5x2 Grid & Biome-Themed Level Cards */
.chapter-grid-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 2px 0;
}
.chapter-tab-btn {
  border: 2.5px solid #f3b6d4;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: #541c3b;
  font-family: inherit;
  font-weight: 800;
  font-size: 12px;
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.chapter-tab-btn:hover {
  transform: translateY(-2px);
  border-color: #ff5ca8;
}
.chapter-tab-btn.active {
  background: linear-gradient(135deg, #ff479b, #ff85c0);
  color: #ffffff;
  border-color: #ffd54f;
  box-shadow: 0 4px 12px rgba(255, 56, 146, 0.4);
}
.chapter-biome-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.chapter-biome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 18px;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.55);
  border: 2.5px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.stage-map-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 4px 2px;
}
.stage-map-card {
  position: relative;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 3px solid #f0c4da;
  padding: 12px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  gap: 6px;
  min-height: 188px;
  box-shadow: 0 6px 14px rgba(45, 14, 34, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stage-map-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(45, 14, 34, 0.2);
}
.stage-map-card.boss-card {
  background: linear-gradient(180deg, #fff9db 0%, #ffe8cc 100%);
  border-color: #fcc419;
  box-shadow: 0 6px 18px rgba(245, 159, 0, 0.28);
}
.stage-map-card.current-card {
  border-color: #29b6f6;
  box-shadow: 0 0 0 3px rgba(41, 182, 246, 0.35), 0 8px 18px rgba(0, 0, 0, 0.18);
}
.stage-map-card .stage-top-ribbon {
  width: 100%;
  padding: 4px 8px;
  border-radius: 12px;
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.45);
}
.stage-stat-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  width: 100%;
}
.stage-stat-chip {
  background: rgba(90, 34, 65, 0.08);
  color: #541c3b;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
@media (max-width: 860px) {
  .chapter-grid-tabs { grid-template-columns: repeat(2, 1fr); }
  .stage-map-cards-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   v8 Update: Item Frames, Hover Tooltips, Candy Racers Showcase & Ad-Free UI
   ========================================================================== */

/* 1. Hide Video Ad elements completely */
#btn-revive-ad,
.ad-reward-btn,
[data-ad-btn] {
  display: none !important;
}

/* 2. Hub Side Dock Refinement (fits Shop, Racers, Lucky Chest, Quests + Piggy/Pass/Starter) */
.hub-side-col {
  gap: 10px;
  max-height: calc(100vh - 170px);
  justify-content: center;
}

.hub-card {
  width: 118px;
  height: 118px;
  padding: 10px 8px 12px;
}

.hub-card .card-art {
  width: 54px;
  height: 54px;
}

.dock-icon-btn {
  position: relative;
  width: 118px;
  min-height: 76px;
  background: linear-gradient(180deg, rgba(255, 250, 245, 0.95) 0%, rgba(255, 218, 236, 0.95) 100%);
  border: 3px solid #ff85c0;
  border-radius: 20px;
  box-shadow: 0 5px 14px rgba(74, 20, 50, 0.22), inset 0 2px 0 #ffffff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px 8px;
  gap: 4px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  pointer-events: auto;
}

.dock-icon-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 18px rgba(255, 46, 147, 0.34);
}

.dock-icon-btn img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.dock-icon-btn .dock-label {
  font-size: 11.5px;
  font-weight: 900;
  color: #5a1e40;
  background: rgba(255, 255, 255, 0.78);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.dock-icon-btn .notify-dot {
  position: absolute;
  top: -6px;
  right: -6px;
  background: linear-gradient(135deg, #ff0055, #ffbe0b);
  color: #fff;
  font-size: 9.5px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
}

/* 3. Visual Item Frames Grid (Replaces Wall-of-Text Item Grants!) */
.item-card {
  min-height: 278px;
  padding: 16px 12px 16px;
  justify-content: space-between;
}

.item-card .card-tagline {
  font-size: 11.5px;
  font-weight: 800;
  color: #7c355b;
  margin: 0 0 2px;
  line-height: 1.25;
  min-height: 15px;
}

.reward-frames-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  margin: 4px 0 6px;
  padding: 6px 6px;
  background: rgba(90, 25, 60, 0.06);
  border-radius: 16px;
  border: 1.5px dashed rgba(255, 105, 180, 0.35);
}

.reward-frames-grid.frames-large {
  gap: 10px;
  padding: 10px 12px;
  background: rgba(25, 6, 38, 0.36);
  border: 2px solid rgba(255, 213, 79, 0.55);
}

.reward-frames-grid.frames-inline {
  display: inline-flex;
  width: auto;
  margin: 0;
  padding: 3px 6px;
  background: transparent;
  border: none;
  gap: 6px;
}

.reward-item-frame {
  position: relative;
  width: 60px;
  height: 68px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fff0f7 68%, #ffd6ea 100%);
  border: 2.5px solid #ff85c0;
  box-shadow:
    0 4px 10px rgba(74, 18, 48, 0.16),
    inset 0 2px 0 rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 5px 3px 4px;
  cursor: pointer;
  transition: transform 0.14s cubic-bezier(0.2, 0.9, 0.3, 1.2), box-shadow 0.14s ease, border-color 0.14s ease;
  user-select: none;
}

.frames-large .reward-item-frame {
  width: 72px;
  height: 82px;
  border-radius: 16px;
  padding: 7px 4px 5px;
}

.frames-inline .reward-item-frame {
  width: 52px;
  height: 58px;
  border-radius: 12px;
  padding: 4px 2px 3px;
}

.reward-item-frame:hover {
  transform: translateY(-4px) scale(1.09);
  z-index: 12;
  box-shadow: 0 8px 18px rgba(255, 46, 147, 0.38), 0 0 0 2px #ffffff;
}

.reward-item-frame.frame-gold {
  background: linear-gradient(180deg, #fffdf2 0%, #ffefc2 65%, #ffd166 100%);
  border-color: #f59f00;
}
.reward-item-frame.frame-cyan {
  background: linear-gradient(180deg, #f2fcff 0%, #cfeeff 65%, #74c0fc 100%);
  border-color: #18b8f0;
}
.reward-item-frame.frame-epic {
  background: linear-gradient(180deg, #faf0ff 0%, #e5dbff 65%, #b197fc 100%);
  border-color: #845ef7;
}
.reward-item-frame.frame-mythic {
  background: linear-gradient(180deg, #fff9db 0%, #ffd8a8 50%, #ff85c0 100%);
  border-color: #ff0055;
  box-shadow: 0 4px 12px rgba(255, 0, 85, 0.25), inset 0 2px 0 #ffffff;
}
.reward-item-frame.frame-orange {
  background: linear-gradient(180deg, #fff8f0 0%, #ffe3c2 65%, #ffa94d 100%);
  border-color: #f76707;
}
.reward-item-frame.frame-pink {
  background: linear-gradient(180deg, #fff5f9 0%, #ffd6e8 65%, #ff85c2 100%);
  border-color: #e01e79;
}

.reward-item-frame .frame-icon-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.reward-item-frame .frame-icon-wrap img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.22));
  transition: transform 0.14s ease;
}

.frames-large .reward-item-frame .frame-icon-wrap img {
  width: 42px;
  height: 42px;
}

.frames-inline .reward-item-frame .frame-icon-wrap img {
  width: 28px;
  height: 28px;
}

.reward-item-frame:hover .frame-icon-wrap img {
  transform: scale(1.12) rotate(-4deg);
}

.reward-item-frame .frame-qty-badge {
  width: 94%;
  background: rgba(68, 16, 46, 0.88);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 900;
  line-height: 1.15;
  padding: 2px 3px;
  border-radius: 8px;
  text-align: center;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.08;
  font-size: 9.5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.frames-large .reward-item-frame .frame-qty-badge {
  font-size: 11.5px;
  padding: 3px 4px;
}

.reward-item-frame.frame-gold .frame-qty-badge {
  background: linear-gradient(90deg, #8c4600, #b45309);
  color: #fff9db;
}
.reward-item-frame.frame-cyan .frame-qty-badge {
  background: linear-gradient(90deg, #005082, #0077b6);
  color: #e0f7ff;
}
.reward-item-frame.frame-mythic .frame-qty-badge {
  background: linear-gradient(90deg, #9e0031, #7209b7);
  color: #ffe066;
}

.reward-item-frame .frame-info-dot {
  position: absolute;
  top: 2px;
  right: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(74, 25, 54, 0.55);
  color: #fff;
  font-size: 8.5px;
  font-weight: 900;
  line-height: 13px;
  text-align: center;
  opacity: 0.72;
}

/* 4. Floating Item Hover Tooltip (#item-hover-tooltip) */
.item-hover-tooltip {
  position: fixed;
  z-index: 300;
  width: 268px;
  background: linear-gradient(160deg, rgba(44, 12, 34, 0.97) 0%, rgba(76, 18, 56, 0.97) 100%);
  border: 2.5px solid #ff9ec8;
  border-radius: 18px;
  padding: 12px 14px;
  color: #ffffff;
  box-shadow: 0 14px 32px rgba(15, 2, 12, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  pointer-events: none;
  backdrop-filter: blur(10px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.item-hover-tooltip .tt-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1.5px dashed rgba(255, 158, 200, 0.35);
}

.item-hover-tooltip .tt-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 2px solid rgba(255, 213, 79, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.item-hover-tooltip .tt-icon-box img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.item-hover-tooltip .tt-title {
  font-size: 14px;
  font-weight: 900;
  color: #ffe066;
  line-height: 1.2;
}

.item-hover-tooltip .tt-cat {
  font-size: 10.5px;
  font-weight: 800;
  color: #ff9ec8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 2px;
}

.item-hover-tooltip .tt-desc {
  font-size: 12px;
  font-weight: 600;
  color: #fce8f3;
  line-height: 1.38;
  margin: 8px 0;
}

.item-hover-tooltip .tt-owned-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.38);
  border: 1.5px solid rgba(0, 245, 212, 0.45);
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 900;
  color: #9ef0ff;
}

.item-hover-tooltip .tt-owned-bar b {
  color: #00f5d4;
}

/* 5. Redesigned Candy Racers Showcase Modal (#heroModal) — Zero Clipping! */
.hero-modal-split {
  display: grid;
  grid-template-columns: 318px 1fr;
  gap: 16px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.hero-stage-preview {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(255, 232, 244, 0.92) 100%);
  border: 3px solid #f0a8d0;
  border-radius: 22px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
  box-shadow: inset 0 2px 0 #ffffff, 0 6px 16px rgba(74, 20, 50, 0.12);
}

.hero-3d-canvas-wrap {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: radial-gradient(circle at 50% 55%, rgba(255, 190, 226, 0.65) 0%, rgba(190, 235, 255, 0.38) 60%, rgba(255, 255, 255, 0) 100%);
  border-radius: 18px;
  padding: 4px 0 6px;
  border: 2px solid rgba(255, 133, 192, 0.35);
}

#hero-anim-canvas {
  width: 210px;
  height: 146px;
  cursor: grab;
  background: transparent;
  display: block;
}

#hero-anim-canvas:active {
  cursor: grabbing;
}

.hero-pose-chips {
  display: flex;
  gap: 5px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.pose-chip {
  border: 2px solid #ff9ec7;
  background: rgba(255, 255, 255, 0.9);
  color: #6a1b46;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.pose-chip:hover {
  border-color: #ff479b;
  transform: translateY(-1px);
}

.pose-chip.active {
  background: linear-gradient(135deg, #ff479b, #e01e79);
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 2px 8px rgba(224, 30, 121, 0.35);
}

.hero-info-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hero-info-card h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  color: #4a1c35;
}

#preview-hero-role {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: #7c2d56;
  background: rgba(255, 180, 215, 0.38);
  padding: 3px 12px;
  border-radius: 999px;
}

#preview-hero-desc {
  margin: 2px 0;
  font-size: 11.5px;
  font-weight: 700;
  color: #6e3c56;
  line-height: 1.32;
}

.hero-stat-frames-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 2px;
}

.hero-preview-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 2px;
}

.hero-preview-actions .ui-btn {
  width: 100% !important;
  min-height: 38px !important;
  font-size: 12px !important;
  padding: 6px 10px !important;
}

@media (max-width: 820px), (orientation: portrait) {
  .hero-modal-split {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .hero-stage-preview {
    overflow: visible;
  }
  .hub-card {
    width: 96px;
    height: 100px;
  }
  .dock-icon-btn {
    width: 96px;
    min-height: 64px;
  }
}

#gameover-rank-line {
  background: linear-gradient(135deg, rgba(255, 245, 250, 0.95), rgba(243, 232, 255, 0.95));
  border: 2px solid #ff85c8;
  border-radius: 999px;
  padding: 5px 18px;
  box-shadow: 0 4px 12px rgba(45, 10, 34, 0.32);
  color: #590d22 !important;
  text-shadow: 0 1px 0 #ffffff;
  display: inline-block;
  margin: 2px auto;
}


/* ==========================================================================
   v1.1.0 Track B v4.0/v4.8 Polished UI, Daylight VFX Canvas & 720p Compact
   ========================================================================== */
#ui-vfx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 65;
}

.ui-btn, .hub-card, .dock-icon-btn {
  overflow: visible;
}

/* Dark-berry backdrop pill on stage nodes for crisp contrast against daylight sky */
#hud-stage-nodes {
  background: rgba(58, 16, 46, 0.72);
  border: 2px solid rgba(255, 198, 224, 0.55);
  border-radius: 999px;
  padding: 6px 12px;
  box-shadow: 0 4px 12px rgba(32, 6, 26, 0.25);
}

/* Hide distracting Hub/Leaderboard/Map/Plus controls while actively racing */
#game-container.in-race #btn-open-leaderboard,
#game-container.in-race #btn-open-stage-map,
#game-container.in-race .currency-pill .plus-chip {
  display: none !important;
}

#game-container.in-race #toast-container {
  top: auto;
  bottom: 98px;
}

/* Feature Guides ? Help button inside modal headers */
.btn-feature-help {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2.5px solid #ffffff;
  background: linear-gradient(180deg, #48c9ff 0%, #1982e8 100%);
  color: #ffffff;
  font-family: inherit;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(15, 70, 140, 0.3);
  margin-left: auto;
  margin-right: 10px;
  flex-shrink: 0;
}
.btn-feature-help:hover {
  transform: scale(1.08);
}

/* Lock pill on soon-to-unlock hub items */
.feature-lock-pill {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  background: #2b1024;
  color: #ffd54f;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1.5px solid #ff85c0;
  white-space: nowrap;
  z-index: 6;
  pointer-events: none;
}

/* Shop 5-column crisp desktop grid (single clean row for Hot Bundles) */
#shop-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 12px;
}

.settings-select {
  padding: 6px 10px;
  border-radius: 10px;
  border: 2px solid #ff9ec8;
  background: #ffffff;
  color: #4a1c35;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(74, 20, 50, 0.12);
  color: #6a1b46;
  font-size: 11px;
  font-weight: 900;
  border: 1.5px solid rgba(255, 133, 192, 0.65);
}

/* P0 Fix for 1280x720 & Compact Window Viewports (vh-short / <=820px height) */
@media (max-height: 820px), (max-width: 1360px) {
  #top-hud-bar {
    padding: 8px 16px;
  }
  .currency-pill {
    min-width: 126px;
    height: 40px;
    padding: 0 10px;
    gap: 6px;
  }
  .currency-pill img {
    width: 26px;
    height: 26px;
  }
  .currency-pill .val {
    font-size: 16px;
  }
  .currency-pill .plus-chip {
    width: 20px;
    height: 20px;
    font-size: 13px;
    line-height: 18px;
  }
  #hud-stage-nodes {
    max-width: 48vw;
    padding: 4px 8px;
  }
  #hud-stage-nodes .stage-node {
    width: 30px;
    height: 30px;
    font-size: 12px;
    border-width: 2.5px;
  }
  #hud-stage-nodes .stage-node.active {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
  #hud-stage-nodes .stage-connector {
    width: 7px;
    height: 4px;
  }
  .top-right-actions .ui-btn {
    min-height: 36px !important;
    padding: 4px 10px !important;
    font-size: 12px !important;
  }
  .icon-btn {
    width: 42px;
    height: 42px;
  }
  #mainPanel {
    padding: 58px 18px 12px;
  }
  .hub-side-col {
    gap: 7px;
    max-height: calc(100vh - 118px);
  }
  .hub-card {
    width: 94px;
    height: 84px;
    padding: 6px 6px 7px;
    border-radius: 18px;
  }
  .hub-card .card-art {
    width: 38px;
    height: 38px;
  }
  .hub-card .card-label-pill {
    font-size: 11px;
    padding: 2px 5px;
  }
  .dock-icon-btn {
    width: 94px;
    min-height: 58px;
    padding: 5px 4px;
    border-radius: 16px;
  }
  .dock-icon-btn img {
    width: 30px;
    height: 30px;
  }
  .dock-icon-btn .dock-label {
    font-size: 10.5px;
    padding: 1px 6px;
  }
  .hub-bottom-cta {
    gap: 5px;
    margin-bottom: 2px;
  }
  #hub-game-logo-badge {
    font-size: 20px !important;
  }
  #hub-stage-banner {
    font-size: 15px !important;
  }
  .hub-power-pill-badge {
    padding: 4px 12px;
    font-size: 12px;
  }
  #hub-btn-power-pack, #hub-btn-worldmap {
    min-height: 34px !important;
    padding: 4px 12px !important;
    font-size: 12px !important;
  }
  #btn-start-game {
    width: min(360px, 78vw);
    height: 58px;
    font-size: 22px;
  }
  .hub-controls-hint {
    padding: 4px 12px;
    font-size: 11.5px;
  }
}

#game-container.vh-short #mainPanel {
  padding-top: 56px;
  padding-bottom: 10px;
}
#game-container.vh-short #btn-start-game {
  height: 56px;
  font-size: 22px;
}
