/**
 * PyrMaker Platform - Master Theme Stylesheet
 * Features:
 * - Desktop: Right Side Drawer (380px) with Category Pills & Square Cards Grid
 * - Mobile: Fixed Bottom Drawer / Tray with Handle
 * - Perfect Square Slots & Cards (1:1 Ratio)
 * - Tiers Scalable up to 30 Tiers (with .pyramid-large, .pyramid-huge, .pyramid-ultra)
 * - Royal Gold & Midnight Blue Visuals
 */

:root {
  color-scheme: dark;
  --bg-dark: #070d18;
  --bg-card: #0d1627;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --accent-glow: rgba(245, 158, 11, 0.4);
  --gold: #f59e0b;
  --gold-light: #fef08a;
  --gold-glow: rgba(245, 158, 11, 0.4);
  --slot-bg: rgba(255, 255, 255, 0.03);
  --slot-border: rgba(245, 158, 11, 0.3);
  --card-border: rgba(245, 158, 11, 0.25);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  --font-en: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-ar: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Cinzel', serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  user-select: text;
  -webkit-user-select: text;
}

/* Prevent text highlighting only on cards and buttons during drag/drop */
.char-card,
.slot,
.btn,
.btn-tier-step,
.stepper-wrapper,
.mobile-drawer-handle,
.category-card {
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-en);
  background: var(--bg-dark);
  background-image: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #070d18 70%);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
}

html[dir="rtl"], html[lang="ar"] {
  font-family: var(--font-ar);
}

/* ==========================================================================
   ARABIC RIGHT-TO-LEFT (RTL) ICON POSITIONING
   In Arabic typography, the text/word comes first (on the right in RTL),
   and the icon/symbol acts as a supportive marker AFTER the text (on the left).
   ========================================================================== */
html[dir="rtl"] .btn,
html[dir="rtl"] .admin-btn,
html[dir="rtl"] .btn-hero-cta,
html[dir="rtl"] .feed-tab,
html[dir="rtl"] .filter-pill,
html[dir="rtl"] .filter-tab,
html[dir="rtl"] .tool-btn,
html[dir="rtl"] .modal-tab-btn,
html[dir="rtl"] .admin-tab-btn,
html[dir="rtl"] .tab-btn,
html[dir="rtl"] .btn-fork-card,
html[dir="rtl"] .category-chip,
html[dir="rtl"] .user-menu-btn,
html[dir="rtl"] .dropdown-menu-item,
html[dir="rtl"] .pin-submit-btn,
html[dir="rtl"] .btn-mode-toggle,
html[dir="rtl"] .btn-save-recommended-pyramid,
html[dir="rtl"] .btn-hdr-mobile,
html[dir="rtl"] .btn-dock-add-mobile {
  flex-direction: row-reverse;
}

/* ==========================================================================
   TOP HEADER
   ========================================================================== */
header.app-header {
  background: rgba(11, 18, 32, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  padding: 0.45rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 52px;
  flex-shrink: 0;
  z-index: 500;
  overflow: visible !important;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none !important;
  color: inherit !important;
}

.brand-icon {
  font-size: 1.45rem;
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--gold-light);
  text-shadow: 0 0 10px var(--gold-glow);
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.brand-subtitle {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.brand-badge {
  font-size: 0.6rem;
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold-light);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 1px 5px;
  border-radius: 99px;
  font-weight: 700;
}

/* Header Sections Switching (Unified Single Header Bar) */
.header-home-items {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
}

.header-workspace-items {
  display: none;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
  overflow: visible !important;
}

body.in-workspace-view .header-home-items {
  display: none !important;
}

body.in-workspace-view .header-workspace-items {
  display: flex !important;
  overflow: visible !important;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

#nav-btn-premium.btn-icon-only {
  width: 34px;
  min-width: 34px;
  height: 32px;
  padding: 0;
  justify-content: center;
  font-size: 1rem;
}

@media (max-width: 1260px) and (min-width: 861px) {
  header.app-header {
    padding: 0.35rem 0.65rem;
    gap: 0.35rem;
  }
  .brand-subtitle,
  .control-group label {
    display: none !important;
  }
  .header-workspace-items {
    gap: 0.3rem;
  }
  .header-workspace-items .global-search-container {
    margin: 0 0.2rem !important;
    min-width: 110px;
    max-width: 210px;
  }
  .header-workspace-items .btn,
  .header-actions .btn {
    padding: 0.32rem 0.52rem;
    font-size: 0.74rem;
  }
}

/* ==========================================================================
   PLATFORM MODE CONTROLS: BETA LAUNCH vs FULL MONETIZED
   ========================================================================== */
body.platform-mode-beta #nav-btn-premium,
body.platform-mode-beta #btn-mobile-premium,
body.platform-mode-beta #footer-link-premium,
body.platform-mode-beta .premium-badge-gold,
body.platform-mode-beta .export-watermark-opt,
body.platform-mode-beta .fork-policy-opt-locked,
body.platform-mode-beta .visibility-opt-private,
body.platform-mode-beta #rules-trial-status-banner,
body.platform-mode-beta #template-visibility-form-group,
body.platform-mode-beta .template-visibility-section,
body.platform-mode-beta .template-visibility-radios,
body.platform-mode-beta #ad-slot-leaderboard,
body.platform-mode-beta #ad-slot-workspace,
body.platform-mode-beta #ad-slot-export,
body.platform-mode-beta .ad-container-slot,
body.platform-mode-beta .ad-banner-workspace,
body.platform-mode-beta .ad-slot-wrap,
body.platform-mode-beta label:has(input[name="creator-fork-policy"][value="locked"]),
body.platform-mode-beta label:has(input[name="setting-visibility"][value="private"]) {
  display: none !important;
}

/* Default state before JS runs: hide beta-restricted items to prevent flicker */
body:not(.platform-mode-monetized) #nav-btn-premium,
body:not(.platform-mode-monetized) #btn-mobile-premium,
body:not(.platform-mode-monetized) #footer-link-premium,
body:not(.platform-mode-monetized) .premium-badge-gold,
body:not(.platform-mode-monetized) .export-watermark-opt,
body:not(.platform-mode-monetized) .fork-policy-opt-locked,
body:not(.platform-mode-monetized) .visibility-opt-private,
body:not(.platform-mode-monetized) #rules-trial-status-banner,
body:not(.platform-mode-monetized) #template-visibility-form-group,
body:not(.platform-mode-monetized) .template-visibility-section,
body:not(.platform-mode-monetized) .template-visibility-radios,
body:not(.platform-mode-monetized) #ad-slot-leaderboard,
body:not(.platform-mode-monetized) #ad-slot-workspace,
body:not(.platform-mode-monetized) #ad-slot-export,
body:not(.platform-mode-monetized) .ad-container-slot,
body:not(.platform-mode-monetized) .ad-banner-workspace,
body:not(.platform-mode-monetized) .ad-slot-wrap {
  display: none !important;
}

/* 2-column grid in Beta mode for remaining fork policies */
body.platform-mode-beta .settings-fork-grid,
body:not(.platform-mode-monetized) .settings-fork-grid {
  grid-template-columns: repeat(2, 1fr) !important;
}

/* Full Monetized System: Restore all elements cleanly */
body.platform-mode-monetized #nav-btn-premium {
  display: inline-flex !important;
}
@media (max-width: 860px) {
  body.platform-mode-monetized #btn-mobile-premium {
    display: inline-flex !important;
  }
}
body.platform-mode-monetized #footer-link-premium {
  display: inline !important;
}
/* BuyMeACoffee Support Button — replaces Premium button in Free & Support Mode */
.btn-support-bmc {
  background: linear-gradient(135deg, #FFDD00, #FBBF24) !important;
  border: 1px solid rgba(255, 221, 0, 0.75) !important;
  color: #111827 !important;
  font-weight: 800 !important;
  box-shadow: 0 3px 12px rgba(255, 221, 0, 0.28);
}
.btn-support-bmc:hover {
  background: linear-gradient(135deg, #FFE438, #F59E0B) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 221, 0, 0.42);
}
.btn-hdr-bmc {
  background: rgba(255, 221, 0, 0.16) !important;
  border: 1px solid rgba(255, 221, 0, 0.55) !important;
  color: #FFDD00 !important;
  text-decoration: none;
}
.footer-support-bmc-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 221, 0, 0.14);
  border: 1px solid rgba(255, 221, 0, 0.45);
  color: #FFDD00 !important;
  font-weight: 800;
  font-size: 0.82rem;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease;
}
.footer-support-bmc-link:hover {
  background: rgba(255, 221, 0, 0.25);
  transform: translateY(-1px);
}
/* Hide header BuyMeACoffee button when Monetized mode is active or URL is not configured */
body.platform-mode-monetized #nav-btn-support-bmc,
body.platform-mode-monetized #btn-mobile-support-bmc,
body.platform-mode-monetized .mode-support-only,
body:not(.platform-mode-monetized) .mode-monetized-only,
[data-support-bmc-link][data-support-unconfigured="1"] {
  display: none !important;
}
/* Show mobile BuyMeACoffee button on mobile when in Free & Support mode */
@media (max-width: 860px) {
  body.platform-mode-beta #btn-mobile-support-bmc:not([data-support-unconfigured="1"]),
  body:not(.platform-mode-monetized) #btn-mobile-support-bmc:not([data-support-unconfigured="1"]) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
}
body.platform-mode-monetized .premium-badge-gold {
  display: inline-flex !important;
}
body.platform-mode-monetized .export-watermark-opt {
  display: flex !important;
}
body.platform-mode-monetized .fork-policy-opt-locked {
  display: flex !important;
}
body.platform-mode-monetized .visibility-opt-private {
  display: flex !important;
}
body.platform-mode-monetized #template-visibility-form-group,
body.platform-mode-monetized .template-visibility-section,
body.platform-mode-monetized .template-visibility-radios {
  display: flex !important;
}
body.platform-mode-monetized .settings-fork-grid {
  grid-template-columns: repeat(3, 1fr) !important;
}

/* Mobile-only header elements hidden on desktop */
.btn-hdr-mobile,
.mobile-top-search-bar {
  display: none !important;
}

/* Common Buttons */
.btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
}

.btn:active {
  transform: scale(0.96);
}

.btn-gold {
  background: linear-gradient(135deg, #d97706, #b45309);
  border-color: var(--gold);
  color: #fff;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.25);
}
.btn-gold:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 0 16px var(--gold-glow);
}

.btn-remix {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  border-color: #8b5cf6;
  color: #fff;
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.3);
  font-weight: 700;
}
.btn-remix:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #4338ca 100%);
  border-color: #a78bfa;
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.55);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(225, 29, 72, 0.18);
  border-color: rgba(225, 29, 72, 0.45);
  color: #fda4af;
}
.btn-danger:hover {
  background: rgba(225, 29, 72, 0.35);
  color: #fff;
  border-color: #f43f5e;
}

.btn-lang {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  font-weight: 800;
}
.btn-lang:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: #38bdf8;
  color: #fff;
}

/* Mode Switcher Toggle Button (Ranker vs Creator Studio) */
.btn-mode-toggle {
  font-weight: 800;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  user-select: none;
  cursor: pointer;
}

.btn-mode-toggle.mode-ranker {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.btn-mode-toggle.mode-ranker:hover {
  background: rgba(16, 185, 129, 0.3);
  border-color: #34d399;
  color: #fff;
  transform: scale(1.03);
}

.btn-mode-toggle.mode-creator {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.55);
  color: #fde047;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.btn-mode-toggle.mode-creator:hover {
  background: rgba(245, 158, 11, 0.35);
  border-color: #fbbf24;
  color: #fff;
  transform: scale(1.03);
}

/* Control Group (Tiers count selector 1 to 30) */
.control-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}

.control-group label {
  color: var(--text-muted);
  font-weight: 600;
}

.control-group select {
  background: #0f172a;
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--gold);
  padding: 0.2rem 0.25rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 900;
  text-align: center;
  outline: none;
  font-family: inherit;
  cursor: pointer;
  width: 78px;
  max-width: 82px;
}

.tiers-select-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  background: #0f172a;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 4px;
  width: 78px;
  max-width: 82px;
  height: 24px;
  cursor: pointer;
  box-sizing: border-box;
  user-select: none;
}

.tiers-select-wrapper .tier-display-num {
  color: var(--gold, #f59e0b);
  font-weight: 900;
  font-size: 0.82rem;
  line-height: 1;
}

.tiers-select-wrapper .tier-display-slots {
  color: #ffffff;
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1;
}

.tiers-select-wrapper select {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
}

.tiers-select-wrapper select option {
  background: #0f172a;
  color: #ffffff;
}

.tiers-select-wrapper:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.35);
}

.stepper-wrapper {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-tier-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--gold-light, #fef08a);
  border-radius: 4px;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
  user-select: none;
  padding: 0;
}

.btn-tier-step:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
  color: #fff;
  transform: scale(1.08);
}

.btn-tier-step:active {
  transform: scale(0.92);
  background: rgba(245, 158, 11, 0.45);
}

/* ==========================================================================
   APP WORKSPACE: DESKTOP SIDEBAR + CANVAS LAYOUT
   ========================================================================== */
.app-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  position: relative;
  overflow: hidden;
}

/* Actions Floating Palette (Desktop Side Dock / Mobile Above Pyramid) */
.workspace-actions-panel {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: rgba(11, 18, 32, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 0.5rem 0.4rem;
  border-radius: 9999px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  width: auto;
  box-sizing: border-box;
}

[dir="rtl"] .workspace-actions-panel {
  right: 1.25rem;
  left: auto;
}

.btn-action-icon {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1.15rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
  user-select: none;
  padding: 0;
}

.btn-action-icon:hover {
  transform: scale(1.15);
  z-index: 50;
}

/* Disabled State: Dimmed until at least 1 character is in the ranking */
.btn-action-icon.btn-disabled-ranking {
  opacity: 0.32 !important;
  filter: grayscale(0.85) !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  transform: none !important;
}

.btn-action-icon.btn-disabled-ranking:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* Tooltip on hover (Always points inwards towards canvas) */
.btn-action-icon::before {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  right: calc(100% + 10px) !important;
  left: auto !important;
  transform: translateY(-50%) scale(0.92);
  background: rgba(11, 18, 32, 0.96);
  color: #ffffff;
  padding: 0.32rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  border-radius: 6px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 100;
}

[dir="rtl"] .btn-action-icon::before {
  right: calc(100% + 10px) !important;
  left: auto !important;
}

.btn-action-icon:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) scale(1);
}

/* Distinct Vibrant Button Themes */
.btn-action-fork {
  background: linear-gradient(135deg, #0284c7, #06b6d4) !important;
  border-color: rgba(56, 189, 248, 0.5) !important;
}
.btn-action-fork:hover {
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.65) !important;
}

.btn-action-clear {
  background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
  border-color: rgba(248, 113, 113, 0.5) !important;
}
.btn-action-clear:hover {
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.65) !important;
}

.btn-action-export {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  border-color: rgba(251, 191, 36, 0.6) !important;
}
.btn-action-export:hover {
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.7) !important;
}

.btn-action-share {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
  border-color: rgba(96, 165, 250, 0.5) !important;
}
.btn-action-share:hover {
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.65) !important;
}

.btn-action-autofill {
  background: linear-gradient(135deg, #a855f7, #7c3aed) !important;
  border-color: rgba(192, 132, 252, 0.5) !important;
}
.btn-action-autofill:hover {
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.65) !important;
}

.btn-action-remix {
  background: linear-gradient(135deg, #10b981, #047857) !important;
  border-color: rgba(52, 211, 153, 0.5) !important;
}
.btn-action-remix:hover {
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.65) !important;
}

/* Left Canvas Area */
.pyramid-section {
  flex: 1;
  height: 100%;
  overflow-x: auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 1rem 3rem 1rem;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  position: relative;
}

/* Floating Zoom & Controls Toolbar */
.viewport-floating-toolbar {
  position: sticky;
  top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  z-index: 30;
  pointer-events: none;
  margin-bottom: 0.75rem;
}

.floating-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(11, 18, 32, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 99px;
  padding: 0.25rem 0.55rem;
  pointer-events: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.tool-btn {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-muted);
  font-size: 0.76rem;
  padding: 0.2rem 0.45rem;
  border-radius: 99px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-family: inherit;
  font-weight: 700;
  transition: all 0.15s ease;
}
.tool-btn:hover {
  color: var(--gold-light);
  background: rgba(245, 158, 11, 0.12);
}
.tool-btn.active {
  color: var(--gold);
  background: rgba(245, 158, 11, 0.2);
}

.tool-btn.tool-btn-download {
  color: var(--gold-light);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 0.2rem 0.65rem;
}
.tool-btn.tool-btn-download:hover {
  background: rgba(245, 158, 11, 0.28);
  color: #fff;
  transform: translateY(-1px);
}

.zoom-indicator {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--gold-light);
  min-width: 38px;
  text-align: center;
}

.pyramid-wrapper {
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
  transform-origin: top center;
}

/* ==========================================================================
   THE EXPORT NODE
   ========================================================================== */
#pyramid-export-node {
  background: radial-gradient(ellipse at center, rgba(17, 24, 39, 0.95), rgba(7, 13, 24, 0.98));
  border: 2px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.15);
  border-radius: 18px;
  padding: 1.5rem 3.5rem 2rem 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  min-width: 320px;
  width: fit-content;
  max-width: max-content;
  box-sizing: border-box;
}

.pyramid-title-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  width: 100%;
}

.pyramid-description-display {
  width: 100%;
  max-width: 680px;
  margin: 0 auto 0.65rem;
  padding: 0 0.75rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: pre-line;
  word-break: break-word;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}

.cover-card-choice {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  background: #000;
  transition: all 0.15s ease;
}

.cover-card-choice:hover,
.cover-card-choice.active {
  border-color: var(--gold);
  transform: scale(1.08);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.cover-card-choice img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pyramid-title-input {
  background: transparent;
  border: 1px dashed rgba(245, 158, 11, 0.4);
  color: var(--gold-light);
  font-weight: 900;
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  text-align: center;
  padding: 0.35rem 1rem;
  border-radius: 8px;
  outline: none;
  font-family: inherit;
  transition: var(--transition);
  max-width: 90%;
  box-sizing: border-box;
  cursor: text;
}

.pyramid-title-input[readonly] {
  border-color: transparent;
  cursor: default;
}

.pyramid-title-input:not([readonly]):hover {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.05);
}

.pyramid-title-input:focus {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 15px var(--gold-glow);
}

.pyramid-banner-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 550px;
  margin-top: -0.2rem;
  margin-bottom: 0.35rem;
}

.pyramid-rows-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0 45px;
  box-sizing: border-box;
}

.pyramid-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  position: relative;
}

.pyramid-row-badge {
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold-light);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  text-align: center;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  z-index: 5;
}

html[dir="rtl"] .pyramid-row-badge {
  right: auto;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
}

.pyramid-row-badge.badge-side-right {
  left: calc(100% + 8px) !important;
  right: auto !important;
}
.pyramid-row-badge.badge-side-left {
  right: calc(100% + 8px) !important;
  left: auto !important;
}

.pyramid-row-badge:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--gold);
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 0 10px var(--gold-glow);
}

/* ==========================================================================
   DYNAMIC ASPECT-RATIO SLOTS (Default 1:1, Supports 16:9, 3:4, 4:3, Custom)
   ========================================================================== */
.slot {
  --slot-base-h: 72px;
  height: var(--slot-base-h);
  width: calc(var(--slot-base-h) * var(--card-aspect-ratio-num, 1));
  aspect-ratio: var(--card-aspect-ratio, 1 / 1);
  box-sizing: border-box;
  background: var(--slot-bg);
  border: 2px dashed var(--slot-border);
  border-radius: var(--radius-md);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
  flex-grow: 0;
}

.pyramid-row:first-of-type .slot {
  --slot-base-h: 90px;
  height: var(--slot-base-h);
  width: calc(var(--slot-base-h) * var(--card-aspect-ratio-num, 1));
  aspect-ratio: var(--card-aspect-ratio, 1 / 1);
  box-sizing: border-box;
  border: 3px solid var(--gold);
  box-shadow: 0 0 20px var(--gold-glow);
  background: rgba(245, 158, 11, 0.1);
  border-radius: 12px;
}


/* Auto-Scaling for Large Pyramids (9 to 30 Tiers) */
.pyramid-large .slot {
  --slot-base-h: 60px;
  border-radius: 8px;
}
.pyramid-large .pyramid-row:first-of-type .slot {
  --slot-base-h: 78px;
}

.pyramid-huge .slot {
  --slot-base-h: 48px;
  border-radius: 6px;
}
.pyramid-huge .pyramid-row:first-of-type .slot {
  --slot-base-h: 64px;
}

.pyramid-ultra .slot {
  --slot-base-h: 38px;
  border-radius: 4px;
}
.pyramid-ultra .pyramid-row:first-of-type .slot {
  --slot-base-h: 50px;
}

.pyramid-mega .slot {
  --slot-base-h: 26px;
  border-radius: 3px;
}
.pyramid-mega .pyramid-row:first-of-type .slot {
  --slot-base-h: 36px;
}

.slot:hover {
  border-color: var(--gold);
  box-shadow: 0 0 14px var(--gold-glow);
  transform: scale(1.05);
  z-index: 2;
}

.slot.drag-over {
  border-color: #38bdf8;
  background: rgba(2, 132, 199, 0.25) !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.6);
  transform: scale(1.1);
}

.slot.selected-slot {
  border-color: #22c55e !important;
  border-style: solid !important;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.6) !important;
  animation: slotPulse 1.2s infinite alternate;
}

@keyframes slotPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}

.slot-empty-icon {
  font-size: 1.2rem;
  color: rgba(245, 158, 11, 0.35);
  font-weight: 900;
  pointer-events: none;
}

.pyramid-row:first-of-type .slot-empty-icon {
  font-size: 2rem;
  color: var(--gold-light);
}

.slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%; /* Same crop focus as the dock card (.char-card img) so the picture looks identical in the cell */
  display: block;
  pointer-events: none;
}

.slot .char-card-canvas {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #fff;
  text-align: center;
  padding: 4px;
}

.slot .char-card-canvas .canvas-name {
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.15;
  word-break: break-word;
  text-shadow: 0 2px 6px rgba(0,0,0,0.9);
}

.slot .char-card-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: var(--cls-min-h, 26%);
  padding: var(--cls-pad, 6px 4px 3px 4px);
  background: var(--cls-bg, linear-gradient(to top, rgba(7, 13, 24, 0.94) 0%, rgba(7, 13, 24, 0.78) 68%, rgba(7, 13, 24, 0) 100%));
  backdrop-filter: var(--cls-blur, none);
  -webkit-backdrop-filter: var(--cls-blur, none);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  box-sizing: border-box;
  font-size: 0.65rem;
  font-weight: var(--cls-weight, 700);
  text-align: center;
  line-height: var(--cls-line-height, 1.15);
  letter-spacing: var(--cls-letter-spacing, 0px);
  text-shadow: var(--cls-text-shadow, 0 1px 3px rgba(0, 0, 0, 0.9));
  overflow: hidden;
  unicode-bidi: plaintext;
  z-index: 2;
  color: var(--cls-color, #fff);
  pointer-events: none;
}

.slot .char-card-label .char-card-label-text {
  display: block;
  width: 100%;
  max-width: 100%;
  text-align: center;
  overflow: hidden;
  unicode-bidi: plaintext;
}

.slot .remove-btn {
  position: absolute;
  top: clamp(1px, calc(var(--slot-base-h, 72px) * 0.04), 3px);
  width: clamp(11px, calc(var(--slot-base-h, 72px) * 0.22), 18px);
  height: clamp(11px, calc(var(--slot-base-h, 72px) * 0.22), 18px);
  background: rgba(225, 29, 72, 0.95);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(8px, calc(var(--slot-base-h, 72px) * 0.13), 11px);
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  z-index: 5;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

html[dir="rtl"] .slot .remove-btn {
  right: auto;
  left: clamp(1px, calc(var(--slot-base-h, 72px) * 0.04), 3px);
}

html[dir="ltr"] .slot .remove-btn {
  left: auto;
  right: clamp(1px, calc(var(--slot-base-h, 72px) * 0.04), 3px);
}

.slot:hover .remove-btn,
.slot.selected-slot .remove-btn {
  opacity: 1;
}

/* Dense tier scaling for remove button */
.pyramid-large .slot .remove-btn {
  width: 14px;
  height: 14px;
  font-size: 10px;
  top: 2px;
}
html[dir="rtl"] .pyramid-large .slot .remove-btn { left: 2px; }
html[dir="ltr"] .pyramid-large .slot .remove-btn { right: 2px; }

.pyramid-huge .slot .remove-btn {
  width: 12px;
  height: 12px;
  font-size: 9px;
  top: 1px;
}
html[dir="rtl"] .pyramid-huge .slot .remove-btn { left: 1px; }
html[dir="ltr"] .pyramid-huge .slot .remove-btn { right: 1px; }

.pyramid-ultra .slot .remove-btn {
  width: 11px;
  height: 11px;
  font-size: 8px;
  top: 1px;
}
html[dir="rtl"] .pyramid-ultra .slot .remove-btn { left: 1px; }
html[dir="ltr"] .pyramid-ultra .slot .remove-btn { right: 1px; }

/* Scaled Mystery Button on opposite corner */
.slot .mystery-btn {
  position: absolute;
  top: clamp(1px, calc(var(--slot-base-h, 72px) * 0.04), 3px);
  width: clamp(11px, calc(var(--slot-base-h, 72px) * 0.22), 18px);
  height: clamp(11px, calc(var(--slot-base-h, 72px) * 0.22), 18px);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(7px, calc(var(--slot-base-h, 72px) * 0.12), 10px);
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  z-index: 5;
}

html[dir="rtl"] .slot .mystery-btn {
  left: auto;
  right: clamp(1px, calc(var(--slot-base-h, 72px) * 0.04), 3px);
}
html[dir="ltr"] .slot .mystery-btn {
  right: auto;
  left: clamp(1px, calc(var(--slot-base-h, 72px) * 0.04), 3px);
}

.slot:hover .mystery-btn,
.slot.selected-slot .mystery-btn {
  opacity: 1;
}

/* Dense tier scaling for mystery button */
.pyramid-large .slot .mystery-btn {
  width: 14px;
  height: 14px;
  font-size: 9px;
  top: 2px;
}
html[dir="rtl"] .pyramid-large .slot .mystery-btn { right: 2px; left: auto; }
html[dir="ltr"] .pyramid-large .slot .mystery-btn { left: 2px; right: auto; }

.pyramid-huge .slot .mystery-btn {
  width: 12px;
  height: 12px;
  font-size: 8px;
  top: 1px;
}
html[dir="rtl"] .pyramid-huge .slot .mystery-btn { right: 1px; left: auto; }
html[dir="ltr"] .pyramid-huge .slot .mystery-btn { left: 1px; right: auto; }

.pyramid-ultra .slot .mystery-btn {
  width: 11px;
  height: 11px;
  font-size: 7px;
  top: 1px;
}
html[dir="rtl"] .pyramid-ultra .slot .mystery-btn { right: 1px; left: auto; }
html[dir="ltr"] .pyramid-ultra .slot .mystery-btn { left: 1px; right: auto; }

/* On Touch/Mobile screens without mouse hover: keep control icons softly visible */
@media (hover: none) and (pointer: coarse) {
  .slot.has-card .remove-btn,
  .slot.has-card .mystery-btn {
    opacity: 0.82;
  }
}

/* Mystery / Hidden slot styling */
.slot.mystery-mode {
  background: linear-gradient(135deg, #1b263b 0%, #0d1b2a 100%) !important;
  border-color: #f4a261 !important;
  box-shadow: 0 0 15px rgba(244, 162, 97, 0.4) !important;
}

.slot.mystery-mode img,
.slot.mystery-mode .char-card-canvas,
.slot.mystery-mode .char-card-label {
  display: none !important;
}

.slot .mystery-badge {
  display: none;
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  animation: pulseMystery 2s infinite ease-in-out;
  z-index: 3;
}

.slot.mystery-mode .mystery-badge {
  display: flex;
}

.slot .mystery-num {
  font-size: 1.15rem;
  font-weight: 900;
  color: #fff;
  background: rgba(230, 57, 70, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 1px 7px;
  border-radius: 12px;
  margin-bottom: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  font-family: var(--font-cinzel), monospace, sans-serif;
}

.slot .mystery-icon {
  font-size: 1.5rem;
  font-weight: 900;
  color: #f4a261;
  text-shadow: 0 0 10px rgba(244, 162, 97, 0.8);
}

.pyramid-large .slot .mystery-num {
  font-size: 0.95rem;
  padding: 0 5px;
}

.pyramid-large .slot .mystery-icon {
  font-size: 1.25rem;
}

.pyramid-huge .slot .mystery-num {
  font-size: 0.8rem;
  padding: 0 4px;
}

.pyramid-huge .slot .mystery-icon {
  font-size: 1rem;
}

.pyramid-ultra .slot .mystery-num {
  font-size: 0.7rem;
  padding: 0 3px;
}

.pyramid-ultra .slot .mystery-icon {
  font-size: 0.85rem;
}

@keyframes pulseMystery {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* ==========================================================================
   DESKTOP RIGHT SIDE DRAWER (380px) & MOBILE BOTTOM DRAWER
   ========================================================================== */
.drawer-section {
  width: 380px;
  background: rgba(11, 18, 32, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-inline-start: 1px solid rgba(245, 158, 11, 0.25);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 40;
  height: 100%;
}

.drawer-header {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-shrink: 0;
}

.mobile-drawer-handle {
  display: none;
  width: 48px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  margin: 0.2rem auto 0.2rem auto;
  cursor: pointer;
}

/* Search Row */
.drawer-search-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
}

.drawer-search-box {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.drawer-search-box input {
  width: 100%;
  height: 32px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fff;
  padding: 0 0.6rem 0 1.8rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}

html[dir="rtl"] .drawer-search-box input {
  padding: 0 1.8rem 0 0.6rem;
}

.drawer-search-box input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 10px var(--gold-glow);
  background: rgba(255, 255, 255, 0.1);
}

.drawer-search-icon {
  position: absolute;
  left: 0.55rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  pointer-events: none;
}

html[dir="rtl"] .drawer-search-icon {
  left: auto;
  right: 0.55rem;
}

/* Action Buttons Row (Responsive with no text clipping) */
.drawer-actions-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  box-sizing: border-box;
}

.drawer-actions-row .btn {
  flex: 1 1 0;
  padding: 0.35rem 0.2rem;
  font-size: 0.72rem;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 32px;
}

.drawer-actions-row .btn-icon-only {
  flex: 0 0 32px;
  padding: 0.35rem;
  font-size: 0.85rem;
}

/* Category Filter Pills (Horizontal Single-Row Scrollable Track with Mouse Wheel Navigation) */
.filter-tabs {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: 0.45rem;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  white-space: nowrap !important;
  padding: 6px 4px 8px 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 158, 11, 0.55) rgba(255, 255, 255, 0.06);
  width: 100%;
  box-sizing: border-box;
  scroll-behavior: smooth;
}
.filter-tabs::-webkit-scrollbar {
  height: 5px; /* Horizontal scrollbar thickness */
}
.filter-tabs::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
}
.filter-tabs::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, 0.5);
  border-radius: 4px;
}
.filter-tabs::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

.filter-pill {
  padding: 0.22rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: inherit;
  flex-shrink: 0;
  line-height: 1.2;
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.filter-pill.active {
  background: var(--gold);
  color: #070d18;
  border-color: var(--gold);
  font-weight: 800;
  box-shadow: 0 2px 8px var(--gold-glow);
}

.filter-pill .pill-count {
  font-size: 0.62rem;
  padding: 0.05rem 0.32rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
}

.filter-pill.active .pill-count {
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
}

.filter-pill-add {
  border-style: dashed;
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--gold-light);
}

/* Cards Grid Inside Drawer (Scrollable Grid on PC) */
.cards-grid {
  flex: 1;
  overflow-y: auto;
  padding: 0.65rem;
  padding-bottom: 4rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(76px * var(--card-aspect-ratio-num, 1)), 1fr));
  grid-auto-rows: max-content;
  gap: 0.55rem;
  align-content: flex-start;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* CARD IN DRAWER (Dynamic Aspect Ratio, Defaults to 1:1) */
.char-card {
  width: 100%;
  aspect-ratio: var(--card-aspect-ratio, 1 / 1);
  position: relative;
  background: #0f172a;
  border: 1.5px solid var(--card-border);
  border-radius: 8px;
  overflow: hidden;
  cursor: grab;
  transition: var(--transition);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.char-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 14px var(--gold-glow);
  z-index: 10;
}

.char-card:active {
  cursor: grabbing;
  transform: scale(0.96);
}

.char-card.in-pyramid {
  opacity: 0.55;
  filter: grayscale(40%);
}

.char-card.in-pyramid::before {
  content: '✓';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  background: #22c55e;
  color: #fff;
  border-radius: 50%;
  font-size: 0.55rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

html[dir="rtl"] .char-card.in-pyramid::before {
  left: auto;
  right: 2px;
}

.char-card.selected-dock-card {
  border-color: var(--gold-light) !important;
  box-shadow: 0 0 0 3px var(--gold), 0 0 18px var(--gold-glow) !important;
  transform: translateY(-4px) scale(1.06);
  animation: pulseSquareCard 1.4s infinite;
}

@keyframes pulseSquareCard {
  0%, 100% { transform: translateY(-4px) scale(1.06); }
  50% { transform: translateY(-6px) scale(1.1); }
}

.char-card img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  display: block;
  pointer-events: none;
}

.char-card .char-card-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #fff;
  text-align: center;
  padding: 4px;
}

.char-card .canvas-name {
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.15;
  word-break: break-word;
  text-shadow: 0 2px 6px rgba(0,0,0,0.9);
}

.char-card .char-card-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 3px 2px 3px;
  background: var(--cls-dock-bg, linear-gradient(to top, rgba(7, 13, 24, 0.92) 0%, rgba(7, 13, 24, 0.72) 65%, transparent 100%));
  font-size: var(--cls-dock-font, 9.5px);
  font-weight: var(--cls-weight, 700);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  unicode-bidi: plaintext; /* English names in RTL page: cut at the end, not the start */
  z-index: 2;
  color: var(--cls-color, #fff);
  text-shadow: var(--cls-text-shadow, 0 1px 2px rgba(0, 0, 0, 0.85));
  line-height: 1.25;
  pointer-events: none;
}

.char-card .dock-card-menu-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 8;
}

html[dir="rtl"] .char-card .dock-card-menu-btn {
  right: auto;
  left: 2px;
}

.char-card .dock-card-delete-btn {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: rgba(220, 38, 38, 0.88);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
  z-index: 8;
}

html[dir="rtl"] .char-card .dock-card-delete-btn {
  left: auto;
  right: 2px;
}

.char-card:hover .dock-card-menu-btn,
.char-card:hover .dock-card-delete-btn {
  opacity: 1;
}

.char-card .dock-card-menu-btn:hover {
  background: var(--gold);
  color: #000;
  transform: scale(1.15);
}

.char-card .dock-card-delete-btn:hover {
  background: #ef4444;
  transform: scale(1.15);
}

@media (hover: none) {
  .char-card .dock-card-menu-btn,
  .char-card .dock-card-delete-btn {
    opacity: 0.85;
  }
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.84);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.modal-backdrop.open {
  display: flex;
  animation: modalFadeIn 0.2s ease-out;
}

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

.modal-box {
  background: #0d1627;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 16px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.8), 0 0 25px rgba(245, 158, 11, 0.15);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 50%;
  line-height: 1;
}
.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px var(--gold-glow);
}

.form-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 110px;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  max-height: 125px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  box-sizing: border-box;
}

.suggestions-grid::-webkit-scrollbar {
  width: 6px;
}
.suggestions-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 9999px;
}
.suggestions-grid::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, 0.35);
  border-radius: 9999px;
}
.suggestions-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(245, 158, 11, 0.65);
}

.suggestion-card {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  background: #000;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease-in-out;
  box-sizing: border-box;
}

.suggestion-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 4px 12px var(--gold-glow);
}

.suggestion-card.selected {
  border: 2px solid var(--gold) !important;
  box-shadow: 0 0 14px var(--gold-glow);
}

.suggestion-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Toast */
#toast-notification {
  position: fixed;
  top: 18px;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%) translateY(-25px);
  background: rgba(11, 18, 32, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 0.65rem 1.15rem;
  color: var(--gold-light);
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85), 0 0 18px rgba(245, 158, 11, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
  z-index: 999999 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.45rem;
  max-width: min(92vw, 440px);
  box-sizing: border-box;
  line-height: 1.45;
  word-break: break-word;
}

/* Character Card Edit Modal Layout (Clean, Headerless, Compact Studio) */
#modal-edit-card .modal-header {
  display: none !important;
}
#modal-edit-card .modal-box {
  padding-top: 0.75rem !important;
}
/* Card editor: 3 image-source buttons side by side */
.edit-card-source-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.edit-card-source-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.4rem;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
  min-width: 0;
}

.edit-card-top-section {
  display: flex;
  gap: 0.85rem;
  align-items: stretch;
  width: 100%;
}
.edit-card-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.edit-card-avatar-box {
  width: 78px;
  height: 78px;
  border-radius: 12px;
  border: 2px solid rgba(245, 158, 11, 0.6);
  background: rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}
.edit-card-avatar-label {
  display: none;
}
.edit-card-fields-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.35rem;
  min-width: 0;
}
.edit-card-name-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
}
.edit-card-category-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
}
#btn-apply-card-url {
  min-width: 38px !important;
  width: 38px !important;
  height: 34px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.15rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
  background: #f59e0b !important;
  color: #0b1120 !important;
  border: none !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer !important;
}
#btn-apply-card-url:hover {
  background: #fbbf24 !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5) !important;
}
.edit-card-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.35rem;
  background: rgba(15, 23, 42, 0.8);
}
.edit-card-footer-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Inline In-Place Tier Label Editing */
.inline-tier-edit-input {
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid var(--gold, #f59e0b);
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  padding: 1px 4px;
  min-width: 40px;
  max-width: 140px;
  outline: none;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
  box-sizing: border-box;
}

.btn-action-icon.active {
  background: rgba(245, 158, 11, 0.25) !important;
  border-color: var(--gold) !important;
  color: var(--gold) !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4) !important;
}

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

/* Touch Ghost Clone */
.touch-drag-ghost {
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--gold);
  box-shadow: 0 10px 30px rgba(0,0,0,0.8), 0 0 20px var(--gold-glow);
  /* The clone lives in <body>, outside .cards-grid: without this the dock card's
     "padding-bottom: 100%" is measured against the whole screen width => tall stretched ghost */
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  aspect-ratio: 1 / 1;
  animation: none !important;
}
.touch-drag-ghost img,
.touch-drag-ghost .char-card-canvas {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}
.touch-drag-ghost .remove-btn,
.touch-drag-ghost .mystery-btn,
.touch-drag-ghost .dock-card-menu-btn,
.touch-drag-ghost .dock-card-delete-btn {
  display: none !important;
}

/* ==========================================================================
   MOBILE RESPONSIVE (Transforms Sidebar Drawer into Fixed Bottom Drawer)
   ========================================================================== */
/* ==========================================================================
   MOBILE-ONLY CONTROLS (HIDDEN ON DESKTOP BY DEFAULT)
   ========================================================================== */
.mobile-canvas-floating-controls,
.mobile-fab-container,
.mobile-floating-save-btn,
.btn-dock-add-mobile {
  display: none !important;
}

.unsaved-pulse-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #0b1220;
  box-shadow: 0 0 8px #ef4444;
  pointer-events: none;
  animation: pulseUnsavedDot 1.4s infinite;
}
@keyframes pulseUnsavedDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.78; }
}

@media (max-width: 860px) {
  /* 1. Header: Compact, clean single line without overflow */
  .app-header {
    padding: 0.35rem 0.65rem !important;
    min-height: 48px !important;
    gap: 0.4rem !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
    overflow-x: hidden !important;
    justify-content: space-between !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .brand-section {
    gap: 0.35rem !important;
    flex-shrink: 0 !important;
  }
  .brand-subtitle {
    display: none !important;
  }
  .brand-title {
    font-size: 0.92rem !important;
    white-space: nowrap !important;
  }
  /* Hide desktop-only bulky headers on mobile in both homepage and workspace */
  body .header-home-items,
  body .header-workspace-items,
  body.in-workspace-view .header-home-items,
  body.in-workspace-view .header-workspace-items {
    display: none !important;
  }
  .header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    flex-wrap: nowrap !important;
    flex-shrink: 0 !important;
  }
  .btn-hdr-mobile {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 9px !important;
    font-size: 14px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #e2e8f0 !important;
    cursor: pointer !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    transition: transform 0.15s ease, background 0.15s ease !important;
  }
  .btn-hdr-mobile:active {
    transform: scale(0.92) !important;
    background: rgba(245, 158, 11, 0.2) !important;
    border-color: var(--gold) !important;
  }
  .btn-hdr-gold {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(217, 119, 6, 0.45)) !important;
    border-color: var(--gold) !important;
    color: var(--gold-light) !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3) !important;
    font-weight: 900 !important;
  }
  .btn-hdr-mobile-publish {
    display: none !important;
  }
  .btn-hdr-mobile-publish.is-active-mobile-publish {
    display: flex !important;
  }
  #btn-mobile-create-template.is-replaced-by-publish {
    display: none !important;
  }
  body.in-workspace-view #btn-mobile-premium {
    display: none !important;
  }
  .btn-lang {
    padding: 0 6px !important;
    font-size: 0.78rem !important;
    font-weight: 800 !important;
    min-width: 32px !important;
    height: 32px !important;
    border-radius: 9px !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--gold) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }
  .btn-auth-login {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    font-size: 0.95rem !important;
    white-space: nowrap !important;
    border-radius: 9px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .btn-auth-login span:last-child {
    display: none !important;
  }

  /* Compact User Profile Button on Mobile Header */
  .user-profile-widget {
    position: relative !important;
  }
  .user-pill-btn {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    border-radius: 9px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    color: var(--gold) !important;
  }
  .user-pill-btn .user-name-text,
  .user-pill-btn .dropdown-arrow-icon,
  .user-pill-btn .user-role-badge,
  .user-pill-btn .user-role-tag {
    display: none !important;
  }
  .user-pill-btn .user-avatar-badge {
    width: 26px !important;
    height: 26px !important;
    border-radius: 7px !important;
    font-size: 0.85rem !important;
    overflow: hidden !important;
  }
  .user-pill-btn .user-avatar-badge img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 7px !important;
    object-fit: cover !important;
  }

  /* Fixed & Non-Clipped User Profile Dropdown Menu on Mobile */
  .user-dropdown-menu {
    position: fixed !important;
    top: 52px !important;
    left: 8px !important;
    right: auto !important;
    width: 290px !important;
    max-width: calc(100vw - 16px) !important;
    background: #0b1220 !important;
    opacity: 1 !important;
    animation: none !important;
    z-index: 9999 !important;
    box-sizing: border-box !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(245, 158, 11, 0.35) !important;
  }
  html[dir="ltr"] .user-dropdown-menu {
    left: auto !important;
    right: 8px !important;
  }

  /* Slide-down mobile search bar (Hidden by default, shown when .open) */
  .mobile-top-search-bar {
    display: none !important;
    position: relative !important;
    background: #0b1220 !important;
    border-bottom: 1px solid rgba(245, 158, 11, 0.35) !important;
    padding: 0.45rem 0.65rem !important;
    align-items: center !important;
    gap: 0.5rem !important;
    z-index: 1100 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6) !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }
  .mobile-top-search-bar.open {
    display: flex !important;
    animation: none !important;
    opacity: 1 !important;
  }
  .mobile-top-search-inner {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    width: 100% !important;
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 8px !important;
    padding: 0.25rem 0.6rem !important;
  }
  .mobile-top-search-inner:focus-within {
    border-color: var(--gold) !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
  }
  .mobile-search-lens {
    font-size: 13px !important;
    opacity: 0.7 !important;
  }
  #mobile-top-search-input {
    flex: 1 !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: #fff !important;
    font-size: 0.82rem !important;
    font-family: inherit !important;
  }
  .btn-search-close {
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    font-size: 14px !important;
    cursor: pointer !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
  }
  .btn-search-close:active {
    color: #fff !important;
  }

  /* Library icon inside mobile search bar */
  .btn-search-library {
    background: rgba(245, 158, 11, 0.16) !important;
    border: 1.5px solid rgba(245, 158, 11, 0.65) !important;
    border-radius: 8px !important;
    color: #f59e0b !important;
    font-size: 16px !important;
    cursor: pointer !important;
    padding: 3px 8px !important;
    min-width: 36px !important;
    height: 32px !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.25) !important;
    transition: all 0.15s ease !important;
  }
  .btn-search-library:active {
    background: rgba(245, 158, 11, 0.35) !important;
    transform: scale(0.93) !important;
  }

  /* 2. Workspace & Canvas Layout */
  .app-workspace {
    flex-direction: column !important;
    overflow: hidden !important;
    position: relative !important;
    height: calc(100vh - 48px) !important;
    height: calc(100dvh - 48px) !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Fixed & Locked Pyramid Section: NO HORIZONTAL SWIMMING OR PANNING */
  .pyramid-section {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important; /* STRICTLY LOCKED HORIZONTALLY */
    padding: 44px 6px 175px 6px !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  /* Locked Pyramid Wrapper (Centering, No transform scale overflow) */
  .pyramid-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    transform: none !important;
    box-sizing: border-box !important;
  }

  /* Locked Export Node / Pyramid Frame: Fits inside screen 100% */
  #pyramid-export-node {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
    padding: 0.65rem 0.35rem 0.85rem 0.35rem !important;
    border-radius: 14px !important;
    gap: 0.4rem !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  /* Locked Rows Container (Always dead-center, balanced alternating badges) */
  .pyramid-rows-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: var(--mobile-row-gap, 4px) !important;
    box-sizing: border-box !important;
    transform: none !important;
  }

  /* Locked Rows */
  .pyramid-row {
    width: max-content !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: var(--mobile-row-gap, 4px) !important;
  }

  /* DYNAMICALLY RESPONSIVE MOBILE SLOTS (Scales with added/removed tiers & aspect ratio) */
  .slot {
    height: var(--mobile-slot-size, 52px) !important;
    width: calc(var(--mobile-slot-size, 52px) * var(--card-aspect-ratio-num, 1)) !important;
    min-width: unset !important;
    max-width: unset !important;
    min-height: unset !important;
    max-height: unset !important;
    aspect-ratio: var(--card-aspect-ratio, 1 / 1) !important;
    border-radius: clamp(5px, calc(var(--mobile-slot-size, 52px) * 0.16), 10px) !important;
    border-width: 1.5px !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
  }

  .pyramid-row:first-of-type .slot {
    height: var(--mobile-apex-size, 62px) !important;
    width: calc(var(--mobile-apex-size, 62px) * var(--card-aspect-ratio-num, 1)) !important;
    min-width: unset !important;
    max-width: unset !important;
    min-height: unset !important;
    max-height: unset !important;
    aspect-ratio: var(--card-aspect-ratio, 1 / 1) !important;
    border-width: 2.5px !important;
    border-radius: clamp(6px, calc(var(--mobile-apex-size, 62px) * 0.18), 12px) !important;
  }

  .slot .slot-empty-icon {
    font-size: clamp(12px, calc(var(--mobile-slot-size, 52px) * 0.42), 26px) !important;
  }

  /* Card label & overlay sizing on mobile is driven dynamically by js/card-label-style.js (--cls-*) */
  .slot .char-card-label {
    min-height: var(--cls-min-h, 26%);
    padding: var(--cls-pad, 6px 4px 3px 4px);
  }

  .pyramid-description-display {
    font-size: 0.76rem !important;
    margin: 0 auto 0.45rem !important;
    padding: 0 0.5rem !important;
  }

  .slot .mystery-num {
    font-size: clamp(8px, calc(var(--mobile-slot-size, 52px) * 0.22), 12px) !important;
  }

  .slot .mystery-badge {
    gap: 2px !important;
  }

  /* Mobile Tier Row Badge (Controlled dynamically via toggle button, 100% inside frame) */
  .pyramid-row-badge {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: clamp(8px, calc(var(--mobile-slot-size, 52px) * 0.22), 10.5px) !important;
    padding: 2px 5px !important;
    min-width: 18px !important;
    max-width: none !important;
    width: max-content !important;
    text-align: center !important;
    border-radius: 7px !important;
    z-index: 10 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
  .pyramid-row-badge.badge-side-right {
    left: calc(100% + 5px) !important;
    right: auto !important;
  }
  .pyramid-row-badge.badge-side-left {
    right: calc(100% + 5px) !important;
    left: auto !important;
  }
  html[dir="rtl"] .pyramid-row-badge:not(.badge-side-left):not(.badge-side-right) {
    right: auto !important;
    left: calc(100% + 5px) !important;
  }
  html[dir="ltr"] .pyramid-row-badge:not(.badge-side-left):not(.badge-side-right) {
    left: auto !important;
    right: calc(100% + 5px) !important;
  }

  /* Hide Desktop Middle Toolbars */
  .workspace-actions-panel {
    display: none !important;
  }
  .viewport-floating-toolbar {
    display: none !important;
  }

  /* 3. In-Canvas Floating Controls (Purely floating, but FIXED in position while scrolling) */
  .mobile-canvas-floating-controls {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    position: fixed !important;
    top: 54px !important;
    left: 0 !important;
    right: 0 !important;
    padding: 0 12px !important;
    pointer-events: none !important;
    z-index: 99 !important;
    box-sizing: border-box !important;
  }

  /* Dock messages (empty / all placed): centered inside the one-line mobile deck */
  .cards-grid .empty-pool-tip {
    flex: 1 0 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    height: 66px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    text-align: center !important;
    white-space: normal !important;
    line-height: 1.3 !important;
    font-size: 0.85rem !important;
    box-sizing: border-box !important;
  }
  .cards-grid .empty-pool-tip > div {
    margin: 0 !important;
  }
  .cards-grid .empty-pool-tip .empty-add-cards-btn {
    font-size: 0.85rem !important;
    padding: 0.4rem 1rem !important;
    margin: 0 !important;
  }
  .cards-grid .empty-pool-tip #btn-load-sample {
    margin-top: 4px !important;
    font-size: 0.68rem !important;
    padding: 0.15rem 0.6rem !important;
    background: transparent !important;
    color: var(--gold-light) !important;
    border: 1px dashed rgba(245, 158, 11, 0.4) !important;
    box-shadow: none !important;
  }

  /* Persistent tip: only for desktop/web, hidden on mobile */
  .dock-persistent-tip {
    display: none !important;
  }

  /* Workspace Ad slot inside Pyramid frame */
  #pyramid-export-node .ad-container-slot,
  #pyramid-export-node #ad-slot-workspace {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0.65rem auto 0.2rem auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  /* Mobile Top Search Dropdown */
  .mobile-top-search-dropdown {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    background: #0b1220 !important;
    border-bottom: 1px solid rgba(245, 158, 11, 0.35) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.95) !important;
    max-height: 60vh !important;
    overflow-y: auto !important;
    padding: 0.5rem !important;
    z-index: 1200 !important;
  }

  .stepper-floating-mobile {
    pointer-events: auto !important;
    display: flex !important;
    align-items: center !important;
    background: rgba(15, 23, 42, 0.88) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    border-radius: 9px !important;
    height: 32px !important;
    padding: 0 2px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5) !important;
  }
  .btn-tier-step-mobile {
    width: 24px !important;
    height: 26px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 900 !important;
    font-size: 15px !important;
    color: var(--gold) !important;
    background: transparent !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
  }
  .btn-tier-step-mobile:active {
    background: rgba(245, 158, 11, 0.25) !important;
  }
  .tier-val-mobile {
    font-weight: 900 !important;
    font-size: 13px !important;
    color: #fff !important;
    min-width: 20px !important;
    text-align: center !important;
  }

  .canvas-actions-mobile {
    pointer-events: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }
  .btn-canvas-mobile {
    width: 34px !important;
    height: 32px !important;
    border-radius: 9px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 15px !important;
    background: rgba(15, 23, 42, 0.88) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #f1f5f9 !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5) !important;
    cursor: pointer !important;
  }
  .btn-canvas-mobile:active {
    transform: scale(0.92) !important;
    border-color: var(--gold) !important;
  }

  /* Pyramid Title */
  .pyramid-title-wrap {
    margin-top: 0 !important;
    margin-bottom: 0.35rem !important;
    text-align: center !important;
    width: 100% !important;
  }
  .pyramid-title-input {
    font-size: 0.95rem !important;
    text-align: center !important;
    font-weight: 900 !important;
    max-width: 100% !important;
    padding: 0.2rem 0.5rem !important;
  }
  .pyramid-banner-desc {
    font-size: 0.72rem !important;
    margin-top: -0.1rem !important;
    margin-bottom: 0.25rem !important;
    padding: 0 0.5rem !important;
  }

  /* 4. Bottom Drawer (Mobile Layout) */
  .drawer-section {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: unset !important;
    max-height: unset !important;
    z-index: 1000 !important;
    background: rgba(11, 18, 32, 0.98) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-top: 2px solid rgba(245, 158, 11, 0.45) !important;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.9) !important;
    padding-bottom: max(0.4rem, env(safe-area-inset-bottom)) !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    flex-shrink: 0 !important;
  }

  .mobile-drawer-handle {
    display: none !important;
  }

  .drawer-header {
    padding: 0.35rem 0.55rem 0.2rem 0.55rem !important;
    gap: 0.3rem !important;
    flex-shrink: 0 !important;
  }

  .drawer-search-row {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
  }

  .btn-dock-add-mobile {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px !important;
    height: 30px !important;
    border-radius: 8px !important;
    background: var(--gold) !important;
    color: #000 !important;
    font-weight: 900 !important;
    font-size: 1.2rem !important;
    border: none !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35) !important;
  }
  .btn-dock-add-mobile:active {
    transform: scale(0.92) !important;
  }

  .drawer-actions-row {
    display: none !important;
  }

  /* Filter Tabs: Strictly ONE Single Horizontal Line */
  .filter-tabs {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    gap: 0.35rem !important;
    padding: 0.15rem 0 !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  .filter-tabs::-webkit-scrollbar {
    display: none !important;
  }

  /* Character Cards Deck: Strictly ONE Single Horizontal Line */
  .cards-grid {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    gap: 0.5rem !important;
    padding: 0.35rem 0.6rem 0.5rem 0.6rem !important;
    height: 82px !important;
    min-height: 82px !important;
    max-height: 82px !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-x: contain !important;
    touch-action: pan-x !important;
    scrollbar-width: thin !important;
    box-sizing: border-box !important;
  }

  .cards-grid .char-card {
    height: 66px !important;
    width: calc(66px * var(--card-aspect-ratio-num, 1)) !important;
    min-width: unset !important;
    max-width: unset !important;
    min-height: unset !important;
    max-height: unset !important;
    padding-bottom: 0 !important;
    flex-shrink: 0 !important;
    aspect-ratio: var(--card-aspect-ratio, 1 / 1) !important;
    border-radius: 9px !important;
    border: 1.5px solid rgba(255, 255, 255, 0.16) !important;
    background: #111a2c !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5) !important;
    position: relative !important;
    overflow: hidden !important;
    cursor: pointer !important;
    display: block !important;
    box-sizing: border-box !important;
    touch-action: pan-x !important;
  }

  .cards-grid .char-card img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: 8px !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    pointer-events: none !important;
  }

  .cards-grid .char-card .char-card-canvas {
    width: 100% !important;
    height: 100% !important;
    border-radius: 8px !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
  }

  .cards-grid .char-card.selected-dock-card {
    border-color: var(--gold) !important;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.9) !important;
    transform: translateY(-2px) scale(1.05) !important;
  }

  .cards-grid .char-card .char-card-label {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 2px 2px 1px 2px;
    background: linear-gradient(to top, rgba(7, 13, 24, 0.95), rgba(7, 13, 24, 0.6) 70%, transparent);
    font-size: 0.55rem;
    font-weight: 700;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    z-index: 2 !important;
    color: #fff;
    pointer-events: none !important;
  }

  /* Standalone Floating Save Button on Mobile (Opposite side of Flash FAB) */
  .mobile-floating-save-btn {
    position: fixed !important;
    bottom: 165px !important;
    right: 14px !important;
    left: auto !important;
    width: 46px !important;
    height: 46px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #ffffff !important;
    border: 2px solid rgba(255, 255, 255, 0.85) !important;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.55) !important;
    font-size: 1.3rem !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1200 !important;
    cursor: pointer !important;
    display: none !important;
  }
  .mobile-floating-save-btn.is-visible {
    display: flex !important;
  }

  /* 5. Mobile Floating Action Palette (FAB) */
  .mobile-fab-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.45rem !important;
    position: fixed !important;
    bottom: 165px !important;
    left: 14px !important;
    z-index: 1200 !important;
  }
  [dir="rtl"] .mobile-fab-container {
    left: 14px !important;
    right: auto !important;
  }

  .mobile-fab-trigger {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: #0b1220 !important;
    font-size: 1.3rem !important;
    font-weight: 900 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid #0b1220 !important;
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.45) !important;
    cursor: pointer !important;
    transition: transform 0.15s ease !important;
  }
  .mobile-fab-trigger:active {
    transform: scale(0.92) !important;
  }

  /* Palette is HIDDEN by default on mobile! Only visible when .open is toggled */
  .mobile-fab-palette {
    display: none !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.4rem !important;
    background: rgba(11, 18, 32, 0.94) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    padding: 0.45rem !important;
    border-radius: 9999px !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.75) !important;
    position: absolute !important;
    bottom: 52px !important;
    left: 0 !important;
    z-index: 1205 !important;
  }
  .mobile-fab-palette.open {
    display: flex !important;
    animation: fabPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
  @keyframes fabPopIn {
    from { opacity: 0; transform: scale(0.8) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
  }
  .mobile-fab-action {
    position: relative !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    font-size: 15px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
    cursor: pointer !important;
    transition: transform 0.15s ease !important;
    overflow: visible !important;
  }
  .mobile-fab-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
  }
  .mobile-fab-label {
    position: absolute !important;
    left: calc(100% + 10px) !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: rgba(11, 18, 32, 0.96) !important;
    color: #f8fafc !important;
    border: 1px solid rgba(245, 158, 11, 0.42) !important;
    border-radius: 8px !important;
    padding: 4px 10px !important;
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7) !important;
    pointer-events: auto !important;
    z-index: 1210 !important;
  }
  .mobile-fab-action.btn-browse-rankings {
    background: rgba(16, 185, 129, 0.25) !important;
    border-color: rgba(16, 185, 129, 0.45) !important;
    color: #6ee7b7 !important;
  }
  .mobile-fab-action.btn-report {
    background: rgba(239, 68, 68, 0.22) !important;
    border-color: rgba(239, 68, 68, 0.45) !important;
    color: #fca5a5 !important;
  }
  .mobile-fab-action[style*="display: none"] {
    display: none !important;
  }
  .mobile-fab-action:active {
    transform: scale(0.9) !important;
  }
  .mobile-fab-action.btn-remix {
    background: rgba(20, 184, 166, 0.25) !important;
    border-color: rgba(20, 184, 166, 0.45) !important;
    color: #5eead4 !important;
  }
  .mobile-fab-action.btn-autofill {
    background: rgba(168, 85, 247, 0.25) !important;
    border-color: rgba(168, 85, 247, 0.45) !important;
    color: #d8b4fe !important;
  }
  .mobile-fab-action.btn-clear {
    background: rgba(244, 63, 94, 0.25) !important;
    border-color: rgba(244, 63, 94, 0.45) !important;
    color: #fda4af !important;
  }
  .mobile-fab-action.btn-share {
    background: rgba(100, 116, 139, 0.25) !important;
    border-color: rgba(100, 116, 139, 0.45) !important;
    color: #cbd5e1 !important;
  }
  .mobile-fab-action.btn-fork {
    background: rgba(245, 158, 11, 0.25) !important;
    border-color: rgba(245, 158, 11, 0.45) !important;
    color: #fde68a !important;
  }
  .mobile-fab-action.btn-community {
    background: rgba(59, 130, 246, 0.25) !important;
    border-color: rgba(59, 130, 246, 0.45) !important;
    color: #93c5fd !important;
  }
  .mobile-fab-action.btn-tier-labels {
    background: rgba(16, 185, 129, 0.25) !important;
    border-color: rgba(16, 185, 129, 0.45) !important;
    color: #6ee7b7 !important;
  }
  .mobile-fab-action.btn-tier-customizer {
    background: rgba(139, 92, 246, 0.25) !important;
    border-color: rgba(139, 92, 246, 0.45) !important;
    color: #c4b5fd !important;
  }
  .mobile-fab-action.btn-names {
    background: rgba(234, 179, 8, 0.25) !important;
    border-color: rgba(234, 179, 8, 0.45) !important;
    color: #fef08a !important;
  }

  /* Pyramid Slot Cards on mobile: Scaled 'X' remove button & '❓' mystery button in opposite corners */
  .slot.has-card {
    overflow: visible !important;
  }
  .slot.has-card img,
  .slot.has-card .char-card-canvas {
    border-radius: inherit !important;
    overflow: hidden !important;
  }
  /* Scaled 'X' remove button on mobile: scales proportionally with slot size */
  .slot.has-card .remove-btn {
    position: absolute !important;
    width: clamp(11px, calc(var(--mobile-slot-size, 52px) * 0.28), 16px) !important;
    height: clamp(11px, calc(var(--mobile-slot-size, 52px) * 0.28), 16px) !important;
    min-width: 11px !important;
    min-height: 11px !important;
    top: calc(-1 * clamp(11px, calc(var(--mobile-slot-size, 52px) * 0.28), 16px) * 0.5) !important;
    background: #ef4444 !important;
    border: 1.5px solid #ffffff !important;
    border-radius: 50% !important;
    color: #ffffff !important;
    font-size: clamp(7px, calc(var(--mobile-slot-size, 52px) * 0.18), 10px) !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6) !important;
    opacity: 1 !important;
    z-index: 25 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    transform: none !important;
  }
  html[dir="rtl"] .slot.has-card .remove-btn {
    left: calc(-1 * clamp(11px, calc(var(--mobile-slot-size, 52px) * 0.28), 16px) * 0.5) !important;
    right: auto !important;
  }
  html[dir="ltr"] .slot.has-card .remove-btn {
    right: calc(-1 * clamp(11px, calc(var(--mobile-slot-size, 52px) * 0.28), 16px) * 0.5) !important;
    left: auto !important;
  }

  /* Scaled '❓' mystery button on mobile: placed on opposite corner */
  .slot.has-card .mystery-btn {
    position: absolute !important;
    width: clamp(11px, calc(var(--mobile-slot-size, 52px) * 0.28), 16px) !important;
    height: clamp(11px, calc(var(--mobile-slot-size, 52px) * 0.28), 16px) !important;
    min-width: 11px !important;
    min-height: 11px !important;
    top: calc(-1 * clamp(11px, calc(var(--mobile-slot-size, 52px) * 0.28), 16px) * 0.5) !important;
    background: #f59e0b !important;
    border: 1.5px solid #ffffff !important;
    border-radius: 50% !important;
    color: #1f1300 !important;
    font-size: clamp(7px, calc(var(--mobile-slot-size, 52px) * 0.18), 10px) !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6) !important;
    opacity: 1 !important;
    z-index: 25 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    transform: none !important;
  }
  html[dir="rtl"] .slot.has-card .mystery-btn {
    right: calc(-1 * clamp(11px, calc(var(--mobile-slot-size, 52px) * 0.28), 16px) * 0.5) !important;
    left: auto !important;
  }
  html[dir="ltr"] .slot.has-card .mystery-btn {
    left: calc(-1 * clamp(11px, calc(var(--mobile-slot-size, 52px) * 0.28), 16px) * 0.5) !important;
    right: auto !important;
  }

  /* ❓ mystery cover always stays inside the square, scaled to the slot size */
  .slot .mystery-icon {
    font-size: clamp(9px, calc(var(--mobile-slot-size, 52px) * 0.4), 22px) !important;
  }
  .pyramid-row:first-of-type .slot .mystery-icon {
    font-size: clamp(10px, calc(var(--mobile-apex-size, 62px) * 0.4), 26px) !important;
  }
  .slot .mystery-num {
    padding: 0 clamp(3px, calc(var(--mobile-slot-size, 52px) * 0.1), 7px) !important;
    margin-bottom: 1px !important;
  }
  .slot .mystery-badge {
    animation: none !important;
  }

  /* Dense tiers (9+ tiers): Permanent 'X' buttons are hidden so they never cover characters */
  .pyramid-dense-tiers .slot.has-card .remove-btn {
    display: none !important;
  }
  /* Revealed on tapped / selected slot only */
  .pyramid-dense-tiers .slot.has-card.selected-slot .remove-btn {
    display: flex !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    top: -8px !important;
    font-size: 11px !important;
    border-width: 1.5px !important;
    z-index: 60 !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.8) !important;
  }
  /* ...and the ❓ takes the usual corner while the X moves to the opposite corner */
  html[dir="rtl"] .pyramid-dense-tiers .slot.has-card.selected-slot .remove-btn {
    right: -8px !important;
    left: auto !important;
  }
  html[dir="ltr"] .pyramid-dense-tiers .slot.has-card.selected-slot .remove-btn {
    left: -8px !important;
    right: auto !important;
  }
  .pyramid-dense-tiers .slot.has-card.selected-slot .mystery-btn {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    top: -8px !important;
    font-size: 10px !important;
    z-index: 60 !important;
  }
  html[dir="rtl"] .pyramid-dense-tiers .slot.has-card.selected-slot .mystery-btn {
    left: -8px !important;
    right: auto !important;
  }
  html[dir="ltr"] .pyramid-dense-tiers .slot.has-card.selected-slot .mystery-btn {
    right: -8px !important;
    left: auto !important;
  }

  /* 4. General Mobile Modal Responsiveness */
  .modal-backdrop {
    padding: 10px !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 99999 !important;
    background: rgba(3, 7, 18, 0.95) !important;
    animation: none !important;
    opacity: 1 !important;
  }
  .modal-backdrop.open {
    animation: none !important;
    opacity: 1 !important;
  }
  .modal-box {
    background: #0d1627 !important;
    opacity: 1 !important;
    animation: none !important;
    width: 100% !important;
    max-width: calc(100vw - 20px) !important;
    max-height: 86vh !important;
    border-radius: 14px !important;
    margin: auto !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  .modal-body {
    padding: 0.85rem !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
  }
  .modal-header {
    padding: 0.75rem 1rem !important;
  }
  .modal-title {
    font-size: 0.95rem !important;
  }
  .modal-close-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.4rem !important;
    cursor: pointer !important;
  }

  /* Specific Template Settings Responsiveness (detailed responsive rules in 09_sfx_misc.css) */
  #modal-template-settings * {
    max-width: 100% !important;
    box-sizing: border-box !important;
    word-break: break-word !important;
  }
  .template-settings-tiers-banner {
    padding: 0.75rem !important;
  }
  .template-settings-tiers-banner button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Specific Tier Customizer Modal Responsiveness */
  #modal-tier-customizer .modal-box {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    max-height: 86vh !important;
  }
  #modal-tier-customizer .tier-customizer-row {
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
    padding: 0.5rem !important;
  }
  #modal-tier-customizer .tier-color-palette {
    width: 100% !important;
    overflow-x: auto !important;
    padding: 3px 0 !important;
  }
  #modal-tier-customizer .modal-footer {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
  #modal-tier-customizer .modal-footer button {
    width: 100% !important;
  }

  /* Specific Character Card Edit Modal Responsiveness (Headerless, Compact Studio) */
  #modal-edit-card .modal-box {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    max-height: 88vh !important;
    padding-top: 0.5rem !important;
  }
  #modal-edit-card .modal-header {
    display: none !important;
  }
  #modal-edit-card .modal-body {
    padding: 0.75rem 0.85rem !important;
    gap: 0.65rem !important;
  }
  #modal-edit-card .edit-card-top-section {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
    width: 100% !important;
  }
  #modal-edit-card .edit-card-avatar-wrap {
    margin: 0 !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  #modal-edit-card .edit-card-avatar-box {
    width: 74px !important;
    height: 74px !important;
    min-width: 74px !important;
    min-height: 74px !important;
  }
  #modal-edit-card .edit-card-fields-wrap {
    flex: 1 !important;
    width: auto !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    gap: 0.35rem !important;
  }
  #modal-edit-card .edit-card-name-field {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.12rem !important;
    width: 100% !important;
  }
  #modal-edit-card .edit-card-modal-footer {
    flex-direction: column-reverse !important;
    gap: 0.55rem !important;
    padding: 0.75rem !important;
  }
  #modal-edit-card .edit-card-footer-actions {
    width: 100% !important;
    display: flex !important;
    gap: 0.5rem !important;
  }
  #modal-edit-card #btn-save-card {
    flex: 2 !important;
    padding: 0.6rem !important;
    font-size: 0.88rem !important;
    font-weight: 800 !important;
    justify-content: center !important;
  }
  #modal-edit-card #btn-cancel-edit-card {
    flex: 1 !important;
    padding: 0.6rem !important;
    font-size: 0.82rem !important;
    justify-content: center !important;
  }
  #modal-edit-card #btn-delete-card {
    width: 100% !important;
    padding: 0.5rem !important;
    font-size: 0.78rem !important;
    justify-content: center !important;
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
    color: #fca5a5 !important;
  }

  .btn-canvas-mobile.active {
    background: rgba(245, 158, 11, 0.25) !important;
    border-color: var(--gold) !important;
    color: var(--gold) !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4) !important;
  }

  #toast-notification {
    top: 14px !important;
    bottom: auto !important;
    left: 12px !important;
    right: 12px !important;
    transform: translateY(-20px) !important;
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    border-radius: 12px !important;
    font-size: 0.85rem !important;
    padding: 0.75rem 1rem !important;
    z-index: 999999 !important;
    box-sizing: border-box !important;
    text-align: center !important;
    justify-content: center !important;
  }
  #toast-notification.show {
    transform: translateY(0) !important;
    opacity: 1 !important;
  }
}

@keyframes slideDownSearch {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   OFFICIAL TEMPLATES MODAL & CARDS
   ========================================================================== */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

.template-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.template-card:hover {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.template-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.template-card-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
}

.template-card-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
}

.template-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.68rem;
}

.template-meta-badge {
  background: rgba(245, 158, 11, 0.12);
  color: var(--gold-light);
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  font-weight: 700;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.template-card-preview {
  display: flex;
  align-items: center;
  margin-top: 0.2rem;
  padding: 0.2rem 0;
}

.template-card-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #0f172a;
  object-fit: cover;
  margin-inline-end: -8px;
  background: #1e293b;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* ==========================================================================
   TIER RANKS CUSTOMIZER MODAL
   ========================================================================== */
.tier-presets-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tier-preset-pill {
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.tier-preset-pill:hover {
  background: rgba(245, 158, 11, 0.2);
  color: #fff;
  border-color: var(--gold);
}

.tier-customizer-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tier-row-badge-preview {
  min-width: 36px;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
  color: #fff;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.tier-color-palette {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.tier-color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.tier-color-dot:hover,
.tier-color-dot.active {
  transform: scale(1.25);
  border-color: #fff;
  box-shadow: 0 0 6px currentColor;
}

/* ==========================================================================
   HIGH TASTE REWARD: GRAND CELESTIAL ASCENSION 👑✨
   ========================================================================== */
.royal-sunburst-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 250vmax;
  height: 250vmax;
  transform: translate(-50%, -50%);
  pointer-events: none !important;
  z-index: 9990;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 215, 0, 0.12) 0deg 8deg,
    rgba(255, 180, 0, 0.03) 8deg 16deg,
    transparent 16deg 24deg,
    rgba(245, 158, 11, 0.08) 24deg 32deg,
    transparent 32deg 40deg
  );
  animation: royalSunburstSpin 40s linear infinite;
  opacity: 0;
  transition: opacity 1.2s ease-out;
  mix-blend-mode: screen;
}

.royal-sunburst-overlay.active {
  opacity: 1;
}

@keyframes royalSunburstSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.pyramid-royal-ascension {
  position: relative;
  transition: all 1.2s ease !important;
  box-shadow: 0 0 75px rgba(245, 158, 11, 0.5), inset 0 0 50px rgba(245, 158, 11, 0.25) !important;
  border-color: #f59e0b !important;
}

.pyramid-royal-ascension::before {
  content: "";
  position: absolute;
  top: -140px;
  left: 50%;
  transform: translateX(-50%);
  width: 750px;
  height: 750px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, rgba(245, 158, 11, 0.12) 45%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: celestialGlowPulse 2.5s infinite alternate ease-in-out;
}

@keyframes celestialGlowPulse {
  0% { transform: translateX(-50%) scale(0.92); opacity: 0.6; }
  100% { transform: translateX(-50%) scale(1.18); opacity: 1; filter: drop-shadow(0 0 45px #f59e0b); }
}

/* ==========================================================================
   SUBMIT COMMUNITY VIDEO MODAL
   ========================================================================== */
#modal-submit-video .modal-box {
  max-width: 480px;
  border-radius: 14px;
}

#modal-submit-video .modal-body {
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

#modal-submit-video .form-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#modal-submit-video .form-input {
  width: 100% !important;
  box-sizing: border-box !important;
}

#modal-submit-video .template-search-wrapper {
  width: 100%;
  position: relative;
}

#modal-submit-video .modal-footer {
  padding: 0.9rem 1.4rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.submit-video-intro-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  color: #fde68a;
  line-height: 1.45;
  text-align: center;
}

.recent-template-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s ease;
  max-width: 100%;
  box-sizing: border-box;
}

.recent-template-chip:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.recent-template-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 190px;
  display: inline-block;
}

@media (max-width: 600px) {
  #modal-submit-video .modal-box {
    max-width: calc(100vw - 24px) !important;
    margin: auto !important;
  }
  #modal-submit-video .modal-body {
    padding: 1rem !important;
    gap: 0.75rem !important;
  }
  #modal-submit-video .modal-footer {
    padding: 0.75rem 1rem !important;
  }
  .recent-template-chip span {
    max-width: 130px;
  }
}

/* ================= GRAND ROYAL & SULTANIC CORONATION CELEBRATION ================= */
#imperial-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none !important;
  z-index: 9992;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.8s;
  background:
    radial-gradient(circle at center, rgba(255, 215, 0, 0.14) 0%, rgba(26, 18, 5, 0.55) 50%, rgba(12, 8, 2, 0.94) 100%),
    repeating-conic-gradient(from 0deg, rgba(255, 215, 0, 0.04) 0deg 12deg, transparent 12deg 24deg);
}

#imperial-overlay.active {
  opacity: 1;
  visibility: visible;
}

#imperial-sigil {
  width: min(88vw, 88vh);
  height: min(60vw, 60vh);
  opacity: 0.94;
  filter: drop-shadow(0 0 35px #ffd700) drop-shadow(0 0 80px rgba(245, 158, 11, 0.8));
  animation: royalCrestPulse 3.5s infinite alternate ease-in-out;
}

#imperial-sigil .imperial-ring-cw {
  transform-origin: 260px 170px;
  animation: spinSlow 24s linear infinite;
}

#imperial-sigil .imperial-ring-ccw {
  transform-origin: 260px 170px;
  animation: spinSlowReverse 16s linear infinite;
}

.royal-wing-left {
  transform-origin: 260px 170px;
  animation: wingLeftUnfold 2.4s ease-in-out infinite alternate;
}

.royal-wing-right {
  transform-origin: 260px 170px;
  animation: wingRightUnfold 2.4s ease-in-out infinite alternate;
}

@keyframes wingLeftUnfold {
  0% { transform: scale(0.95) rotate(-3deg); opacity: 0.88; }
  100% { transform: scale(1.08) rotate(3deg); opacity: 1; filter: drop-shadow(0 0 30px #ffd700); }
}

@keyframes wingRightUnfold {
  0% { transform: scale(0.95) rotate(3deg); opacity: 0.88; }
  100% { transform: scale(1.08) rotate(-3deg); opacity: 1; filter: drop-shadow(0 0 30px #ffd700); }
}

@keyframes royalCrestPulse {
  0% { transform: scale(0.92); opacity: 0.82; }
  50% { transform: scale(1.04); opacity: 1; filter: drop-shadow(0 0 55px #ffd700) drop-shadow(0 0 100px rgba(251, 191, 36, 0.95)); }
  100% { transform: scale(0.95); opacity: 0.88; }
}

/* Scepter Cursor & Stardust Trail */
#royal-scepter-cursor {
  position: fixed;
  width: 44px;
  height: 44px;
  pointer-events: none !important;
  z-index: 100002;
  display: none;
  filter: drop-shadow(0 0 12px #ffd700) drop-shadow(0 0 24px rgba(245, 158, 11, 0.9));
  transform: translate(-10px, -30px);
  transition: opacity 0.3s ease;
}

.scepter-spark {
  position: fixed;
  pointer-events: none !important;
  z-index: 100001;
  color: #ffd700;
  text-shadow: 0 0 10px #ffd700, 0 0 20px #f59e0b;
  font-weight: bold;
  animation: sparkFade 1.2s ease-out forwards;
}

@keyframes sparkFade {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2) rotate(180deg); opacity: 0; }
}

/* Ascending Winged Hero Card */
#ascending-hero-container {
  position: fixed;
  z-index: 100010;
  display: flex;
  align-items: center;
  justify-content: center;
  direction: ltr !important;
  pointer-events: none !important;
  transition: all 0.85s cubic-bezier(0.18, 0.9, 0.25, 1.2);
  filter: drop-shadow(0 0 45px rgba(255, 215, 0, 0.95)) drop-shadow(0 25px 65px rgba(0, 0, 0, 0.95));
}

.hero-card-wrapper {
  position: relative;
  height: 155px;
  width: calc(155px * var(--card-aspect-ratio-num, 1));
  max-width: 240px;
  aspect-ratio: var(--card-aspect-ratio, 1 / 1);
  border-radius: 18px;
  border: 4px solid #ffd700;
  box-shadow: 0 0 50px #ffd700, inset 0 0 25px rgba(255, 215, 0, 0.4);
  overflow: visible;
  background: #111;
  animation: heroCardHover 2.2s infinite alternate ease-in-out;
}

@keyframes heroCardHover {
  0% { transform: translateY(0) scale(1); filter: brightness(1.1); }
  100% { transform: translateY(-16px) scale(1.05); filter: brightness(1.35) drop-shadow(0 0 35px #ffd700); }
}

.hero-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}

.standard-hero-wrapper {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.4), rgba(15, 23, 42, 0.95)) !important;
  border: 3.5px solid #ffd700 !important;
  box-shadow: 0 0 45px rgba(255, 215, 0, 0.7), inset 0 0 25px rgba(255, 215, 0, 0.35) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.standard-trophy-box {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.standard-trophy-icon {
  font-size: 5rem;
  line-height: 1;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 25px #ffd700);
  animation: trophyFloat 2s infinite ease-in-out alternate;
}

@keyframes trophyFloat {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-8px) scale(1.08); }
}

.standard-trophy-sparkles {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.8rem;
  color: #fef08a;
  animation: sparkleTwinkle 1.2s infinite alternate;
}

@keyframes sparkleTwinkle {
  0% { opacity: 0.4; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.2); }
}

.hero-crown {
  position: absolute;
  top: -46px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 3rem;
  filter: drop-shadow(0 0 16px #ffd700);
  animation: heroCrownBob 1.2s infinite alternate ease-in-out;
}

@keyframes heroCrownBob {
  0% { transform: translateX(-50%) translateY(0) rotate(-6deg) scale(1); }
  100% { transform: translateX(-50%) translateY(-10px) rotate(6deg) scale(1.2); }
}

.hero-laurel-badge {
  position: absolute;
  bottom: -32px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: linear-gradient(135deg, rgba(20, 14, 3, 0.98), rgba(10, 7, 2, 0.99));
  border: 1.5px solid #ffd700;
  border-radius: 20px;
  padding: 3px 14px;
  color: #ffd700;
  font-size: 0.85rem;
  font-weight: 900;
  text-shadow: 0 0 10px #ffd700;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

/* Flapping Golden Falcon Wings Attached Directly to Card */
.hero-wing {
  width: 180px;
  height: 140px;
  overflow: visible;
}

.hero-wing-left {
  margin-right: -15px;
  transform-origin: right center;
  animation: wingFlapLeft 0.42s infinite alternate ease-in-out;
}

.hero-wing-right {
  margin-left: -15px;
  transform-origin: left center;
  animation: wingFlapRight 0.42s infinite alternate ease-in-out;
}

@keyframes wingFlapLeft {
  0% { transform: scaleX(0.85) rotate(-15deg); }
  100% { transform: scaleX(1.15) rotate(18deg); }
}

@keyframes wingFlapRight {
  0% { transform: scaleX(0.85) rotate(15deg); }
  100% { transform: scaleX(1.15) rotate(-18deg); }
}

/* Chaotic Tumbling & Bowing Courtiers (Submissive Acrobatics!) */
.tumbling-courtier {
  position: fixed;
  height: 60px;
  width: calc(60px * var(--card-aspect-ratio-num, 1));
  max-width: 110px;
  aspect-ratio: var(--card-aspect-ratio, 1 / 1);
  border-radius: 12px;
  border: 2px solid #ffd700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.65), 0 8px 25px rgba(0, 0, 0, 0.85);
  overflow: visible;
  pointer-events: none !important;
  z-index: 100005;
  background: #111;
  transition: transform 0.04s linear;
}

.tumbling-courtier img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.tumbling-courtier.somersault img {
  animation: courtierSomersault 0.75s infinite linear;
}

@keyframes courtierSomersault {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.tumbling-courtier.bowing {
  animation: courtierBow 0.7s infinite alternate ease-in-out;
}

@keyframes courtierBow {
  0% { transform: translateY(0) rotate(0deg) scale(1); }
  50% { transform: translateY(22px) rotate(32deg) scale(0.9); }
  100% { transform: translateY(0) rotate(0deg) scale(1); }
}

.courtier-speech-bubble {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 12, 3, 0.96);
  border: 1px solid #ffd700;
  color: #fef08a;
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  animation: bubblePopIn 0.3s cubic-bezier(0.18, 0.9, 0.25, 1.2) forwards;
}

@keyframes bubblePopIn {
  from { transform: translateX(-50%) scale(0.5); opacity: 0; }
  to { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* Festive Congratulations Balloons & Popups */
.festive-congrats-pill {
  position: fixed;
  z-index: 100008;
  pointer-events: none !important;
  font-family: 'Cairo', 'Inter', sans-serif;
  font-weight: 900;
  color: #ffd700;
  background: linear-gradient(135deg, rgba(24, 16, 4, 0.96), rgba(12, 8, 2, 0.98));
  border: 2px solid #ffd700;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.85), 0 0 25px rgba(245, 158, 11, 0.6);
  padding: 0.6rem 1.4rem;
  border-radius: 30px;
  font-size: 1.05rem;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.8);
  animation: shoutPop 2.8s cubic-bezier(0.18, 0.9, 0.25, 1.2) forwards;
  max-width: 85vw;
  text-align: center;
}

@keyframes shoutPop {
  0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
  15% { transform: scale(1.15) rotate(4deg); opacity: 1; }
  25% { transform: scale(1) rotate(0deg); opacity: 1; }
  75% { transform: scale(1) translateY(-15px); opacity: 1; }
  100% { transform: scale(0.85) translateY(-45px); opacity: 0; }
}

/* Radiant Golden Shockwave */
.royal-shockwave {
  position: fixed;
  border-radius: 50%;
  border: 4px solid #ffd700;
  box-shadow: 0 0 45px #ffd700, inset 0 0 45px rgba(255, 215, 0, 0.6);
  pointer-events: none !important;
  z-index: 99993;
  transform: translate(-50%, -50%);
  animation: shockwaveBurst 1.8s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes shockwaveBurst {
  0% {
    width: 20px;
    height: 20px;
    opacity: 1;
    border-width: 6px;
  }
  100% {
    width: 220vmax;
    height: 220vmax;
    opacity: 0;
    border-width: 1px;
  }
}

.imperial-stardust {
  position: absolute;
  pointer-events: none !important;
  color: #ffd700;
  text-shadow: 0 0 10px #ffd700, 0 0 20px #f59e0b;
  animation: stardustRise 4.2s ease-out forwards;
  z-index: 9993;
}

@keyframes stardustRise {
  0% {
    transform: translateY(0) scale(0.3) rotate(0deg);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 0.9;
  }
  100% {
    transform: translateY(-85vh) scale(1.2) rotate(180deg);
    opacity: 0;
  }
}

.high-taste-glow {
  border-color: #f59e0b !important;
  box-shadow: 0 0 35px #f59e0b, 0 0 80px rgba(245, 158, 11, 0.6) !important;
  animation: highTastePulse 1.2s infinite alternate !important;
  z-index: 10 !important;
}

@keyframes highTastePulse {
  0% { transform: scale(1); filter: brightness(1.15) drop-shadow(0 0 10px #f59e0b); }
  100% { transform: scale(1.12); filter: brightness(1.45) drop-shadow(0 0 25px #ffd700); }
}

.royal-slot-crown {
  position: absolute;
  top: -42px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.6rem;
  pointer-events: none !important;
  z-index: 99995;
  filter: drop-shadow(0 0 18px #ffd700) drop-shadow(0 0 30px rgba(245, 158, 11, 0.85));
  animation: royalCrownFloat 1.8s infinite alternate ease-in-out;
}

@keyframes royalCrownFloat {
  0% { transform: translateX(-50%) translateY(0) rotate(-6deg) scale(0.95); }
  100% { transform: translateX(-50%) translateY(-12px) rotate(6deg) scale(1.15); }
}

.high-taste-particles-wrapper {
  position: fixed;
  inset: 0;
  pointer-events: none !important;
  z-index: 99999;
  overflow: hidden;
}

.high-taste-particle {
  position: absolute;
  pointer-events: none !important;
  animation: particleBurst ease-out forwards;
}

.high-taste-particle.coin {
  animation: coinBurst ease-out forwards;
}

.high-taste-particle.streamer {
  animation: streamerFly ease-out forwards;
}

@keyframes particleBurst {
  0% {
    transform: translate(0, 0) scale(0.3) rotate(0deg);
    opacity: 1;
  }
  65% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(1.3) rotate(720deg);
    opacity: 0;
  }
}

@keyframes coinBurst {
  0% {
    transform: translate(0, 0) scale(0.4) rotateY(0deg) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: translate(calc(var(--tx) * 0.6), calc(var(--ty) * 0.6)) scale(1.2) rotateY(540deg) rotate(180deg);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), calc(var(--ty) + 120px)) scale(1) rotateY(1080deg) rotate(360deg);
    opacity: 0;
  }
}

@keyframes streamerFly {
  0% {
    transform: translate(0, 0) scale(0.2) rotate(0deg);
    opacity: 1;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(1.1) rotate(900deg);
    opacity: 0;
  }
}

/* Calligraphic Royal Praise Badges */
.royal-praise-badge {
  position: fixed;
  pointer-events: none !important;
  z-index: 99996;
  font-weight: 900;
  font-family: 'Cairo', 'Cinzel', sans-serif;
  color: #ffd700;
  background: linear-gradient(135deg, rgba(22, 16, 4, 0.95) 0%, rgba(12, 8, 2, 0.97) 100%);
  border: 1.8px solid #ffd700;
  box-shadow:
    0 14px 45px rgba(0, 0, 0, 0.88),
    0 0 35px rgba(245, 158, 11, 0.55),
    inset 0 0 15px rgba(255, 215, 0, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.75rem 1.8rem;
  border-radius: 35px;
  text-shadow: 0 0 14px rgba(255, 215, 0, 0.8);
  letter-spacing: 0.8px;
  animation: royalPraiseRise 3.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: 88vw;
  box-sizing: border-box;
  text-align: center;
  font-size: 1.05rem;
}

@keyframes royalPraiseRise {
  0% {
    opacity: 0;
    transform: scale(0.65) translateY(35px) rotate(-3deg);
  }
  15% {
    opacity: 1;
    transform: scale(1.08) translateY(-4px) rotate(0deg);
  }
  25% {
    transform: scale(1) translateY(0);
  }
  80% {
    opacity: 1;
    transform: scale(1) translateY(-15px);
  }
  100% {
    opacity: 0;
    transform: scale(0.85) translateY(-50px);
  }
}

/* Grand Sultanic & Royal Decree Scroll */
.sultanic-decree-scroll {
  position: fixed;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1.6rem;
  background: linear-gradient(135deg, rgba(22, 15, 3, 0.98) 0%, rgba(10, 7, 2, 0.99) 100%);
  border: 2.2px solid #ffd700;
  border-radius: 20px;
  padding: 1.2rem 2.6rem;
  box-shadow:
    0 20px 75px rgba(0, 0, 0, 0.97),
    0 0 50px rgba(245, 158, 11, 0.75),
    inset 0 0 30px rgba(255, 215, 0, 0.25);
  outline: 1px solid rgba(255, 215, 0, 0.6);
  outline-offset: -6px;
  color: #fff;
  max-width: 92vw;
  box-sizing: border-box;
  z-index: 99998;
  pointer-events: none !important;
}

.sultanic-decree-scroll.animate-in {
  animation: sultanicSlideIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.sultanic-decree-scroll.animate-out {
  animation: sultanicSlideOut 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes sultanicSlideIn {
  from { top: -150px; opacity: 0; transform: translateX(-50%) scale(0.8); }
  to { top: 50px; opacity: 1; transform: translateX(-50%) scale(1); }
}

@keyframes sultanicSlideOut {
  from { top: 50px; opacity: 1; transform: translateX(-50%) scale(1); }
  to { top: -150px; opacity: 0; transform: translateX(-50%) scale(0.8); }
}

.sultanic-seal {
  font-size: 3.2rem;
  filter: drop-shadow(0 0 18px #ffd700);
  animation: sealFloat 1.8s infinite alternate ease-in-out;
  flex-shrink: 0;
}

.sultanic-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sultanic-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 0 18px rgba(255, 215, 0, 0.85);
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sultanic-subtitle {
  font-size: 0.95rem;
  color: #fef08a;
  opacity: 0.96;
  font-style: italic;
  letter-spacing: 0.3px;
}

.sultanic-badge {
  align-self: flex-start;
  margin-top: 5px;
  background: rgba(245, 158, 11, 0.28);
  border: 1px solid rgba(255, 215, 0, 0.7);
  padding: 3px 14px;
  border-radius: 20px;
  font-size: 0.80rem;
  font-weight: 800;
  color: #fef08a;
  letter-spacing: 1px;
}

/* ==========================================================================
   Universal Interactive Secrets & Rules Engine Styles
   ========================================================================== */

.rule-list-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.rule-list-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 215, 0, 0.35);
  transform: translateY(-1px);
}

.rule-list-card.reward-card {
  border-right: 4px solid #f59e0b;
}

.rule-list-card.curse-card {
  border-right: 4px solid #ef4444;
}

[dir="ltr"] .rule-list-card.reward-card {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid #f59e0b;
}

[dir="ltr"] .rule-list-card.curse-card {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid #ef4444;
}

.rule-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.rule-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rule-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

.rule-badge.reward {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}

.rule-badge.curse {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #f87171;
}

.rule-name-text {
  font-weight: 800;
  font-size: 0.92rem;
  color: #fff;
}

.rule-summary-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.rule-tags-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.rule-tag {
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 1px 6px;
  color: #cbd5e1;
}

/* Priority Info Box & Rule Priority Badges */
.priority-info-box {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.85rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #f1f5f9;
}

.priority-info-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.rule-priority-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
}

.rule-priority-pill.top-priority {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
  border-color: #f59e0b;
}

.rule-actions-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-reorder {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f8fafc;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-reorder:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.25);
  border-color: #fbbf24;
  transform: translateY(-1px);
}

/* Outcome Segmented Toggle Buttons (Reward vs Curse) */
.outcome-toggle-group {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.btn-outcome-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0 0.85rem;
  height: 38px;
  min-height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-outcome-toggle .outcome-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.btn-outcome-toggle:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-outcome-toggle.active[data-type="reward"] {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(245, 158, 11, 0.2));
  border-color: #10b981;
  color: #34d399;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.35);
}

.btn-outcome-toggle.active[data-type="curse"] {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(153, 27, 27, 0.3));
  border-color: #ef4444;
  color: #fca5a5;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.35);
}

/* Rule Editor Top Bar: Strictly ONE single line */
.rule-editor-top-bar {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.75rem;
}

.rule-editor-top-bar #btn-back-to-rules-list {
  height: 38px;
  padding: 0 0.85rem;
  font-size: 0.82rem;
  white-space: nowrap;
  flex-shrink: 0;
  margin: 0;
}

.rule-editor-top-bar #rule-input-name {
  flex: 1;
  min-width: 140px;
  height: 38px;
  box-sizing: border-box;
  font-size: 0.85rem;
}

.rule-editor-top-bar .outcome-toggle-group {
  display: flex;
  gap: 0.35rem;
  height: 38px;
  margin: 0;
  flex-shrink: 0;
}

/* Condition Builder Row */
.cond-builder-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  flex-wrap: nowrap;
  overflow: visible;
  position: relative;
}

/* Custom Dropdown & Card Picker */
.custom-picker-container {
  position: relative;
  display: inline-block;
  user-select: none;
}

.custom-card-picker {
  min-width: 175px;
  max-width: 220px;
  flex: 0 1 200px;
}

.cond-type-select {
  flex: 1 1 220px;
  min-width: 190px;
  height: 42px !important;
  padding: 0.45rem 0.85rem !important;
  font-size: 0.88rem !important;
  line-height: 1.5 !important;
  color-scheme: dark !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: var(--radius-sm) !important;
  color: #fff !important;
  outline: none !important;
}

.cond-type-select:focus {
  border-color: var(--gold) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25) !important;
}

.cond-target-card-wrap {
  min-width: 160px;
  max-width: 200px;
  flex: 0 1 190px;
}

.custom-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  min-height: 42px;
  height: 42px;
  padding: 0 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.6;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.custom-picker-trigger:hover {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.picker-trigger-content {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
  height: 100%;
}

.picker-trigger-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.88rem;
  line-height: 1.6;
  padding-top: 1px;
  color: #f8fafc;
  font-weight: 600;
}

.picker-trigger-arrow {
  color: var(--gold);
  font-size: 0.8rem;
  flex-shrink: 0;
  margin-inline-start: 4px;
}

.picker-thumb-img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.picker-thumb-icon {
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
}

.custom-picker-menu {
  position: fixed !important;
  min-width: 320px;
  max-width: 440px;
  max-height: 400px;
  background: #0d1627 !important;
  border: 1.5px solid rgba(245, 158, 11, 0.6) !important;
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.95), 0 0 25px rgba(245, 158, 11, 0.25) !important;
  z-index: 999999 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.custom-picker-search-wrap {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: #080d1a;
  flex-shrink: 0;
}

.custom-picker-search-input {
  width: 100%;
  padding: 7px 11px;
  background: #1e293b;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.5;
  outline: none;
  box-sizing: border-box;
}

.custom-picker-search-input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.35);
}

.custom-picker-list {
  overflow-y: auto;
  flex: 1;
  max-height: 330px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.custom-picker-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: #cbd5e1;
  font-size: 0.88rem;
  line-height: 1.6;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.custom-picker-item:hover {
  background: #1e293b;
  color: #fbbf24;
}

.custom-picker-item.selected {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  font-weight: 700;
}

.picker-item-name {
  line-height: 1.6;
  padding-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-picker-empty {
  padding: 12px;
  text-align: center;
  color: #64748b;
  font-size: 0.78rem;
}

/* Logical Connector Pill Switch */
.cond-logic-toggle {
  display: inline-flex;
  align-items: center;
  background: #0b1325;
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 20px;
  padding: 2px 3px;
  gap: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.logic-pill {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.22rem 0.75rem;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  line-height: 1.2;
}

.logic-pill:hover:not(.active) {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
}

.logic-pill.active[data-val="AND"] {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.45);
}

.logic-pill.active[data-val="OR"] {
  background: #f59e0b;
  color: #0f172a;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.45);
}

.rule-op-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  margin: 0 3px;
  vertical-align: middle;
}

.rule-op-badge.op-and {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.rule-op-badge.op-or {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.45);
}

/* Universal Dark Styling for All Selects & Options */
select,
option,
optgroup,
.form-select,
.cond-logic-select {
  color-scheme: dark !important;
  background-color: #0f172a !important;
  color: #f8fafc !important;
  cursor: pointer;
  transition: none !important;
}

option, optgroup {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  font-family: inherit;
  font-size: 0.88rem;
  padding: 6px 10px;
}

.cond-target-input {
  width: 70px;
  flex-shrink: 0;
  height: 42px;
  box-sizing: border-box;
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
}

.btn-del-condition {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 0.65rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  line-height: 1;
  height: 42px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-del-condition:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

/* Modal Rules Builder Sizing & Polish */
#modal-rules-builder .modal-box {
  width: 95%;
  max-width: 860px !important;
  height: auto;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transition: all 0.22s ease-in-out;
}

#modal-rules-builder .modal-box.editor-active {
  min-height: 560px;
  height: 88vh;
  max-height: 92vh;
}

#modal-rules-builder .modal-body {
  flex: 1;
  padding: 1.25rem 1.4rem;
  overflow-y: auto;
}

/* Condition In-Between Logical Connector */
.cond-connector-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 0.2rem 0;
  user-select: none;
}

.cond-connector-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.35), transparent);
}

.cond-logic-select {
  background: #0b1325 !important;
  color: #fde047 !important;
  border: 1px solid rgba(245, 158, 11, 0.5) !important;
  border-radius: 20px;
  padding: 0.25rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
  transition: none !important;
}

.cond-logic-select:hover,
.cond-logic-select:focus {
  border-color: #f59e0b !important;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.35);
}

/* ==========================================================================
   10-Hour Curse Lockdown & Password Bar
   ========================================================================== */
.curse-unlock-bar,
#curse-unlock-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100050 !important;
  pointer-events: auto !important;
  cursor: default !important;
  user-select: auto !important;
  width: 90%;
  max-width: 580px;
  background: rgba(15, 0, 3, 0.96) !important;
  border: 2px solid #ff0033;
  border-radius: var(--radius-md);
  box-shadow: 0 0 35px rgba(255, 0, 51, 0.75), 0 10px 30px rgba(0,0,0,0.9);
  padding: 1rem 1.25rem;
  animation: unlockBarPulse 2.5s infinite alternate ease-in-out;
  direction: rtl;
}

#curse-unlock-bar *,
.curse-unlock-bar * {
  pointer-events: auto !important;
  user-select: auto !important;
}

[dir="ltr"] .curse-unlock-bar {
  direction: ltr;
}

@keyframes unlockBarPulse {
  0% { box-shadow: 0 0 20px rgba(255, 0, 51, 0.5); border-color: #ff0033; }
  100% { box-shadow: 0 0 45px rgba(255, 0, 51, 0.9); border-color: #ff3366; }
}

.curse-unlock-inner {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: center;
}

.curse-unlock-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  color: #ff3344;
  font-weight: 900;
  font-size: 1.05rem;
}

.lock-timer {
  background: #ff0033;
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  font-family: monospace;
  font-size: 0.95rem;
  letter-spacing: 1px;
}

.curse-unlock-desc {
  font-size: 0.82rem;
  color: #ff99aa;
}

.curse-unlock-form {
  display: flex;
  gap: 0.5rem;
  max-width: 440px;
  margin: 0.3rem auto 0;
  width: 100%;
}

.curse-unlock-form input,
#curse-unlock-input {
  flex: 1;
  background: #000 !important;
  border: 1.5px solid #ff0033 !important;
  color: #fff !important;
  padding: 0.6rem 0.95rem !important;
  border-radius: var(--radius-sm) !important;
  font-family: inherit !important;
  font-size: 0.92rem !important;
  text-align: center !important;
  outline: none !important;
  box-shadow: 0 0 12px rgba(255, 0, 0, 0.4) !important;
  pointer-events: auto !important;
  cursor: text !important;
  user-select: text !important;
}

.curse-unlock-form input:focus,
#curse-unlock-input:focus {
  border-color: #ff3366 !important;
  box-shadow: 0 0 18px rgba(255, 0, 51, 0.8) !important;
}

#btn-submit-unlock {
  pointer-events: auto !important;
  cursor: pointer !important;
}

.curse-unlock-error {
  font-size: 0.78rem;
  color: #ff5566;
  font-weight: 700;
}

/* ==========================================================================
   RESPONSIVE MOBILE SUPPORT FOR SECRETS & RULES ENGINE
   ========================================================================== */
@media (max-width: 600px) {
  #modal-rules-builder .modal-box {
    width: 96% !important;
    max-height: 94vh !important;
    border-radius: 12px;
  }

  #modal-rules-builder .modal-box.editor-active {
    min-height: unset !important;
    height: 92vh !important;
  }

  #modal-rules-builder .modal-body {
    padding: 0.75rem 0.65rem !important;
  }

  .rule-editor-top-bar {
    flex-wrap: wrap !important;
    gap: 0.45rem !important;
  }

  .rule-editor-top-bar #btn-back-to-rules-list {
    order: 1;
    font-size: 0.75rem !important;
    padding: 0 0.6rem !important;
    height: 34px !important;
  }

  .rule-editor-top-bar .outcome-toggle-group {
    order: 2;
    height: 34px !important;
  }

  .rule-editor-top-bar .outcome-toggle-group .btn-outcome-toggle {
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 0.6rem !important;
    font-size: 0.78rem !important;
  }

  .rule-editor-top-bar #rule-input-name {
    order: 3;
    width: 100% !important;
    flex-basis: 100% !important;
    height: 36px !important;
    font-size: 0.82rem !important;
  }

  .cond-builder-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.45rem !important;
    padding: 0.65rem !important;
  }

  .custom-card-picker {
    min-width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
  }

  .custom-picker-trigger {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .cond-type-select {
    width: 100% !important;
    min-width: 100% !important;
  }

  .cond-target-card-wrap {
    min-width: 100% !important;
    max-width: 100% !important;
  }

  .cond-builder-row .btn-del-condition {
    align-self: flex-end;
  }

  .custom-picker-menu {
    min-width: unset !important;
    width: 92vw !important;
    max-width: 92vw !important;
    left: 4vw !important;
    right: 4vw !important;
    top: 15vh !important;
    bottom: auto !important;
    max-height: 65vh !important;
    border-radius: 12px !important;
  }

  .custom-picker-list {
    max-height: calc(65vh - 55px) !important;
  }
}

/* ==========================================================================
   CREATOR FORK SHIELD (PREMIUM)
   ========================================================================== */
.creator-fork-shield-card {
  margin-top: 1rem;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.fork-shield-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.premium-badge-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-size: 0.68rem;
  font-weight: 900;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.fork-policy-radios {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.fork-policy-opt {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fork-policy-opt:hover {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.3);
}

.fork-policy-opt input[type="radio"] {
  margin-top: 0.2rem;
  cursor: pointer;
  accent-color: #f59e0b;
}

.fork-opt-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #f1f5f9;
}

.fork-opt-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 0.15rem;
}

/* ==========================================================================
   COMPACT TEMPLATE SETTINGS MODAL (Desktop + Mobile Responsive)
   ========================================================================== */
#modal-template-settings .settings-modal-box {
  max-width: 720px;
  max-height: 90vh;
}

#modal-template-settings .settings-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.8rem 1rem;
}

.settings-section-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
}

#modal-template-settings .template-cover-upload-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.settings-cover-preview {
  width: 96px;
  height: 58px;
  border-radius: 7px;
  border: 1.5px solid var(--gold);
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-cover-controls {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  flex: 1;
  min-width: 0;
}

.settings-cover-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.settings-dim-tip {
  font-size: 0.68rem;
  color: #f59e0b;
}

.settings-cover-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.settings-compact-btn {
  font-size: 0.74rem;
  padding: 0.3rem 0.6rem;
}

.settings-compact-select {
  width: 100%;
  font-size: 0.76rem;
  padding: 0.3rem 0.55rem;
}

.settings-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  align-items: start;
}

#modal-template-settings .form-group {
  gap: 0.22rem;
}

#modal-template-settings .form-label {
  font-size: 0.76rem;
}

.settings-compact-input {
  padding: 0.42rem 0.65rem;
  font-size: 0.82rem;
  height: 36px;
  box-sizing: border-box;
}

.settings-compact-textarea {
  min-height: 50px !important;
  max-height: 110px;
  padding: 0.42rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.4;
}

.settings-micro-tip {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Sleek Horizontal Rewards & Penalties Banner (NEVER stacked vertically on desktop!) */
.template-settings-rules-banner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.04));
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.8rem;
}

.rules-banner-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  text-align: start;
}

.rules-banner-title {
  font-weight: 800;
  color: #fbbf24;
  font-size: 0.84rem;
  line-height: 1.25;
}

.rules-banner-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.rules-banner-btn {
  font-size: 0.76rem;
  padding: 0.34rem 0.8rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.template-visibility-radios {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.settings-private-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.settings-sub-badge {
  font-size: 0.65rem !important;
  padding: 1px 6px !important;
  line-height: 1.3;
}

.settings-radio-card {
  margin: 0;
  padding: 0.45rem 0.6rem !important;
  gap: 0.45rem !important;
}

.settings-radio-card .fork-opt-title {
  font-size: 0.77rem;
}

.settings-radio-card .fork-opt-sub {
  font-size: 0.69rem;
  line-height: 1.3;
}

.settings-fork-shield {
  margin-top: 0 !important;
  padding: 0.55rem 0.7rem !important;
}

.settings-fork-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem !important;
  margin-top: 0.45rem !important;
}

#modal-template-settings .settings-modal-footer {
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.settings-footer-primary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-footer-primary > div {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-footer-primary .btn {
  min-width: max-content;
  height: auto !important;
  min-height: 36px;
  padding: 0.45rem 0.95rem;
  line-height: 1.3;
  white-space: nowrap;
  justify-content: center;
  box-sizing: border-box;
}

.settings-share-btn {
  font-size: 0.76rem;
  padding: 0.4rem 0.7rem;
}

@media (max-width: 860px) {
  #modal-template-settings .settings-modal-box {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
  }
  #modal-template-settings .settings-modal-body {
    padding: 0.65rem 0.7rem !important;
    gap: 0.5rem !important;
  }
  .settings-two-col {
    grid-template-columns: 1fr !important;
    gap: 0.45rem !important;
  }
  #modal-template-settings .template-cover-upload-row {
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.55rem !important;
  }
  #modal-template-settings #setting-cover-preview-box,
  .settings-cover-preview {
    width: 78px !important;
    max-width: 78px !important;
    height: 52px !important;
    margin: 0 !important;
  }
  #modal-template-settings #btn-upload-template-cover {
    width: auto !important;
  }
  #modal-template-settings #setting-cover-card-picker-container {
    min-width: 110px !important;
    flex: 1 1 120px !important;
  }
  .template-settings-rules-banner {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    padding: 0.48rem 0.6rem !important;
  }
  .template-settings-rules-banner .rules-banner-btn {
    width: auto !important;
    font-size: 0.72rem !important;
    padding: 0.3rem 0.58rem !important;
  }
  .template-visibility-radios {
    grid-template-columns: 1fr !important;
    gap: 0.4rem !important;
  }
  .settings-fork-grid {
    grid-template-columns: 1fr !important;
    gap: 0.4rem !important;
  }
  #modal-template-settings .settings-modal-footer {
    padding: 0.55rem 0.7rem !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.45rem !important;
  }
  .settings-share-btn {
    width: 100% !important;
    justify-content: center !important;
  }
  .settings-footer-primary {
    display: flex !important;
    width: 100% !important;
    gap: 0.5rem !important;
    flex-wrap: wrap !important;
  }
  .settings-footer-primary > div {
    display: flex !important;
    flex: 1 1 auto !important;
    gap: 0.5rem !important;
    justify-content: flex-end !important;
  }
  .settings-footer-primary .btn {
    flex: 1 1 auto !important;
    min-width: max-content !important;
    height: auto !important;
    min-height: 36px !important;
    padding: 0.5rem 0.85rem !important;
    font-size: 0.82rem !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
  }
}




/* ==========================================================================
   PYRMAKER PLATFORM - HOMEPAGE, EXPLORE HUB, & GLOBAL FOOTER STYLES
   ========================================================================== */

/* Global Search Container in Top Header */
.global-search-container {
  position: relative;
  flex: 1 1 160px;
  min-width: 120px;
  max-width: 360px;
  margin: 0 0.45rem;
}

.search-lens-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  opacity: 0.6;
  pointer-events: none;
}

[dir="rtl"] .search-lens-icon {
  left: auto;
  right: 0.85rem;
}

#global-search-input,
#workspace-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 0.42rem 1rem 0.42rem 2.3rem;
  color: #fff;
  font-size: 0.82rem;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

[dir="rtl"] #global-search-input,
[dir="rtl"] #workspace-search-input {
  padding: 0.42rem 2.3rem 0.42rem 1rem;
}

#global-search-input:focus,
#workspace-search-input:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

/* Workspace Instant Search Dropdown */
.workspace-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 320px;
  background: rgba(11, 18, 32, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.85);
  z-index: 999999 !important;
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
  text-align: inherit;
}

[dir="rtl"] .workspace-search-dropdown {
  text-align: right;
}

.workspace-search-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #fff;
  font-size: 0.82rem;
}

.workspace-search-item:hover {
  background: rgba(245, 158, 11, 0.18);
  color: var(--gold);
}

.workspace-search-item img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.workspace-search-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0.3rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Premium Button (Go Ad-Free Pill) */
.btn-premium {
  background: linear-gradient(135deg, #8b5cf6, #d946ef) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  border: none !important;
  border-radius: 9999px !important;
  padding: 0.42rem 0.95rem !important;
  box-shadow: 0 2px 10px rgba(168, 85, 247, 0.35) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.btn-premium:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 18px rgba(168, 85, 247, 0.6) !important;
}

/* Page Views System */
.page-view {
  flex: 1;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.page-view.active {
  display: flex;
  flex-direction: column;
}

/* WORKSPACE VIEWPORT CONTAINER */
#view-workspace {
  width: 100%;
  height: calc(100vh - 52px);
  height: calc(100dvh - 52px);
  min-height: 0;
  display: none;
  flex-direction: column !important;
  overflow: hidden !important;
  position: relative;
}

#view-workspace.active,
#view-workspace[style*="display: flex"],
#view-workspace[style*="display:flex"] {
  display: flex !important;
  flex-direction: column !important;
}

/* Homepage Scroll Container */
.homepage-scroll-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

/* Hero Section */
.homepage-hero {
  text-align: center;
  padding: 3rem 1.25rem 2rem;
  background: radial-gradient(circle at 50% 0%, rgba(245, 158, 11, 0.09) 0%, rgba(15, 23, 42, 0.4) 75%);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

.hero-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.25rem 0.7rem;
  border-radius: 9999px;
  letter-spacing: 0.08em;
  margin-bottom: 0.9rem;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  animation: heroPulseDot 1.5s infinite;
}

@keyframes heroPulseDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.hero-title {
  font-size: 2.35rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 740px;
  margin: 0 auto 1.6rem;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.8rem;
}

.btn-hero-cta {
  padding: 0.75rem 1.8rem !important;
  font-size: 0.98rem !important;
  font-weight: 800 !important;
  border-radius: 10px !important;
}

.btn-outline-light {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  transition: all 0.2s;
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #fff;
}

.hero-app-badges {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.badges-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badges-row {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  justify-content: center;
}

.mock-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  padding: 0.45rem 0.95rem;
  cursor: default;
}

.badge-icon {
  font-size: 1.2rem;
}

.badge-texts {
  display: flex;
  flex-direction: column;
  text-align: left;
}

[dir="rtl"] .badge-texts {
  text-align: right;
}

.badge-sub {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.badge-main {
  font-size: 0.82rem;
  font-weight: 800;
  color: #ffffff;
}

/* Featured Categories Section (15 cards) */
.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.95rem;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.section-see-all-btn {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

@media (max-width: 1024px) {
  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.category-card {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}

.category-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.category-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.category-card:hover .category-card-img {
  transform: scale(1.08);
}

.category-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.35) 55%, transparent 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.5rem 0.4rem;
}

.category-card-title {
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Feed Section (Tabs, Hashtags, Cards) */
.feed-header-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.6rem;
}

.feed-tabs {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
}

.feed-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: inherit;
}

.feed-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.feed-tab.active {
  color: var(--gold);
  background: rgba(245, 158, 11, 0.12);
  border-bottom: 2px solid var(--gold);
  border-radius: 8px 8px 0 0;
}

.search-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--gold-light);
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
}

.btn-clear-pill {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

/* Hashtags Bar */
.hashtags-scroll-wrapper {
  overflow-x: auto;
  padding: 0.5rem 0;
  margin-top: 0.4rem;
  scrollbar-width: none;
}

.hashtags-scroll-wrapper::-webkit-scrollbar {
  display: none;
}

.hashtags-bar {
  display: flex;
  gap: 0.4rem;
  white-space: nowrap;
}

.hashtag-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.32rem 0.75rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.hashtag-pill:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

.hashtag-pill.active {
  color: #0f172a;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 800;
}

/* Templates Cards Grid (Compact & Clean) */
.templates-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 0.9rem;
  margin-top: 1.1rem;
}

@media (max-width: 640px) {
  .templates-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }
}

.template-card {
  background: rgba(30, 41, 59, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.template-card.compact-card {
  cursor: pointer;
  padding: 0.48rem !important;
  gap: 0.38rem !important;
  border-radius: 12px !important;
}

.template-card.compact-card .card-thumb-box {
  border-radius: 8px;
  aspect-ratio: 16 / 9.5;
}

.template-card:hover {
  transform: translateY(-3px);
  border-color: rgba(245, 158, 11, 0.48);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

.template-card.compact-card .card-body {
  padding: 0.15rem 0.3rem 0.15rem !important;
  gap: 0.28rem !important;
}

.template-card.compact-card .card-title {
  font-size: 0.88rem !important;
  line-height: 1.3 !important;
  margin: 0 !important;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.1rem;
  flex-wrap: wrap;
}

.card-main-category {
  background: rgba(59, 130, 246, 0.16);
  color: #60a5fa;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}

.card-plays-stat {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fbbf24;
  white-space: nowrap;
}

.browse-more-templates-wrap {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  margin-top: 0.75rem;
}

.btn-browse-more-templates {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(217, 119, 6, 0.28));
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fde68a;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.btn-browse-more-templates:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(217, 119, 6, 0.42));
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.22);
}

.card-thumb-box {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: #0f172a;
  cursor: pointer;
}

.card-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.template-card:hover .card-thumb-img {
  transform: scale(1.05);
}

.card-count-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

[dir="rtl"] .card-count-badge {
  right: auto;
  left: 8px;
}

.card-pyramid-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(245, 158, 11, 0.95);
  color: #000;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 3px 7px;
  border-radius: 6px;
}

[dir="rtl"] .card-pyramid-badge {
  left: auto;
  right: 8px;
}

.card-body {
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.55rem;
}

.card-title {
  font-size: 0.96rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.35;
  margin: 0;
  cursor: pointer;
}

.card-title:hover {
  color: var(--gold);
}

.card-tags-row {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.card-tag {
  font-size: 0.68rem;
  color: var(--gold-light);
  background: rgba(245, 158, 11, 0.1);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.card-actions-row {
  display: flex;
  gap: 0.5rem;
  padding: 0 0.9rem 0.9rem;
}

.btn-rank-now {
  flex: 1;
  background: var(--gold) !important;
  color: #000000 !important;
  font-weight: 800 !important;
  border-radius: 7px !important;
  padding: 0.48rem !important;
  font-size: 0.82rem !important;
  border: none !important;
  cursor: pointer;
}

.btn-rank-now:hover {
  filter: brightness(1.1);
}

.btn-fork-card {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 7px !important;
  padding: 0.48rem 0.75rem !important;
  font-size: 0.82rem !important;
  cursor: pointer;
}

.btn-fork-card:hover {
  background: rgba(255, 255, 255, 0.12) !important;
}

.btn-manage-card {
  background: rgba(245, 158, 11, 0.1) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
  border-radius: 7px !important;
  padding: 0.48rem 0.65rem !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-manage-card:hover {
  background: rgba(245, 158, 11, 0.22) !important;
}

/* Streamer / Community Spotlight Strip */
.streamer-spotlight-section {
  padding-top: 1rem;
}

.spotlight-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.spotlight-videos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 0.95rem;
}

@media (max-width: 800px) {
  .spotlight-videos-grid {
    grid-template-columns: 1fr;
  }
}

.spotlight-video-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.spotlight-video-card:hover {
  transform: translateY(-3px);
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.video-thumb-wrapper {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #000;
}

.video-thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
}

.video-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  padding-left: 2px;
}

.video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

[dir="rtl"] .video-duration {
  right: auto;
  left: 8px;
}

.video-info {
  padding: 0.8rem;
}

.video-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
  margin: 0 0 0.4rem;
}

.video-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Brand Family Section */
.brand-family-section {
  margin-top: 0.5rem;
}

.brand-banner-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.brand-intro-text h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 0.5rem;
}

.brand-intro-text p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 820px;
  margin: 0;
}

.brand-creations-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.strip-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.strip-label strong {
  color: var(--gold);
}

.strip-tools {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tool-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  font-weight: 700;
  color: #f1f5f9;
  padding: 0.28rem 0.65rem;
  border-radius: 6px;
}

/* Global Footer */
.app-global-footer {
  background: #090d16;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2.75rem 1.5rem 2rem;
  color: var(--text-muted);
  width: 100%;
}

.workspace-footer {
  margin-top: 2rem;
}

.footer-top-info {
  max-width: 1240px;
  margin: 0 auto 2.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-brand-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: #ffffff;
  margin: 0 0 0.5rem;
}

.footer-brand-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 550px;
  margin: 0;
}

.footer-sub-creations {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sub-creations-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sub-creations-label strong {
  color: var(--gold);
}

.sub-creations-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.sub-pill {
  font-size: 0.72rem;
  font-weight: 700;
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

.footer-links-grid {
  max-width: 1240px;
  margin: 0 auto 2.25rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

@media (max-width: 960px) {
  .footer-links-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem;
  }
}

@media (max-width: 560px) {
  .footer-links-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Documentation & Policy Center Modal Tabs */
.info-guide-tabs-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 158, 11, 0.3) transparent;
}

.info-guide-tabs-bar::-webkit-scrollbar {
  height: 4px;
}
.info-guide-tabs-bar::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, 0.3);
  border-radius: 99px;
}

.info-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  flex-shrink: 0;
}

.info-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.info-tab-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.45);
  color: var(--gold-light);
}

.doc-article-section {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  font-size: 0.88rem;
  line-height: 1.75;
}

.doc-section-title {
  color: var(--gold-light);
  font-size: 1.05rem;
  font-weight: 800;
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  padding-bottom: 0.45rem;
  margin-top: 0.4rem;
}

.doc-highlight-box {
  background: rgba(245, 158, 11, 0.07);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  color: #fef08a;
}

.footer-col-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.footer-link-action {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.84rem;
  transition: color 0.15s ease;
  cursor: pointer;
  display: inline-block;
}

.footer-link-action:hover {
  color: var(--gold);
}

.footer-bottom-bar {
  max-width: 1240px;
  margin: 0 auto;
  text-align: center;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.45);
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Workspace Sub-Toolbar: Merged into Single Top Header Bar */
.workspace-sub-toolbar {
  display: none !important;
}

.workspace-sub-toolbar::-webkit-scrollbar {
  height: 4px;
}

.workspace-sub-toolbar::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, 0.35);
  border-radius: 99px;
}

.toolbar-left-group, .toolbar-right-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

/* Universal Clean SVG Icon */
.ui-icon {
  display: inline-block;
  vertical-align: middle;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
}

/* Sponsored Template Cards & Badges */
.template-card.sponsored {
  border-color: rgba(245, 158, 11, 0.45) !important;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.15) !important;
}

.card-sponsor-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  right: auto;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-weight: 800;
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 6px;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

[dir="rtl"] .card-sponsor-badge {
  left: auto;
  right: 8px;
}

.pyramid-sponsor-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 0.78rem;
  color: #fbbf24;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.pyramid-sponsor-banner:hover {
  background: rgba(245, 158, 11, 0.22);
  transform: translateY(-1px);
}

/* Community Aggregate Card Consensus Badge */
.card-consensus-badge {
  position: absolute;
  bottom: 3px;
  left: 3px;
  background: rgba(0, 0, 0, 0.88);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fbbf24;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  z-index: 6;
  pointer-events: none;
}

[dir="rtl"] .card-consensus-badge {
  left: auto;
  right: 3px;
}

.tool-btn.tool-btn-community.active {
  background: rgba(245, 158, 11, 0.25) !important;
  border-color: #fbbf24 !important;
  color: #fbbf24 !important;
}

.btn-community {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}
.btn-community:hover {
  background: rgba(245, 158, 11, 0.22);
  border-color: #f59e0b;
  color: #fff;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}
.btn-community.active {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #000 !important;
  border-color: #fbbf24 !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.6);
}

.btn-action-icon.btn-action-community {
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}
.btn-action-icon.btn-action-community:hover,
.btn-action-icon.btn-action-community.active {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}
.btn-action-icon.btn-action-community.is-recommended-pyramid,
.mobile-fab-action.btn-community.is-recommended-pyramid {
  background: rgba(168, 85, 247, 0.2) !important;
  border-color: rgba(192, 132, 252, 0.55) !important;
  color: #e9d5ff !important;
}
.btn-action-icon.btn-action-community.is-recommended-pyramid:hover,
.btn-action-icon.btn-action-community.is-recommended-pyramid.active,
.mobile-fab-action.btn-community.is-recommended-pyramid.active {
  background: rgba(168, 85, 247, 0.35) !important;
  border-color: #c084fc !important;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.55) !important;
}

/* Card Placement Pulse Animation */
@keyframes slotPulseGlow {
  0% { transform: scale(0.92); box-shadow: 0 0 0 rgba(245, 158, 11, 0.9); }
  50% { transform: scale(1.08); box-shadow: 0 0 20px rgba(245, 158, 11, 0.9); border-color: #fbbf24; }
  100% { transform: scale(1); box-shadow: none; }
}
.slot.slot-pulse-place {
  animation: slotPulseGlow 0.5s ease-out;
}

/* Export Modal New Compact & Maximized Layout */
#modal-export .modal-box {
  max-width: 820px !important;
  width: 95vw;
}

#modal-export .modal-body {
  padding: 0.85rem 1.15rem;
  gap: 0.6rem;
}

.export-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.export-toolbar-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.export-toolbar-selectors {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.export-field-compact {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.export-field-compact .form-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin: 0;
}

.export-field-compact .form-select {
  padding: 0.28rem 0.6rem;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #e2e8f0;
}

.export-toolbar-row-toggles {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.78rem;
}

.export-toggle-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.78rem;
  color: #cbd5e1;
}

.export-toggle-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: #f59e0b;
}

.export-preview-container {
  min-height: 280px;
  max-height: 54vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-md);
  background: radial-gradient(circle at 50% 50%, rgba(30, 27, 75, 0.4) 0%, rgba(7, 13, 24, 0.95) 100%);
  position: relative;
  padding: 0.75rem;
}

#export-preview-img {
  max-width: 100%;
  max-height: 50vh;
  object-fit: contain;
  width: auto;
  height: auto;
  display: none;
  margin: 0 auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(245, 158, 11, 0.2);
  border-radius: 12px;
}

/* Export Dimension & Format Presets (Compact Segmented Control) */
.export-format-presets {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.35);
  padding: 2px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  gap: 2px;
}

.export-format-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 0.25rem 0.65rem;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.export-format-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.export-format-btn.active {
  background: #f59e0b !important;
  border-color: transparent !important;
  color: #0b1120 !important;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.4);
}


/* ==========================================================================
   SOCIAL MEDIA CARDS & SHARE MODAL
   ========================================================================== */
.social-card-preview-wrap {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.social-card-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.social-card-badge {
  font-size: 0.75rem;
  color: var(--gold-light);
  font-weight: 700;
}

.social-card-box {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.social-card-box:hover {
  border-color: var(--gold);
}

.social-card-cover-wrap {
  width: 100%;
  height: 180px;
  position: relative;
  background: #090d16;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.social-card-apex-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(7, 13, 24, 0.9);
  border: 1px solid var(--gold);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--gold-light);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  gap: 4px;
}

html[dir="rtl"] .social-card-apex-badge {
  right: auto;
  left: 8px;
}

.social-card-content {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: #0b1120;
}

.social-card-domain {
  font-size: 0.7rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: inherit;
}

.social-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.35;
}

.social-card-desc {
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.social-card-meta {
  font-size: 0.72rem;
  color: var(--gold-light);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.2rem;
}

.social-share-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.social-btn-x {
  background: #000;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.social-btn-x:hover {
  background: #111;
  border-color: #fff;
  transform: translateY(-2px);
}

.social-btn-wa {
  background: #128c7e;
  color: #fff;
}

.social-btn-wa:hover {
  background: #25d366;
  transform: translateY(-2px);
}

.social-btn-tg {
  background: #229ed9;
  color: #fff;
}

.social-btn-tg:hover {
  background: #2cb5f6;
  transform: translateY(-2px);
}

.social-btn-export {
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold-light);
  border-color: rgba(245, 158, 11, 0.4);
}

.social-btn-export:hover {
  background: var(--gold);
  color: #000;
  transform: translateY(-2px);
}

/* ==========================================================================
   FIXES: centered button text, clean export capture, phone export screen
   ========================================================================== */
.btn {
  justify-content: center;
}

/* While the exporter captures #pyramid-export-node it adds .is-exporting:
   hide remove/mystery action buttons and ads. Keep the beautiful desktop
   title box, dashed empty slots with +, and tier badges exactly like PC. */
#pyramid-export-node.is-exporting .remove-btn,
#pyramid-export-node.is-exporting .mystery-btn,
#pyramid-export-node.is-exporting .slot-action-btn,
#pyramid-export-node.is-exporting .ad-container-slot,
#pyramid-export-node.is-exporting #ad-slot-workspace,
#pyramid-export-node.is-exporting .slot.has-card .remove-btn,
#pyramid-export-node.is-exporting .slot.has-card .mystery-btn,
#pyramid-export-node.is-exporting .pyramid-description-display,
#pyramid-export-node.is-exporting #pyramid-sponsor-banner,
#pyramid-export-node.is-exporting .pyramid-sponsor-banner {
  display: none !important;
}
#pyramid-export-node.is-exporting .slot,
#pyramid-export-node.is-exporting .slot * {
  animation: none !important;
  transition: none !important;
}
#pyramid-export-node.is-exporting .slot {
  box-shadow: none !important;
}
#pyramid-export-node.is-exporting .pyramid-row:first-of-type .slot {
  box-shadow: 0 0 20px var(--gold-glow) !important;
}
#pyramid-export-node.is-exporting .slot.mystery-mode {
  box-shadow: 0 0 15px rgba(244, 162, 97, 0.4) !important;
}
#pyramid-export-node.is-exporting .pyramid-row-badge {
  text-overflow: clip !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  white-space: nowrap !important;
  max-width: none !important;
  width: max-content !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
  text-align: center !important;
}
#pyramid-export-node.is-exporting .char-card-label {
  letter-spacing: normal !important;
  word-spacing: normal !important;
}

@media (max-width: 860px) {
  /* Full tier rank names up to 25 chars displayed clearly without truncation */
  .pyramid-row-badge {
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
    padding: 2px 5px !important;
    width: max-content !important;
    max-width: none !important;
    font-size: clamp(7.5px, calc(var(--mobile-slot-size, 52px) * 0.21), 10.5px) !important;
  }

  /* ---- Export screen on phones: compact, one clean column ---- */
  #modal-export .modal-box {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
    display: flex !important;
    flex-direction: column !important;
  }
  #modal-export .modal-header {
    padding: 0.55rem 0.8rem !important;
  }
  #modal-export .modal-title {
    font-size: 0.95rem !important;
  }
  #modal-export .modal-body {
    padding: 0.5rem 0.65rem !important;
    gap: 0.45rem !important;
    overflow-y: auto !important;
    flex: 1 1 auto !important;
  }
  #modal-export .export-toolbar {
    padding: 0.4rem 0.5rem !important;
    gap: 0.35rem !important;
  }
  #modal-export .export-toolbar-selectors {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.4rem !important;
    width: 100% !important;
  }
  #modal-export .export-toolbar-row-main {
    width: 100% !important;
  }
  #modal-export .export-field-compact {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 2px !important;
    min-width: 0 !important;
  }
  #modal-export .export-field-compact .form-select {
    width: 100% !important;
    min-width: 0 !important;
    text-overflow: ellipsis !important;
  }
  #modal-export .export-toolbar-row-toggles {
    gap: 0.4rem 0.9rem !important;
    padding-top: 0.3rem !important;
  }
  #modal-export .export-preview-container {
    min-height: 0 !important;
    max-height: none !important;
    padding: 0.4rem !important;
    overflow: visible !important;
  }
  #modal-export #export-preview-img {
    max-width: 100% !important;
    max-height: 58dvh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px !important;
  }
  /* no ad box inside the export screen on phones */
  #modal-export #ad-slot-export {
    display: none !important;
  }
  #modal-export .modal-footer {
    padding: 0.55rem 0.65rem !important;
    flex-wrap: nowrap !important;
  }
  #modal-export .modal-footer-actions,
  #modal-export .modal-footer > div {
    width: 100% !important;
    display: flex !important;
    gap: 0.5rem !important;
  }
  #modal-export .modal-footer .btn {
    flex: 1 1 0 !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 0.6rem 0.4rem !important;
    font-size: 0.82rem !important;
    white-space: normal !important;
  }
}

/* ==========================================================================
   DEDICATED USER PROFILE PAGE (/u/<username>/)
   ========================================================================== */

#view-profile {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-dark, #070d18);
  background-image: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #070d18 70%);
}

.profile-page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  box-sizing: border-box;
}

/* 1. Profile Hero Card */
.profile-hero-card {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(11, 18, 32, 0.98));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  margin-bottom: 1.5rem;
}

.profile-hero-banner {
  height: 110px;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #0f172a 100%);
  position: relative;
}

.profile-hero-body {
  padding: 0 1.5rem 1.25rem;
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
  margin-top: -45px;
  position: relative;
  flex-wrap: wrap;
}

.profile-avatar-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  flex-shrink: 0;
}

.profile-avatar-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid var(--gold, #f59e0b);
  background: #070d18;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
  overflow: hidden;
}

.profile-avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.profile-avatar-edit-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gold, #f59e0b);
  color: #000;
  border: 2px solid #070d18;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.profile-hero-details {
  flex: 1;
  min-width: 240px;
  padding-bottom: 4px;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.profile-display-name {
  font-size: 1.35rem;
  font-weight: 900;
  color: #fff;
  margin: 0;
  line-height: 1.2;
}

.profile-badge-pill {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--gold, #f59e0b);
  color: var(--gold-light, #fbbf24);
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 800;
}

.profile-handle-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
  margin-top: 4px;
}

.profile-handle {
  font-weight: 700;
  color: #60a5fa;
}

.profile-dot {
  opacity: 0.4;
}

.profile-meta-text {
  font-size: 0.78rem;
}

.profile-bio-text {
  font-size: 0.85rem;
  color: #cbd5e1;
  margin-top: 6px;
  line-height: 1.5;
}

.profile-social-links {
  margin-top: 8px;
  display: flex;
  gap: 0.5rem;
}

.profile-social-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  font-size: 0.75rem;
  text-decoration: none;
  font-weight: 700;
  transition: var(--transition);
}
.profile-social-chip:hover {
  background: rgba(59, 130, 246, 0.25);
}

.profile-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-bottom: 4px;
}

/* 2. Stats Bar */
.profile-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0.85rem 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.profile-stat-item .stat-number {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--gold-light, #fef08a);
  font-family: 'Cinzel', serif;
}

.profile-stat-item .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
  font-weight: 700;
}

.profile-stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(255, 255, 255, 0.08);
}

/* 3. Profile Tabs Nav */
.profile-tabs-nav {
  display: flex;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 1.25rem;
}

.profile-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted, #94a3b8);
  padding: 0.65rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: var(--transition);
  font-family: inherit;
}

.profile-tab-btn:hover {
  color: #fff;
}

.profile-tab-btn.active {
  color: var(--gold, #f59e0b);
  border-bottom-color: var(--gold, #f59e0b);
}

.profile-tab-btn .tab-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 800;
}
.profile-tab-btn.active .tab-badge {
  background: rgba(245, 158, 11, 0.2);
  color: var(--gold-light, #fbbf24);
}

/* 4. Cards Grid */
.profile-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.1rem;
}

.profile-pyramid-card {
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.profile-pyramid-card:hover {
  transform: translateY(-3px);
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 12px rgba(245, 158, 11, 0.15);
}

.profile-pyramid-card .card-cover-wrap {
  position: relative;
  width: 100%;
  height: 135px;
  background: #0b1120;
  overflow: hidden;
}

.profile-pyramid-card .card-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.profile-pyramid-card:hover .card-cover-img {
  transform: scale(1.04);
}

.profile-pyramid-card .card-apex-pill {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(11, 17, 32, 0.92);
  border: 1px solid var(--gold, #f59e0b);
  color: var(--gold-light, #fef08a);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}
html[dir="ltr"] .profile-pyramid-card .card-apex-pill {
  right: auto;
  left: 8px;
}

.profile-pyramid-card .card-body {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.profile-pyramid-card .card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 0.4rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.profile-pyramid-card .card-meta {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.profile-pyramid-card .card-actions-row {
  display: flex;
  gap: 0.45rem;
  margin-top: auto;
}

.profile-pyramid-card .card-actions-row .btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
}

.profile-pyramid-card .card-actions-row .btn-view-pyramid,
.profile-pyramid-card .card-actions-row .btn-play-template {
  flex: 1;
  text-decoration: none;
  justify-content: center;
}

/* 5. Empty State */
.profile-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  margin-top: 1rem;
}

.profile-empty-state .empty-icon {
  font-size: 2.8rem;
  margin-bottom: 0.75rem;
}

.profile-empty-state h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.35rem;
}

.profile-empty-state p {
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
  max-width: 440px;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .profile-hero-body {
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: -45px;
    padding: 0 1rem 1rem;
  }
  .profile-name-row {
    justify-content: center;
  }
  .profile-handle-row {
    justify-content: center;
  }
  .profile-social-links {
    justify-content: center;
  }
  .profile-hero-actions {
    width: 100%;
    justify-content: center;
    margin-top: 0.75rem;
  }
  .profile-cards-grid {
    grid-template-columns: 1fr;
  }
}


/* =========================================================================
   6. Shared Ranking Author Banner, Read-Only Showcase Mode & Share Auth Notice
   ========================================================================= */

.ranking-author-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: 720px;
  margin: 0 auto 1rem;
  padding: 0.7rem 1rem;
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.94), rgba(30, 41, 59, 0.92));
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 14px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
  flex-wrap: wrap;
}

.ranking-banner-author {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.ranking-banner-author:hover {
  opacity: 0.88;
}

.ranking-banner-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  border: 2px solid var(--gold, #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.ranking-banner-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ranking-banner-avatar-emoji {
  font-size: 1.25rem;
}

.ranking-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ranking-banner-label {
  font-size: 0.72rem;
  color: var(--gold-light, #fbbf24);
  font-weight: 700;
}

.ranking-banner-name {
  font-size: 0.95rem;
  color: #fff;
  font-weight: 800;
}

.ranking-banner-num {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  font-weight: 700;
  direction: ltr;
  display: inline-block;
}

.ranking-banner-cta {
  padding: 0.45rem 0.95rem !important;
  font-size: 0.82rem !important;
  white-space: nowrap;
}

/* Read-Only Showcase Mode (when viewing another user's ranking /t/{userNumber}/{slug}/) */
body.in-readonly-ranking .drawer-section,
body.in-readonly-ranking .control-group,
body.in-readonly-ranking .slot .remove-btn,
body.in-readonly-ranking .slot .mystery-btn,
body.in-readonly-ranking #btn-clear-slots,
body.in-readonly-ranking #btn-auto-fill,
body.in-readonly-ranking #btn-remix-slots,
body.in-readonly-ranking #btn-publish-template,
body.in-readonly-ranking #btn-template-settings,
body.in-readonly-ranking #btn-rules-secrets,
body.in-readonly-ranking #btn-action-template-settings,
body.in-readonly-ranking #btn-action-save-recommended,
body.in-readonly-ranking #btn-toggle-view-mode,
body.in-readonly-ranking #btn-bulk-import,
body.in-readonly-ranking #btn-tier-ranks,
body.in-readonly-ranking #mobile-stepper-wrap,
body.in-readonly-ranking #mobile-btn-settings,
body.in-readonly-ranking #mobile-btn-tier-ranks,
body.in-readonly-ranking #mobile-fab-publish,
body.in-readonly-ranking #mobile-fab-clear,
body.in-readonly-ranking #mobile-fab-autofill,
body.in-readonly-ranking #mobile-fab-remix,
body.in-readonly-ranking #tool-tier-ranks,
body.in-readonly-ranking #btn-action-ranking-versions,
body.in-readonly-ranking #mobile-fab-versions {
  display: none !important;
}

body.in-readonly-ranking .workspace-main {
  justify-content: center;
}

body.in-readonly-ranking .pyramid-canvas-section {
  width: 100%;
  max-width: 100%;
}

/* Share Modal Guest / Min-Cards Notice */
.share-auth-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.75rem 0.9rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 10px;
  flex-wrap: wrap;
}

.share-auth-notice-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 200px;
}

.share-auth-notice-text strong {
  font-size: 0.82rem;
  color: var(--gold-light, #fbbf24);
}

.share-auth-notice-text span {
  font-size: 0.76rem;
  color: #cbd5e1;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .ranking-author-banner {
    padding: 0.6rem 0.75rem;
    gap: 0.65rem;
  }
  .ranking-banner-cta {
    width: 100%;
    justify-content: center;
  }
}

/* Floating Flash Panel Versions Count Badge */
#btn-action-ranking-versions {
  position: relative;
}
#btn-action-ranking-versions[data-count]:not([data-count=""])::after {
  content: attr(data-count);
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #f59e0b;
  color: #0b1220;
  font-size: 0.65rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
