@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg-deep: #080d10;
  --bg-base: #0b1114;
  --bg-surface: #0f171b;
  --bg-card: #131c20;
  --bg-input: #172227;
  --bg-sheet: #0e1619;
  
  --primary-orange: #ff4d00;
  --primary-orange-hover: #ff5c14;
  --pack-orange: #ff520d;
  --emerald-green: #00995c;
  --emerald-green-hover: #00b06b;
  
  --crimp-gold-1: #c78643;
  --crimp-gold-2: #f6c075;
  --crimp-gold-3: #d18d40;
  --crimp-gold-4: #874917;
  --crimp-gold-5: #582e0e;

  --text-white: #ffffff;
  --text-light: #e4e9ec;
  --text-muted: #74838b;
  --text-dim: #4d5b62;
  
  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-strong: rgba(255, 255, 255, 0.28);
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'DM Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  background-color: var(--bg-deep);
  color: var(--text-white);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow: hidden;
}

body.mobile-app-body {
  position: relative;
  background: radial-gradient(circle at 50% 30%, #0e171b 0%, #090e11 60%, #06090a 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  height: 100dvh;
  width: 100%;
}

/* Subtle tech circuit background lines */
.bg-circuit-lines {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.85;
}

.bg-circuit-svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Responsive mobile viewport container with phone aspect ratio */
.app-viewport {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--app-background-color, var(--bg-base));
  background-image:
    linear-gradient(rgba(8, 13, 16, 0.42), rgba(8, 13, 16, 0.58)),
    var(--app-background-image, url("/backgrounds/stars.jpg"));
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  box-shadow: 0 0 70px rgba(0, 0, 0, 0.7);
}

.app-content-scale {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ==========================================================================
   TOP BAR (Category Selector + Balance Pill)
   ========================================================================== */
.mobile-topbar {
  flex-shrink: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right, 0px)) 10px max(18px, env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, rgba(8, 13, 16, 0.96) 0%, rgba(8, 13, 16, 0.8) 80%, transparent 100%);
  backdrop-filter: blur(8px);
}

/* Left: Pokemon dropdown pill */
.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  background: transparent;
  border: none;
  color: var(--text-white);
  padding: 4px 6px;
  border-radius: 8px;
  transition: opacity 0.2s ease;
}

.category-pill:hover, .category-pill:active {
  opacity: 0.85;
}

.pokeball-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.pokeball-icon > span {
  font-size: 22px;
  line-height: 1;
}

.category-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-white);
}

.chevron-down {
  color: #9cb1b9;
  transition: transform 0.25s ease;
}

.category-pill.menu-open .chevron-down {
  transform: rotate(180deg);
}

/* Category Dropdown Menu */
.category-menu {
  position: absolute;
  top: 60px;
  left: 18px;
  width: 210px;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  background: #111a1e;
  border: 1px solid var(--border-medium);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.65);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: slide-down 0.2s ease both;
}

.category-menu[hidden] {
  display: none;
}

.category-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-light);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.category-option:hover, .category-option.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-white);
}

.category-option:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.category-option:disabled:hover {
  background: transparent;
  color: var(--text-light);
}

.category-option-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-option-status {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.category-menu-empty {
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.cat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.category-option.active .cat-dot {
  background: var(--primary-orange);
  box-shadow: 0 0 8px var(--primary-orange);
}

/* Right: Balance Capsule Pill */
.wallet-pill-container {
  display: inline-flex;
  align-items: center;
  height: 36px;
  background: #0d1519;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 9999px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.wallet-pill-wrap {
  position: relative;
  flex-shrink: 0;
}

.wallet-credit-toast {
  position: absolute;
  top: -10px;
  right: 22px;
  z-index: 2;
  padding: 2px 6px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 9999px;
  background: var(--emerald-green);
  color: #07190e;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
}

.wallet-credit-toast[hidden] {
  display: none !important;
}

.wallet-credit-toast.is-visible {
  animation: wallet-credit-rise 1.5s ease both;
}

@keyframes wallet-credit-rise {
  0% { opacity: 0; transform: translateY(5px) scale(0.94); }
  14% { opacity: 1; transform: translateY(0) scale(1); }
  76% { opacity: 1; transform: translateY(-2px) scale(1); }
  100% { opacity: 0; transform: translateY(-10px) scale(0.96); }
}

.wallet-pill-container:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.wallet-pill-container:active {
  transform: scale(0.97);
}

.balance-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-white);
  padding: 0 11px 0 14px;
  letter-spacing: -0.01em;
}

.balance-add-button {
  display: grid;
  place-items: center;
  width: 33px;
  height: 100%;
  background: var(--emerald-green);
  border: none;
  color: var(--text-white);
  cursor: pointer;
  transition: background 0.2s ease;
}

.balance-add-button:hover {
  background: var(--emerald-green-hover);
}

/* ==========================================================================
   MAIN CONTENT & TABS
   ========================================================================== */
.app-main-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

.app-main-content::-webkit-scrollbar {
  width: 4px;
}

.app-main-content::-webkit-scrollbar-track {
  background: transparent;
}

.app-main-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
}

.tab-view {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.tab-view[hidden] {
  display: none !important;
}

/* ==========================================================================
   PRIMARY PACKS VIEW
   ========================================================================== */
#tab-packs {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  padding-top: 2px;
  touch-action: pan-y;
}

/* Carousel Stage with 3D Cylindrical Ring */
.pack-carousel-stage {
  position: relative;
  --pack-carousel-base-radius: clamp(200px, 28vh, 240px);
  --pack-carousel-radius: var(--pack-carousel-base-radius);
  --pack-carousel-perspective: 1100px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 0 16px;
  overflow: visible;
  perspective: var(--pack-carousel-perspective);
  perspective-origin: 50% 50%;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.pack-carousel-stage:active {
  cursor: grabbing;
}

.carousel-glow {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0);
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 100, 20, 0.22) 0%, rgba(30, 80, 95, 0.18) 45%, transparent 70%);
  filter: blur(28px);
  pointer-events: none;
  z-index: 1;
}

/* Pack 3D Carousel Cylinder / Ring */
.pack-carousel-track {
  position: relative;
  width: clamp(200px, 34vh, 230px);
  height: clamp(335px, 44vh, 384px);
  aspect-ratio: 228 / 382;
  transform-style: preserve-3d;
  will-change: transform;
  /* Preserve a 3D matrix when the initial Y rotation is zero. */
  transform: translateZ(0.01px) rotateY(0deg);
  transition: transform 0.45s cubic-bezier(0.2, 0.85, 0.3, 1);
}

.pack-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  backface-visibility: visible;
  cursor: pointer;
  transform: rotateY(var(--slide-angle, 0deg)) translateZ(var(--pack-carousel-radius));
  transition: opacity 0.35s ease, filter 0.35s ease;
  will-change: transform, opacity, filter;
}

.pack-slide:not(.active) {
  opacity: 0.62;
  filter: brightness(0.72) saturate(0.85);
}

.pack-slide.active {
  opacity: 1;
  filter: brightness(1) saturate(1);
}

.foil-pack {
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  border-radius: 5px;
  user-select: none;
  -webkit-user-select: none;
  transform: translateZ(0);
}

.foil-pack.main-pack {
  width: 100%;
  height: 100%;
  aspect-ratio: 228 / 382;
  box-shadow: 
    0 24px 44px -8px rgba(0, 0, 0, 0.85),
    0 8px 18px rgba(0, 0, 0, 0.6),
    0 0 35px rgba(10, 25, 30, 0.5);
  will-change: transform;
}

/* Reflection underneath packs */
.foil-pack.main-pack::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 48%;
  background: inherit;
  border-radius: inherit;
  transform: scaleY(-1);
  opacity: 0.22;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 80%);
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 80%);
  pointer-events: none;
  filter: blur(1px);
}

.pack-slide.active .foil-pack.main-pack {
  animation: float-pack 6s ease-in-out infinite alternate;
}

.pack-fifty-fifty .pack-body {
  background: radial-gradient(circle at 65% 25%, #14532d 0%, #052e16 60%, #03170b 100%) !important;
}

.pack-max .pack-body {
  background: radial-gradient(circle at 65% 25%, #831843 0%, #500724 60%, #240311 100%) !important;
}

.collectibles-badge.pink {
  background: #db2777 !important;
  box-shadow: 0 2px 6px rgba(219, 39, 119, 0.45) !important;
}

.sweep-pink {
  background: linear-gradient(142deg, transparent 38%, #db2777 38.5%) !important;
}

.emblem-pink {
  border-color: #f9a8d4 !important;
}

.ball-pink-top {
  background: #ec4899 !important;
}

.collectibles-badge.green {
  background: #16a34a !important;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.45) !important;
}

.sweep-green {
  background: linear-gradient(142deg, transparent 38%, #16a34a 38.5%) !important;
}

.emblem-green {
  border-color: #4ade80 !important;
}

.ball-green-top {
  background: #22c55e !important;
}

@keyframes float-pack {
  0% { transform: translate3d(0, 0px, 0) rotate(0deg); }
  50% { transform: translate3d(0, -4px, 0) rotate(0.4deg); }
  100% { transform: translate3d(0, 0px, 0) rotate(0deg); }
}

/* Collector Pack Theme */
.pack-collector .pack-body {
  background: radial-gradient(circle at 65% 25%, #1e293b 0%, #0f172a 60%, #080d1a 100%) !important;
}
.sweep-gold {
  background: linear-gradient(142deg, transparent 38%, #d97706 38.5%) !important;
}
.collectibles-badge.gold {
  background: #d97706 !important;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.4) !important;
}
.emblem-gold {
  border-color: #fbbf24 !important;
}
.ball-gold-top {
  background: #f59e0b !important;
}

/* Premium Pack Theme */
.pack-premium .pack-body {
  background: radial-gradient(circle at 65% 25%, #2e1065 0%, #170933 60%, #0c041c 100%) !important;
}
.sweep-purple {
  background: linear-gradient(142deg, transparent 38%, #7c3aed 38.5%) !important;
}
.collectibles-badge.purple {
  background: #7c3aed !important;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.4) !important;
}
.emblem-purple {
  border-color: #38bdf8 !important;
}
.ball-purple-top {
  background: #8b5cf6 !important;
}

/* Metallic Copper / Gold Foil Crimps */
.pack-crimp {
  position: relative;
  width: 100%;
  height: 22px;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    var(--crimp-gold-1) 0%,
    var(--crimp-gold-2) 28%,
    var(--crimp-gold-3) 55%,
    var(--crimp-gold-4) 82%,
    var(--crimp-gold-5) 100%
  );
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.4), inset 0 -1px 2px rgba(0, 0, 0, 0.5);
}

.top-crimp {
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.4);
}

.bottom-crimp {
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  border-top: 1px solid rgba(0, 0, 0, 0.4);
  background: linear-gradient(
    180deg,
    var(--crimp-gold-5) 0%,
    var(--crimp-gold-4) 20%,
    var(--crimp-gold-3) 48%,
    var(--crimp-gold-2) 75%,
    var(--crimp-gold-1) 100%
  );
}

/* Vertical ridges for metallic crimp teeth */
.crimp-ridges {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.45) 0px,
    rgba(0, 0, 0, 0.45) 1.5px,
    transparent 1.5px,
    transparent 4px,
    rgba(255, 255, 255, 0.25) 4px,
    rgba(255, 255, 255, 0.25) 5px,
    transparent 5px,
    transparent 6px
  );
}

.crimp-sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 45%, transparent 70%);
  opacity: 0.5;
}

/* Pack Body */
.pack-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(circle at 65% 25%, #252e32 0%, #151a1d 60%, #0f1315 100%);
}

.pack-cover-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 180ms ease-out;
  pointer-events: none;
  -webkit-user-drag: none;
}

.pack-cover-art.is-loaded {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .pack-cover-art {
    transition: none;
  }
}

.pack-onepiece .pack-body {
  background: radial-gradient(circle at 65% 25%, #713f12 0%, #3b1d0a 60%, #1a0c06 100%);
}

.category-option:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

body[data-game="onepiece"] .category-pill {
  border-color: rgba(245, 158, 11, 0.45);
}

body[data-game="onepiece"] .category-option.active .cat-dot {
  background: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.65);
}

body[data-game="onepiece"] .carousel-glow {
  background: radial-gradient(ellipse, rgba(180, 83, 9, 0.22) 0%, transparent 68%);
}

.pack-brand-header .triumph-logo-mark,
.pack-body > .triumph-watermark,
.pack-body > .pack-orange-sweep,
.pack-body > .pokeball-emblem {
  display: none;
}

.foil-specular-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.16) 0%,
    rgba(255, 255, 255, 0.05) 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.08) 75%,
    transparent 100%
  );
  pointer-events: none;
}

/* Brand area: TT logo and orange badge */
.pack-brand-header {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-top: 14px;
}

.triumph-logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.collectibles-badge {
  background: #ff5414;
  color: #ffffff;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  padding: 2.5px 8px;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(255, 84, 20, 0.4);
}

/* Large Watermark: TRIUMPH */
.triumph-watermark {
  position: absolute;
  top: 98px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 27px;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.09);
  pointer-events: none;
  z-index: 2;
  font-family: var(--font-sans);
}

/* Angled Orange Sweep Graphic */
.pack-orange-sweep {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 190px;
  background: linear-gradient(142deg, transparent 38%, var(--pack-orange) 38.5%);
  z-index: 2;
}

/* Central Pokeball Emblem */
.pokeball-emblem {
  position: absolute;
  top: 172px;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
}

.emblem-outer-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #202629;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.emblem-ball {
  width: 100%;
  height: 100%;
  position: relative;
}

.ball-half.ball-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: #202629;
}

.ball-half.ball-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: #1b2023;
}

.ball-seam {
  position: absolute;
  top: calc(50% - 1.5px);
  left: 0;
  right: 0;
  height: 3px;
  background: #ffffff;
  z-index: 2;
}

.ball-center-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
}

.ball-btn-ring {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.ball-btn-core {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #1c2225;
  border: 2px solid #ffffff;
}

/* Pack bottom text */
.pack-footer-label {
  position: relative;
  z-index: 4;
  margin-top: auto;
  margin-bottom: 9px;
  text-align: center;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #ff520d;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Pack ripped animation */
.foil-pack.pack-ripping {
  animation: pack-rip-burst 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards !important;
}

@keyframes pack-rip-burst {
  0% { transform: scale(1) translate3d(0, 0, 0); filter: brightness(1); }
  50% { transform: scale(1.04) translate3d(0, -6px, 0); filter: brightness(1.5) drop-shadow(0 0 24px rgba(255, 84, 20, 0.7)); }
  100% { transform: scale(0.98) translate3d(0, 2px, 0); filter: brightness(1.2); }
}

/* ==========================================================================
  PACK TITLE
   ========================================================================== */
.pack-heading-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: clamp(6px, 1.2vh, 12px);
  padding: 0 16px;
}

.pack-display-title {
  font-size: clamp(18px, 2.3vh, 22px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-white);
  margin-bottom: 0;
  text-align: center;
}

.pack-carousel-stage { touch-action: pan-y; }

.pack-carousel-stage:focus-visible .main-pack {
  outline: 2px solid var(--primary-orange);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .pack-wrapper-enter,
  .pack-wrapper-exit {
    animation-duration: 1ms;
  }
}

/* ==========================================================================
   STATS BAR (Min Value, Max Pull, Pack Style)
   ========================================================================== */
.pack-stats-row {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  align-items: end;
  width: calc(100% - 32px);
  margin: clamp(8px, 1.6vh, 20px) auto 0;
  padding: 0 6px;
}

.stat-unit {
  display: flex;
  flex-direction: column;
}

.stat-unit-left {
  align-items: flex-start;
}

.stat-unit-center {
  align-items: center;
}

.stat-unit-right {
  align-items: flex-end;
}

.stat-subtle-rule {
  width: 90%;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  margin-bottom: 9px;
}

.stat-unit-right .stat-subtle-rule {
  margin-left: auto;
}

.stat-label-text {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 5px;
  white-space: nowrap;
}

.stat-number-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.1;
}

/* Flanked horizontal lines for Center Max Pull */
.max-pull-title-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
  margin-bottom: 5px;
}

.stat-h-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
}

.center-label {
  margin-bottom: 0;
}

.max-pull-big {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.style-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 15px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-white);
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

.style-badge:focus-visible {
  outline: 2px solid var(--primary-orange);
  outline-offset: 4px;
  border-radius: 3px;
}

/* ==========================================================================
   PRIMARY BUY ACTION CTA
   ========================================================================== */
.buy-action-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: clamp(10px, 2vh, 20px) 18px clamp(16px, 2.2vh, 22px);
}

.buy-cta-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.buy-cta-button {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: clamp(42px, 5vh, 48px);
  background: var(--primary-orange);
  border: none;
  border-radius: 9999px;
  color: var(--text-white);
  font-size: clamp(15px, 2vh, 17px);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 8px 24px rgba(255, 77, 0, 0.38);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.buy-cta-button:hover:not(:disabled) {
  background: var(--primary-orange-hover);
  box-shadow: 0 10px 28px rgba(255, 77, 0, 0.5);
  transform: translateY(-1px);
}

.buy-cta-button:active:not(:disabled) {
  transform: scale(0.98);
}

.buy-cta-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  background: #2a343a;
  color: #72828a;
}

.refill-request-button {
  flex: 0 0 auto;
  min-width: 92px;
  min-height: clamp(42px, 5vh, 48px);
  padding: 0 14px;
  border: 1px solid var(--border-medium);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-white);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.refill-request-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.35);
}

.refill-request-button:disabled,
.topup-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

#request-refill-btn[hidden],
#wallet-request-refill-btn[hidden],
#refill-status[hidden],
#wallet-refill-status[hidden] {
  display: none !important;
}

.refill-status {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.refill-status.error {
  color: #ff6b6b;
}

.status-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.status-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald-green);
  box-shadow: 0 0 6px var(--emerald-green);
}

.meta-dot {
  color: rgba(255, 255, 255, 0.2);
}

.notice-callout {
  min-height: 18px;
  margin-top: 6px;
  font-size: 11px;
  color: #ff6b6b;
  font-family: var(--font-mono);
  text-align: center;
}

/* ==========================================================================
   BOTTOM NAVIGATION BAR (Fixed 5-item mobile menu matching screenshot)
   ========================================================================== */
.mobile-bottom-nav {
  flex-shrink: 0;
  width: 100%;
  position: relative;
  z-index: 50;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  background: rgba(7, 11, 13, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease, transform 0.15s ease;
  user-select: none;
  padding: 4px 0;
}

.nav-item:active {
  transform: scale(0.92);
}

.nav-item.active {
  color: var(--text-white);
}

.nav-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
}

.nav-notification-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  padding: 0 4px;
  border: 2px solid #090d0f;
  border-radius: 999px;
  background: #ef3340;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(239, 51, 64, 0.45);
}

.nav-notification-badge[hidden] {
  display: none;
}

.nav-item-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.nav-item.active .nav-item-label {
  font-weight: 600;
  color: var(--text-white);
}

/* ==========================================================================
  CARD SHOP VIEW STYLING
   ========================================================================== */
.view-header {
  padding: 24px 20px 14px;
}

#friends-directory-view > .view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.friend-notifications-button {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #c6d0d3;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.friend-notifications-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.friend-notifications-button[hidden] {
  display: none;
}

.friend-request-toast {
  position: fixed;
  z-index: 120;
  right: max(14px, env(safe-area-inset-right, 0px));
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  left: max(14px, env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(520px, calc(100% - 28px));
  margin: 0 auto;
  padding: 12px 14px;
  border: 1px solid rgba(239, 51, 64, 0.35);
  border-radius: 14px;
  background: rgba(20, 24, 28, 0.97);
  color: #f4f6f7;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.48);
  font-size: 12px;
  animation: friend-toast-in 180ms ease-out;
}

.friend-request-toast[hidden] {
  display: none;
}

.friend-request-toast > span {
  flex: 1;
}

.friend-request-toast button {
  border: 0;
  background: transparent;
  color: #ff6974;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.friend-request-toast button:last-child {
  padding: 0 2px;
  color: #aab4b8;
  font-size: 18px;
}

@keyframes friend-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .friend-request-toast {
    animation: none;
  }
}

.friends-directory-view > [hidden] {
  display: none !important;
}

.friends-incoming-disclosure {
  margin: 12px 20px 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 140, 20, 0.28);
  border-radius: 12px;
  background: rgba(255, 122, 24, 0.06);
}

.friends-incoming-disclosure[hidden] {
  display: none;
}

.friends-incoming-disclosure > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  color: #ffe0cb;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.friends-incoming-disclosure > summary::-webkit-details-marker {
  display: none;
}

.friends-incoming-count {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: #e85b19;
  color: white;
  font-size: 10px;
}

.friends-disclosure-chevron {
  margin-left: auto;
  color: #ffae79;
  font-size: 17px;
  transition: transform 0.15s ease;
}

.friends-incoming-disclosure[open] .friends-disclosure-chevron {
  transform: rotate(180deg);
}

.friends-incoming-disclosure .friends-list {
  gap: 8px;
  padding: 0 10px 10px;
}

#friends-list-section {
  scroll-margin-top: 12px;
}

.view-header h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.view-subtitle {
  font-size: 13px;
  color: var(--text-light);
}

.card-shop-section {
  margin: 0;
}

.card-shop-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, 0.8fr);
  align-items: end;
  gap: 10px;
  padding: 0 20px;
  margin: 0 0 14px;
}

.card-shop-search-area {
  grid-column: 1 / -1;
}

.card-shop-search-area,
.card-shop-category-area,
.card-shop-sort-area {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.card-shop-search-area label,
.card-shop-category-area label,
.card-shop-sort-area label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.card-shop-search-area input,
.card-shop-category-area select,
.card-shop-sort-area select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-white);
  font: inherit;
  font-size: 13px;
}

.card-shop-search-area input:focus-visible,
.card-shop-category-area select:focus-visible,
.card-shop-sort-area select:focus-visible {
  outline: 2px solid var(--primary-orange);
  outline-offset: 2px;
}

.card-shop-sort-area select {
  cursor: pointer;
}

.card-shop-category-area select {
  cursor: pointer;
}

.card-shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 20px 24px;
}

.card-shop-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: rgba(8, 14, 17, 0.72);
}

.card-shop-open-btn {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--text-white);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.card-shop-open-btn:hover {
  background: rgba(255, 255, 255, 0.045);
}

.card-shop-open-btn:focus-visible {
  outline: 2px solid var(--primary-orange);
  outline-offset: -2px;
}

.card-shop-thumb {
  display: grid;
  width: 100%;
  aspect-ratio: 63 / 88;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #182329;
}

.card-shop-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}

.card-shop-info {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.card-shop-info strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-white);
  font-size: clamp(9px, 2.7vw, 12px);
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-shop-info span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-shop-info b {
  margin-top: 2px;
  color: var(--emerald-green-hover);
  font-size: clamp(10px, 2.8vw, 13px);
  font-weight: 800;
}

.card-shop-empty,
.card-shop-status {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.card-shop-status.error {
  color: #ff8585;
}

/* ==========================================================================
   COLLECTION VIEW STYLING
   ========================================================================== */
.collection-view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.collection-tools {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr) minmax(74px, 0.82fr);
  align-items: end;
  gap: 6px;
  padding: 0 12px;
  margin: 0 0 14px;
}

.friend-collection-tools {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr);
}

.collection-search-area,
.collection-type-area,
.collection-sort-area,
.collection-select-mode-area {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.collection-search-area label,
.collection-type-area label,
.collection-sort-area label,
.collection-select-mode-area label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
}

.collection-search-area input,
.collection-type-area select,
.collection-sort-area select,
.collection-select-mode-btn {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 6px;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-white);
  font: inherit;
  font-size: 11px;
}

.collection-search-area input:focus-visible,
.collection-type-area select:focus-visible,
.collection-sort-area select:focus-visible,
.collection-select-mode-btn:focus-visible {
  outline: 2px solid var(--primary-orange);
  outline-offset: 2px;
}

.collection-type-area select,
.collection-sort-area select {
  cursor: pointer;
}

.collection-select-mode-btn {
  padding: 0 5px;
  border-color: rgba(255, 85, 10, 0.48);
  background: rgba(255, 85, 10, 0.12);
  color: #ffd1bd;
  font-weight: 700;
  cursor: pointer;
}

.collection-select-mode-btn[aria-pressed="true"] {
  border-color: var(--primary-orange);
  background: rgba(255, 85, 10, 0.24);
  color: var(--text-white);
}

.collection-bulk-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 12px 14px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: rgba(16, 24, 28, 0.94);
}

.collection-bulk-actions[hidden] {
  display: none !important;
}

.collection-selection-summary,
.collection-bulk-status {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-light);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.collection-bulk-status.error {
  color: #ff8585;
}

.collection-bulk-actions .sheet-action-button {
  min-width: 0;
  min-height: 36px;
  margin: 0;
  padding: 0 6px;
  font-size: 11px;
}

.collection-bulk-actions .sheet-action-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.collection-no-results {
  padding: 18px 20px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.collection-grid-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 20px 24px;
}

.friends-view-content {
  padding-bottom: 20px;
}

.friends-view-content[hidden] {
  display: none !important;
}

.friends-code-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 20px 18px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 133, 72, 0.3);
  border-radius: 12px;
  background: linear-gradient(120deg, rgba(255, 77, 0, 0.13), rgba(255, 255, 255, 0.035));
}

.friends-code-card > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.friends-code-card span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.friends-code-card strong {
  color: #ffb18f;
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: 0.2em;
}

.friends-search-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 20px;
}

.friends-search-form label {
  color: var(--text-light);
  font-size: 12px;
  font-weight: 700;
}

.friends-search-row {
  display: flex;
  gap: 8px;
}

.friends-search-row input {
  min-width: 0;
  flex: 1;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  outline: none;
  background: #111a1e;
  color: var(--text-white);
  font: inherit;
  font-size: 13px;
}

.friends-search-row input:focus-visible {
  border-color: var(--primary-orange);
  box-shadow: 0 0 0 3px rgba(255, 77, 0, 0.15);
}

.friends-search-row input {
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.friends-search-row button,
.friend-action-button,
.friends-back-button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-light);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.friends-search-row button,
.friend-action-button.primary {
  border-color: rgba(255, 77, 0, 0.5);
  background: rgba(255, 77, 0, 0.16);
  color: #ffb18f;
}

.friends-search-row button:hover,
.friend-action-button:hover:not(:disabled),
.friends-back-button:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: var(--border-strong);
}

.friend-action-button.primary:hover:not(:disabled),
.friends-search-row button:hover {
  background: rgba(255, 77, 0, 0.27);
  border-color: rgba(255, 77, 0, 0.8);
}

.friend-action-button:disabled {
  opacity: 0.62;
  cursor: default;
}

.friend-action-button.subtle {
  padding: 0 10px;
  color: var(--text-muted);
}

.friends-status {
  min-height: 18px;
  margin: 10px 20px 0;
  color: var(--text-muted);
  font-size: 11px;
}

.friends-status:empty {
  display: none;
}

.friends-status.error {
  color: #ff8a8a;
}

.friends-section {
  margin-top: 20px;
}

.friends-section > h3 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 20px 10px;
  color: var(--text-white);
  font-size: 15px;
}

.friends-section > h3 span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.friends-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 20px;
}

.friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: #10181c;
}

.friend-row-person {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.friend-row-avatar {
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  background: #1b282e;
  object-fit: cover;
}

.friend-row-identity {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.friend-row-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.friend-row-identity strong {
  overflow: hidden;
  color: var(--text-white);
  font-size: 12px;
  text-overflow: ellipsis;
}

.friend-row-identity span,
.friend-pending-label {
  color: var(--text-muted);
  font-size: 10px;
}

.friend-row-identity .friend-unread-count {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef3340;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.friend-row-title .friend-dev-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid rgba(255, 140, 20, 0.42);
  border-radius: 999px;
  background: rgba(255, 140, 20, 0.12);
  color: #ffb18f;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
}

.friend-row-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.friend-action-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 10px;
}

.friends-empty {
  margin: 0 20px;
  padding: 12px 14px;
  border: 1px dashed var(--border-subtle);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

.account-friends-sheet {
  max-height: min(82%, 620px);
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.account-friends-status {
  min-height: 18px;
  margin: 10px 20px 0;
  color: var(--text-muted);
  font-size: 11px;
}

.account-friends-status:empty {
  display: none;
}

.account-friends-status.error {
  color: #ff8a8a;
}

.account-friends-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 20px;
}

.friend-profile-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px 2px;
}

.friend-profile-heading h2 {
  margin-bottom: 4px;
  font-size: 21px;
}

.friend-message-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border-color: rgba(255, 140, 20, 0.58);
  background: linear-gradient(135deg, rgba(255, 122, 24, 0.2), rgba(234, 88, 12, 0.1));
  color: #ffd2b8;
  font-weight: 700;
}

.friend-message-unread-count {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef3340;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.friend-message-unread-count[hidden] {
  display: none;
}

.friend-chat-panel {
  margin: 8px 12px 12px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(12, 19, 22, 0.92);
}

.friend-chat-panel[hidden] {
  display: none;
}

.friend-chat-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.friend-chat-heading h3 {
  margin: 0;
  color: var(--text-white);
  font-size: 14px;
}

.friend-chat-heading p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

.friend-chat-close {
  min-width: 54px;
  height: 30px;
  flex: 0 0 auto;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: #c6d0d3;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.friend-chat-close:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.friend-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(28vh, 220px);
  min-height: 56px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 8px;
  background: rgba(3, 8, 10, 0.36);
  overscroll-behavior: contain;
}

.friend-chat-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 86%;
}

.friend-chat-message.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.friend-chat-bubble {
  margin: 0;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px 10px 10px 3px;
  background: #1a282e;
  color: #edf4f5;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.friend-chat-message.mine .friend-chat-bubble {
  border-color: rgba(255, 122, 24, 0.28);
  border-radius: 10px 10px 3px 10px;
  background: linear-gradient(135deg, #9a4319, #71340f);
  color: #fff7f0;
}

.friend-chat-message time {
  margin: 4px 4px 0;
  color: #78878b;
  font-size: 10px;
}

.friend-chat-empty {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.friend-chat-empty[hidden] {
  display: none;
}

.friend-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin-top: 6px;
}

.friend-chat-form textarea {
  width: 100%;
  min-height: 40px;
  max-height: 80px;
  resize: vertical;
  padding: 7px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: rgba(3, 8, 10, 0.72);
  color: var(--text-white);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.friend-chat-form textarea:focus {
  border-color: rgba(255, 140, 20, 0.65);
  outline: 2px solid rgba(255, 140, 20, 0.14);
}

.friend-chat-form button {
  min-height: 40px;
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px solid rgba(255, 140, 20, 0.7);
  border-radius: 9px;
  background: linear-gradient(135deg, #ff7a18, #ea580c);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.friend-chat-form button:disabled {
  opacity: 0.55;
  cursor: default;
}

.friend-chat-status {
  min-height: 15px;
  margin: 6px 2px 0;
  color: var(--text-muted);
  font-size: 11px;
}

.friend-chat-status:empty {
  display: none;
}

.friend-chat-status.error {
  color: #ff8a8a;
}

body.friend-chat-open .app-main-content {
  overflow: hidden;
  overscroll-behavior: none;
}

body.friend-chat-open .mobile-bottom-nav {
  display: none !important;
}

body.friend-chat-open #friend-chat-panel:not([hidden]) {
  position: fixed;
  z-index: 120;
  top: var(--friend-chat-visual-top, 72px);
  right: 12px;
  bottom: auto;
  left: 12px;
  display: flex;
  flex-direction: column;
  height: var(--friend-chat-panel-height, auto);
  max-height: none;
  margin: 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.72);
}

body.friend-chat-keyboard-open #friend-chat-panel:not([hidden]) {
  height: var(--friend-chat-panel-height, auto);
  bottom: auto;
}

body.friend-chat-open #friend-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

@media (min-width: 768px) and (pointer: fine) {
  body.friend-chat-open .app-main-content {
    overflow-y: auto;
    overscroll-behavior: auto;
  }

  body.friend-chat-open .mobile-bottom-nav {
    display: flex !important;
  }

  body.friend-chat-open #friend-chat-panel:not([hidden]) {
    top: auto;
    right: 24px;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 20px);
    left: auto;
    width: min(440px, calc(100vw - 48px));
    height: min(560px, 72dvh);
    min-height: min(320px, calc(100dvh - 32px));
    max-height: calc(100dvh - 32px);
    margin: 0;
    padding: 16px;
    border-color: rgba(255, 255, 255, 0.14);
    border-radius: 16px;
  }

  body.friend-chat-open .friend-chat-heading {
    margin-bottom: 12px;
  }

  body.friend-chat-open .friend-chat-heading h3 {
    font-size: 16px;
  }

  body.friend-chat-open .friend-chat-heading p {
    font-size: 12px;
  }

  body.friend-chat-open .friend-chat-messages {
    gap: 10px;
    padding: 10px;
  }

  body.friend-chat-open .friend-chat-bubble {
    padding: 9px 12px;
    font-size: 14px;
    line-height: 1.5;
  }

  body.friend-chat-open .friend-chat-message time {
    font-size: 11px;
  }

  body.friend-chat-open .friend-chat-empty {
    font-size: 13px;
  }

  body.friend-chat-open .friend-chat-form {
    gap: 8px;
    margin-top: 10px;
  }

  body.friend-chat-open .friend-chat-form textarea {
    min-height: 44px;
    max-height: 120px;
    padding: 10px 12px;
    font-size: 14px;
  }

  body.friend-chat-open .friend-chat-form button {
    min-height: 44px;
    padding: 0 16px;
    font-size: 13px;
  }

  body.friend-chat-open .friend-chat-status {
    font-size: 12px;
  }
}

.account-stats-grid.friend-profile-stats {
  gap: 8px;
  padding: 10px 20px 4px;
}

.friend-profile-stats .acc-stat-box {
  min-width: 0;
  padding: 12px 4px;
}

.friend-profile-stats .acc-stat-num {
  font-size: clamp(14px, 4vw, 18px);
}

.friend-profile-stats .acc-stat-desc {
  line-height: 1.3;
}

.friend-profile-nav {
  display: flex;
  gap: 8px;
  padding: 24px 20px 0;
}

.friend-profile-nav > button {
  flex: 1 1 0;
  min-width: 0;
  padding-right: 8px;
  padding-left: 8px;
}

.friends-back-button {
  margin: 0;
  min-height: 36px;
}

.friend-card-grid {
  padding-bottom: 8px;
}

.friend-card-grid .collection-card {
  cursor: default;
}

@media (max-width: 360px) {
  .friend-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .friend-row-actions {
    align-self: flex-end;
  }
}

.collection-card {
  display: flex;
  flex-direction: column;
  background: #10181c;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  padding: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.2s ease, box-shadow 0.2s ease;
  animation: card-appear 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  will-change: transform;
}

.collection-card:hover {
  transform: translate3d(0, -2px, 0);
  border-color: var(--border-medium);
}

.collection-card-selectable {
  cursor: pointer;
}

.collection-card-selectable:focus-visible {
  outline: 2px solid var(--primary-orange);
  outline-offset: 3px;
}

.collection-card-selectable.is-selection-mode {
  cursor: default;
}

.collection-card-selectable.is-selected {
  border-color: var(--primary-orange);
  box-shadow: 0 0 0 1px rgba(255, 85, 10, 0.45), 0 4px 14px rgba(0, 0, 0, 0.4);
}

.collection-card-select-checkbox {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 3;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  background: rgba(7, 12, 14, 0.82);
  cursor: pointer;
}

.collection-card-select-checkbox[hidden] {
  display: none !important;
}

.collection-card-select-checkbox input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--primary-orange);
  cursor: pointer;
}

.collection-card-select-checkbox input:disabled {
  cursor: not-allowed;
}

@keyframes card-appear {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

.card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 2.5 / 3.5;
  display: grid;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
  background: #182329;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.collection-quantity-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: grid;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: #dc2626;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.thumb-symbol {
  font-size: 32px;
  color: rgba(255, 255, 255, 0.4);
}

.card-thumb.coral { background: linear-gradient(135deg, #2a1b18, #602517); }
.card-thumb.blue { background: linear-gradient(135deg, #132431, #174261); }
.card-thumb.lime { background: linear-gradient(135deg, #1c2718, #304e22); }
.card-thumb.gold { background: linear-gradient(135deg, #2b2613, #5e4e1a); }

.card-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
}

.card-details strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-details small {
  font-size: 10px;
  color: var(--text-muted);
}

.card-price {
  margin-top: 3px;
  color: var(--emerald-green-hover);
  font-size: 11px;
  font-weight: 700;
}

.card-price.unavailable {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 500;
}

.collection-purchased-tag {
  align-self: flex-start;
  padding: 3px 6px;
  border: 1px solid rgba(250, 204, 21, 0.3);
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.12);
  color: #facc15;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* Empty Collection State */
.collection-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 24px;
  margin: 10px 20px;
  background: #10181c;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
}

.collection-empty-state[hidden] {
  display: none;
}

.empty-icon-ring {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ==========================================================================
   REWARDS & WALLET VIEW
   ========================================================================== */
.reward-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin: 0 20px 16px;
  background: #121c21;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
}

.reward-card.highlight {
  border-color: rgba(0, 153, 92, 0.4);
  background: linear-gradient(135deg, #101c1d 0%, #0d1a1b 100%);
}

.reward-icon-box {
  font-size: 28px;
}

.reward-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reward-card-info strong {
  font-size: 14px;
  font-weight: 700;
}

.reward-card-info span {
  font-size: 11px;
  color: var(--text-muted);
}

.reward-card-info small {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 3px;
}

.reward-claim-btn {
  padding: 8px 16px;
  background: var(--emerald-green);
  border: none;
  border-radius: 9999px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.wallet-balance-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  margin: 0 20px;
  background: #10181c;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  text-align: center;
}

.wallet-card-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.wallet-card-val {
  font-size: 38px;
  font-weight: 800;
  color: var(--text-white);
  margin: 8px 0 4px;
}

.wallet-card-val small {
  font-size: 14px;
  color: var(--emerald-green);
  font-family: var(--font-mono);
}

.wallet-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.wallet-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.wallet-quick-add-btn {
  flex: 1;
  height: 42px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-medium);
  color: var(--text-white);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================================================
   ACCOUNT VIEW
   ========================================================================== */
.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin: 0 20px 18px;
  background: #111a1e;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
}

.profile-avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 50%;
  background: #1b282e;
  color: #9cb1b9;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar img[hidden] {
  display: none;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-meta strong {
  font-size: 15px;
  font-weight: 700;
}

.profile-username {
  color: var(--text-muted);
  font-size: 11px;
}

.profile-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(0, 153, 92, 0.2);
  color: var(--emerald-green);
  width: max-content;
}

.account-auth-form {
  display: grid;
  gap: 8px;
  margin: 0 20px 18px;
}

.account-auth-form[hidden] {
  display: none;
}

.digital-terms-card {
  display: grid;
  gap: 8px;
  margin: 0 20px 18px;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: rgba(17, 26, 30, 0.82);
}

.digital-terms-card h3 {
  margin: 0;
  color: var(--text-white);
  font-size: 13px;
}

.digital-terms-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.digital-terms-checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  color: var(--text-white);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.digital-terms-checkbox input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary-orange);
  cursor: pointer;
}

.account-auth-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.account-auth-input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-white);
  font: inherit;
  font-size: 14px;
}

.account-auth-input:focus-visible {
  outline: 2px solid var(--primary-orange);
  outline-offset: 2px;
}

.account-auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.account-auth-submit {
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-white);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.account-auth-submit.primary {
  border-color: var(--primary-orange);
  background: var(--primary-orange);
}

.account-auth-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.account-auth-message {
  margin: -8px 20px 18px;
  color: var(--emerald-green-hover);
  font-size: 12px;
}

.account-auth-message.error {
  color: #ff8585;
}

.account-auth-message[hidden],
#account-logout-btn[hidden] {
  display: none;
}

.account-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 20px 20px;
}

.acc-stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px;
  background: #10181c;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  text-align: center;
}

.acc-stat-num {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-white);
  margin-bottom: 4px;
}

.acc-stat-desc {
  font-size: 10px;
  color: var(--text-muted);
}

.account-actions-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 20px 24px;
}

.account-settings-sheet {
  max-height: min(92%, 760px);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.account-settings-sheet::-webkit-scrollbar {
  display: none;
}

.account-settings-form {
  display: grid;
  gap: 9px;
  padding: 16px 20px 20px;
}

.account-settings-hint {
  margin: -4px 0 2px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.settings-file-input {
  height: auto;
  min-height: 44px;
  padding: 8px;
  font-size: 11px;
}

.settings-photo-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--text-muted);
  font-size: 10px;
}

.settings-photo-preview-row img {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  object-fit: cover;
  border: 1px solid var(--border-medium);
  border-radius: 50%;
}

.settings-photo-preview-row img[hidden] {
  display: none;
}

.settings-photo-preview-row #settings-photo-hint {
  flex: 1;
}

.settings-background-fieldset {
  min-width: 0;
  margin: 8px 0 0;
  padding: 0;
  border: 0;
}

.settings-background-fieldset legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 10px;
  color: var(--text-light);
  font-size: 12px;
  font-weight: 700;
}

.settings-background-categories {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 112px));
  justify-content: center;
  gap: 12px;
}

.settings-background-category-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  overflow: hidden;
  padding: 9px 6px;
  border: 1px solid var(--border-medium);
  border-radius: 14px;
  background: #10181c;
  color: var(--text-white);
  cursor: pointer;
  isolation: isolate;
}

.settings-background-category-tile:hover,
.settings-background-category-tile.is-open {
  border-color: var(--primary-orange);
  box-shadow: 0 0 0 2px rgba(255, 77, 0, 0.18);
}

.settings-background-category-tile:focus-visible {
  outline: 2px solid var(--primary-orange);
  outline-offset: 3px;
}

.settings-background-category-preview {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
}

.settings-background-category-preview::after {
  position: absolute;
  inset: 35% 0 0;
  background: linear-gradient(transparent, rgba(5, 9, 11, 0.94));
  content: '';
}

.settings-background-simple-preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 5px;
  padding: 10px 17px 42px;
  background: #0b1114;
}

.settings-background-simple-preview i {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #12345a;
}

.settings-background-simple-preview i:nth-child(2) { background: #343a40; }
.settings-background-simple-preview i:nth-child(3) { background: #123d2b; }
.settings-background-simple-preview i:nth-child(4) { background: #541b2b; }

.settings-background-custom-preview {
  background-image: url("/backgrounds/stars.jpg");
  background-position: center;
  background-size: cover;
}

.settings-background-category-title,
.settings-background-category-detail {
  position: relative;
  z-index: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-background-category-title {
  font-size: 13px;
  font-weight: 800;
}

.settings-background-category-detail {
  color: rgba(255, 255, 255, 0.78);
  font-size: 8px;
}

.settings-background-count {
  min-height: 14px;
  margin: 8px 0 6px;
  color: var(--text-muted);
  font-size: 10px;
}

.settings-background-count[hidden],
.settings-background-grid[hidden] {
  display: none !important;
}

.settings-save-button {
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--primary-orange);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.settings-save-button[hidden] {
  display: none !important;
}

.settings-save-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.settings-background-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: 38vh;
  padding: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.settings-background-option {
  min-width: 0;
  padding: 5px;
  border: 1px solid var(--border-medium);
  border-radius: 11px;
  background: #10181c;
  color: var(--text-light);
  text-align: left;
  cursor: pointer;
}

.settings-background-option[aria-pressed="true"] {
  border-color: var(--primary-orange);
  box-shadow: 0 0 0 2px rgba(255, 77, 0, 0.2);
}

.settings-background-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  background-position: center;
  background-size: cover;
}

.settings-background-option-label {
  display: block;
  padding: 6px 3px 2px;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 350px) {
  .settings-background-categories {
    grid-template-columns: repeat(2, minmax(0, 100px));
  }

  .settings-background-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.settings-background-loading,
.settings-background-empty {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 11px;
}

.account-settings-status {
  min-height: 16px;
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
}

.account-settings-unsaved-warning {
  margin: 8px 0 0;
  color: #ff6b6b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.account-settings-unsaved-warning[hidden] {
  display: none !important;
}

.account-settings-status:empty {
  display: none;
}

.account-settings-status.error {
  color: #ff8585;
}

.acc-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  box-sizing: border-box;
  background: #111a1e;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-light);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}

.acc-action-row:hover {
  border-color: var(--border-medium);
  background: #152126;
}

.acc-action-row:focus-visible {
  outline: 2px solid var(--primary-orange);
  outline-offset: 2px;
}

.acc-action-row.donate-row {
  border-color: rgba(67, 190, 135, 0.4);
  color: var(--emerald-green-hover);
}

.acc-arrow {
  color: var(--text-muted);
  font-size: 18px;
}

.acc-action-row.reset-row {
  color: #ff6b6b;
}

.full-reset-complete {
  margin: 0 20px 20px;
  color: var(--emerald-green-hover);
  font-size: 12px;
  line-height: 1.4;
}

.full-reset-sheet {
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}

.full-reset-warning {
  margin: 16px 20px;
  padding: 14px;
  border: 1px solid rgba(255, 107, 107, 0.35);
  border-radius: 10px;
  background: rgba(255, 107, 107, 0.08);
  color: var(--text-light);
  font-size: 13px;
  line-height: 1.5;
}

.full-reset-warning strong {
  display: block;
  margin-bottom: 4px;
  color: #ff8585;
}

.full-reset-form {
  display: grid;
  gap: 8px;
  padding: 0 20px;
}

.full-reset-form .account-auth-label strong {
  color: var(--text-white);
}

.full-reset-status {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.full-reset-status.error {
  color: #ff8585;
}

.full-reset-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.full-reset-actions button {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.full-reset-cancel {
  background: var(--bg-card);
  color: var(--text-white);
}

.full-reset-submit {
  border-color: #c94a4a !important;
  background: #b83232;
  color: #fff;
}

.full-reset-submit:disabled,
.full-reset-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.contact-support-sheet {
  max-height: min(92%, 680px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}

body.contact-support-keyboard-open #contact-support-modal {
  position: fixed;
  z-index: 140;
  inset: auto 0 auto;
  top: var(--contact-support-visual-top, 0px);
  height: var(--contact-support-visual-height, 100dvh);
  align-items: flex-start;
  border-radius: 0;
}

body.contact-support-keyboard-open #contact-support-modal .contact-support-sheet {
  width: 100%;
  height: 100%;
  max-height: 100%;
  border-radius: 0;
}

.contact-support-modal .contact-support-sheet {
  animation: support-sheet-drop 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.contact-support-form {
  display: grid;
  gap: 9px;
  padding: 0 20px 20px;
}

.contact-support-message {
  height: auto;
  min-height: 132px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}

.contact-support-status {
  min-height: 16px;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.contact-support-status:empty {
  display: none;
}

.contact-support-status.error {
  color: #ff8585;
}

.contact-support-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.contact-support-actions button:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ==========================================================================
  MODALS (Wallet Sheet, Reveal Overlay, and Other Dialogs)
   ========================================================================== */
.app-modal {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: inherit;
  overflow: hidden;
}

.app-modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(5px);
  animation: fade-in 0.2s ease both;
}

.modal-sheet {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 100%;
  max-height: 82%;
  background: var(--bg-sheet);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  border: 1px solid var(--border-medium);
  border-bottom: none;
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  animation: slide-up-sheet 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  overflow: hidden;
}

.modal-sheet.account-settings-sheet {
  max-height: min(92%, 760px);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

.modal-sheet.wallet-sheet {
  max-height: 92%;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

.app-modal.terms-modal {
  align-items: center;
  padding: 24px;
}

.terms-sheet {
  width: min(100%, 420px);
  max-height: min(90%, 520px);
  padding: 18px 22px 22px;
  border: 1px solid var(--border-medium);
  border-radius: 20px;
  text-align: center;
  animation: none;
  overflow-y: auto;
}

.terms-sheet h2 {
  margin: 12px 0 8px;
  color: var(--text-white);
  font-size: 22px;
}

.terms-modal-message {
  margin: 0;
  color: var(--text-white);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.55;
}

.terms-modal-note {
  margin: 14px 0 18px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.terms-continue-button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  background: var(--primary-orange);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.terms-continue-button:focus-visible,
.digital-terms-checkbox input:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.collection-card-modal {
  align-items: stretch;
}

@keyframes slide-up-sheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes support-sheet-drop {
  from { transform: translateY(-100vh); }
  to { transform: translateY(0); }
}

.sheet-drag-handle {
  width: 38px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  margin: 10px auto 4px;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 20px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.sheet-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-white);
}

.sheet-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sheet-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  color: var(--text-light);
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.collection-card-sheet {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior-y: contain;
  animation: fade-in 0.18s ease both;
}

.collection-card-sheet .sheet-drag-handle {
  display: none;
}

.collection-card-sheet .sheet-header {
  flex-shrink: 0;
  padding-top: max(16px, env(safe-area-inset-top));
}

.collection-card-popout-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 16px;
}

.collection-card-preview {
  display: grid;
  place-items: center;
  width: min(88vw, 420px, 50dvh);
  aspect-ratio: 63 / 88;
  flex: 0 1 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: #182329;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}

.collection-card-preview.has-image {
  width: fit-content;
  max-width: min(88vw, 420px);
  height: auto;
  max-height: min(58dvh, 620px);
  aspect-ratio: auto;
  flex: 0 0 auto;
}

.collection-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.collection-card-preview.has-image img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(58dvh, 620px);
}

.collection-card-preview.coral { background: linear-gradient(135deg, #2a1b18, #602517); }
.collection-card-preview.blue { background: linear-gradient(135deg, #132431, #174261); }
.collection-card-preview.lime { background: linear-gradient(135deg, #1c2718, #304e22); }
.collection-card-preview.gold { background: linear-gradient(135deg, #2b2613, #5e4e1a); }

.collection-card-preview-symbol {
  color: rgba(255, 255, 255, 0.56);
  font-size: 72px;
}

.collection-card-popout-details {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  gap: 6px;
  text-align: center;
}

.collection-card-rarity {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.collection-card-market-label {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 11px;
}

.collection-card-price {
  color: var(--text-white);
  font-size: 22px;
  overflow-wrap: anywhere;
}

.collection-card-quantity-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 16px;
  margin: 0 20px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.collection-card-quantity-controls[hidden] {
  display: none !important;
}

.collection-card-quantity-label {
  color: var(--text-light);
  font-size: 13px;
  font-weight: 700;
}

.collection-card-quantity-stepper {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.quantity-stepper-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-white);
  font: inherit;
  font-size: 20px;
  cursor: pointer;
}

.quantity-stepper-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.collection-card-quantity-stepper output {
  min-width: 24px;
  color: var(--text-white);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

.collection-card-purchase-summary {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
}

.collection-card-quantity {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
}

.collection-card-status {
  margin: 8px 20px 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.collection-card-status.error {
  color: #ff8585;
}

#collection-card-status[hidden],
#collection-card-buy[hidden],
#collection-card-sell[hidden],
#collection-card-send-open[hidden],
#collection-card-send-panel[hidden] {
  display: none !important;
}

.collection-card-actions {
  display: flex;
  gap: 12px;
  margin: 8px 20px 16px;
}

.collection-card-sheet > .collection-card-status,
.collection-card-sheet > .collection-card-actions,
.collection-card-sheet > .collection-card-send-panel {
  flex-shrink: 0;
}

#collection-card-actions[hidden] {
  display: none !important;
}

#collection-card-sell,
#collection-card-buy,
#collection-card-send-open {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  height: 36px;
  margin: 0;
  box-sizing: border-box;
  font-size: 13px;
}

#collection-card-sell:disabled,
#collection-card-buy:disabled,
#collection-card-send-open:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.collection-card-send-panel {
  display: grid;
  gap: 8px;
  margin: 8px 20px 16px;
}

.collection-card-send-panel label {
  color: var(--text-light);
  font-size: 11px;
  font-weight: 700;
}

.collection-card-send-panel select {
  width: min(100%, 360px);
  min-height: 48px;
  justify-self: center;
  padding: 0 14px;
  border: 1px solid var(--border-medium);
  border-radius: 9px;
  background: #10181c;
  color: var(--text-white);
  font: inherit;
  font-size: 14px;
  text-align: center;
  text-align-last: center;
}

.collection-card-send-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.collection-card-send-actions .friend-action-button {
  min-height: 48px;
  padding: 0 16px;
  font-size: 12px;
}

.collection-bulk-send-sheet {
  gap: 12px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}

.collection-bulk-send-label {
  margin: 4px 20px 0;
  color: var(--text-light);
  font-size: 12px;
  font-weight: 700;
}

.collection-bulk-send-friend {
  width: calc(100% - 40px);
  min-height: 46px;
  align-self: center;
  padding: 0 12px;
  border: 1px solid var(--border-medium);
  border-radius: 9px;
  background: #10181c;
  color: var(--text-white);
  font: inherit;
}

.collection-bulk-send-sheet .collection-card-status {
  margin: 0 20px;
}

.collection-bulk-send-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 20px;
}

.collection-bulk-send-actions .friend-action-button {
  min-height: 46px;
  padding: 0 12px;
  font-size: 12px;
}

.pack-style-modal {
  align-items: flex-end;
  padding: 0;
}

.pack-style-sheet {
  --style-accent: #ff550a;
  --style-accent-light: #ff8a5d;
  --style-accent-glow: rgba(255, 85, 10, 0.14);
  --style-track-bg: rgba(255, 85, 10, 0.1);
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  height: 96%;
  max-height: 100%;
  padding: 30px 20px max(22px, env(safe-area-inset-bottom));
  overflow-y: auto;
  background: radial-gradient(circle at 10% 0%, var(--style-accent-glow), transparent 42%), linear-gradient(160deg, #303030 0%, #181818 22%, #090909 48%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 0;
  border-radius: 34px 34px 0 0;
  box-shadow: 0 -18px 45px rgba(0, 0, 0, 0.6);
  animation: slide-up-sheet 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.pack-style-header {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 18px;
  min-height: 116px;
}

.pack-style-mark {
  width: 56px;
  height: 82px;
  object-fit: contain;
  transform: rotate(-5deg);
  filter: drop-shadow(0 0 12px var(--style-accent-glow)) drop-shadow(0 5px 10px rgba(0, 0, 0, 0.5));
}

.pack-style-modal[data-pack-id="collector"] .pack-style-sheet {
  --style-accent: #d97706;
  --style-accent-light: #fbbf24;
  --style-accent-glow: rgba(217, 119, 6, 0.16);
  --style-track-bg: rgba(217, 119, 6, 0.12);
}

.pack-style-modal[data-pack-id="premium"] .pack-style-sheet {
  --style-accent: #7c3aed;
  --style-accent-light: #c084fc;
  --style-accent-glow: rgba(124, 58, 237, 0.18);
  --style-track-bg: rgba(124, 58, 237, 0.13);
}

.pack-style-modal[data-pack-id="fifty-fifty"] .pack-style-sheet {
  --style-accent: #16a34a;
  --style-accent-light: #4ade80;
  --style-accent-glow: rgba(22, 163, 74, 0.17);
  --style-track-bg: rgba(22, 163, 74, 0.13);
}

.pack-style-heading h2 {
  margin: 0;
  color: var(--style-accent-light);
  font-size: 30px;
  line-height: 1.1;
}

.pack-style-heading p {
  margin: 8px 0 0;
  color: #c1c1c1;
  font-size: 14px;
  line-height: 1.45;
}

.pack-style-close {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-white);
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}

.pack-style-picker {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pack-style-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-white);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.pack-style-divider::before,
.pack-style-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
}

.pack-style-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.pack-style-option {
  flex: 1 1 120px;
  width: auto;
  max-width: 132px;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.24);
  color: #c1c1c1;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.pack-style-option.selected {
  border-color: var(--style-accent-light);
  color: var(--text-white);
  background: var(--style-accent-glow);
  box-shadow: 0 0 16px var(--style-accent-glow);
}

.payout-odds-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payout-odds-section h3 {
  margin: 0;
  color: var(--style-accent-light);
  font-size: 14px;
  font-weight: 600;
}

.payout-odds-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payout-band-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}

.payout-band-range,
.payout-band-value {
  color: #b9b9b9;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.payout-band-value,
.pack-style-sheet .pack-style-value-range strong {
  color: var(--style-accent-light);
}

.payout-band-range {
  text-align: right;
}

.payout-band-track {
  height: 28px;
  overflow: hidden;
  background: var(--style-track-bg);
  border-radius: 4px;
}

.payout-band-fill {
  width: 0;
  height: 100%;
  min-width: 1px;
  transition: width 0.25s ease;
}

.payout-band-fill { background: linear-gradient(90deg, var(--style-accent), var(--style-accent-light)); }

.pack-style-value-range {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #a7a7a7;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.pack-style-value-range strong {
  color: var(--text-white);
  font-size: 24px;
  font-weight: 500;
}

.range-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.range-dots::before {
  content: "";
  width: 16px;
  border-top: 2px dotted #777;
}

.range-dots i,
.range-dots b {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #898989;
}

.range-dots b {
  width: 10px;
  height: 10px;
  background: #f4cf5b;
  box-shadow: 0 0 8px rgba(244, 207, 91, 0.7);
}

.pack-style-disclaimer {
  margin: 0;
  color: #888;
  font-size: 12px;
  line-height: 1.45;
}

.pack-style-apply {
  flex: 0 0 auto;
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(100deg, var(--style-accent), var(--style-accent-light));
  color: var(--text-white);
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

@media (min-width: 481px) {
  .pack-style-sheet {
    height: 100%;
    border-radius: 40px;
  }
}

@media (max-height: 740px) {
  .pack-style-sheet { gap: 16px; padding-top: 18px; }
  .pack-style-header { min-height: 88px; }
  .pack-style-mark { height: 68px; }
  .payout-band-row,
  .payout-band-track { min-height: 28px; height: 28px; }
}

/* Wallet Top-up Sheet */
/* Shared action button used by card sheets. */
.sheet-action-button {
  margin: 12px 20px 20px;
  height: 48px;
  background: var(--primary-orange);
  border: none;
  border-radius: 9999px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 77, 0, 0.4);
}

.wallet-balance-highlight {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px;
  text-align: center;
}

.w-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.w-amount {
  font-size: 36px;
  font-weight: 800;
  color: var(--text-white);
  margin: 6px 0;
}

.quick-topup-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 20px 16px;
}

.topup-btn {
  height: 46px;
  background: #131c21;
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  color: var(--text-white);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.topup-btn:hover {
  background: #17242a;
  border-color: rgba(255, 255, 255, 0.3);
}

.topup-footnote {
  padding: 0 24px 24px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

/* ==========================================================================
   CARD REVEAL OVERLAY (Fresh Pull Dialog)
   ========================================================================== */
.reveal-overlay {
  position: absolute;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: clamp(12px, 4vw, 20px);
  border-radius: inherit;
  overflow-y: auto;
}

.reveal-overlay[hidden] {
  display: none !important;
}

.pull-reel[hidden],
#revealed-card[hidden],
#reveal-done[hidden],
#reveal-sell[hidden],
#reveal-sell-status[hidden] {
  display: none !important;
}

.reveal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 9, 0.88);
  backdrop-filter: blur(8px);
  will-change: opacity;
  animation: fade-in 0.25s ease both;
}

.reveal-dialog {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(360px, 100%);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: clamp(16px, 5vw, 26px) clamp(14px, 6vw, 24px) clamp(16px, 5vw, 24px);
  background: #0f171b;
  border: 1px solid var(--border-medium);
  border-radius: 24px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
  will-change: transform, opacity;
  transform: translateZ(0);
  animation: rise-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.reveal-fireworks {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.reveal-dialog > #revealed-card,
.reveal-dialog > #reveal-title,
.reveal-dialog > .reveal-subtitle,
.reveal-dialog > .reveal-actions,
.reveal-dialog > .pull-reel {
  position: relative;
  z-index: 2;
}

.card-emerge-layer {
  position: absolute;
  inset: 0;
  z-index: 125;
  overflow: hidden;
  perspective: 1100px;
  pointer-events: none;
}

.card-emerge-card {
  position: absolute;
  top: 0;
  left: 0;
  transform-style: preserve-3d;
  transform-origin: center;
  will-change: transform;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.72)) drop-shadow(0 0 18px rgba(255, 132, 52, 0.38));
}

.card-emerge-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 12px;
  background: #101820;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-emerge-back img,
.card-emerge-front img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-emerge-front {
  transform: rotateY(180deg);
  background: linear-gradient(145deg, #24313b, #0b1014);
  color: #fff;
}

.card-emerge-front strong {
  position: absolute;
  z-index: 0;
  inset: auto 10px 12px;
  overflow: hidden;
  color: #fff;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

.card-emerge-front img {
  position: relative;
  z-index: 1;
  object-fit: contain;
  background: #101820;
}

.reveal-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #ff914d;
  font-family: var(--font-mono);
  margin-bottom: 12px;
}

.pull-reel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 4px;
}

.pull-reel-window {
  position: relative;
  width: 100%;
  height: clamp(164px, 26vh, 204px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: #080e12;
  cursor: pointer;
  touch-action: pan-y;
}

.pull-reel-window:focus-visible {
  outline: 2px solid var(--primary-orange);
  outline-offset: 3px;
}

.pull-reel-track {
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  height: 100%;
  padding: 0 calc(50% - 54px);
  box-sizing: border-box;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.pull-reel-card {
  position: relative;
  display: flex;
  flex: 0 0 108px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  box-sizing: border-box;
  width: 108px;
  height: 154px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9px;
  background: linear-gradient(150deg, #263038, #101519 68%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}

.pull-reel-card::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, transparent 36%, rgba(255, 255, 255, 0.08));
  content: "";
  pointer-events: none;
}

.pull-reel-card.coral { background-color: #442019; background-image: linear-gradient(150deg, #67331f, #171111 72%); }
.pull-reel-card.blue { background-color: #10273a; background-image: linear-gradient(150deg, #245071, #10161d 72%); }
.pull-reel-card.lime { background-color: #24351a; background-image: linear-gradient(150deg, #3c5828, #111713 72%); }
.pull-reel-card.gold { background-color: #473b13; background-image: linear-gradient(150deg, #80651a, #17140d 72%); }

.pull-reel-card-symbol {
  position: absolute;
  top: 12px;
  right: 12px;
  color: rgba(255, 255, 255, 0.34);
  font-size: 34px;
}

.pull-reel-card-name,
.pull-reel-card-rarity,
.pull-reel-card-price {
  position: relative;
  z-index: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pull-reel-card-name {
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.pull-reel-card-rarity,
.pull-reel-card-price {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 9px;
}

.pull-reel-card-price {
  color: #fff;
  font-weight: 700;
}

.pull-reel-card:last-child {
  border-color: var(--primary-orange);
  box-shadow: 0 0 18px rgba(255, 84, 20, 0.32), 0 8px 18px rgba(0,  0, 0, 0.45);
}

.pull-reel-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 2;
  width: 2px;
  background: var(--primary-orange);
  box-shadow: 0 0 10px rgba(255, 84, 20, 0.65);
  pointer-events: none;
}

.pull-reel-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.pull-reel-hint {
  color: var(--text-muted);
  font-size: 11px;
}

.pull-reel-stop {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255, 84, 20, 0.65);
  border-radius: 999px;
  background: rgba(255, 84, 20, 0.12);
  color: var(--text-white);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.pull-reel-stop:disabled {
  opacity: 0.7;
  cursor: wait;
}

.close-reveal {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 20px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.card-face {
  position: relative;
  width: 245px;
  height: 343px;
  aspect-ratio: 63 / 88;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 77, 0, 0.25);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  animation: card-arrive 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.card-face.has-real-image {
  background: #141c20;
  padding: 0;
  width: 245px;
  height: 343px;
  aspect-ratio: 63 / 88;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.8), 0 0 35px rgba(255, 84, 20, 0.35);
  overflow: hidden;
}

.reveal-dialog > #revealed-card {
  width: min(245px, 72vw, 32dvh);
  height: auto;
  flex: 0 1 auto;
  aspect-ratio: 63 / 88;
}

.revealed-pokemon-img {
  width: 100%;
  height: 100%;
  aspect-ratio: 63 / 88;
  object-fit: contain;
  border-radius: 12px;
  display: block;
  margin: 0 auto;
  will-change: transform;
  transform: translateZ(0);
}

.card-face.coral { background: linear-gradient(135deg, #3c1a15, #8c2a16); }
.card-face.blue { background: linear-gradient(135deg, #162f44, #1b5380); }
.card-face.lime { background: linear-gradient(135deg, #24351a, #436e25); }
.card-face.gold { background: linear-gradient(135deg, #383013, #7a641a); }

.card-face-top, .card-face-bottom {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.7);
}

.card-face-symbol {
  position: absolute;
  top: 40%;
  right: 18px;
  font-size: 48px;
  color: rgba(255, 255, 255, 0.3);
}

.card-face-title {
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  text-align: left;
}

.reveal-dialog h2 {
  font-size: clamp(16px, 5vw, 20px);
  font-weight: 800;
  color: var(--text-white);
  margin-top: clamp(10px, 3vh, 18px);
}

.reveal-subtitle {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(10px, 3vw, 12px);
  color: var(--text-muted);
  margin: 6px 0 clamp(12px, 3vh, 20px);
  font-family: var(--font-mono);
}

.reveal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.reveal-done {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  height: auto;
  padding: 6px clamp(4px, 2vw, 10px);
  background: var(--primary-orange);
  border: none;
  border-radius: 9999px;
  color: #ffffff;
  font-size: clamp(10px, 3vw, 12px);
  line-height: 1.2;
  white-space: normal;
  text-wrap: balance;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 77, 0, 0.4);
}

.reveal-sell {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  height: auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-white);
  font: inherit;
  padding: 0 8px;
  font-size: clamp(9px, 2.8vw, 12px);
  font-weight: 700;
  cursor: pointer;
  line-height: 1.2;
  white-space: normal;
  text-wrap: balance;
}

.reveal-sell:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.1);
}

.reveal-sell:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.reveal-sell-status {
  flex: 0 0 100%;
  width: 100%;
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

/* Card-dial reveal: keep the carousel visible and hand the flight card off in place. */
.reveal-overlay.is-card-dial-reveal {
  padding: 0;
  overflow: hidden;
}

.reveal-overlay.is-card-dial-reveal .reveal-backdrop {
  background: transparent;
  backdrop-filter: none;
  animation: none;
}

.reveal-overlay.is-card-dial-reveal .reveal-dialog {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  animation: none;
  transform: none;
}

.reveal-overlay.is-card-dial-reveal .close-reveal {
  z-index: 3;
}

.reveal-overlay.is-card-dial-reveal #revealed-card {
  position: absolute;
  top: calc(50% - 44px);
  left: 50%;
  width: var(--dial-card-width, 245px);
  height: var(--dial-card-height, 343px);
  margin: 0;
  padding: 0;
  opacity: 0;
  transform: translate(-50%, -50%) rotateY(90deg);
  transform-style: preserve-3d;
  animation: none;
}

.reveal-overlay.is-card-dial-reveal.is-card-dial-reveal-visible #revealed-card {
  animation: dial-card-front-reveal 380ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes dial-card-front-reveal {
  0% { opacity: 0; transform: translate(-50%, -50%) rotateY(88deg) scale(0.97); }
  45% { opacity: 0.72; }
  100% { opacity: 1; transform: translate(-50%, -50%) rotateY(0deg) scale(1); }
}

.reveal-overlay.is-card-dial-reveal #reveal-title,
.reveal-overlay.is-card-dial-reveal .reveal-subtitle {
  position: absolute;
  left: 14px;
  right: 14px;
  margin: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

.reveal-overlay.is-card-dial-reveal #reveal-title {
  top: var(--dial-card-info-top, calc(50% + 140px));
  font-size: 18px;
}

.reveal-overlay.is-card-dial-reveal .reveal-subtitle {
  top: calc(var(--dial-card-info-top, calc(50% + 140px)) + 27px);
  overflow: hidden;
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reveal-overlay.is-card-dial-reveal .reveal-actions {
  position: absolute;
  top: calc(var(--dial-card-info-top, calc(50% + 140px)) + 58px);
  bottom: auto;
  left: 50%;
  width: min(var(--dial-card-width, 245px), calc(100% - 32px));
  padding: 6px;
  gap: 6px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(8, 13, 16, 0.82);
}

/* ==========================================================================
   CARD DIAL / RIP SPIN TAB VIEW
   ========================================================================== */
#tab-rip {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  padding-top: 4px;
  background: transparent;
}

.app-viewport.card-dial-active .mobile-bottom-nav {
  display: none;
}

.card-dial-close {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  right: 12px;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(8, 13, 16, 0.72);
  color: var(--text-white);
  font: inherit;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.card-dial-close[hidden] {
  display: none;
}

.card-dial-close:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.card-dial-close:disabled {
  opacity: 0.45;
  cursor: wait;
}

.rip-view-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  min-height: 100%;
  width: 100%;
  padding: 6px 12px 14px;
  box-sizing: border-box;
}

.rip-view-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 4px;
  gap: 4px;
  z-index: 5;
}

.rip-eyebrow {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  background: rgba(255, 84, 20, 0.16);
  border: 1px solid rgba(255, 84, 20, 0.45);
  color: #ff914d;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
}

.rip-eyebrow.gold {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}

.rip-eyebrow.purple {
  background: rgba(168, 85, 247, 0.16);
  border-color: rgba(168, 85, 247, 0.45);
  color: #c084fc;
}

.rip-title {
  font-size: clamp(20px, 2.6vh, 24px);
  font-weight: 800;
  color: var(--text-white);
  letter-spacing: -0.01em;
}

.rip-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* 3D Card Dial Stage */
.card-dial-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: clamp(300px, 46vh, 410px);
  min-height: 0;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1100px;
  perspective-origin: 50% 50%;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  margin: 0;
  transform: translate(-50%, -50%);
}

.card-dial-stage:active {
  cursor: grabbing;
}

.card-dial-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0);
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 84, 20, 0.25) 0%, rgba(30, 80, 95, 0.15) 50%, transparent 70%);
  filter: blur(32px);
  pointer-events: none;
  z-index: 1;
}

/* 3D Pack Cylinder Track */
.card-dial-track {
  position: relative;
  width: clamp(112px, 16vh, 136px);
  height: clamp(190px, 28vh, 232px);
  aspect-ratio: 228 / 382;
  transform-style: preserve-3d;
  will-change: transform;
  transform: rotateY(0deg);
  transition: transform 0.45s cubic-bezier(0.2, 0.85, 0.3, 1);
}

/* Individual Pack in the 3D Ring */
.card-dial-item {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  backface-visibility: visible;
  cursor: pointer;
  transform: rotateY(calc(var(--card-angle, 0deg))) translateZ(var(--card-radius, 320px));
  transition: opacity 0.3s ease, filter 0.3s ease, transform 0.3s ease;
  will-change: transform, opacity, filter;
}

.card-dial-item:not(.active) {
  opacity: 0.58;
  filter: brightness(0.68) saturate(0.8);
}

.card-dial-item.active {
  opacity: 1;
  filter: brightness(1.05) saturate(1.1);
  z-index: 10;
}

.card-dial-stage.pack-focused {
  cursor: pointer;
}

.card-dial-stage.pack-focused,
.card-dial-stage.is-spinning {
  touch-action: none;
  overscroll-behavior: contain;
}

.card-dial-stage.is-spinning .card-dial-item.active {
  opacity: 0.58;
  filter: brightness(0.68) saturate(0.8);
  z-index: 1;
}

.card-dial-stage.is-spinning .card-dial-pack::before {
  opacity: 0;
  animation: none;
}

.card-dial-stage.pack-focused .card-dial-item:not(.focused) {
  opacity: 0.16;
  filter: brightness(0.35) saturate(0.45) blur(1px);
}

.card-dial-item.focused {
  opacity: 1;
  filter: brightness(1.08) saturate(1.1);
  transform: rotateY(calc(var(--card-angle, 0deg))) translateZ(calc(var(--card-radius, 320px) + 90px));
  z-index: 20;
}

.card-dial-item.focused,
.card-dial-item.focused .card-dial-pack {
  cursor: ew-resize;
}

.card-dial-item.focused .card-dial-pack {
  transform: scale(1.08);
  box-shadow: 0 0 34px rgba(255, 84, 20, 0.7), 0 20px 44px rgba(0, 0, 0, 0.9);
}

/* Mini Foil Pack for the 3D Dial */
.card-dial-pack {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  border-radius: 5px;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transform-origin: center center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card-dial-pack.is-winner {
  box-shadow: 0 0 28px rgba(255, 84, 20, 0.8), 0 16px 36px rgba(0, 0, 0, 0.9);
  transform: scale(1.35);
  transform-origin: center top;
}

.card-dial-pack.pack-slid-away {
  visibility: hidden !important;
  pointer-events: none !important;
}

.card-dial-pack .pack-body::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  z-index: 6;
  width: 100%;
  height: 9px;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95) 14%, #ffb36b 48%, rgba(255, 255, 255, 0.9) 82%, transparent);
  clip-path: polygon(0 48%, 9% 18%, 18% 76%, 29% 22%, 39% 86%, 51% 18%, 62% 70%, 73% 15%, 84% 78%, 94% 28%, 100% 52%, 100% 68%, 91% 48%, 82% 92%, 71% 45%, 61% 86%, 49% 38%, 38% 100%, 27% 42%, 17% 100%, 8% 48%, 0 82%);
  filter: drop-shadow(0 0 7px rgba(255, 150, 75, 0.9));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.card-dial-pack .pack-body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  z-index: 7;
  width: 100%;
  height: 8px;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(180deg, #fff3cb 0%, #ff9b42 34%, rgba(108, 35, 14, 0.9) 100%);
  clip-path: polygon(0 0, 7% 42%, 15% 10%, 23% 56%, 32% 16%, 41% 64%, 50% 20%, 60% 62%, 70% 12%, 80% 54%, 90% 18%, 100% 48%, 100% 100%, 0 100%);
  filter: drop-shadow(0 2px 5px rgba(255, 117, 36, 0.85));
  transform: scaleX(0);
  transform-origin: left center;
}

.foil-rip-spark {
  position: absolute;
  z-index: 8;
  top: var(--rip-spark-y, 50%);
  left: var(--rip-spark-x, 50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.55);
  background: radial-gradient(circle, #ffffff 0 7%, #fff4c2 12%, rgba(255, 178, 83, 0.72) 27%, rgba(255, 103, 30, 0.18) 52%, transparent 72%);
  filter: drop-shadow(0 0 4px rgba(255, 244, 194, 0.95)) drop-shadow(0 0 10px rgba(255, 122, 44, 0.8));
}

.foil-rip-spark::before,
.foil-rip-spark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff7d6;
  clip-path: polygon(50% 0, 59% 39%, 100% 50%, 59% 60%, 50% 100%, 41% 60%, 0 50%, 41% 39%);
}

.foil-rip-spark::before {
  transform: scale(0.72);
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.95));
}

.foil-rip-spark::after {
  inset: 7px;
  transform: rotate(45deg) scale(0.7);
  background: #ffad4f;
}

.card-dial-pack.rip-dragging .foil-rip-spark {
  opacity: 1;
  animation: foil-rip-sparkle 0.34s ease-in-out infinite alternate;
}

@keyframes foil-rip-sparkle {
  from { transform: translate(-50%, -50%) scale(0.68) rotate(-12deg); }
  to { transform: translate(-50%, -50%) scale(1.08) rotate(12deg); }
}

.card-dial-pack.rip-dragging .pack-body::after {
  left: var(--rip-line-left, 0px);
  width: var(--rip-line-width, 0px);
  opacity: var(--rip-progress, 0);
  transform: none;
  transition: none;
}

/* Pack Elements inside Dial */
.card-dial-pack .pack-crimp {
  height: 14px;
}

.card-dial-pack .top-crimp {
  position: relative;
  transform-origin: left bottom;
  will-change: transform, opacity;
  z-index: 15;
  transition: transform 0.16s ease;
}

.card-dial-pack.rip-dragging .top-crimp {
  transform: var(--rip-flap-transform, none);
  transition: none;
}

.card-dial-pack.rip-dragging::before {
  opacity: 0;
  animation: none;
}

.card-dial-pack .bottom-crimp {
  height: 14px;
}

.card-dial-pack .pack-brand-header {
  margin-top: 8px;
  gap: 3px;
}

.card-dial-pack .triumph-logo-mark svg {
  width: 16px;
  height: 14px;
}

.card-dial-pack .collectibles-badge {
  font-size: 6px;
  padding: 1.5px 5px;
}

.card-dial-pack .triumph-watermark {
  top: 56px;
  font-size: 18px;
}

.card-dial-pack .pack-orange-sweep {
  height: 110px;
}

.card-dial-pack .pokeball-emblem {
  top: 104px;
}

.card-dial-pack .emblem-outer-ring {
  width: 48px;
  height: 48px;
  border-width: 2px;
}

.card-dial-pack .emblem-ball {
  border-width: 1.5px;
}

.card-dial-pack .ball-center-btn {
  width: 14px;
  height: 14px;
}

.card-dial-pack .pack-footer-label {
  font-size: 6.5px;
  margin-bottom: 5px;
}

/* Rip tear-line visual guide across the top of the active front pack */
.card-dial-item.active .card-dial-pack::before {
  content: "← SWIPE TOP SEAL →";
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  font-size: 6.5px;
  font-weight: 800;
  color: #ff914d;
  letter-spacing: 0.14em;
  text-align: center;
  z-index: 20;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.45);
  border-bottom: 1px dashed rgba(255, 145, 77, 0.85);
  padding: 1px 0;
  pointer-events: none;
  animation: rip-dash-pulse 1.4s ease-in-out infinite;
}

.card-dial-item.active .card-dial-pack.rip-dragging::before {
  opacity: 0;
  animation: none;
}

@keyframes rip-dash-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; filter: drop-shadow(0 0 4px rgba(255, 145, 77, 0.8)); }
}

/* Ripping Animation on the chosen pack */
.card-dial-pack.ripping-pack {
  transform-origin: center top;
  animation: pack-shake-burst 1.32s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.card-dial-pack.ripping-pack .top-crimp {
  animation: crimp-tear-off 0.94s 0.2s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

.card-dial-pack.ripping-pack .pack-body {
  animation: pack-open-flash 1.28s ease-out forwards;
}

.card-dial-pack.ripping-pack .pack-body::before {
  animation: foil-torn-edge 1.08s 0.24s cubic-bezier(0.18, 0.78, 0.24, 1) forwards;
}

.card-dial-pack.ripping-pack .pack-body::after {
  animation: foil-tear-line 0.82s 0.18s ease-out forwards;
}

@keyframes pack-shake-burst {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1.35) rotate(0deg); }
  8% { transform: translate3d(-2px, 1px, 0) scale(1.2) rotate(-1.8deg); }
  17% { transform: translate3d(3px, -1px, 0) scale(1.23) rotate(2deg); }
  28% { transform: translate3d(-3px, 1px, 0) scale(1.3) rotate(-1.5deg); }
  40% { transform: translate3d(1px, -3px, 0) scale(1.38) rotate(1deg); }
  52% { transform: translate3d(-1px, -5px, 0) scale(1.48) rotate(-0.8deg); }
  68% { transform: translate3d(2px, 2px, 0) scale(1.56) rotate(1.1deg); }
  84% { transform: translate3d(-1px, 0, 0) scale(1.43) rotate(-0.4deg); }
}

@keyframes crimp-tear-off {
  0% {
    transform: translate3d(0, 0, 0) rotateX(0) rotateZ(0) scaleY(1);
    opacity: 1;
  }
  18% {
    transform: translate3d(-4px, -2px, 8px) rotateX(-12deg) rotateZ(-2deg) scaleY(1.04);
    opacity: 1;
  }
  38% {
    transform: translate3d(4px, -7px, 20px) rotateX(-30deg) rotateZ(5deg) scaleY(0.96);
    opacity: 1;
  }
  54% {
    transform: translate3d(16px, -14px, 34px) rotateX(-42deg) rotateZ(22deg) scaleY(0.9);
    opacity: 1;
  }
  76% {
    transform: translate3d(52px, -34px, 52px) rotateX(-64deg) rotateZ(58deg) scaleY(0.78);
    opacity: 0.9;
  }
  100% {
    transform: translate3d(104px, -66px, 72px) rotateX(-78deg) rotateZ(88deg) scaleY(0.62);
    opacity: 0;
  }
}

@keyframes foil-torn-edge {
  0% { opacity: 0; transform: scaleX(0); }
  38% { opacity: 1; transform: scaleX(0.42); }
  68% { opacity: 1; transform: scaleX(1.04); }
  82% { opacity: 0.92; transform: scaleX(0.98); }
  100% { opacity: 0.9; transform: scaleX(1); }
}

@keyframes pack-open-flash {
  0%, 20% { filter: brightness(1); transform: scaleY(1); }
  35% { filter: brightness(1.8) contrast(1.14) drop-shadow(0 0 30px rgba(255, 84, 20, 0.9)); transform: scaleY(0.97); }
  52% { filter: brightness(1.3) contrast(1.08) drop-shadow(0 0 14px rgba(255, 145, 77, 0.65)); transform: scaleY(1.025); }
  70% { filter: brightness(1.18); transform: scaleY(0.995); }
  100% { filter: brightness(1.12); transform: scaleY(1); }
}

@keyframes foil-tear-line {
  0% { opacity: 0; transform: scaleX(0); }
  20% { opacity: 1; transform: scaleX(0.18); }
  48% { opacity: 1; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(1); }
}

/* Floor Reflection for 3D Packs */
/* Rip spin action button */
.rip-spin-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 140, 20, 0.85);
  border-radius: 9999px;
  background: linear-gradient(135deg, #ff7a18 0%, #ea580c 100%);
  color: #ffffff;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 24px rgba(234, 88, 12, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.rip-spin-button:active {
  transform: scale(0.98);
}

.rip-spin-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.rip-stop-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 84, 20, 0.8);
  border-radius: 9999px;
  background: linear-gradient(135deg, #ff5414 0%, #e04206 100%);
  color: #ffffff;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 24px rgba(255, 84, 20, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.rip-stop-button:active {
  transform: scale(0.98);
}

.rip-stop-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.rip-open-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(0, 200, 115, 0.85);
  border-radius: 9999px;
  background: linear-gradient(135deg, #00b86b 0%, #00874e 100%);
  color: #ffffff;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 24px rgba(0, 184, 107, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: pulse-open-btn 1.6s ease-in-out infinite;
}

.rip-open-button:active {
  transform: scale(0.98);
}

.rip-open-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

@keyframes pulse-open-btn {
  0%, 100% { box-shadow: 0 8px 24px rgba(0, 184, 107, 0.45); }
  50% { box-shadow: 0 8px 30px rgba(0, 230, 130, 0.7); }
}

.rip-back-button {
  width: 100%;
  min-height: 38px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
  color: var(--text-light);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.rip-back-button:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Animations */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translate3d(0, 16px, 0) scale(0.97); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes card-arrive {
  0% {
    opacity: 0;
    transform: perspective(700px) translate3d(0, 32px, -30px) rotateX(10deg) scale(0.92);
  }
  70% {
    opacity: 1;
    transform: perspective(700px) translate3d(0, -4px, 6px) rotateX(-1deg) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: perspective(700px) translate3d(0, 0, 0) rotateX(0deg) scale(1);
  }
}

@keyframes slide-down {
  from { opacity: 0; transform: translate3d(0, -8px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* ==========================================================================
   PHONE ASPECT RATIO & RESPONSIVE CONTAINER
   ========================================================================== */
@media (min-width: 481px) {
  /* Keep the app at its mobile-design size and show the selected background around it. */
  body.mobile-app-body {
    padding: 0;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
    background-color: var(--app-background-color, var(--bg-base));
    background-image:
      linear-gradient(rgba(8, 13, 16, 0.42), rgba(8, 13, 16, 0.58)),
      var(--app-background-image, url("/backgrounds/stars.jpg"));
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
  }

  .app-viewport {
    flex: 0 1 auto;
    width: min(100%, 665px);
    height: min(100vh, 768px);
    height: min(100dvh, 768px);
    max-width: 665px;
    max-height: 768px;
    aspect-ratio: auto;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .mobile-bottom-nav {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@media (max-width: 480px) {
  /* On mobile phones, fill screen seamlessly at 100dvh with zero zoom */
  .app-viewport {
    width: 100%;
    height: 100dvh;
    max-width: 100%;
    border-radius: 0;
    border: none;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  body.mobile-app-body {
    padding: 0;
  }

  .app-viewport {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
  }

  .mobile-bottom-nav {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@media (max-height: 820px) {
  .pack-carousel-stage {
    --pack-carousel-base-radius: clamp(150px, 22vh, 220px);
    padding: 26px 0 0;
    top: 16px;
  }

  .pack-carousel-track {
    width: clamp(137px, 22.1vh, 188px);
    height: clamp(230px, 37vh, 312px);
  }

  .pack-heading-group {
    margin-top: 2px;
    transform: translateY(12px);
  }

  .pack-display-title {
    margin-bottom: 0;
  }

  .pack-stats-row {
    margin-top: 6px;
    transform: translateY(6px);
  }

  .buy-action-container {
    padding-top: 8px;
    padding-bottom: 14px;
  }

  .notice-callout {
    min-height: 0;
    margin-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* iOS Safari zooms the page when a focused text control uses less than 16px. */
@media (max-width: 767px) {
  .mobile-app-body input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):focus,
  .mobile-app-body textarea:focus,
  .mobile-app-body select:focus {
    font-size: 16px !important;
  }
}
