/* Mobile Touch Controls & Responsiveness for Zayan Ayyar */

:root {
  --gold-glow: #f5d061;
  --teal-glow: #1ad4c5;
  --sapphire-dark: rgba(8, 13, 20, 0.72);
  --sapphire-border: rgba(245, 208, 97, 0.45);
  --sapphire-active: rgba(26, 212, 197, 0.55);
}

/* Optimize touch interactions across the entire viewport */
html, body {
  touch-action: none !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  overscroll-behavior: none !important;
}

#mobile-controls {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  font-family: "Georgia", serif;
  opacity: 0;
  display: none;
  transition: opacity 0.3s ease;
}

body.in-game #mobile-controls.active {
  display: block;
  opacity: 1;
}

body:not(.in-game) #mobile-controls,
#mobile-controls:not(.active),
#mobile-controls:not(.active) * {
  display: none !important;
  pointer-events: none !important;
}

#shell, #pause, .panel, .file-box, .book {
  z-index: 100 !important;
  pointer-events: auto !important;
}

#shell, #pause, .panel, .file-box, .book,
#menu-list, #pause-list, #settings, #manual, #credits {
  touch-action: pan-y !important;
  overscroll-behavior: contain;
}

button, #menu-list li, #pause-list li, .hint {
  touch-action: manipulation !important;
}

/* Touch look swipe pad (covers right half and center of screen) */
#mobile-look-zone {
  position: absolute;
  top: 60px;
  right: 0;
  bottom: 120px;
  width: 55%;
  pointer-events: auto;
  touch-action: none;
  z-index: 26;
}

/* Virtual Joystick on the bottom left */
#joystick-container {
  position: absolute;
  left: max(24px, env(safe-area-inset-left));
  bottom: max(24px, env(safe-area-inset-bottom));
  width: 140px;
  height: 140px;
  pointer-events: auto;
  touch-action: none;
  z-index: 28;
}

#joystick-base {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 26, 40, 0.6) 0%, rgba(8, 13, 20, 0.8) 100%);
  border: 2px solid var(--sapphire-border);
  box-shadow: 0 0 15px rgba(245, 208, 97, 0.25), inset 0 0 12px rgba(26, 212, 197, 0.15);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

#joystick-stick {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffd978 0%, #b8860b 80%, #7d5b00 100%);
  border: 2px solid #fff3b0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), 0 0 10px rgba(245, 208, 97, 0.5);
  position: absolute;
  transform: translate(0px, 0px);
  transition: transform 0.04s ease-out;
  pointer-events: none;
}

#joystick-stick::after {
  content: "✦";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3b2800;
  font-size: 18px;
  font-weight: bold;
}

/* Action Pad Cluster on the bottom right */
#mobile-actions {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  width: 140px;
  height: 135px;
  pointer-events: none;
  z-index: 28;
}

.touch-btn {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(26, 38, 56, 0.85) 0%, rgba(10, 16, 26, 0.95) 100%);
  border: 1.5px solid var(--sapphire-border);
  color: #f5d061;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 0 8px rgba(245, 208, 97, 0.2);
  backdrop-filter: blur(4px);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: transform 0.08s ease, border-color 0.1s ease, box-shadow 0.1s ease;
}

.touch-btn:active, .touch-btn.active {
  transform: scale(0.92);
  border-color: var(--teal-glow);
  box-shadow: 0 0 16px rgba(26, 212, 197, 0.7), inset 0 0 10px rgba(26, 212, 197, 0.4);
  color: #1ad4c5;
}

.touch-btn .icon {
  font-size: 16px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8));
}

.touch-btn .lbl {
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 1px;
  font-weight: 600;
  opacity: 0.9;
}

/* Primary Slash Button (Large) */
#btn-touch-slash {
  right: 12px;
  bottom: 16px;
  width: 62px;
  height: 62px;
  border: 2.5px solid #f5d061;
  background: radial-gradient(circle at 35% 35%, rgba(60, 42, 15, 0.9) 0%, rgba(20, 14, 5, 0.95) 100%);
}

#btn-touch-slash .icon {
  font-size: 26px;
}

/* Unified Combat Action Cluster */
/* Shield (Defense / Sipar-e-Noor) */
#btn-touch-rostam, #btn-touch-vault {
  right: 80px;
  bottom: 16px;
  width: 48px;
  height: 48px;
}

/* Upper row: [Toss 🪨] [Sneak 🐾] */
#btn-touch-sneak {
  right: 18px;
  bottom: 84px;
  width: 48px;
  height: 48px;
  border-color: rgba(26, 212, 197, 0.5);
}

#btn-touch-sneak:active, #btn-touch-sneak.active {
  border-color: #6efff3;
  box-shadow: 0 0 16px rgba(110, 255, 243, 0.8), inset 0 0 10px rgba(110, 255, 243, 0.5);
  color: #6efff3;
}

#btn-touch-dagger {
  right: 80px;
  bottom: 70px;
  width: 48px;
  height: 48px;
  border-color: rgba(245, 208, 97, 0.6);
}

#btn-touch-dagger:active, #btn-touch-dagger.active {
  border-color: #ffd700;
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.85);
  color: #ffd700;
}

/* Special Attack (Zarb) Button */
#btn-touch-special {
  right: 18px;
  bottom: 138px;
  width: 44px;
  height: 44px;
}

/* Relics Bar (top right / bottom center) */
#mobile-relics-bar {
  position: absolute;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: clamp(4px, 1.5vw, 8px);
  pointer-events: auto;
  z-index: 28;
  max-width: calc(100vw - 220px);
  overflow-x: auto;
  scrollbar-width: none;
}

#mobile-relics-bar::-webkit-scrollbar {
  display: none;
}

.relic-touch-btn.hidden-relic {
  display: none !important;
}

.relic-touch-btn {
  width: 42px;
  height: 42px;
  min-width: 40px !important;
  min-height: 40px !important;
  border-radius: 10px;
  background: rgba(12, 18, 28, 0.85);
  border: 1px solid rgba(245, 208, 97, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #f4ead2;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.relic-touch-btn:active {
  transform: scale(0.92);
  border-color: #1ad4c5;
}

.relic-touch-btn .icon {
  font-size: 13.5px;
}

.relic-touch-btn .lbl {
  font-size: 7.5px;
  margin-top: 1px;
}

/* Quick Menu Touch Buttons (Top Bar) */
#mobile-top-bar {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  gap: 10px;
  pointer-events: auto;
  z-index: 30;
}

.quick-touch-btn {
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(10, 16, 26, 0.85);
  border: 1px solid rgba(245, 208, 97, 0.4);
  color: #f5d061;
  font-size: 13px;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  pointer-events: auto;
  touch-action: none;
}

.quick-touch-btn:active {
  background: rgba(26, 212, 197, 0.25);
  border-color: #1ad4c5;
}

.relic-touch-btn.locked,
.unowned-weapon,
.locked-relic {
  opacity: 0.35 !important;
  filter: grayscale(0.85) brightness(0.7) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  box-shadow: none !important;
  pointer-events: auto !important;
}

.relic-touch-btn.locked::after,
.unowned-weapon::after,
.locked-relic::after {
  content: "🔒";
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  padding: 2px;
  line-height: 1;
}

.relic-touch-btn.unlocked {
  opacity: 1 !important;
  filter: none;
  border-color: rgba(245, 208, 97, 0.85);
  box-shadow: 0 0 10px rgba(245, 208, 97, 0.4), 0 2px 6px rgba(0,0,0,0.4);
}

.relic-touch-btn.just-unlocked,
.weapon-just-unlocked {
  animation: relic-glow-burst 1.2s ease-out;
}

@keyframes relic-glow-burst {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(245, 208, 97, 0); }
  50% { transform: scale(1.18); box-shadow: 0 0 22px rgba(245, 208, 97, 0.9); border-color: #fff3b0; }
  100% { transform: scale(1); box-shadow: 0 0 10px rgba(245, 208, 97, 0.4); }
}

/* Camera Look Drag Widget (Right side) */
.camera-drag-widget {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  top: 40%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: auto;
  touch-action: none;
  z-index: 27;
  user-select: none;
  -webkit-user-select: none;
}

.dragger-track {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(10, 18, 30, 0.75);
  border: 1.5px solid rgba(26, 212, 197, 0.5);
  box-shadow: 0 0 12px rgba(26, 212, 197, 0.25), inset 0 0 8px rgba(10, 16, 26, 0.6);
  border-radius: 24px;
  padding: 4px 8px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.camera-drag-widget.dragging .dragger-track {
  border-color: #6efff3;
  box-shadow: 0 0 18px rgba(110, 255, 243, 0.75), inset 0 0 12px rgba(26, 212, 197, 0.4);
  transform: scale(1.05);
}

.dragger-arrow {
  color: rgba(110, 255, 243, 0.65);
  font-size: 14px;
  line-height: 1;
  font-weight: bold;
}

.dragger-thumb {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #6efff3 0%, #0d7377 80%, #063d40 100%);
  border: 1.5px solid #a8fffa;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 8px rgba(26, 212, 197, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #032024;
  font-size: 16px;
  transform: translate(0px, 0px);
  transition: transform 0.08s ease-out;
  pointer-events: none;
}

.camera-drag-widget.dragging .dragger-thumb {
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #6efff3 60%, #14919b 100%);
  border-color: #ffffff;
  box-shadow: 0 0 14px rgba(110, 255, 243, 0.95);
}

.dragger-label {
  font-size: 8px;
  color: #a8fffa;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

/* Dialog must sit above look-zone/joystick so tap-to-continue works */
#dialog:not(.hidden) {
  z-index: 40 !important;
  pointer-events: auto !important;
  cursor: pointer;
}

/* While dialog is open, stop camera/look overlays from eating taps, BUT joystick is NEVER disabled! */
body.dialog-open #mobile-look-zone {
  pointer-events: none !important;
}

#joystick-container {
  pointer-events: auto !important;
}

#dialog .next {
  min-height: 48px;
  padding: 12px 18px;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  animation: pulse-caret 1s infinite alternate;
}

@keyframes pulse-caret {
  from { opacity: 0.75; transform: translateX(0); }
  to { opacity: 1; transform: translateX(4px); }
}

/* Exit Game button: Title Menu & Pause Menu */
.btn-exit-game {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 14px;
  padding: 12px 20px;
  min-height: 50px;
  background: linear-gradient(180deg, #441418 0%, #200709 100%);
  color: #fca5a5;
  border: 1.5px solid #b91c1c;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  pointer-events: auto !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn-exit-game:active {
  transform: scale(0.97);
  background: linear-gradient(180deg, #581c22 0%, #300a0d 100%);
  border-color: #ef4444;
}

/* Mobile responsive adjustments */
@media (max-width: 900px) {
  .mini-stage-map { padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); }
  .mini-stage-card {
    width: min(96vw, 720px) !important;
    max-width: 96vw !important;
    max-height: 92dvh !important;
    overflow-y: auto;
    touch-action: pan-y;
    padding: 16px 20px !important;
  }
  .mini-stage-title { font-size: 20px !important; }
  .mini-stage-intro { font-size: 13px !important; line-height: 1.45 !important; }
  .mini-stage-state { font-size: 12px !important; }
  .mini-stage-controls { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mini-stage-controls .mini-stage-play { grid-column: 1 / -1; grid-row: 1; }
  .mini-stage-controls button { min-height: 48px; font-size: 13px !important; }
  .mini-stage-track { gap: 8px; margin: 10px 0; }
  .mini-stage-track button { width: 36px; height: 36px; font-size: 13px; }

  @media (orientation: landscape) and (max-height: 500px) {
    .mini-stage-card { padding: 10px 18px !important; max-height: calc(100dvh - 12px) !important; }
    .mini-stage-kicker { margin: 0 0 5px; }
    .mini-stage-number { margin: 7px 0 2px; }
    .mini-stage-title { font-size: 20px !important; }
    .mini-stage-relic { margin-bottom: 6px; }
    .mini-stage-intro { min-height: 0; margin: 6px 0; font-size: 12.5px !important; }
    .mini-stage-state { margin: 5px 0; font-size: 11.5px !important; }
    .mini-stage-controls {
      position: sticky;
      bottom: 0;
      grid-template-columns: 1fr 1.35fr 1fr;
      margin-top: 8px;
      padding-top: 6px;
      background: rgba(18, 15, 12, 0.98);
    }
    .mini-stage-controls .mini-stage-play { grid-column: auto; grid-row: auto; }
    .mini-stage-controls button { min-height: 44px; }
    .mini-stage-exit { margin-top: 5px; min-height: 32px; }
  }

  #hint-bar {
    display: none !important;
  }
  
  #top {
    padding: 10px 16px;
  }
  
  .brand {
    font-size: 16px;
  }
  
  #room-name {
    font-size: 12px;
  }
  
  #meters {
    gap: 12px;
    font-size: 14px;
    white-space: nowrap !important;
  }

  #courage {
    display: inline-flex;
    align-items: center;
    white-space: nowrap !important;
    word-break: keep-all !important;
    font-size: clamp(15px, 2.2vw, 20px);
    letter-spacing: clamp(3px, 0.8vw, 5px);
    line-height: 1;
  }

  .file-box {
    max-width: 96vw !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    padding: 20px 24px !important;
  }

  #menu .file-box {
    width: min(95vw, 680px) !important;
    max-width: min(95vw, 680px) !important;
    padding: clamp(14px, 3vw, 22px) !important;
    box-sizing: border-box;
  }
  #menu .menu-royal-title,
  #menu .file-box h1 {
    font-size: clamp(24px, 5.5vw, 34px) !important;
    margin: 4px 0 2px !important;
  }
  #menu .menu-urdu-sub,
  #menu .file-box h2 {
    font-size: clamp(13px, 2.8vw, 16px) !important;
    margin-bottom: 6px !important;
  }
  .menu-divider-ornament {
    margin: 6px auto !important;
  }
  .menu-badge-ribbon {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .diff-label,
  .mode-toggle,
  .kicker {
    font-size: 11.5px !important;
  }
  .legend, .hint {
    font-size: 11.5px !important;
  }

  .tilism-book, .book {
    max-width: 92vw !important;
    max-height: 88vh !important;
    padding: 18px 20px !important;
  }

  #weapons,
  #btn-save {
    display: none !important;
  }

  #menu-list li,
  #pause-list li {
    min-height: 44px;
    font-size: 14px !important;
    padding: 8px 14px !important;
    box-sizing: border-box;
    display: flex;
    align-items: center;
  }

  .crawl-art {
    margin: -12px -16px 14px -16px;
    height: clamp(180px, 38vh, 320px);
    overflow: hidden;
    border-bottom: 2px solid rgba(245, 208, 97, 0.4);
    border-radius: 6px 6px 0 0;
    background: #080d14;
  }
  .crawl-hero-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    display: block;
  }

  .controls-block {
    display: none !important;
  }
}

html.mobile-ui #weapons,
body.mobile-ui #weapons,
.mobile-ui #weapons,
html.mobile-ui #hud #weapons,
body.mobile-ui #hud #weapons,
.mobile-ui #hud #weapons,
html.mobile-ui #btn-save,
body.mobile-ui #btn-save,
.mobile-ui #btn-save,
html.mobile-ui .desktop-setting,
body.mobile-ui .desktop-setting,
.mobile-ui .desktop-setting,
html.mobile-ui .controls-block,
body.mobile-ui .controls-block,
.mobile-ui .controls-block,
html.mobile-ui kbd,
body.mobile-ui kbd,
.mobile-ui kbd {
  display: none !important;
}

/* Upcoming 2027 Showcase & Banners */
.upcoming-teaser-banner {
  display: inline-block;
  margin: 6px auto 14px;
  padding: 6px 14px;
  background: linear-gradient(90deg, rgba(245, 208, 97, 0.15), rgba(26, 212, 197, 0.15));
  border: 1px solid rgba(245, 208, 97, 0.4);
  border-radius: 20px;
  color: #ffd978;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(245, 208, 97, 0.2);
  animation: glow-pulse 2.5s infinite ease-in-out;
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(245, 208, 97, 0.2); border-color: rgba(245, 208, 97, 0.4); }
  50% { box-shadow: 0 0 16px rgba(26, 212, 197, 0.4); border-color: rgba(26, 212, 197, 0.6); color: #1ad4c5; }
}

.upcoming-2027-showcase {
  margin: 16px 0;
  padding: 14px 18px;
  background: radial-gradient(circle at 50% 0%, rgba(26, 212, 197, 0.12), rgba(8, 13, 20, 0.85));
  border: 1.5px solid rgba(245, 208, 97, 0.5);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(245, 208, 97, 0.15);
}

.upcoming-badge {
  display: inline-block;
  color: #f5d061;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.upcoming-title {
  color: #fff3b0;
  font-size: 20px;
  margin: 4px 0 8px;
  letter-spacing: 0.08em;
  text-shadow: 0 0 10px rgba(245, 208, 97, 0.4);
}

.upcoming-desc {
  font-size: 13px;
  color: #d1d9e2;
  line-height: 1.45;
  margin: 0;
}

/* === MONETIZATION & REWARDED AD UI === */

/* 1. Soul Forge: Gaze into the Zanbeel (+25 Gems) */
.forge-ad-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 10px 0 16px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(245, 208, 97, 0.25) 0%, rgba(200, 140, 20, 0.35) 100%);
  border: 1.5px solid #f5d061;
  border-radius: 8px;
  color: #fff3b0;
  font-family: inherit;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 208, 97, 0.3), inset 0 0 10px rgba(245, 208, 97, 0.2);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.forge-ad-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(245, 208, 97, 0.45);
}

.forge-ad-btn:active {
  transform: scale(0.97);
}

.forge-ad-btn .ad-icon {
  font-size: 18px;
  color: #f5d061;
}

.forge-ad-btn .ad-reward {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.1em;
  background: rgba(8, 13, 20, 0.7);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(245, 208, 97, 0.5);
  color: #ffd978;
}

.gem-sparkle {
  animation: sparkle-glow 1s ease-in-out;
}

@keyframes sparkle-glow {
  0% { transform: scale(1); color: #fff; text-shadow: 0 0 15px #f5d061; }
  50% { transform: scale(1.15); color: #1ad4c5; text-shadow: 0 0 25px #1ad4c5; }
  100% { transform: scale(1); color: inherit; text-shadow: none; }
}

/* 2. Defeat / Zanbeel Miracle Rescue Modal */
.defeat-rescue-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 150;
  width: min(92vw, 440px);
  padding: 26px 28px;
  background: radial-gradient(circle at 50% 10%, rgba(20, 30, 48, 0.95) 0%, rgba(8, 13, 20, 0.98) 100%);
  border: 2px solid #f5d061;
  border-radius: 14px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.9), 0 0 25px rgba(245, 208, 97, 0.35);
  text-align: center;
  backdrop-filter: blur(8px);
}

.defeat-rescue-card.hidden {
  display: none !important;
}

.rescue-kicker {
  font-size: 12px;
  letter-spacing: 0.25em;
  color: #1ad4c5;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.defeat-rescue-card h2 {
  font-size: 24px;
  color: #f5d061;
  margin: 0 0 8px;
  letter-spacing: 0.05em;
}

.rescue-desc {
  font-size: 13px;
  color: #d1d9e2;
  line-height: 1.4;
  margin: 0 0 18px;
}

.rescue-ad-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(245, 208, 97, 0.35) 0%, rgba(184, 134, 11, 0.5) 100%);
  border: 2px solid #ffd978;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(245, 208, 97, 0.4);
  transition: transform 0.1s ease;
}

.rescue-ad-btn:hover {
  transform: scale(1.02);
}

.rescue-ad-btn:active {
  transform: scale(0.98);
}

.rescue-ad-btn .ad-reward {
  font-size: 11px;
  background: rgba(8, 13, 20, 0.8);
  padding: 3px 8px;
  border-radius: 4px;
  color: #f5d061;
}

.rescue-timer-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin: 14px 0;
  overflow: hidden;
}

.rescue-timer-bar div {
  width: 100%;
  height: 100%;
  background: #1ad4c5;
  animation: countdown-bar 5s linear forwards;
}

@keyframes countdown-bar {
  from { width: 100%; }
  to { width: 0%; }
}

.rescue-skip-btn {
  background: transparent;
  border: none;
  color: #8fa0b5;
  font-size: 12px;
  letter-spacing: 0.1em;
  cursor: pointer;
  padding: 6px;
}

.rescue-skip-btn:hover {
  color: #d1d9e2;
}

/* 3. Victory Doubler */
.win-double-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  background: linear-gradient(135deg, rgba(26, 212, 197, 0.25) 0%, rgba(245, 208, 97, 0.25) 100%);
  border: 1.5px solid #1ad4c5;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(26, 212, 197, 0.3);
  margin-bottom: 8px;
}

.win-double-btn.claimed {
  background: rgba(26, 212, 197, 0.15);
  border-color: #1ad4c5;
  color: #1ad4c5;
  cursor: default;
}

.win-double-btn .ad-reward {
  font-size: 10px;
  letter-spacing: 0.1em;
  background: rgba(8, 13, 20, 0.7);
  padding: 3px 6px;
  border-radius: 4px;
  color: #1ad4c5;
}

/* 4. Simulated Ad Modal (Desktop / Browser Preview) */
.ad-sim-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 13, 20, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.ad-sim-card {
  width: min(90vw, 400px);
  padding: 28px;
  background: radial-gradient(circle at 50% 10%, #162232 0%, #0c1420 100%);
  border: 1.5px solid #f5d061;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(245, 208, 97, 0.3);
}

.ad-sim-badge {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #1ad4c5;
  margin-bottom: 8px;
}

.ad-sim-title {
  color: #f5d061;
  font-size: 22px;
  margin: 0 0 8px;
}

.ad-sim-desc {
  color: #cfd8e3;
  font-size: 13px;
  margin: 0 0 20px;
}

.ad-sim-progress-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.ad-sim-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #f5d061, #1ad4c5);
}

.ad-sim-status {
  font-size: 12px;
  color: #9eb1c7;
  letter-spacing: 0.05em;
  margin: 0 0 14px;
}

.ad-sim-skip-btn {
  padding: 6px 14px;
  background: rgba(245, 208, 97, 0.15);
  border: 1px solid #f5d061;
  border-radius: 6px;
  color: #f5d061;
  font-size: 12px;
  cursor: pointer;
}

/* Difficulty selector */
.difficulty-selector {
  margin: 8px 0 6px;
  text-align: center;
}
.diff-label {
  font-size: 12px;
  color: #9eb1c7;
  letter-spacing: 0.08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}
.diff-buttons {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.diff-btn {
  padding: 6px 16px;
  background: rgba(30, 40, 60, 0.6);
  border: 1px solid rgba(110, 177, 199, 0.3);
  border-radius: 6px;
  color: #9eb1c7;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.diff-btn.sel {
  background: rgba(110, 255, 243, 0.15);
  border-color: #6efff3;
  color: #fff;
}
.diff-btn:active {
  transform: scale(0.96);
}

/* Mode toggles */
.mode-toggles {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 6px 0;
}
.mode-toggle {
  font-size: 13px;
  color: #9eb1c7;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.mode-toggle input {
  width: 16px;
  height: 16px;
  accent-color: #f5d061;
}

/* Achievement summary on win screen */
.ach-summary {
  font-size: 13px;
  color: #6efff3;
  margin-top: 8px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Keep the Gems panel usable on phones, including wide landscape screens. */
html.mobile-ui #hint-bar, body.mobile-ui #hint-bar, .mobile-ui #hint-bar,
html.mobile-ui #weapons, body.mobile-ui #weapons, .mobile-ui #weapons,
html.mobile-ui #btn-save, body.mobile-ui #btn-save, .mobile-ui #btn-save,
html.mobile-ui #soul-forge kbd, body.mobile-ui #soul-forge kbd, .mobile-ui #soul-forge kbd { display: none !important; }
#soul-forge { padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
#soul-forge .forge-box {
  box-sizing: border-box; width: 100%; max-width: 620px !important;
  height: min(520px, calc(100dvh - 24px)); max-height: calc(100dvh - 24px) !important;
  padding: 12px !important; display: grid; grid-template-columns: minmax(0,1fr) auto;
  grid-template-rows: auto auto auto minmax(0,1fr) auto; gap: 6px 12px;
  overflow: hidden !important; background: #0d1e23; border:1px solid #b69b6155 !important; border-radius:8px !important;
}
.forge-box > * { flex-shrink: 0; }
.forge-box h2 { grid-column:1; grid-row:1; margin:0; text-align:left; font:600 20px/1.4 Georgia,serif; }
.forge-box .kicker { display: none; }
#forge-metals { grid-column:2; grid-row:1; margin:0; align-self:center; font:12px/1.4 Arial,sans-serif; }
#forge-status { grid-column:1/-1; grid-row:3; margin:0; text-align:left; font:12px/1.4 Arial,sans-serif; }
#forge-status:empty { display:none; }
#forge-list {
  grid-column:1/-1; grid-row:4; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-content:start; gap:6px;
  min-height: 0; overflow-y: auto; margin:0; padding:0 2px;
  touch-action: pan-y !important; overscroll-behavior: contain;
}
#forge-list * { touch-action: pan-y !important; }
.forge-up { grid-template-columns: minmax(0, 1fr) auto; gap:3px 8px; padding:8px; min-height:64px; box-sizing:border-box; border-radius:4px; }
.forge-up-name { font:600 13px/1.3 Arial,sans-serif; }
.forge-up-desc { font:11px/1.4 Arial,sans-serif; }
.forge-up-cost { font:12px/1.4 Arial,sans-serif; }
.forge-ad-btn { grid-column:1/-1; grid-row:2; margin:0; padding:8px; min-height:48px; flex-wrap:wrap; font:600 12px/1.4 Arial,sans-serif; border-radius:4px; box-shadow:none; }
#soul-forge #btn-forge-close { grid-column:1/-1; grid-row:5; min-height:48px; padding:8px 12px; font:600 12px/1.4 Arial,sans-serif; border-radius:4px; }
@media(max-width:540px) { #forge-list { grid-template-columns:minmax(0,1fr); } }
#btn-forge-close { min-height: 44px; padding: 10px 20px; border: 1px solid #f5d061; border-radius: 8px; background: #243343; color: #f5d061; font: inherit; cursor: pointer; }
html.mobile-ui.forge-open #mobile-controls, body.mobile-ui.forge-open #mobile-controls, .mobile-ui.forge-open #mobile-controls,
html.mobile-ui.forge-open #hud, body.mobile-ui.forge-open #hud, .mobile-ui.forge-open #hud { display: none !important; }

/* Magic Portal Transition Overlay */
#portal-transition-overlay,
.portal-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none !important;
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
  background-color: #04080e;
  overflow: hidden;
}

#portal-transition-overlay.visible,
.portal-transition-overlay.visible {
  opacity: 1;
  display: flex !important;
  pointer-events: auto !important;
}

#portal-transition-overlay.hidden,
.portal-transition-overlay.hidden {
  display: none !important;
  pointer-events: none !important;
  opacity: 0;
}

#portal-bg-art {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.35) saturate(1.2);
  transform: scale(1.02);
  transition: transform 1.6s cubic-bezier(0.1, 0.7, 0.1, 1), filter 1.6s ease;
}

#portal-transition-overlay.visible #portal-bg-art {
  transform: scale(1.16);
  filter: brightness(0.55) saturate(1.35);
}

#portal-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(4, 10, 18, 0.25) 0%, rgba(2, 5, 10, 0.88) 75%, #020408 100%);
}

#portal-magic-circle {
  position: relative;
  width: min(280px, 70vw);
  height: min(280px, 70vw);
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-rune-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed rgba(245, 208, 97, 0.8);
  box-shadow: 0 0 25px rgba(245, 208, 97, 0.5), inset 0 0 20px rgba(26, 212, 197, 0.3);
  animation: spin-rune 12s linear infinite;
}

.portal-rune-inner {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  border: 2px solid rgba(110, 255, 243, 0.85);
  box-shadow: 0 0 20px rgba(110, 255, 243, 0.55), inset 0 0 15px rgba(245, 208, 97, 0.3);
  animation: spin-rune-reverse 8s linear infinite;
}

.portal-star {
  position: absolute;
  inset: 32%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff4d2;
  font-size: clamp(32px, 8vw, 48px);
  text-shadow: 0 0 20px #ffd700, 0 0 40px #1ad4c5;
  animation: portal-core-pulse 1.4s ease-in-out infinite alternate;
}

@keyframes spin-rune {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes spin-rune-reverse {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

@keyframes portal-core-pulse {
  from { transform: scale(0.92); opacity: 0.8; }
  to { transform: scale(1.15); opacity: 1; }
}

#portal-info-box {
  position: relative;
  margin-top: 24px;
  text-align: center;
  padding: 10px 24px;
  border-radius: 12px;
  background: rgba(8, 14, 24, 0.85);
  border: 1px solid rgba(245, 208, 97, 0.5);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  max-width: 90vw;
}

#portal-kicker {
  font-size: 11px;
  color: #1ad4c5;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin: 0 0 4px;
}

#portal-title {
  font-size: clamp(20px, 5vw, 28px);
  color: #ffd978;
  font-family: serif;
  letter-spacing: 0.08em;
  margin: 0;
  text-shadow: 0 0 12px rgba(245, 208, 97, 0.6);
}

#portal-lore {
  font-size: 12px;
  color: #e2d8c3;
  margin: 6px 0 0;
  max-width: 420px;
}

/* How to play · Manual navigation controls */
.manual-book {
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.manual-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}

.manual-header .kicker {
  margin: 0;
  flex: 1;
  font-size: 13px;
  color: #1ad4c5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.manual-close-btn {
  background: rgba(220, 60, 60, 0.2) !important;
  border: 1.5px solid rgba(255, 100, 100, 0.7) !important;
  color: #ffb4b4 !important;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  touch-action: manipulation !important;
  white-space: nowrap;
  transition: all 0.15s ease;
  min-height: 38px;
}

.manual-close-btn:active {
  background: rgba(255, 60, 60, 0.45) !important;
  transform: scale(0.96);
}

#manual-page {
  max-height: 52vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 6px;
}

#manual-page h2 {
  font-size: clamp(20px, 4.5vw, 26px);
  color: #ffd978;
  margin: 0 0 10px 0;
  text-shadow: 0 0 10px rgba(245, 208, 97, 0.4);
}

#manual-page p {
  font-size: clamp(14px, 3.5vw, 16px);
  line-height: 1.55;
  color: #e8ded0;
}

.manual-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(245, 208, 97, 0.3);
}

.manual-nav-btn {
  background: linear-gradient(180deg, rgba(30, 48, 70, 0.9) 0%, rgba(14, 22, 36, 0.95) 100%) !important;
  border: 1.5px solid rgba(245, 208, 97, 0.6) !important;
  color: #f5d061 !important;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  touch-action: manipulation !important;
  transition: all 0.15s ease;
  min-height: 44px;
  min-width: 96px;
  text-align: center;
}

.manual-nav-btn:active {
  background: rgba(245, 208, 97, 0.25) !important;
  border-color: #ffd978 !important;
  transform: scale(0.96);
}

.manual-nav-btn-primary {
  background: linear-gradient(180deg, rgba(245, 208, 97, 0.35) 0%, rgba(184, 134, 11, 0.5) 100%) !important;
  border-color: #f5d061 !important;
  color: #fff !important;
  box-shadow: 0 0 12px rgba(245, 208, 97, 0.35);
}

.manual-page-indicator {
  font-size: 13px;
  color: #9eb1c7;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

/* 3D Folk Tale Trial HUD & Victory Modal */
#trial-hud {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(20, 32, 48, 0.92) 0%, rgba(10, 16, 26, 0.96) 100%);
  border: 1.5px solid #f5d061;
  box-shadow: 0 0 16px rgba(245, 208, 97, 0.45), inset 0 0 10px rgba(26, 212, 197, 0.25);
  color: #ffd978;
  font-weight: 700;
  font-size: clamp(12px, 3.2vw, 15px);
  padding: 8px 20px;
  border-radius: 20px;
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0.5px;
  z-index: 25;
  pointer-events: none;
  animation: trialPulse 2.4s infinite alternate ease-in-out;
}

@keyframes trialPulse {
  0% { box-shadow: 0 0 10px rgba(245, 208, 97, 0.3); border-color: rgba(245, 208, 97, 0.7); }
  100% { box-shadow: 0 0 22px rgba(245, 208, 97, 0.7), 0 0 8px rgba(26, 212, 197, 0.4); border-color: #ffd978; }
}

.trial-victory-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 14, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
}

.trial-victory-card {
  width: min(520px, 92vw);
  background: linear-gradient(180deg, #1e2838 0%, #0d1522 100%) !important;
  border: 2px solid #f5d061 !important;
  box-shadow: 0 0 35px rgba(245, 208, 97, 0.4) !important;
  border-radius: 12px;
  padding: 24px 28px;
  text-align: center;
  color: #f4ead2;
  box-sizing: border-box;
}

.trial-victory-card h2 {
  font-size: clamp(20px, 5vw, 28px);
  color: #ffd978;
  margin: 6px 0 12px;
  text-shadow: 0 0 12px rgba(245, 208, 97, 0.5);
}

.trial-art-frame {
  height: min(24vh, 180px);
  overflow: hidden;
  border-radius: 8px;
  margin: 12px 0;
  border: 1px solid rgba(245, 208, 97, 0.4);
  background: #05080e;
}

.trial-art-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trial-lesson {
  font-size: 14px;
  color: #f4ead2;
  line-height: 1.5;
  margin: 10px 0;
}

.trial-reward-badge {
  display: inline-block;
  background: rgba(245, 208, 97, 0.15);
  border: 1.5px solid #f5d061;
  color: #f5d061;
  font-weight: 700;
  font-size: 15px;
  padding: 8px 20px;
  border-radius: 20px;
  margin: 10px 0 18px;
  box-shadow: 0 0 12px rgba(245, 208, 97, 0.25);
}

.trial-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trial-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation !important;
  transition: transform 0.12s ease;
  min-height: 46px;
  box-sizing: border-box;
}

.trial-btn:active {
  transform: scale(0.97);
}

.btn-trial-reward {
  background: linear-gradient(180deg, #ffd978 0%, #b8860b 100%) !important;
  color: #1a1205 !important;
  border: 1.5px solid #fff !important;
  box-shadow: 0 0 14px rgba(245, 208, 97, 0.5);
}

.btn-trial-primary {
  background: linear-gradient(180deg, #1ad4c5 0%, #0d7f76 100%) !important;
  color: #041a18 !important;
  border: 1.5px solid #6efff3 !important;
}

.btn-trial-back {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ccc !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Relic & Weapon Showcase Modal */
.relic-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 7, 14, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 16px;
  box-sizing: border-box;
}

.relic-modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.relic-modal-overlay.hidden {
  display: none !important;
  pointer-events: none !important;
}

.relic-modal-card {
  width: min(92vw, 420px);
  max-height: min(90vh, 640px);
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top, #141f33 0%, #080f1a 70%, #03060b 100%) !important;
  border: 1.5px solid #f5d061 !important;
  box-shadow: 0 0 35px rgba(245, 208, 97, 0.35), 0 0 80px rgba(26, 212, 197, 0.15) !important;
  border-radius: 12px;
  padding: 18px 20px !important;
  color: #f4ead2;
  box-sizing: border-box;
  text-align: center;
  transform: scale(0.92);
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.relic-modal-overlay.visible .relic-modal-card {
  transform: scale(1);
}

.relic-modal-kicker {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: #1ad4c5;
  text-transform: uppercase;
  margin: 0 0 4px;
  font-weight: 700;
}

.relic-modal-title {
  font-size: clamp(22px, 5.5vw, 28px);
  color: #ffd978;
  margin: 2px 0 2px;
  font-family: Georgia, serif;
  text-shadow: 0 0 14px rgba(245, 208, 97, 0.5);
}

.relic-modal-subtitle {
  font-size: 13px;
  color: #a0c4d8;
  margin: 0 0 10px;
  font-style: italic;
}

.relic-modal-art-frame {
  width: 100%;
  height: min(26vh, 180px);
  border-radius: 8px;
  overflow: hidden;
  margin: 0 0 12px;
  border: 1.5px solid rgba(245, 208, 97, 0.45);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
  background: #000;
}

.relic-modal-art-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.relic-modal-scroll-body {
  overflow-y: auto;
  max-height: 26vh;
  margin-bottom: 14px;
  padding-right: 4px;
  text-align: left;
}

.relic-modal-lore {
  font-size: 13.5px;
  line-height: 1.55;
  color: #eae0cb;
  margin: 0 0 10px;
}

.relic-modal-controls {
  background: rgba(26, 212, 197, 0.08);
  border-left: 3px solid #1ad4c5;
  padding: 8px 10px;
  border-radius: 4px;
}

.relic-ctrl-tag {
  display: inline-block;
  font-size: 11px;
  color: #1ad4c5;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.relic-modal-controls p {
  margin: 0;
  font-size: 12.5px;
  color: #ffd978;
  font-weight: 600;
}

.relic-modal-claim-btn {
  width: 100%;
  min-height: 48px;
  padding: 12px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffd978 0%, #b8860b 100%) !important;
  color: #1a1205 !important;
  border: 1.5px solid #fff !important;
  box-shadow: 0 0 16px rgba(245, 208, 97, 0.4);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease;
}

.relic-modal-claim-btn:active {
  transform: scale(0.97);
}

@media (orientation: landscape) and (max-height: 500px) {
  .relic-modal-card {
    flex-direction: row;
    flex-wrap: wrap;
    width: min(94vw, 680px);
    max-height: 94vh;
    padding: 10px 16px !important;
  }
  .relic-modal-art-frame {
    width: 36%;
    height: 130px;
    margin-bottom: 0;
  }
  .relic-modal-scroll-body {
    width: 60%;
    max-height: 130px;
    margin-left: 4%;
    margin-bottom: 8px;
  }
}

/* ---------------------------------------------------------------------------
 * AYYAR SPECIAL ATTACK GAUGE (Zarb-e-Tilism)
 * --------------------------------------------------------------------------- */
.special-meter-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(8, 13, 20, 0.78);
  border: 1.5px solid rgba(245, 208, 97, 0.45);
  border-radius: 12px;
  padding: 3px 8px;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.7), 0 0 8px rgba(245, 208, 97, 0.2);
  user-select: none;
}

.special-meter-crest {
  color: #ffd700;
  font-size: 14px;
  line-height: 1;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.9);
  animation: crest-shimmer 2s infinite ease-in-out;
}

@keyframes crest-shimmer {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px #ffd700); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 8px #fff); }
}

.special-meter-bar {
  width: 58px;
  height: 8px;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(245, 208, 97, 0.3);
  position: relative;
}

.special-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #b8860b 0%, #ffd700 70%, #ffffff 100%);
  border-radius: 4px;
  transition: width 0.2s ease-out;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

.special-meter-fill.full {
  background: linear-gradient(90deg, #ffd700 0%, #1ad4c5 70%, #ffffff 100%);
  animation: special-meter-burst 0.7s infinite alternate ease-in-out;
}

@keyframes special-meter-burst {
  0% { filter: brightness(1); box-shadow: 0 0 6px #ffd700; }
  100% { filter: brightness(1.6); box-shadow: 0 0 16px #1ad4c5, 0 0 24px #ffd700; }
}

.special-meter-val {
  font-size: 11px;
  font-weight: 700;
  color: #f5d061;
  min-width: 26px;
  text-align: right;
  letter-spacing: 0.05em;
  font-family: monospace;
}

/* Mobile HUD Glowing Special Button */
#btn-touch-special {
  right: 76px;
  bottom: 190px;
  width: 56px;
  height: 56px;
  border: 2px solid #ffd700;
  background: radial-gradient(circle at 35% 35%, rgba(220, 160, 20, 0.95) 0%, rgba(50, 30, 5, 0.98) 100%);
  color: #fff;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.8), inset 0 0 12px rgba(255, 255, 255, 0.4);
  animation: touch-special-pulse 1.1s infinite alternate ease-in-out;
  z-index: 30;
}

#btn-touch-special .icon {
  font-size: 24px;
  color: #fff;
  text-shadow: 0 0 8px #ffd700;
}

#btn-touch-special .lbl {
  color: #ffd700;
  font-weight: bold;
}

@keyframes touch-special-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.7), inset 0 0 8px rgba(255, 255, 255, 0.3);
  }
  100% {
    transform: scale(1.12);
    box-shadow: 0 0 26px rgba(255, 215, 0, 1), 0 0 35px rgba(26, 212, 197, 0.8), inset 0 0 14px #fff;
  }
}

/* Glowing Central Special Prompt */
.special-prompt {
  position: fixed;
  bottom: 95px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(35, 22, 5, 0.94) 0%, rgba(8, 14, 22, 0.96) 100%);
  border: 2px solid #ffd700;
  border-radius: 24px;
  padding: 10px 26px;
  color: #ffd700;
  font-family: "Georgia", serif;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.85), 0 0 20px rgba(26, 212, 197, 0.6);
  box-shadow: 0 0 22px rgba(255, 215, 0, 0.6), inset 0 0 14px rgba(255, 215, 0, 0.25);
  cursor: pointer;
  z-index: 38;
  animation: prompt-glow-pulse 0.9s infinite alternate ease-in-out;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

@keyframes prompt-glow-pulse {
  0% { transform: translateX(-50%) scale(1); filter: brightness(1); }
  100% { transform: translateX(-50%) scale(1.06); filter: brightness(1.35); box-shadow: 0 0 32px rgba(255, 215, 0, 0.9), 0 0 45px rgba(26, 212, 197, 0.7); }
}

/* ---------------------------------------------------------------------------
 * SAMRI VAULT SAFE LOCKPICKING MODAL (Stage 5)
 * --------------------------------------------------------------------------- */
.samri-safe-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(5, 8, 15, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  padding: 16px;
}

.samri-safe-card {
  max-width: 440px;
  width: 100%;
  text-align: center;
  padding: 24px;
  border: 2px solid #f5d061;
  background: radial-gradient(circle at 50% 20%, #1c2738 0%, #0a101a 100%);
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.85), 0 0 28px rgba(245, 208, 97, 0.35);
}

.safe-desc {
  font-size: 13px;
  color: #cbd5e1;
  margin: 10px 0 16px;
  line-height: 1.4;
}

.samri-safe-dials {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 18px 0;
}

.safe-dial-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.safe-dial-btn {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 2px solid #ffd700;
  background: radial-gradient(circle at 35% 35%, #2a3a50 0%, #0d1520 100%);
  color: #ffd700;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(255, 215, 0, 0.25);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s, border-color 0.2s, box-shadow 0.2s;
}

.safe-dial-btn:active {
  transform: scale(0.92);
}

.safe-dial-btn.correct {
  border-color: #1ad4c5;
  color: #1ad4c5;
  box-shadow: 0 0 20px rgba(26, 212, 197, 0.8), inset 0 0 12px rgba(26, 212, 197, 0.5);
}

.safe-dial-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #a0aec0;
  font-weight: bold;
}

.safe-status {
  font-size: 12px;
  color: #f5d061;
  margin: 10px 0 16px;
  font-style: italic;
  min-height: 18px;
}

/* ---------------------------------------------------------------------------
 * AYYAR STAR RATING & RANK DISPLAY
 * --------------------------------------------------------------------------- */
.trial-stars {
  font-size: 32px;
  color: #ffd700;
  letter-spacing: 6px;
  margin: 8px 0;
  text-shadow: 0 0 16px rgba(255, 215, 0, 0.85);
  animation: trial-star-pulse 1.2s infinite alternate ease-in-out;
}

@keyframes trial-star-pulse {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.08); filter: brightness(1.3); }
}

.trial-rank-badge {
  display: inline-block;
  padding: 4px 20px;
  border-radius: 20px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.15em;
  margin: 4px 0 12px 0;
  text-transform: uppercase;
}

.trial-rank-s {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  color: #1a0e00;
  box-shadow: 0 0 22px rgba(255, 215, 0, 0.85);
  border: 1.5px solid #fff;
}

.trial-rank-a {
  background: linear-gradient(135deg, #1ad4c5 0%, #0077b6 100%);
  color: #ffffff;
  box-shadow: 0 0 18px rgba(26, 212, 197, 0.8);
  border: 1.5px solid #99f6e4;
}

.trial-rank-b {
  background: linear-gradient(135deg, #a78bfa 0%, #6366f1 100%);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(167, 139, 250, 0.7);
}

.trial-rank-c {
  background: #374151;
  color: #e5e7eb;
}

.trial-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(245, 208, 97, 0.25);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 10px 0;
  font-size: 12px;
  color: #e2e8f0;
}

.trial-stat-item strong {
  color: #f5d061;
}

/* Stage Chooser Rating Pill */
.mini-stage-rating {
  font-size: 13px;
  color: #ffd700;
  margin: 4px 0 8px;
  font-weight: bold;
  letter-spacing: 0.08em;
}

/* ==========================================================================
   Endless Mode Tilism Labyrinth (2026 Edition)
   ========================================================================== */

#endless-hud,
.endless-hud {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(10, 18, 30, 0.84);
  border: 1.5px solid rgba(245, 208, 97, 0.55);
  border-radius: 24px;
  padding: 5px 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.65), 0 0 16px rgba(245, 208, 97, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 95;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 90vw;
  flex-wrap: wrap;
}

#endless-hud.hidden,
.endless-hud.hidden {
  display: none !important;
}

.endless-hud-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Georgia", serif;
  font-weight: bold;
  font-size: 13px;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(245, 208, 97, 0.7);
  letter-spacing: 1px;
}

.endless-hud-badge .endless-icon {
  font-size: 14px;
  color: #1ad4c5;
  animation: endlessPulse 2s infinite ease-in-out;
}

@keyframes endlessPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 3px #1ad4c5); }
  50% { transform: scale(1.22); filter: drop-shadow(0 0 9px #6efff3); }
}

.endless-path-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(26, 212, 197, 0.16);
  color: #6efff3;
  border: 1px solid rgba(26, 212, 197, 0.45);
  letter-spacing: 0.5px;
}

.endless-path-badge.endless-path-valor {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.55);
}

.endless-path-badge.endless-path-mystery {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.55);
}

.endless-path-badge.endless-path-sanctuary {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.55);
}

.endless-path-badge.endless-path-eclipse {
  background: rgba(217, 70, 239, 0.25);
  color: #f0abfc;
  border-color: rgba(217, 70, 239, 0.65);
  box-shadow: 0 0 10px rgba(217, 70, 239, 0.35);
}

.endless-score-badge {
  font-family: monospace;
  font-size: 13px;
  font-weight: bold;
  color: #f5d061;
  background: rgba(0, 0, 0, 0.45);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(245, 208, 97, 0.3);
}

.endless-boons-tray {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 240px;
  overflow-x: auto;
  scrollbar-width: none;
}
.endless-boons-tray::-webkit-scrollbar {
  display: none;
}

.boon-mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 13px;
  background: rgba(20, 30, 48, 0.9);
  border: 1.5px solid rgba(245, 208, 97, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.boon-mini-badge:hover {
  transform: scale(1.25);
}
.boon-mini-badge.boon-common {
  border-color: #34d399;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.5);
}
.boon-mini-badge.boon-rare {
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}
.boon-mini-badge.boon-epic {
  border-color: #c084fc;
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.7);
}
.boon-mini-badge.boon-legendary {
  border-color: #fbbf24;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.8);
  animation: boonLegendaryGlow 2.5s infinite ease-in-out;
}

@keyframes boonLegendaryGlow {
  0%, 100% { box-shadow: 0 0 6px rgba(251, 191, 36, 0.5); }
  50% { box-shadow: 0 0 16px rgba(251, 191, 36, 0.9); }
}

/* Branching Path Modal Cards */
#endless-branch-modal,
#endless-branching-modal,
#zayan-branching-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.endless-branch-card,
.path-card,
.endless-path-card {
  background: radial-gradient(circle at 50% 10%, rgba(26, 40, 60, 0.92) 0%, rgba(12, 18, 28, 0.96) 100%);
  border: 1.5px solid rgba(245, 208, 97, 0.35);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  outline: none;
}

.endless-branch-card:hover,
.endless-branch-card:focus-visible,
.path-card:hover,
.path-card:focus-visible,
.endless-path-card:hover,
.endless-path-card:focus-visible {
  transform: translateY(-5px);
  border-color: #ffd700;
  box-shadow: 0 12px 30px rgba(245, 208, 97, 0.3);
  background: rgba(24, 38, 60, 0.97);
}

.endless-branch-card:active,
.path-card:active,
.endless-path-card:active {
  transform: scale(0.97);
}

.path-danger-stars,
.endless-danger-tag {
  font-size: 13px;
  color: #ef4444;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

/* 3-Card Boon Modal with Rarity Glows */
#endless-boon-modal,
#zayan-boon-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.boon-card,
.endless-boon-card {
  background: rgba(14, 23, 38, 0.9);
  border-radius: 14px;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  outline: none;
}

.boon-card:hover,
.boon-card:focus-visible,
.endless-boon-card:hover,
.endless-boon-card:focus-visible {
  transform: translateY(-4px);
}

.boon-card.common,
.boon-rarity-common {
  border: 1.5px solid rgba(16, 185, 129, 0.5);
}
.boon-card.common:hover,
.boon-rarity-common:hover {
  border-color: #34d399;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}

.boon-card.rare,
.boon-rarity-rare {
  border: 1.5px solid rgba(6, 182, 212, 0.6);
}
.boon-card.rare:hover,
.boon-rarity-rare:hover {
  border-color: #38bdf8;
  box-shadow: 0 8px 24px rgba(6, 182, 212, 0.4);
}

.boon-card.epic,
.boon-rarity-epic {
  border: 1.5px solid rgba(168, 85, 247, 0.7);
}
.boon-card.epic:hover,
.boon-rarity-epic:hover {
  border-color: #c084fc;
  box-shadow: 0 8px 26px rgba(168, 85, 247, 0.45);
}

.boon-card.legendary,
.boon-rarity-legendary {
  border: 2px solid rgba(245, 158, 11, 0.9);
  background: radial-gradient(circle at 50% 0%, rgba(50, 28, 10, 0.92) 0%, rgba(14, 23, 38, 0.95) 100%);
  animation: boonLegendaryPulse 3s infinite ease-in-out;
}

/* Endless Defeat / Run Summary Modal */
#endless-defeat-modal,
#zayan-defeat-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.endless-defeat-card {
  background: radial-gradient(circle at 50% 0%, rgba(28, 42, 65, 0.96) 0%, rgba(10, 16, 26, 0.98) 100%);
  border: 2px solid rgba(245, 208, 97, 0.5);
  border-radius: 18px;
  padding: 24px 20px;
  color: #fff;
  text-align: center;
  max-width: 640px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.9), 0 0 28px rgba(245, 208, 97, 0.25);
  box-sizing: border-box;
}

.endless-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(8, 14, 22, 0.6);
  border-bottom: 1px solid rgba(245, 208, 97, 0.15);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
}

.btn-endless-retry,
#btn-endless-retry {
  background: linear-gradient(135deg, #ffd978 0%, #d97706 100%);
  color: #2b1d03;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 208, 97, 0.35);
  transition: all 0.15s ease;
  min-height: 42px;
}
.btn-endless-retry:hover,
#btn-endless-retry:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(245, 208, 97, 0.5);
}

.btn-endless-title,
#btn-endless-title {
  background: rgba(22, 34, 52, 0.85);
  color: #f5d061;
  border: 1.5px solid rgba(245, 208, 97, 0.4);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 42px;
}
.btn-endless-title:hover,
#btn-endless-title:hover {
  background: rgba(30, 48, 74, 0.95);
  border-color: #f5d061;
  color: #fff;
}

.btn-endless-double-gems,
#btn-endless-double-gems {
  background: linear-gradient(135deg, #1ad4c5 0%, #0d9488 100%);
  color: #032b26;
  border: 1.5px solid #5eead4;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(26, 212, 197, 0.3);
  font-weight: bold;
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  min-height: 42px;
}
.btn-endless-double-gems:hover,
#btn-endless-double-gems:hover {
  box-shadow: 0 6px 20px rgba(26, 212, 197, 0.45);
  transform: translateY(-1px);
}

@media (max-width: 600px) {
  #endless-hud,
  .endless-hud {
    top: 52px;
    gap: 6px;
    padding: 4px 10px;
  }
  .endless-hud-badge {
    font-size: 11px;
  }
  .endless-path-badge {
    font-size: 10px;
    padding: 2px 6px;
  }
  .endless-score-badge {
    font-size: 11px;
    padding: 2px 6px;
  }
}


/* Mobile full-width dialog */
#dialog {
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  border-top: 2px solid #f5d061 !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: none !important;
  border-radius: 16px 16px 0 0 !important;
  padding: 14px 20px max(14px, env(safe-area-inset-bottom)) !important;
}


/* Decollide Top Bar & Meters */
html.mobile-ui #meters,
body.mobile-ui #meters,
.mobile-ui #meters {
  margin-right: 175px !important;
  white-space: nowrap !important;
}

/* Modal Close Icon in Tilism */
.modal-close-icon {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 36px;
  height: 36px;
  background: rgba(245, 208, 97, 0.15);
  border: 1px solid #f5d061;
  border-radius: 50%;
  color: #f5d061;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

/* Landscape Scrollable Modals */
.win-card, .trial-victory-card, .file-box, #settings .file-box {
  max-height: calc(100dvh - 24px) !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* 40dp Touch Targets */
.relic-touch-btn {
  min-width: 40px !important;
  min-height: 40px !important;
}
.mini-stage-track button {
  width: 48px !important;
  height: 48px !important;
  font-size: 16px !important;
}
#menu-list li {
  min-height: 48px !important;
}

/* Remove performance-costly backdrop-filter from active virtual controls */
.touch-btn {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Flight uses steering and look; combat powers have no role in this course. */
body.carpet-flight #mobile-actions,
body.carpet-flight #mobile-relics-bar { display: none !important; }
body.carpet-flight #trial-hud { max-width: calc(100vw - 32px); font-size: 12px; }

/* Start Menu */
#menu {
  background: linear-gradient(90deg, #07151af5 0%, #07151aeb 28%, #07151a73 57%, #07151a08 85%), url('../assets/story/noorabad.jpg') 70% center / cover !important;
  isolation: isolate;
}
#shell > #menu {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: var(--screen-top, 12px) var(--screen-right, 12px) var(--screen-bottom, 12px) var(--screen-left, 12px) !important;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}
#menu .file-box {
  position: relative;
  z-index: 1;
  margin: 0;
  width: min(48vw, 500px) !important;
  max-width: min(48vw, 500px) !important;
  max-height: min(92dvh, var(--panel-height, 92vh)) !important;
  background: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: clamp(16px, 2vw, 24px) !important;
  box-shadow: none !important;
}
#menu .menu-header { text-align: start; margin: 10px 0 16px; }
#menu .menu-badge-ribbon { justify-content: flex-start; }
#menu .menu-royal-badge { padding: 0; border: 0; background: none; color: #d2bb87; font: 600 10px/1.5 Arial,sans-serif; letter-spacing: .2em; }
#menu .menu-royal-title { margin: 8px 0; font-size: clamp(27px,4vw,48px); letter-spacing: .025em; line-height: 1; color: #fff3da; background: none; -webkit-text-fill-color: currentColor; filter: none; }
#menu .menu-story-title { margin: 8px 0 14px; color: #e3d2ac; font: italic 18px/1.3 Georgia,serif; }
#menu .menu-mission-subtitle { color: #c4d2ce; font: 500 10px/1.5 Arial,sans-serif; letter-spacing: .12em; }
#menu .menu-filigree, #menu .menu-divider-ornament, #menu .menu-urdu-sub,
#menu .menu-item-icon-wrap, #menu .menu-item-badge { display: none; }
#menu-list { grid-template-columns: repeat(6,minmax(0,1fr)); gap: 8px; margin: 12px 0; }
#menu .menu-item { min-height: 48px; padding: 10px 12px; border: 1px solid #d6c49c26; border-radius: 4px; background: #0b20288c; box-shadow: none; transform: none; transition: background .16s, border-color .16s; }
#menu-list .menu-item { grid-column: span 3; }
#menu-list .menu-card-hero-primary, #menu-list .menu-card-hero-secondary { grid-column: 1 / -1; }
#menu-list .menu-more { grid-column:1 / -1; list-style:none; }
#menu-list .menu-more summary { min-height:48px; padding:0 12px; align-content:center; cursor:pointer; color:#d6dacc; font:600 12px/48px Arial,sans-serif; }
#menu-list .menu-more summary:focus-visible { outline:2px solid #fff4ce; }
#menu-list .menu-more-list { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:8px; padding:0; margin:0; list-style:none; }
#menu-list [data-action="credits"], #menu-list [data-action="legal"], #menu-list [data-action="exit"] { grid-column: span 2; padding: 8px; background: none; }
#menu-list [data-action="credits"] .menu-item-title, #menu-list [data-action="legal"] .menu-item-title, #menu-list [data-action="exit"] .menu-item-title { font-size: 10px; }
#menu-list [data-action="credits"] .menu-item-arrow, #menu-list [data-action="legal"] .menu-item-arrow, #menu-list [data-action="exit"] .menu-item-arrow { display: none; }
#menu .menu-item-title { color: #eae7db; font: 600 11px/1.4 Arial,sans-serif; letter-spacing: .04em; }
#menu .menu-item-desc { display: none; }
#menu .menu-item-arrow { color: #b8c7c2; }
#menu .menu-item:hover, #menu .menu-item.sel { background: #23423bbb; border-color: #d6c49c88; box-shadow: none; }
#menu .menu-card-hero-primary { min-height: 56px; background: #e4c78f; border-color: #e4c78f; padding: 10px 14px; }
#menu .menu-card-hero-primary:hover, #menu .menu-card-hero-primary.sel { background: #f0d9ab; }
#menu .menu-card-hero-primary .menu-item-title { color: #182a28; font-size: 14px; }
#menu .menu-card-hero-primary .menu-item-desc { display: block; color: #374b43; font: 12px/1.4 Arial,sans-serif; margin-top: 4px; }
#menu .menu-card-hero-secondary { border-color: #cdb78666; }
#menu .menu-card-hero-secondary .menu-item-title { font-size: 13px; }
#menu .difficulty-selector { border: 0; border-top: 1px solid #d6c49c33; border-radius: 0; background: none; padding: 14px 0 0; }
#menu .diff-btn { min-height: 48px; border-radius: 4px; box-shadow: none; }
#menu .diff-btn.sel { background: #21453d; border-color: #d6c49c; box-shadow: none; }
#menu .mode-toggle-card { border-radius: 4px; background: #0b20288c; }
#menu .toggle-icon { display: none; }
#menu .legend { color: #c4d2ce; font: 11px/1.5 Arial,sans-serif; margin-top: 16px; }
#menu .language-row { position: fixed; top: var(--screen-top,12px); right: var(--screen-right,12px); margin: 0; gap: 0; font-size: 0; z-index: 2; }
#menu .language-select { min-height: 48px; background: #112b2dd9; border-color: #cdb78666; font-size: 12px; }
#menu .menu-play-options { border-top: 1px solid #d6c49c33; color: #d6dacc; font: 12px/1.5 Arial,sans-serif; }
#menu .menu-play-options summary { min-height: 48px; display: list-item; align-content: center; cursor: pointer; padding: 0 8px; box-sizing: border-box; }
#menu .menu-play-options summary:focus-visible { outline: 2px solid #fff4ce; outline-offset: -2px; }
#menu .upcoming-teaser-banner { display: none; }
body:has(#shell:not(.hidden)) #npc-talk-btn { display: none !important; }
@media (max-width: 600px) and (orientation: portrait) {
  #menu .file-box {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90vh !important;
    padding: 14px 14px !important;
  }
  #menu { background-position: 65% center !important; }
  #menu .file-box { background: #07151ad9 !important; }
}
@media (max-height: 540px) and (orientation: landscape) {
  #menu .file-box {
    max-height: 96dvh !important;
    padding: 10px 14px !important;
  }
  #menu .menu-header { margin: 8px 0 14px; }
  #menu .menu-royal-title { font-size: 30px; }
  #menu .menu-story-title { font-size: 16px; margin-bottom: 8px; }
}

.adventure-overlay {position:fixed;inset:0;z-index:10000;display:flex;align-items:center;justify-content:center;background:rgba(4, 11, 18, 0.88);backdrop-filter:blur(8px);padding:12px;box-sizing:border-box;touch-action:pan-y;}
.adventure-card {position:relative;width:min(680px,95vw);max-height:88vh;overflow-y:auto;padding:26px 24px;background:radial-gradient(ellipse at 50% 0%, #152e3e 0%, #0c1b26 55%, #050d14 100%);border:2px solid #e0ba63;border-radius:18px;color:#fff4dc;box-sizing:border-box;box-shadow:0 16px 50px rgba(0,0,0,0.9), 0 0 30px rgba(224, 186, 99, 0.25), inset 0 1px 1px rgba(255,255,255,0.2);}
.adventure-card button {min-height:46px;padding:10px 18px;margin:5px;border:1px solid #d1b267;border-radius:10px;background:linear-gradient(180deg, #1f454c, #132a2f);color:#fff2d6;font-size:15px;touch-action:manipulation;cursor:pointer;transition:all 0.15s ease;}
.adventure-card button:not(:disabled):hover {border-color:#f5d061;filter:brightness(1.1);}
.adventure-card button:disabled {opacity:.45;filter:grayscale(0.4);cursor:not-allowed;}
.adventure-card .adventure-close {position:absolute;right:12px;top:10px;width:38px;height:38px;min-height:38px;padding:0;margin:0;font-size:18px;line-height:1;border-radius:50%;border:1.5px solid #e0ba63;background:rgba(18, 38, 52, 0.8);color:#ffe8a3;display:grid;place-items:center;cursor:pointer;z-index:10;}
.adventure-card .adventure-close:hover {background:#e0ba63;color:#1a0f02;}
.adventure-card article {border-top:1px solid rgba(224, 186, 99, 0.2);padding:12px 0;}
.adventure-card small {float:right;color:#76ddd0;}
.card-ornament {position:absolute;font-size:16px;color:#ebb747;text-shadow:0 0 10px #f5d061;pointer-events:none;z-index:5;line-height:1;}
.card-ornament.top-left {top:6px;left:8px;}
.card-ornament.top-right {top:6px;right:8px;}
.card-ornament.bottom-left {bottom:6px;left:8px;}
.card-ornament.bottom-right {bottom:6px;right:8px;}

#nearby-activity {position:fixed;left:50%;bottom:24%;transform:translateX(-50%);z-index:18;min-height:48px;padding:12px 24px;border:2px solid #efd47e;border-radius:24px;color:#fff5d2;background:#113d48;font-weight:bold;touch-action:manipulation;}
#nearby-activity[hidden],body:has(#shell:not(.hidden)) #nearby-activity,body:has(.adventure-overlay) #nearby-activity,body:has(#archery-mobile-overlay) #nearby-activity,body:has(#jadugar-race-hud-overlay) #nearby-activity {display:none!important;}

.daily-card {width:min(940px,96vw);}
.daily-games-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:12px;}
.daily-games-grid article {padding:12px;background:#143940;border:1px solid #5e8580;border-radius:10px;}
.daily-game-active #hud,.daily-game-active #mobile-controls,.daily-game-active #npc-talk-btn,.daily-game-active #nearby-activity,.daily-game-active #objective-hud,.daily-game-active #hint-bar {display:none!important;}

.legal-card{width:min(950px,96vw)}.legal-card iframe{border:0;width:100%;height:60vh;background:#10202a}.legal-card nav{display:flex;gap:8px;flex-wrap:wrap}
/* Shared viewport spacing: panels must fit inside phone cutouts and system bars. */
:root { --screen-top: max(12px, env(safe-area-inset-top)); --screen-bottom: max(12px, env(safe-area-inset-bottom)); --screen-left: max(12px, env(safe-area-inset-left)); --screen-right: max(12px, env(safe-area-inset-right)); --panel-height: calc(100dvh - var(--screen-top) - var(--screen-bottom)); }
.panel, #pause, .adventure-overlay, .relic-modal-overlay, .modal-overlay {
 box-sizing:border-box; padding:var(--screen-top) var(--screen-right) var(--screen-bottom) var(--screen-left) !important;
}
.file-box, .book, .adventure-card, .win-card, .trial-victory-card, .modal-overlay > div {
 box-sizing:border-box; min-width:0; max-width:100%; max-height:var(--panel-height) !important;
 overflow-y:auto; overscroll-behavior:contain; overflow-wrap:break-word;
}
.panel > .file-box, #pause > .file-box, .adventure-card {padding:clamp(16px,3vw,28px) !important;}
.adventure-card > h2 {margin:0 48px 16px 0;line-height:1.25;}
.adventure-card .adventure-close {width:44px;height:44px;min-height:44px;padding:0;margin:0;top:8px;right:8px;}
.daily-games-grid {grid-template-columns:repeat(auto-fit,minmax(min(210px,100%),1fr));}
.wheel-layout > * {min-width:0;}
#shell > #menu {padding:var(--screen-top) var(--screen-right) var(--screen-bottom) var(--screen-left) !important;}
#menu .file-box {max-height:var(--panel-height) !important;}
#relic-modal .relic-modal-card {
 display:grid; grid-template-columns:minmax(0,1fr); gap:10px; width:min(100%,480px); max-width:100%;
 max-height:var(--panel-height) !important; padding:16px !important; margin:0; overflow-y:auto !important;
}
#relic-modal .relic-modal-kicker, #relic-modal .relic-modal-title, #relic-modal .relic-modal-subtitle {display:block;width:auto;margin:0;line-height:1.3;}
#relic-modal .relic-modal-kicker {letter-spacing:.14em;font-size:10px;}
#relic-modal .relic-modal-title {font-size:clamp(22px,4vw,30px);}
#relic-modal .relic-modal-art-frame {width:100%;height:clamp(110px,24dvh,180px);margin:0;box-sizing:border-box;}
#relic-modal .relic-modal-scroll-body {width:auto;min-width:0;min-height:0;max-height:none;margin:0;padding:0 4px 0 0;overflow:visible;}
#relic-modal .relic-modal-claim-btn {margin:0;min-height:48px;white-space:normal;}
@media (orientation:landscape) and (max-height:600px) {
 #relic-modal .relic-modal-card {width:min(100%,850px);grid-template-columns:minmax(160px,.8fr) minmax(0,1.6fr);grid-template-rows:auto auto auto minmax(0,1fr) auto;gap:8px 18px;}
 #relic-modal .relic-modal-kicker,#relic-modal .relic-modal-title,#relic-modal .relic-modal-subtitle {grid-column:1 / -1;}
 #relic-modal .relic-modal-art-frame {grid-column:1;grid-row:4;height:100%;min-height:100px;max-height:180px;}
 #relic-modal .relic-modal-scroll-body {grid-column:2;grid-row:4;max-height:clamp(80px,calc(100dvh - 230px),210px);overflow-y:auto;touch-action:pan-y;}
 #relic-modal .relic-modal-claim-btn {grid-column:1 / -1;grid-row:5;}
 .modal-overlay > div {padding:16px !important;}
}
@media(max-width:600px) and (orientation:portrait) {
 #menu .file-box {max-height:var(--panel-height) !important;}
}

/* ==========================================================================
   ✦ TILISM WHEEL OF FORTUNE & ROYAL BAZAAR OVERHAUL ✦
   ========================================================================== */

/* --- Wheel Overhaul Styles --- */
.wheel-card {
  width: min(960px, 96vw) !important;
  max-width: 960px !important;
  background: radial-gradient(ellipse at 50% 0%, #152d3d 0%, #0c1c27 55%, #050d14 100%) !important;
  border: 2px solid #e0ba63 !important;
  box-shadow: 0 16px 50px rgba(0,0,0,0.95), 0 0 35px rgba(224, 186, 99, 0.3), inset 0 1px 1px rgba(255,255,255,0.2) !important;
  border-radius: 20px !important;
  padding: clamp(16px, 3vw, 28px) !important;
}

.wheel-header-banner {
  text-align: center;
  margin-bottom: 12px;
  padding: 4px 48px 10px 48px;
  border-bottom: 1px solid rgba(224, 186, 99, 0.25);
}

.wheel-header-kicker {
  font-size: 11px;
  letter-spacing: 2.5px;
  color: #dfbe7a;
  font-weight: 700;
  text-transform: uppercase;
}

.wheel-title {
  font-family: 'Cinzel', 'Georgia', 'Times New Roman', serif;
  font-size: clamp(20px, 3.5vw, 30px);
  color: #fff6d8;
  margin: 4px 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9), 0 0 20px rgba(245, 208, 97, 0.4);
  letter-spacing: 1px;
}

.wheel-subtitle {
  font-size: 12px;
  color: #c9b480;
  letter-spacing: 0.6px;
  opacity: 0.92;
}

.wheel-purse-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 16px;
  background: rgba(8, 20, 30, 0.75);
  border: 1px solid rgba(224, 186, 99, 0.35);
  border-radius: 12px;
}

.wheel-purse-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #e4edf0;
}

.wheel-purse-badge .purse-coin {
  font-size: 18px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.wheel-purse-badge .wheel-balance {
  color: #ffdf78;
  font-size: 17px;
  font-weight: bold;
  text-shadow: 0 0 8px rgba(245, 208, 97, 0.6);
}

.wheel-compliance-pill {
  font-size: 11px;
  color: #8ec3cf;
  background: rgba(26, 212, 197, 0.1);
  border: 1px solid rgba(26, 212, 197, 0.3);
  border-radius: 20px;
  padding: 4px 12px;
}

.wheel-mode-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.wheel-mode-tab {
  flex: 1;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(14, 30, 44, 0.65) !important;
  border: 1.5px solid rgba(224, 186, 99, 0.3) !important;
  border-radius: 12px !important;
  color: #d6e2e8 !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer;
  padding: 8px 14px !important;
  margin: 0 !important;
  transition: all 0.2s ease;
}

.wheel-mode-tab:hover {
  border-color: #f5d061 !important;
  background: rgba(224, 186, 99, 0.15) !important;
}

.wheel-mode-tab.active {
  background: linear-gradient(180deg, rgba(224, 186, 99, 0.25), rgba(14, 30, 44, 0.9)) !important;
  border-color: #f5d061 !important;
  color: #fff !important;
  box-shadow: 0 0 16px rgba(245, 208, 97, 0.35);
}

.wheel-mode-tab .tab-icon {
  font-size: 16px;
}

.wheel-mode-tab .tab-pill {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: bold;
}

.wheel-mode-tab .tab-pill.ready {
  background: #0d6342;
  color: #5ef3b8;
  border: 1px solid #1ad4c5;
}

.wheel-mode-tab .tab-pill.claimed {
  background: #3d2c12;
  color: #e5b058;
  border: 1px solid #947030;
}

.wheel-mode-tab .tab-pill.premium {
  background: #541d3b;
  color: #ff9ed2;
  border: 1px solid #c084fc;
}

.wheel-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 24px;
  align-items: start;
}

.wheel-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  width: 100% !important;
}

.wheel-stage-rune-ring {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  border: 2px dashed rgba(245, 208, 97, 0.25);
  box-shadow: 0 0 30px rgba(26, 212, 197, 0.15);
  pointer-events: none;
  animation: spin-slow 60s linear infinite;
}

/* Fallback CSS disc */
.wheel-disc {
  height: 240px;
  width: 240px;
  border-radius: 50%;
  border: 6px solid #e0ba63;
  box-shadow: 0 0 0 4px #785213, 0 0 35px rgba(245, 208, 97, 0.45), inset 0 0 24px rgba(0,0,0,0.8);
  background: conic-gradient(#113a5e 0 60%, #7a1838 60% 85%, #0f5e46 85% 95%, #a87720 95% 100%);
  display: grid;
  place-items: center;
  position: relative;
}

.wheel-disc-center {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, #fce494 0%, #b88523 70%, #6e4c10 100%);
  border: 3px solid #ffeeba;
  display: grid;
  place-items: center;
  box-shadow: 0 0 15px rgba(0,0,0,0.8);
  color: #fff;
  font-size: 26px;
}

.wheel-pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  color: #e61f4b;
  font-size: 38px;
  text-shadow: 0 0 12px rgba(230, 31, 75, 0.8), 0 2px 4px #000;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.8));
}

.wheel-controls-pane {
  background: rgba(10, 22, 34, 0.65);
  border: 1px solid rgba(224, 186, 99, 0.25);
  border-radius: 14px;
  padding: 16px;
}

.panel-header h3 {
  font-size: 18px;
  color: #ffe8a3;
  margin: 0 0 4px;
}

.panel-header p {
  font-size: 13px;
  color: #b7cdd6;
  margin: 0 0 12px;
  line-height: 1.4;
}

.wheel-odds-group {
  margin: 12px 0 16px;
  background: rgba(6, 16, 26, 0.7);
  border: 1px solid rgba(224, 186, 99, 0.2);
  border-radius: 12px;
  padding: 12px;
}

.odds-header {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #e0ba63;
  margin-bottom: 8px;
  font-weight: bold;
}

.wheel-odds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
  gap: 8px;
}

.wheel-odd-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  background: rgba(16, 35, 52, 0.6);
  border: 1px solid rgba(245, 208, 97, 0.25);
  border-radius: 8px;
  text-align: center;
}

.wheel-odd-chip.jackpot {
  background: linear-gradient(145deg, rgba(168, 119, 32, 0.35), rgba(122, 24, 56, 0.35));
  border-color: #f5d061;
  box-shadow: 0 0 10px rgba(245, 208, 97, 0.25);
}

.wheel-odd-chip .odd-gem {
  font-size: 13px;
  font-weight: bold;
  color: #fff5d0;
  margin-bottom: 2px;
}

.wheel-odd-chip .odd-rate {
  font-size: 12px;
  color: #1ad4c5;
  font-weight: 700;
}

.btn-royal-spin {
  width: 100% !important;
  min-height: 54px !important;
  margin: 14px 0 8px !important;
  border: 2px solid #ffe494 !important;
  border-radius: 14px !important;
  background: linear-gradient(180deg, #fce07a 0%, #d89f2a 50%, #9e6b12 100%) !important;
  color: #2a1600 !important;
  cursor: pointer;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 6px 20px rgba(0,0,0,0.6), 0 0 25px rgba(245, 208, 97, 0.45) !important;
  transition: all 0.15s ease;
  padding: 6px 14px !important;
}

.btn-royal-spin:not(:disabled) {
  animation: royal-pulse 2.2s infinite ease-in-out;
}

.btn-royal-spin:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(0,0,0,0.7), 0 0 35px rgba(245, 208, 97, 0.7) !important;
  filter: brightness(1.08);
}

.btn-royal-spin:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.8) !important;
}

.btn-spin-text {
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

.btn-spin-sub {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.85;
  letter-spacing: 0.5px;
}

.btn-royal-spin:disabled {
  opacity: 0.55 !important;
  filter: grayscale(0.5) !important;
  cursor: not-allowed !important;
  animation: none !important;
}

.wheel-confirm {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #c0d3dc;
  padding: 8px 0;
  cursor: pointer;
  line-height: 1.35;
}

.wheel-confirm input {
  margin-top: 2px;
  accent-color: #f5d061;
}

.btn-restore {
  background: transparent !important;
  border: 1px solid rgba(224, 186, 99, 0.35) !important;
  color: #dfbe7a !important;
  font-size: 12px !important;
  padding: 6px 12px !important;
  border-radius: 8px !important;
  cursor: pointer;
  width: 100% !important;
  margin-top: 8px !important;
}

.btn-restore:hover {
  border-color: #f5d061 !important;
  color: #fff !important;
}

.wheel-product {
  font-size: 12px;
  color: #8faec0;
  margin: 6px 0;
}

.wheel-result-banner {
  margin-top: 14px;
  padding: 10px 16px;
  background: rgba(8, 20, 32, 0.7);
  border: 1px solid rgba(224, 186, 99, 0.3);
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  color: #ffe8a3;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheel-result-banner.active {
  border-color: #f5d061;
  box-shadow: 0 0 15px rgba(245, 208, 97, 0.3);
  color: #fff;
  font-weight: bold;
}

.wheel-disclaimer {
  font-size: 11px;
  color: #7997a5;
  text-align: center;
  margin-top: 12px;
  line-height: 1.4;
}

/* Fanfare Celebration Modal Overlay */
.wheel-fanfare-overlay {
  position: fixed;
  inset: 0;
  z-index: 10005;
  background: rgba(3, 8, 14, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.fanfare-card {
  position: relative;
  width: min(440px, 92vw);
  background: radial-gradient(circle at 50% 20%, #20455d 0%, #0c1a25 70%, #060e15 100%);
  border: 2px solid #f5d061;
  border-radius: 20px;
  box-shadow: 0 0 50px rgba(245, 208, 97, 0.5);
  padding: 32px 24px;
  text-align: center;
  animation: fanfare-pop 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.fanfare-emblem {
  font-size: 52px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 15px #f5d061);
}

.fanfare-kicker {
  font-size: 12px;
  letter-spacing: 3px;
  color: #dfbe7a;
  font-weight: bold;
}

.fanfare-title {
  font-size: 26px;
  color: #fff;
  font-family: 'Cinzel', 'Georgia', serif;
  margin: 4px 0 12px;
}

.fanfare-amount {
  font-size: 38px;
  font-weight: 900;
  color: #ffd859;
  text-shadow: 0 0 20px rgba(245, 208, 97, 0.8);
  margin-bottom: 12px;
}

.fanfare-desc {
  font-size: 13px;
  color: #cbe0ea;
  margin-bottom: 20px;
}

.fanfare-claim-btn {
  width: 100% !important;
  min-height: 48px !important;
  border: 2px solid #ffe494 !important;
  border-radius: 12px !important;
  background: linear-gradient(180deg, #fce07a 0%, #d89f2a 100%) !important;
  color: #2a1600 !important;
  font-size: 16px !important;
  font-weight: bold !important;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5) !important;
}

/* --- Bazaar Overhaul Styles --- */
.bazaar-card {
  width: min(980px, 96vw) !important;
  max-width: 980px !important;
  background: radial-gradient(ellipse at 50% 0%, #152d3d 0%, #0c1c27 55%, #050d14 100%) !important;
  border: 2px solid #e0ba63 !important;
  box-shadow: 0 16px 50px rgba(0,0,0,0.95), 0 0 35px rgba(224, 186, 99, 0.3), inset 0 1px 1px rgba(255,255,255,0.2) !important;
  border-radius: 20px !important;
  padding: clamp(16px, 3vw, 28px) !important;
}

.bazaar-arch-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 52px 12px 18px;
  margin-bottom: 14px;
  background: linear-gradient(90deg, rgba(16, 42, 58, 0.85), rgba(9, 20, 30, 0.95));
  border: 1.5px solid #dfbe7a;
  border-radius: 14px;
  box-shadow: 0 0 20px rgba(224, 186, 99, 0.2);
}

.bazaar-header-crest {
  font-size: 38px;
  filter: drop-shadow(0 0 10px #f5d061);
}

.bazaar-kicker {
  font-size: 11px;
  letter-spacing: 2px;
  color: #dfbe7a;
  font-weight: bold;
}

.bazaar-title {
  font-family: 'Cinzel', 'Georgia', serif;
  font-size: clamp(18px, 3.2vw, 26px);
  color: #fff5d0;
  margin: 2px 0;
  text-shadow: 0 0 14px rgba(245, 208, 97, 0.35);
}

.bazaar-subtitle {
  font-size: 12px;
  color: #a9cbd6;
  opacity: 0.92;
}

.bazaar-currency-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.metal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}

.metal-pill.gold {
  background: linear-gradient(180deg, #3d2d0f 0%, #1f1606 100%);
  border: 1.5px solid #f5d061;
  color: #ffe894;
}

.metal-pill.silver {
  background: linear-gradient(180deg, #242e38 0%, #11181f 100%);
  border: 1.5px solid #cbd5e1;
  color: #f1f5f9;
}

.metal-pill.copper {
  background: linear-gradient(180deg, #382116 0%, #1a0f09 100%);
  border: 1.5px solid #b87333;
  color: #f6c098;
}

.metal-total-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(26, 212, 197, 0.12);
  border: 1.5px solid #1ad4c5;
  border-radius: 20px;
  color: #e6fffa;
  font-size: 13px;
}

.bazaar-daily-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(50, 36, 12, 0.8), rgba(20, 24, 30, 0.9));
  border: 1.5px solid #dfbe7a;
  border-radius: 14px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.daily-chest-icon {
  font-size: 34px;
  filter: drop-shadow(0 0 10px #f5d061);
}

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

.daily-title {
  font-size: 15px;
  font-weight: bold;
  color: #ffe494;
}

.daily-desc {
  font-size: 12px;
  color: #d0c2a5;
  margin-top: 2px;
}

.btn-claim-daily {
  min-height: 42px !important;
  padding: 8px 18px !important;
  border: 1.5px solid #ffe494 !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #fce07a 0%, #d89f2a 100%) !important;
  color: #2a1600 !important;
  font-size: 13px !important;
  font-weight: bold !important;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  margin: 0 !important;
}

.btn-claim-daily:not(:disabled) {
  animation: royal-pulse 2s infinite ease-in-out;
}

.btn-claim-daily:disabled {
  opacity: 0.5 !important;
  filter: grayscale(0.5) !important;
  cursor: default !important;
  animation: none !important;
  background: #26333c !important;
  border-color: #556a77 !important;
  color: #8e9fa9 !important;
}

.bazaar-preview-box {
  background: radial-gradient(ellipse at 50% 50%, #163242 0%, #0c1a25 70%, #060e15 100%);
  border: 1.5px solid rgba(224, 186, 99, 0.4);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
  text-align: center;
}

.preview-badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 2px;
  color: #1ad4c5;
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.preview-hint {
  font-size: 12px;
  color: #9ebbc5;
  margin: 0 0 8px;
}

.bazaar-preview-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

.bazaar-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.bazaar-tab {
  white-space: nowrap;
  min-height: 42px !important;
  padding: 8px 16px !important;
  border: 1px solid rgba(224, 186, 99, 0.3) !important;
  border-radius: 10px !important;
  background: rgba(14, 28, 42, 0.7) !important;
  color: #cbe0ea !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer;
  margin: 0 !important;
  transition: all 0.2s ease;
}

.bazaar-tab.active {
  background: linear-gradient(180deg, rgba(224, 186, 99, 0.3), rgba(14, 28, 42, 0.9)) !important;
  border-color: #f5d061 !important;
  color: #fff !important;
  box-shadow: 0 0 12px rgba(245, 208, 97, 0.3);
}

.bazaar-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.bazaar-card-item {
  display: flex;
  flex-direction: column;
  position: relative;
  border-radius: 14px;
  background: linear-gradient(145deg, #132734 0%, #0b1520 100%);
  padding: 16px;
  box-sizing: border-box;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1.5px solid;
  cursor: pointer;
}

.bazaar-card-item:hover {
  transform: translateY(-2px);
}

.bazaar-card-item.rarity-legendary {
  border-color: #f5c542;
  box-shadow: 0 4px 18px rgba(0,0,0,0.5), inset 0 0 14px rgba(245, 197, 66, 0.12);
}

.bazaar-card-item.rarity-rare {
  border-color: #2dd4bf;
  box-shadow: 0 4px 18px rgba(0,0,0,0.5), inset 0 0 14px rgba(45, 212, 191, 0.12);
}

.bazaar-card-item.rarity-mystic {
  border-color: #c084fc;
  box-shadow: 0 4px 18px rgba(0,0,0,0.5), inset 0 0 14px rgba(192, 132, 252, 0.12);
}

.item-pedestal {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0.4) 80%);
  border: 1px solid rgba(245, 208, 97, 0.35);
}

.item-icon {
  font-size: 24px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}

.item-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  margin-right: 54px;
}

.rarity-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
}

.rarity-tag.legendary {
  background: #543a0d;
  color: #ffd666;
  border: 1px solid #f5c542;
}

.rarity-tag.rare {
  background: #0d4440;
  color: #5ef3b8;
  border: 1px solid #2dd4bf;
}

.rarity-tag.mystic {
  background: #411d54;
  color: #f0abfc;
  border: 1px solid #c084fc;
}

.perk-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(224, 186, 99, 0.15);
  border: 1px solid rgba(224, 186, 99, 0.4);
  color: #fff0c2;
}

.count-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(45, 212, 191, 0.15);
  border: 1px solid #2dd4bf;
  color: #a7f3d0;
}

.item-name {
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  margin: 0 0 2px;
  line-height: 1.3;
  margin-right: 54px;
}

.item-subtext {
  font-size: 11px;
  color: #dfbe7a;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.item-desc {
  font-size: 12px;
  line-height: 1.4;
  color: #b7cad4;
  margin: 0 0 14px;
  flex: 1;
}

.item-action-col {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.cost-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: bold;
}

.cost-pill.can-afford {
  background: rgba(14, 48, 36, 0.8);
  border: 1px solid #1ad4c5;
  color: #a7f3d0;
}

.cost-pill.cannot-afford {
  background: rgba(48, 14, 14, 0.8);
  border: 1px solid #ef4444;
  color: #fca5a5;
}

.cost-pill.owned {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid #64748b;
  color: #cbd5e1;
}

.btn-purchase {
  min-height: 38px !important;
  padding: 6px 14px !important;
  border: 1.5px solid #ffe494 !important;
  border-radius: 8px !important;
  background: linear-gradient(180deg, #fce07a 0%, #d89f2a 100%) !important;
  color: #2a1600 !important;
  font-size: 13px !important;
  font-weight: bold !important;
  cursor: pointer;
  margin: 0 !important;
  transition: all 0.15s ease;
}

.btn-purchase:not(:disabled):hover {
  filter: brightness(1.1);
  transform: scale(1.02);
}

.btn-equip {
  min-height: 38px !important;
  padding: 6px 14px !important;
  border: 1.5px solid #2dd4bf !important;
  border-radius: 8px !important;
  background: rgba(45, 212, 191, 0.15) !important;
  color: #2dd4bf !important;
  font-size: 13px !important;
  font-weight: bold !important;
  cursor: pointer;
  margin: 0 !important;
}

.btn-equip.is-equipped {
  background: #0f766e !important;
  color: #fff !important;
  border-color: #5eead4 !important;
  cursor: default;
}

.btn-use-item {
  min-height: 38px !important;
  padding: 6px 14px !important;
  border: 1.5px solid #38bdf8 !important;
  border-radius: 8px !important;
  background: rgba(56, 189, 248, 0.15) !important;
  color: #7dd3fc !important;
  font-size: 13px !important;
  font-weight: bold !important;
  cursor: pointer;
  margin: 0 !important;
}

.status-passive {
  font-size: 12px;
  font-weight: bold;
  color: #c084fc;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(192, 132, 252, 0.12);
  border: 1px solid #c084fc;
}

.bazaar-status {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: bold;
  z-index: 10010;
  transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  text-align: center;
  max-width: 90vw;
}

.bazaar-status.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.bazaar-status.success {
  background: #0f5e46;
  border: 1.5px solid #5ef3b8;
  color: #fff;
  box-shadow: 0 4px 20px rgba(15, 94, 70, 0.6);
}

.bazaar-status.warning {
  background: #78350f;
  border: 1.5px solid #f59e0b;
  color: #fff;
  box-shadow: 0 4px 20px rgba(120, 53, 15, 0.6);
}

/* Animations */
@keyframes royal-pulse {
  0%, 100% {
    box-shadow: 0 4px 18px rgba(0,0,0,0.6), 0 0 20px rgba(245, 208, 97, 0.35);
  }
  50% {
    box-shadow: 0 4px 22px rgba(0,0,0,0.6), 0 0 32px rgba(245, 208, 97, 0.7);
  }
}

@keyframes fanfare-pop {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 720px) {
  .wheel-layout {
    grid-template-columns: 1fr;
  }
  .wheel-stage {
    min-height: 260px;
    margin: 0 auto;
  }
  .bazaar-arch-header {
    flex-direction: column;
    text-align: center;
    padding: 16px 20px 14px;
    margin-top: 6px;
  }
  .metal-total-pill {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
  .bazaar-daily-card {
    flex-direction: column;
    text-align: center;
  }
}

body.daily-game-active #c{display:block!important;opacity:1!important;visibility:visible!important;pointer-events:auto!important;}
body.daily-game-active #story-bg{display:none!important;}

#arena-challenge-label{position:fixed;left:12px;right:12px;bottom:5px;z-index:10030;pointer-events:none;text-align:center;color:#e5d7b2;font:11px/1.3 sans-serif;text-shadow:0 2px 3px #000;max-width:80vw;margin:auto;}
.daily-games-grid select{background:#182c3b;color:#f4ddb0;border:1px solid #ab8c50;border-radius:6px;min-height:36px;margin:4px;}

/* Keep victory choices reachable on short landscape phone screens. */
#win .win-card{max-height:calc(100dvh - 24px);overflow-y:auto;box-sizing:border-box;}
@media (max-height:500px){
  #win .win-card{padding:12px 18px;max-width:720px;}
  #win h1{font-size:24px;margin:3px 0;}
  #win p{font-size:12px;line-height:1.35;margin:4px 0;}
  #win .upcoming-2027-showcase{margin:6px 0;padding:7px 12px;}
  #win .upcoming-badge{font-size:10px;letter-spacing:.08em;}
  #win .win-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;}
  #win .win-actions button{min-height:40px;padding:7px 10px;font-size:12px;margin:0;}
  #win .win-actions button[data-win="teaser"]{grid-column:1/-1;grid-row:1;}
}

/* Compact, readable completion cards leave room for the story artwork. */
#win .win-card { padding:18px 22px; border-radius:16px; }
#win h1 { font-size:clamp(26px,4vw,38px); line-height:1.1; margin:8px 0 12px; }
#win p { font-size:14px; line-height:1.45; margin:6px 0; }
#win .kicker { font-size:10px; letter-spacing:.16em; }
#win .win-stats { padding:10px 14px; margin:10px 0; }
#win .upcoming-2027-showcase { padding:10px 12px; margin:10px 0; }
#win .upcoming-badge { font-size:10px; letter-spacing:.08em; }
#win .win-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:12px 0; }
#win .win-actions button { min-height:44px; padding:9px 10px; font-size:12px; letter-spacing:.02em; margin:0; }
#win .win-actions [data-win="teaser"] { grid-column:1/-1; grid-row:1; }
#win .ending-illustration {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  object-position: 50% 25%;
  border-radius: 10px;
  border: 1.5px solid rgba(223, 190, 122, 0.45);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(223, 190, 122, 0.2);
  margin-bottom: 12px;
}
@media (max-height: 520px) {
  #win .ending-illustration { max-height: 105px; margin-bottom: 8px; }
  #win .win-card { padding: 12px 16px; }
}
#win .win-sub-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  grid-column: 1 / -1;
}
#win .win-sub-actions button {
  flex: 1;
  min-height: 38px;
  padding: 8px 6px;
  font-size: 12px;
}
#win .btn-win-expedition {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 44px;
  font-size: 14px;
  font-weight: bold;
  background: linear-gradient(135deg, #1ad4c5, #008891) !important;
  color: #fff !important;
  border: 1.5px solid #6efff3 !important;
  border-radius: 8px;
  box-shadow: 0 0 16px rgba(26, 212, 197, 0.35);
}
@media (orientation:landscape) {
  #win { align-items:flex-start; padding-left:3vw; }
  #win .win-card { width: min(580px,65vw); }
}

/* Keep the catalogue immediately accessible on phones. */
.bazaar-preview-box summary{cursor:pointer;color:#6ee5d8;padding:10px;font-size:13px;}
.bazaar-preview-box:not([open]){padding:0;}
.bazaar-preview-box:not([open]) .preview-header,.bazaar-preview-box:not([open]) .bazaar-preview-stage{display:none;}
@media(max-width:600px){
 .bazaar-header-crest,.bazaar-kicker,.daily-chest-icon{display:none;}
 .bazaar-arch-header{padding:10px 26px 10px 8px;margin:0 0 10px;}
 .bazaar-title{font-size:16px!important;margin:0 0 5px;}
 .bazaar-subtitle{font-size:10px;}
 .bazaar-currency-strip{gap:5px;margin-bottom:10px;}
 .metal-pill{padding:4px 8px;font-size:11px;}
 .bazaar-daily-card{flex-direction:row;text-align:left;padding:10px;gap:8px;margin-bottom:10px;}
 .daily-title{font-size:12px;}.daily-desc{font-size:10px;}.btn-claim-daily{padding:8px;font-size:11px;min-width:104px;}
 .bazaar-catalog-grid{grid-template-columns:minmax(0,1fr);}
 .bazaar-tabs{gap:5px;}.bazaar-tab{padding:8px;font-size:11px;}
}

.bazaar-cash-shop{border:1px solid #9862c5;border-radius:12px;padding:12px;margin:12px 0;}.bazaar-cash-shop[hidden]{display:none;}.bazaar-cash-shop>p{font-size:12px;line-height:1.4;}.bazaar-cash-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:8px;margin:8px 0;}.bazaar-cash-grid p{font-size:12px;line-height:1.4;}


/* ── AAA ROYAL BAZAAR HERO 3D SHOWCASE & CARDS ──────────────────────── */
.bazaar-hero-showcase {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  background: radial-gradient(ellipse at 50% 40%, rgba(26, 54, 76, 0.7) 0%, rgba(11, 22, 34, 0.95) 75%, #050b11 100%);
  border: 1.5px solid rgba(245, 208, 97, 0.45);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 24px rgba(245, 208, 97, 0.08);
  align-items: center;
}

@media (max-width: 680px) {
  .bazaar-hero-showcase {
    grid-template-columns: 1fr;
    padding: 12px 14px;
  }
}

.showcase-left {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bazaar-preview-stage {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 250px;
}

.showcase-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
}

.showcase-rarity-pill {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 3px 10px;
  border-radius: 6px;
  text-transform: uppercase;
}

.showcase-rarity-pill.rarity-legendary {
  background: rgba(245, 197, 66, 0.2);
  color: #f5c542;
  border: 1px solid #f5c542;
  box-shadow: 0 0 10px rgba(245, 197, 66, 0.3);
}

.showcase-rarity-pill.rarity-mystic {
  background: rgba(192, 132, 252, 0.2);
  color: #c084fc;
  border: 1px solid #c084fc;
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.3);
}

.showcase-rarity-pill.rarity-rare {
  background: rgba(45, 212, 191, 0.2);
  color: #2dd4bf;
  border: 1px solid #2dd4bf;
  box-shadow: 0 0 10px rgba(45, 212, 191, 0.3);
}

.showcase-title {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  font-weight: 700;
  color: #fefce8;
  margin: 0;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}

.showcase-subtext {
  font-size: 13px;
  color: #93c5fd;
  font-style: italic;
  margin-bottom: 4px;
}

.showcase-perk {
  display: inline-block;
  align-self: flex-start;
  background: linear-gradient(135deg, rgba(245, 208, 97, 0.25), rgba(212, 168, 38, 0.1));
  border: 1px solid rgba(245, 208, 97, 0.5);
  color: #fde047;
  font-weight: 700;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 8px;
  letter-spacing: 0.02em;
}

.showcase-lore {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.45;
  font-style: italic;
  margin: 4px 0 12px;
  border-left: 2px solid rgba(245, 208, 97, 0.4);
  padding-left: 10px;
}

.showcase-action-bar {
  display: flex;
  gap: 12px;
}

.showcase-action-btn {
  padding: 10px 28px !important;
  font-family: 'Cinzel', serif !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  min-height: 44px !important;
  transition: all 0.15s ease !important;
}

.showcase-action-btn.buy {
  background: linear-gradient(135deg, #f5d061 0%, #d4a826 60%, #b88d18 100%) !important;
  color: #0b1118 !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 4px 14px rgba(212, 168, 38, 0.5) !important;
}

.showcase-action-btn.equip {
  background: linear-gradient(135deg, #1ad4c5 0%, #0d9488 100%) !important;
  color: #051319 !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 4px 14px rgba(26, 212, 197, 0.45) !important;
}

/* Mobile responsive adjustments for universal delayed loading spinner */
@media (max-width: 600px) {
  #zayan-delayed-spinner .delayed-spinner-card {
    padding: 13px 18px;
    gap: 13px;
    min-width: 240px;
    max-width: 88vw;
    border-radius: 14px;
  }
  #zayan-delayed-spinner .delayed-spinner-ring {
    width: 40px;
    height: 40px;
  }
  #zayan-delayed-spinner .spinner-sigil {
    font-size: 14px;
  }
  #zayan-delayed-spinner .delayed-spinner-title {
    font-size: 14.5px;
  }
  #zayan-delayed-spinner .delayed-spinner-subtitle {
    font-size: 11.5px;
  }
}


.showcase-action-btn.equipped {
  background: rgba(30, 41, 59, 0.8) !important;
  color: #64748b !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: none !important;
  cursor: default !important;
}

.bazaar-card-item.is-equipped {
  border-color: #1ad4c5 !important;
  box-shadow: 0 0 16px rgba(26, 212, 197, 0.4), inset 0 0 12px rgba(26, 212, 197, 0.12) !important;
}

.owned-badge {
  color: #2dd4bf;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
}

#shop-overlay { padding:12px; background:#061116ed; backdrop-filter:none; }
#pause { background:#061116ed; }
#pause .file-box { width:min(620px,94vw) !important; max-height:calc(100dvh - 24px) !important; padding:14px !important; box-sizing:border-box; overflow-y:auto; border:1px solid #b69b6155 !important; border-radius:8px !important; background:#0d1e23 !important; box-shadow:0 20px 60px #0007 !important; }
#pause .kicker { margin:0 0 12px; color:#b5c9c1; font:600 11px/1.5 Arial,sans-serif; letter-spacing:.14em; }
#pause-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:0; padding:0; }
#pause-list .menu-item { min-height:44px; box-sizing:border-box; padding:8px 12px; border:1px solid #adc4bf33; border-radius:4px; background:#102326; box-shadow:none; transform:none; }
#pause-list .menu-item-icon-wrap { display:none; }
#pause-list .menu-item-title { font:600 12px/1.4 Arial,sans-serif; color:#f3e5c8; letter-spacing:0; }
#pause-list .menu-item.sel, #pause-list .menu-item:focus-visible { border-color:#dfc18b; background:#23423b; outline:1px solid #dfc18b; }
#shop-overlay .bazaar-card { width:min(1080px,100%); max-height:calc(100dvh - 24px); box-sizing:border-box; padding:20px; border:1px solid #b69b6155; border-radius:8px; background:#0d1e23; box-shadow:0 20px 60px #0007; overflow-y:auto; transform:none !important; animation:none; }
#shop-overlay .adventure-close { position:fixed; top:18px; right:18px; min-width:44px; min-height:44px; z-index:5; }
#shop-overlay .card-ornament, #shop-overlay .bazaar-header-crest, #shop-overlay .daily-chest-icon { display:none; }
#shop-overlay .bazaar-arch-header { border:0; padding:0 48px 12px 0; background:none; }
#shop-overlay .bazaar-title { margin:4px 0; font:600 28px Georgia,serif; color:#f2dfb7; text-shadow:none; letter-spacing:0; }
#shop-overlay .bazaar-kicker { font:10px Arial,sans-serif; letter-spacing:.15em; color:#aabfb8; }
#shop-overlay .bazaar-subtitle { font:12px/1.5 Arial,sans-serif; color:#aabfb8; }
#shop-overlay .bazaar-currency-strip { padding:10px 0; gap:12px; background:none; border-block:1px solid #b69b612c; border-radius:0; box-shadow:none; }
#shop-overlay .metal-pill, #shop-overlay .metal-total-pill { background:none; border:0; padding:4px; box-shadow:none; }
#shop-overlay .bazaar-daily-card { margin:12px 0; padding:10px 12px; border:1px solid #a6c5ba33; background:#142b2b; border-radius:5px; box-shadow:none; }
#shop-overlay .bazaar-hero-showcase { margin:14px 0; border:1px solid #b69b6133; background:#102326; border-radius:6px; box-shadow:none; }
#shop-overlay .showcase-right { padding:16px; }
#shop-overlay .bazaar-tabs { gap:8px; flex-wrap:wrap; margin:14px 0; }
#shop-overlay .bazaar-tab { min-height:44px; padding:8px 12px; border-radius:4px; font:12px Arial,sans-serif; letter-spacing:0; box-shadow:none; }
#shop-overlay .bazaar-catalog-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
#shop-overlay .bazaar-card-item { min-width:0; padding:8px; gap:4px; background:#102326; border:1px solid #adc4bf33; border-radius:5px; box-shadow:none; transform:none; }
#shop-overlay .item-pedestal { position:relative; top:auto; right:auto; width:100%; height:100px; padding:0; margin:0; background:none; box-shadow:none; border:0; }
#shop-overlay .bazaar-item-art { display:block; width:100%; height:100px; object-fit:contain; }
#shop-overlay .item-title { font:600 14px/1.3 Arial,sans-serif; color:#f3e5c8; text-shadow:none; }
#shop-overlay .item-header { margin:0 0 4px; padding:0; min-width:0; }
#shop-overlay .item-title { margin:0 0 4px; }
#shop-overlay .item-price { font:600 13px/1.5 Arial,sans-serif; color:#e8ca83; }
#shop-overlay .item-secondary { display:flex; flex-direction:column; gap:4px; }
#shop-overlay .bazaar-card-item .item-desc, #shop-overlay .bazaar-card-item .item-subtext { display:none; }
#shop-overlay .item-rarity-badge { font:600 10px/1.4 Arial,sans-serif; letter-spacing:.06em; }
#shop-overlay .item-footer { margin-top:4px; padding-top:4px; }
#shop-overlay .btn-item-action { min-height:48px !important; width:100%; }
#shop-overlay .item-actions { width:100%; }
#shop-overlay .item-desc { font:12px/1.5 Arial,sans-serif; color:#b6c7c4; }
#shop-overlay .item-perk-chip { background:#203a38; color:#d3e0d9; box-shadow:none; border:0; font:11px/1.5 Arial,sans-serif; }
#shop-overlay .btn-item-action, #shop-overlay .btn-claim-daily, #shop-overlay .showcase-action-btn { min-height:44px; border-radius:4px; box-shadow:none; font:600 12px Arial,sans-serif; }
#shop-overlay button:focus-visible { outline:2px solid #fff1c9; outline-offset:2px; }
#shop-overlay .bazaar-subtitle { display:none; }
#shop-overlay .bazaar-catalog-panel { min-width:0; }
#shop-overlay .bazaar-arch-header { margin:0; padding-bottom:8px; }
#shop-overlay .bazaar-title { font-size:22px; }
#shop-overlay .metal-pill, #shop-overlay .metal-total-pill { font:12px/1.5 Arial,sans-serif; }
#shop-overlay .metal-icon, #shop-overlay .tab-icon { display:none; }
#shop-overlay .bazaar-daily-card { gap:12px; }
#shop-overlay .daily-title { font:600 13px/1.5 Arial,sans-serif; }
#shop-overlay .daily-desc { font:12px/1.5 Arial,sans-serif; }
#shop-overlay .preview-header { padding:0; }
#shop-overlay .preview-badge { font:600 10px/1.5 Arial,sans-serif; letter-spacing:.12em; }
#shop-overlay .preview-hint { margin:3px 0; font:12px/1.5 Arial,sans-serif; }
#shop-overlay .showcase-title { font:600 20px/1.25 Georgia,serif; letter-spacing:0; text-shadow:none; }
#shop-overlay .showcase-lore { font:12px/1.5 Arial,sans-serif; }
@media (min-width:700px) and (orientation:landscape) {
  #shop-overlay .bazaar-card { display:grid; grid-template-columns:minmax(240px,.85fr) minmax(0,1.15fr); gap:0 16px; }
  #shop-overlay .bazaar-arch-header, #shop-overlay .bazaar-currency-strip, #shop-overlay .bazaar-daily-card, #shop-overlay .bazaar-cash-shop, #shop-overlay .bazaar-status { grid-column:1/-1; }
  #shop-overlay .bazaar-hero-showcase { grid-column:1; grid-row:4; display:flex; flex-direction:column; padding:12px; align-self:start; }
  #shop-overlay .bazaar-catalog-panel { grid-column:2; grid-row:4; }
  #shop-overlay .showcase-right { padding:8px 0 0; width:100%; box-sizing:border-box; }
  #shop-overlay .bazaar-tabs, #shop-overlay .bazaar-catalog-grid { grid-column:2; }
  #shop-overlay .bazaar-catalog-grid { grid-template-columns:repeat(2,minmax(0,1fr)); align-self:start; }
  #shop-overlay .bazaar-preview-stage { min-height:220px; }
  #shop-overlay .bazaar-daily-card { margin:8px 0; padding:8px 12px; }
  #shop-overlay .daily-desc { display:none; }
}
@media(max-width:760px) {
  #shop-overlay .bazaar-card { padding:14px; }
  #shop-overlay .bazaar-catalog-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #shop-overlay .bazaar-hero-showcase { display:flex; flex-direction:column; }
  #shop-overlay .item-pedestal, #shop-overlay .bazaar-item-art { height:100px; }
}
@media (min-width:700px) and (max-height:500px) and (orientation:landscape) {
  #shop-overlay .bazaar-card { padding:12px !important; }
  #shop-overlay .bazaar-kicker { display:none; }
  #shop-overlay .bazaar-arch-header { padding-bottom:4px; }
  #shop-overlay .bazaar-title { font-size:20px; }
  #shop-overlay .bazaar-currency-strip { padding:4px 0; margin-bottom:0; }
  #shop-overlay .bazaar-daily-card { grid-row:5; }
  #shop-overlay .bazaar-hero-showcase { margin:8px 0; }
  #shop-overlay .bazaar-tabs { margin:8px 0; gap:6px; flex-wrap:nowrap; overflow-x:auto; }
  #shop-overlay .bazaar-tab { flex:0 0 auto; }
}

/* Leave the centre of the Android landscape view clear without shrinking tap targets. */
@media (orientation: landscape) {
  body.mobile-ui #top { padding:10px 14px; background:none; }
  body.mobile-ui #top .brand { display:none; }
  body.mobile-ui #minimap-container { display:none; }
  body.mobile-ui #room-name { position:absolute; top:8px; left:14px; margin:0; font:12px/1.4 Georgia,serif; letter-spacing:.03em; }
  body.mobile-ui #meters { position:absolute; top:30px; left:14px; margin-right:0 !important; text-align:left; }
  body.mobile-ui #courage { font-size:16px; letter-spacing:3px; }
  body.mobile-ui #rewind { font-size:12px; letter-spacing:1px; margin-top:2px; }
  body.mobile-ui #objective-hud { top:10px; left:180px; transform:none; max-width:calc(100vw - 420px); padding:5px 8px; border:0; border-radius:4px; font:11px/1.4 Arial,sans-serif; letter-spacing:0; }
  body.mobile-ui #mobile-top-bar { top:8px; right:12px; gap:6px; }
  body.mobile-ui .quick-touch-btn { min-height:44px; box-sizing:border-box; padding:4px 8px; font:11px Arial,sans-serif; letter-spacing:0; gap:4px; }
  body.mobile-ui #joystick-container { width:104px; height:104px; left:18px; bottom:18px; }
  body.mobile-ui #joystick-stick { width:44px; height:44px; }
  body.mobile-ui .relic-touch-btn { min-width:44px; min-height:44px; }
  body.mobile-ui #joystick-base, body.mobile-ui .touch-btn, body.mobile-ui .dragger-track { box-shadow:none; backdrop-filter:none; }
  body.mobile-ui #mobile-actions { width:128px; height:116px; }
  body.mobile-ui #btn-touch-slash { width:56px; height:56px; right:0; bottom:0; }
  body.mobile-ui #btn-touch-rostam, body.mobile-ui #btn-touch-vault { width:44px; height:44px; right:64px; bottom:0; }
  body.mobile-ui #btn-touch-dagger { width:44px; height:44px; right:64px; bottom:52px; }
  body.mobile-ui #btn-touch-sneak { width:44px; height:44px; right:6px; bottom:64px; }
  body.mobile-ui #camera-drag-widget { top:36%; right:12px; }
  body.mobile-ui .dragger-track { min-height:44px; box-sizing:border-box; padding:2px 4px; }
  body.mobile-ui .dragger-thumb { width:30px; height:30px; }
  body.mobile-ui .dragger-label { display:none; }
  body.mobile-ui .npc-talk-btn { bottom:76px; min-width:0; min-height:44px; max-width:55vw; box-sizing:border-box; padding:6px 12px; gap:8px; border-width:1px; border-radius:6px; font:12px/1.4 Arial,sans-serif; animation:none; box-shadow:none; }
  body.mobile-ui .npc-talk-btn .npc-btn-icon { font-size:14px; }
  body.mobile-ui .npc-talk-btn .npc-btn-badge { font-size:11px; }
}
