* {
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  --festival-october-harvest-gradient: linear-gradient(135deg, #24252b 0%, #363941 15%, #5b4d54 29%, #87554f 43%, #b96446 55%, #d97939 68%, #ee9135 82%, #ffad47 100%);
}

body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: var(--theme-page-bg);
  background-size: 400% 400%;
  background-repeat: no-repeat;
  animation: gradientShift 15s ease infinite;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: 'Courier New', 'Consolas', monospace;
  color: var(--theme-body-text);
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  -webkit-user-select: none;
  user-select: none;
}

/* Game labels and button-adjacent text should not open mobile text selection.
   Keep fields where players type or edit text selectable. */
:is(input, textarea, select, [contenteditable="true"], [contenteditable="plaintext-only"], [role="textbox"]) {
  -webkit-user-select: text;
  user-select: text;
}

/* Keep festival color transitions stationary at the viewport's normal size. */
html[data-theme^="festival-"] body {
  background-size: 100% 100%;
  background-position: center;
  animation: none;
}

/* Non-default themes can opt back into the colorful Default-mode gradient. */
html:not([data-theme="light"])[data-page-gradient="colorful"] body {
  background: var(--theme-colorful-page-bg);
  background-size: 400% 400%;
  background-repeat: no-repeat;
  animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

h1, h2, h3, .nav-brand {
  font-family: 'Press Start 2P', 'Courier New', monospace;
}

.carousel {
  display: flex;
  /* Transition handled by JavaScript for better control */
  height: 100vh;
  height: 100dvh;
  width: 100%;
  will-change: transform;
  /* Enable touch events to bubble up to parent */
  touch-action: pan-y;
  pointer-events: auto;
}

.carousel-slide {
  position: relative;
  min-width: 100vw;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  overflow: visible;
  pointer-events: none !important;  /* CRITICAL: Prevent slide from blocking clicks to children */
}

/* Weekly festival scene decorations. */
#mainView.festival-active {
  position: relative;
}

#mainView.festival-active .carousel-slide {
  /* Keep the animated backdrop below the scene ground and both SVG layers. */
  isolation: isolate;
}

#mainView.festival-active .carousel-slide::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: -1;
  width: min(calc(var(--festival-art-height, 95vh) * 16 / 9), 100vw);
  height: var(--festival-art-height, 95vh);
  transform: translate(-50%, -50%);
  background: url('../images/svg/fireworks.svg') center center / 100% 100% no-repeat;
  opacity: 0.82;
  animation: festivalFireworksBurst 5.5s ease-in-out infinite;
  pointer-events: none;
}

#mainView.festival-starlight .carousel-slide::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 2;
  width: min(calc(95vh * 16 / 9), 100vw);
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
  background: url('../images/svg/festivals/starlight_festival/festival_starlight_default.svg') center center / 100% 100% no-repeat;
  pointer-events: none;
}

html:is([data-theme="grey"], [data-theme="festival-october-harvest"]) #mainView.festival-starlight .carousel-slide::after {
  background-image: url('../images/svg/festivals/starlight_festival/festival_starlight_grey.svg');
}

html:is([data-theme="dark"], [data-theme="festival-starlight"]) #mainView.festival-starlight .carousel-slide::after {
  background-image: url('../images/svg/festivals/starlight_festival/festival_starlight_purple.svg');
}

html[data-page-gradient="colorful"]:not([data-theme^="festival-"]) #mainView.festival-starlight .carousel-slide::after {
  background-image: url('../images/svg/festivals/starlight_festival/festival_starlight_default.svg');
}

#mainView.festival-starlight .carousel-slide > svg.tent-svg {
  z-index: 3;
}

#mainView.festival-sweet-snack .carousel-slide::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 2;
  width: min(calc(95vh * 16 / 9), 100vw);
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
  background: url('../images/svg/festivals/sweet_snack_fair/festival_snack_default_foreground.svg') center center / 100% 100% no-repeat;
  pointer-events: none;
}

html:is([data-theme="grey"], [data-theme="festival-october-harvest"]) #mainView.festival-sweet-snack .carousel-slide::after {
  background-image: url('../images/svg/festivals/sweet_snack_fair/festival_snack_grey_foreground.svg');
}

html:is([data-theme="dark"], [data-theme="festival-starlight"]) #mainView.festival-sweet-snack .carousel-slide::after {
  background-image: url('../images/svg/festivals/sweet_snack_fair/festival_snack_purple_foreground.svg');
}

html[data-page-gradient="colorful"]:not([data-theme^="festival-"]) #mainView.festival-sweet-snack .carousel-slide::after {
  background-image: url('../images/svg/festivals/sweet_snack_fair/festival_snack_default_foreground.svg');
}

#mainView.festival-sweet-snack .carousel-slide > svg.tent-svg {
  z-index: 3;
}

#mainView.festival-lucky-pull .carousel-slide::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 2;
  width: min(calc(95vh * 16 / 9), 100vw);
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
  background: url('../images/svg/festivals/lucky_parade/festival_lucky_default.svg?v=1') center center / 100% 100% no-repeat;
  pointer-events: none;
}

html:is([data-theme="grey"], [data-theme="festival-october-harvest"]) #mainView.festival-lucky-pull .carousel-slide::after {
  background-image: url('../images/svg/festivals/lucky_parade/festival_lucky_grey.svg?v=1');
}

html:is([data-theme="dark"], [data-theme="festival-starlight"]) #mainView.festival-lucky-pull .carousel-slide::after {
  background-image: url('../images/svg/festivals/lucky_parade/festival_lucky_purple.svg?v=1');
}

html[data-page-gradient="colorful"]:not([data-theme^="festival-"]) #mainView.festival-lucky-pull .carousel-slide::after {
  background-image: url('../images/svg/festivals/lucky_parade/festival_lucky_default.svg?v=1');
}

#mainView.festival-lucky-pull .carousel-slide > svg.tent-svg {
  z-index: 3;
}

#mainView.festival-ozoz-birthday .carousel-slide::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 2;
  width: min(calc(95vh * 16 / 9), 100vw);
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
  background: url('../images/svg/festivals/ozoz_birthday/festival_ozoz_default.svg?v=1') center center / 100% 100% no-repeat;
  pointer-events: none;
}

html:is([data-theme="grey"], [data-theme="festival-october-harvest"]) #mainView.festival-ozoz-birthday .carousel-slide::after {
  background-image: url('../images/svg/festivals/ozoz_birthday/festival_ozoz_grey.svg?v=1');
}

html:is([data-theme="dark"], [data-theme="festival-starlight"]) #mainView.festival-ozoz-birthday .carousel-slide::after {
  background-image: url('../images/svg/festivals/ozoz_birthday/festival_ozoz_purple.svg?v=1');
}

html[data-page-gradient="colorful"]:not([data-theme^="festival-"]) #mainView.festival-ozoz-birthday .carousel-slide::after {
  background-image: url('../images/svg/festivals/ozoz_birthday/festival_ozoz_default.svg?v=1');
}

.october-festival-art {
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 2;
  width: min(calc(95vh * 16 / 9), 100vw);
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#mainView.festival-october-harvest .carousel-slide::before {
  content: none;
}

.october-background-ghosts {
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 1;
  width: min(calc(95vh * 16 / 9), 100vw);
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
  overflow: hidden;
  pointer-events: none;
}

.october-ghost {
  position: absolute;
  width: clamp(80px, 10%, 150px);
  height: auto;
  opacity: 0.4;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 12px rgba(255, 249, 242, 0.52));
  pointer-events: none;
}

.october-ghost--one {
  left: 9%;
  top: 8%;
  animation: octoberGhostDriftOne 11s ease-in-out infinite;
}

.october-ghost--two {
  left: 75%;
  top: 10%;
  width: clamp(70px, 8.5%, 130px);
  animation: octoberGhostDriftTwo 13s ease-in-out -4s infinite;
}

@keyframes octoberGhostDriftOne {
  0%, 100% { transform: translate(0, 0); opacity: 0.32; }
  50% { transform: translate(26px, -20px); opacity: 0.52; }
}

@keyframes octoberGhostDriftTwo {
  0%, 100% { transform: translate(0, 0); opacity: 0.27; }
  50% { transform: translate(-29px, 18px); opacity: 0.46; }
}

@media (prefers-reduced-motion: reduce) {
  .october-ghost { animation: none; }
}

.october-apple-picker {
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 3;
  width: min(calc(95vh * 16 / 9), 100vw);
  aspect-ratio: 16 / 9;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.october-apple-hit { fill: transparent; pointer-events: all; cursor: pointer; }
.october-apple-picker:focus-visible .october-apple-hit { stroke: #fff3ec; stroke-width: 4; }

.october-maze-sign { display: none; cursor: pointer; pointer-events: auto; }
body.october-maze-available .october-maze-sign { display: block; }
body.october-maze-available #claw_speakers { display: none; }
.october-maze-sign-image { pointer-events: none; }
.october-maze-sign-hit { fill: transparent; pointer-events: all; }
#claw_ozoz.october-maze-departing {
  transform: translateX(-450px);
  opacity: 0;
  transition: transform 550ms ease-in, opacity 550ms ease-in;
  pointer-events: none;
}

.balloon-game-modal.corn-maze-modal {
  width: min(1180px, 96vw);
  max-width: 96vw;
}
.corn-maze-modal .game-main { min-width: 0; }
.corn-maze-modal .game-sidebar { flex: 0 0 220px; }
.corn-maze-modal .maze-canvas-viewport { width: 100%; overflow: hidden; }
.corn-maze-modal #cornMazeCanvas {
  display: block;
  width: 100%;
  max-width: 900px;
  height: auto;
  margin: 0 auto;
  border: 3px solid var(--theme-body-text);
  border-radius: 12px;
  image-rendering: pixelated;
  touch-action: none;
}
.corn-maze-modal #cornMazeDpad { display: none; }
@media (pointer: coarse) {
  .corn-maze-modal #cornMazeDpad { display: grid; }
}
.corn-maze-modal .maze-status { text-align: center; }
.corn-maze-modal #cornMazeResult:not([hidden]) { display: block; }
.corn-maze-modal #cornMazeCanvas[hidden] { display: none; }
.corn-maze-modal .maze-level-picker {
  padding: .7rem;
  border: 1px solid rgba(91, 76, 98, .2);
  border-radius: 10px;
  background: rgba(255, 255, 255, .12);
}
.corn-maze-modal .maze-level-picker strong { display: block; margin-bottom: .45rem; }
.corn-maze-modal .maze-level-buttons { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .25rem; }
.corn-maze-modal .maze-level-buttons button {
  min-width: 0;
  padding: .4rem 0;
  border: 1px solid var(--theme-body-text);
  border-radius: 6px;
  background: transparent;
  color: var(--theme-text);
  cursor: pointer;
}
.corn-maze-modal .maze-level-buttons button[aria-pressed="true"] {
  background: var(--theme-body-text);
  color: var(--theme-modal-bg);
}
.corn-maze-modal .maze-level-picker small { display: block; margin-top: .45rem; font-size: .7rem; }
.corn-maze-modal #cornMazeStart[hidden],
.corn-maze-modal #cornMazeRestart[hidden] { display: none; }
.corn-maze-leaderboard-modal .leaderboard-tabs .lb-tab { flex: 1 1 3rem; }
@media (max-width: 768px) {
  .corn-maze-modal .game-sidebar { flex-basis: auto; }
  .corn-maze-modal #cornMazeCanvas { max-width: 100%; }
  .corn-maze-modal[data-board-visible="true"][data-difficulty="4"] #cornMazeCanvas,
  .corn-maze-modal[data-board-visible="true"][data-difficulty="5"] #cornMazeCanvas {
    width: 640px;
    max-width: none;
  }
  .corn-maze-modal[data-board-visible="true"][data-difficulty="4"] .maze-canvas-viewport,
  .corn-maze-modal[data-board-visible="true"][data-difficulty="5"] .maze-canvas-viewport {
    height: min(52vh, 360px);
  }
}

@keyframes festivalFireworksBurst {
  0%, 100% {
    opacity: 0.48;
    filter: brightness(0.98);
    transform: translate(-50%, -50%) scale(0.998);
  }
  18% {
    opacity: 0.7;
    filter: brightness(1.08) drop-shadow(0 0 4px rgba(255, 243, 236, 0.38));
    transform: translate(-50%, -50%) scale(1);
  }
  34% {
    opacity: 0.56;
    filter: brightness(1.02);
  }
  52% {
    opacity: 0.76;
    filter: brightness(1.12) drop-shadow(0 0 5px rgba(255, 217, 141, 0.35));
    transform: translate(-50%, -50%) scale(1.002);
  }
  68% {
    opacity: 0.54;
    filter: brightness(1);
  }
  82% {
    opacity: 0.66;
    filter: brightness(1.06) drop-shadow(0 0 4px rgba(201, 180, 232, 0.32));
  }
}

#mainView.festival-active .sparkles,
#mainView.festival-active #gem_sparkles,
#mainView.festival-active #gem_parkles,
#mainView.festival-active #gacha_sparkles,
#mainView.festival-active #play_sparkles,
#mainView.festival-active #claw_sparkles,
#mainView.festival-active #wheel_sparkles {
  opacity: 0 !important;
}

.festival-mission-btn {
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + 1rem);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 3px solid #5b4c62;
  border-radius: 50%;
  background: #ffd98d;
  color: #5b4c62;
  font-size: 1.45rem;
  box-shadow: 0 5px 0 rgba(91, 76, 98, 0.22), 0 0 18px rgba(255, 217, 141, 0.45);
  cursor: pointer;
  pointer-events: auto;
}

.festival-mission-btn:hover {
  transform: translateY(-1px);
}

.festival-mission-toggle {
  position: fixed;
  top: calc(var(--nav-height, 80px) + 0.75rem);
  right: calc(env(safe-area-inset-right, 0px) + 1rem);
  z-index: 950;
  display: none;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.8rem;
  border: 2px solid #5b4c62;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff3ec 0%, #ffd98d 50%, #f79ab5 100%);
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  font-weight: 900;
  box-shadow: 0 4px 0 rgba(91, 76, 98, 0.22), 0 0 18px rgba(255, 217, 141, 0.5);
  cursor: pointer;
  pointer-events: auto;
}

.festival-mission-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: #5b4c62;
  color: #ffd98d;
}

.festival-mission-panel {
  position: fixed;
  top: calc(var(--nav-height, 80px) + 6.5rem);
  right: calc(env(safe-area-inset-right, 0px) + 1rem);
  z-index: 960;
  display: none;
  width: min(390px, calc(100vw - 2rem));
  max-height: calc(100dvh - var(--nav-height, 80px) - 7.25rem);
  overflow-y: auto;
  padding: 0;
  border: 4px solid #5b4c62;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 249, 245, 0.98), rgba(255, 243, 236, 0.98)),
    repeating-linear-gradient(0deg, rgba(201, 180, 232, 0.18) 0 12px, rgba(255, 217, 141, 0.14) 12px 24px);
  box-shadow: 0 12px 0 rgba(91, 76, 98, 0.18), 0 18px 34px rgba(91, 76, 98, 0.28);
  pointer-events: auto;
}

.festival-mission-panel.active {
  display: block;
}

.festival-mission-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0;
  padding: 1rem 0.9rem 0.85rem;
  border-bottom: 4px solid #5b4c62;
  background:
    repeating-linear-gradient(90deg, #f79ab5 0 24px, #ffd98d 24px 48px, #5dd4de 48px 72px);
}

.festival-mission-panel-title {
  color: #fff9f5;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.78rem;
  line-height: 1.4;
  text-shadow: 2px 2px 0 #5b4c62;
}

.festival-mission-panel-close {
  width: 30px;
  height: 30px;
  border: 2px solid #5b4c62;
  border-radius: 50%;
  background: var(--theme-input-bg);
  color: var(--theme-control-text);
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.18);
}

.festival-mission-modal {
  max-width: 680px;
}

.festival-mission-subtitle {
  color: #6b5773;
  font-size: 0.85rem;
  margin: 0.3rem 0 0;
  text-align: left;
}

/* Auction page refresh */
.auctions-container {
  padding: 2rem;
  width: min(100%, 1650px);
  max-width: 1650px;
  box-sizing: border-box;
  margin: 0 auto;
}

.auction-page-subtitle {
  max-width: 760px;
  margin: -0.5rem auto 1.25rem;
  text-align: center;
  color: var(--theme-text);
  font-size: 0.95rem;
  line-height: 1.55;
}

#myAuctionsList,
#friendsAuctionsList {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
  gap: 1.15rem !important;
}

.auctions-grid .auction-card {
  background: var(--theme-card-bg) !important;
  border: 0 !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 24px var(--theme-shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.auctions-grid .auction-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px var(--theme-shadow-strong);
}

.auctions-grid .auction-card .card-placeholder {
  box-shadow: 0 5px 16px var(--theme-shadow);
}

.auction-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

.auction-pagination[hidden] { display: none; }

.auction-card.is-pinned {
  background: #fff9ed !important;
}

.auction-card-image-wrap {
  aspect-ratio: 3.6715 / 5.159;
  border-radius: 4.85% / 3.45%;
  position: relative;
  overflow: hidden;
  margin-bottom: 0.75rem;
  background: #fce4d8;
}

.auction-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4.85% / 3.45%;
}

.auction-card-meta {
  margin-bottom: 0.75rem;
}

.auction-card-title {
  margin: 0 0 0.25rem;
  color: #5b4c62;
  font-size: 1rem;
}

.auction-card-subtitle {
  margin: 0;
  font-size: 0.8rem;
  color: #777;
}

.auction-card-seller {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #888;
}

.auction-bid-panel {
  background: rgba(91, 76, 98, 0.1);
  padding: 0.75rem;
  border-radius: 10px;
  margin-top: auto;
  margin-bottom: 0.75rem;
}

@media (min-width: 1200px) {
  #myAuctionsList,
  #friendsAuctionsList {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
}

.auction-bid-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.auction-bid-row:last-child {
  margin-bottom: 0;
}

.auction-bid-label,
.auction-bid-value {
  font-size: 0.85rem;
  color: #5b4c62;
}

.auction-bid-value {
  font-weight: bold;
  text-align: right;
}

.auction-time {
  font-size: 0.85rem;
  color: #e88aa9;
}

.auction-owned-badge {
  background: rgba(91, 76, 98, 0.9);
  color: #fff3ec;
  padding: 0.3rem 0.6rem;
  border-radius: 15px;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  font-weight: bold;
  text-align: center;
}

.auction-pin-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: #ffd98d;
  color: #5b4c62;
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: bold;
  z-index: 10;
}

.auction-action-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.9rem;
}

.auction-action-btn + .auction-action-btn {
  margin-top: 0.5rem;
}

.auction-action-btn--cancel {
  background: #5b4c62;
}

.auction-action-btn--cancel-bid {
  background: #e88aa9;
  margin-bottom: 0.5rem;
}

.auction-action-btn--pin {
  background: #b7ce84;
  margin-bottom: 0.5rem;
}

.auction-card.is-pinned .auction-action-btn--pin {
  background: #ffd98d;
}

.auction-duration-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.auction-duration-btn {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
}

.auction-modal-card-name {
  color: #5b4c62;
  margin-bottom: 0.5rem;
}

.auction-modal-help {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.bid-modal-card-name {
  color: #5b4c62;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.bid-modal-copy {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.bid-modal-copy.is-current {
  color: #5b4c62;
  margin-bottom: 0.5rem;
}

.bid-modal-gems {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.bid-modal-input {
  width: 100%;
  margin-bottom: 1rem;
}

.modal-action-row {
  display: flex;
  gap: 0.5rem;
}

.modal-action-row .action-btn {
  flex: 1;
}

.modal-action-btn--muted {
  background: #999;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.achievements-grid .achievement-card {
  padding: 1.5rem;
  border-radius: 20px;
  border: 3px solid #5b4c62;
  background: #fff3ec;
}

.achievements-grid .achievement-card.is-completed {
  background: linear-gradient(135deg, #fff9f5 0%, #ffe6f7 100%);
  box-shadow: 0 6px 20px rgba(247, 154, 181, 0.4);
}

.achievements-grid .achievement-card.is-claimed {
  opacity: 0.7;
  background: #e8e8e8;
  box-shadow: none;
}

.achievement-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.achievement-card-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.achievement-card-copy {
  flex: 1;
}

.achievement-card-title {
  margin: 0;
  color: #5b4c62;
  font-size: 1.1rem;
}

.achievement-card-count {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: #777;
}

.achievement-progress-track,
.crafting-progress-bar-wrap,
.ozoz-progress-bar {
  background: #fff3ec;
  border-radius: 10px;
  height: 20px;
  overflow: hidden;
  margin-bottom: 1rem;
  box-shadow: inset 0 1px 3px rgba(91, 76, 98, 0.16);
}

.achievement-progress-fill,
.crafting-progress-bar,
.ozoz-progress-fill {
  height: 100%;
  width: var(--achievement-progress, 0%);
  transition: width 0.3s ease;
  background: #c9b4e8;
  border-radius: inherit;
}

.achievement-card.is-completed .achievement-progress-fill,
.achievement-progress-fill.is-completed {
  background: #5dd4de;
}

.achievement-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.achievement-progress-text {
  font-size: 0.9rem;
  color: #5b4c62;
  font-weight: bold;
}

.era-progress-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.era-progress-track {
  width: 120px;
  margin-bottom: 0;
}

.era-progress-fill {
  background: linear-gradient(90deg, #ffd98d 0%, #ffd98d 100%);
}

.era-progress-text {
  font-size: 0.85rem;
  color: var(--theme-text);
  font-weight: bold;
}

.era-progress-icon {
  font-size: 1rem;
}

.achievement-status-text {
  color: #888;
  font-size: 0.9rem;
}

.achievement-reward-text {
  color: #999;
  font-size: 0.9rem;
}

.achievement-claim-btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.action-btn--accent {
  background: #5dd4de;
}

.full-width-btn {
  width: 100%;
  margin-top: 0.5rem;
}

.tournament-vote-status {
  background: #fff3ec !important;
  background-image: none !important;
  border: 0 !important;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  text-align: center;
  box-shadow: 0 4px 14px rgba(91, 76, 98, 0.08);
}

.tournament-vote-status-title {
  color: #5b4c62;
  font-weight: 700;
}

.tournament-vote-status-copy {
  color: #b0a0bb;
  font-size: 0.8rem;
  margin: 0.25rem 0 0;
}

.festival-mission-list {
  display: grid;
  gap: 0;
  margin: 0.85rem;
  padding: 0.35rem 0.8rem;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 249, 245, 0.96), rgba(255, 243, 236, 0.94)),
    repeating-linear-gradient(90deg, rgba(93, 212, 222, 0.14) 0 16px, rgba(255, 217, 141, 0.16) 16px 32px, rgba(247, 154, 181, 0.12) 32px 48px);
  box-shadow: inset 0 0 0 2px rgba(91, 76, 98, 0.14), 0 5px 0 rgba(91, 76, 98, 0.1);
}

.festival-modal-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.festival-modal-tab {
  border: 2px solid #5b4c62;
  border-radius: 8px;
  background: var(--theme-input-bg);
  color: var(--theme-control-text);
  padding: 0.6rem 0.75rem;
  font-family: 'Courier New', monospace;
  font-weight: 800;
  cursor: pointer;
}

.festival-modal-tab.active {
  background: #ffd98d;
}

.festival-tab-panel {
  display: none;
}

.festival-tab-panel.active {
  display: block;
}

.festival-mission-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  position: relative;
  padding: 0.75rem 0;
  border: 0;
  border-bottom: 2px dashed rgba(91, 76, 98, 0.2);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.festival-mission-item.complete {
  background: linear-gradient(90deg, rgba(123, 207, 131, 0.14), rgba(255, 217, 141, 0.1), transparent);
}

.festival-mission-item:last-child {
  border-bottom: 0;
}

.festival-mission-name {
  color: #5b4c62;
  font-weight: 900;
  font-size: 0.86rem;
  line-height: 1.25;
}

.festival-mission-progress,
.festival-mission-loading {
  color: #6b5773;
  font-size: 0.76rem;
  font-weight: 900;
}

.festival-mission-bar {
  height: 10px;
  margin-top: 0.45rem;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(91, 76, 98, 0.14);
}

.festival-mission-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #5dd4de 0%, #ffd98d 54%, #f79ab5 100%);
}

.festival-mission-claim {
  min-width: 96px;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-radius: 999px;
  background: #ffd98d;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.14);
  cursor: pointer;
}

.festival-mission-claim:disabled {
  opacity: 0.78;
  cursor: default;
  background: #ffe0fa;
  box-shadow: none;
}

.bounty-board {
  margin: 0;
}

.bounty-board-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  margin: 0.85rem 0.85rem 0;
  padding: 0 0.8rem;
}

.bounty-board-balance {
  color: #5b4c62;
  font-size: 0.78rem;
  font-weight: 900;
}

.bounty-refresh-btn,
.bounty-accept-btn,
.bounty-pool-btn {
  min-width: 86px;
  max-width: 100%;
  align-items: center;
  text-align: center;
  white-space: nowrap;
}

.bounty-board-actions,
.bounty-active-actions {
  display: flex;
  width: 100%;
  gap: 0.45rem;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.bounty-board-actions button,
.bounty-active-actions button {
  flex: 1 1 115px;
  height: 44px;
  min-height: 44px;
  margin: 0;
}

.bounty-active-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: stretch;
  border: 2px solid rgba(91, 76, 98, 0.26);
  border-radius: 10px;
  background: rgba(255, 249, 245, 0.96);
  box-shadow: 0 4px 0 rgba(91, 76, 98, 0.12);
  padding: 0.75rem;
  margin: 0.85rem 0.85rem 0;
}

.bounty-board-list {
  margin-top: 0.75rem;
}

.bounty-board-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.bounty-board-item .shop-price-pill {
  margin: 0;
}

.bounty-card-name {
  color: #5b4c62;
  font-weight: 900;
  line-height: 1.25;
}

.bounty-card-desc {
  color: #6b5773;
  font-size: 0.76rem;
  font-weight: 800;
  margin-top: 0.2rem;
}

.bounty-mission-list {
  margin-top: 0.85rem;
}

.bounty-mission-pool {
  margin: 0.75rem 0.85rem 0;
  padding: 0.75rem;
  border: 2px solid rgba(91, 76, 98, 0.18);
  border-radius: 10px;
  background: rgba(255, 249, 245, 0.86);
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.1);
}

.bounty-mission-pool-title {
  color: #5b4c62;
  font-size: 0.84rem;
  font-weight: 900;
  margin-bottom: 0.55rem;
}

.bounty-mission-pool-list {
  display: grid;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding-left: 0;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.bounty-mission-pool-item {
  display: block;
  padding: 0.75rem;
  border: 2px solid #c9b4e8;
  border-radius: 10px;
  background: var(--theme-control-bg, #fff3ec);
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.12);
  color: #5b4c62;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

.bounty-mission-pool-item small {
  display: block;
  color: #8a718f;
  font-size: 0.7rem;
  font-weight: 900;
}

.bounty-mission-list-hidden {
  display: none;
}

.bounty-mission-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.bounty-mission-progress-bar {
  display: block;
  width: 100%;
  height: 10px;
  margin-top: 0.45rem;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(91, 76, 98, 0.14);
  appearance: none;
}

.bounty-mission-progress-bar::-webkit-progress-bar {
  background: rgba(91, 76, 98, 0.14);
}

.bounty-mission-progress-bar::-webkit-progress-value {
  background: linear-gradient(90deg, #5dd4de 0%, #ffd98d 54%, #f79ab5 100%);
  border-radius: 999px;
}

.bounty-mission-progress-bar::-moz-progress-bar {
  background: linear-gradient(90deg, #5dd4de 0%, #ffd98d 54%, #f79ab5 100%);
  border-radius: 999px;
}

.bounty-mission-state {
  align-self: center;
  text-align: center;
}

.bounty-cancel-btn {
  margin-top: 0;
  width: auto;
  min-width: 86px;
  min-height: 44px;
  padding: 5px 10px;
  font-size: 14px;
  white-space: nowrap;
}

.bounty-active-actions .bounty-pool-btn,
.bounty-board-actions .bounty-pool-btn,
.bounty-board-actions .bounty-refresh-btn {
  height: 44px;
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.2;
  white-space: normal;
}

.guess-who-title-text { position: relative; display: inline-block; }
.guess-who-alias-button { position: absolute; left: calc(100% + .2rem); top: 50%; transform: translateY(-50%); display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.guess-who-alias-button .crafting-info-icon { margin-left: 0; }
.guess-who-alias-button:focus-visible { outline: 2px solid var(--theme-border-strong); outline-offset: 1px; border-radius: 50%; }
.guess-who-alias-panel { max-height: 310px; overflow-y: auto; text-align: left; }
.guess-who-game-modal > .guess-who-alias-panel { width: 100%; max-width: none; margin: 0.5rem 0 1rem; }
.guess-who-alias-panel[hidden] { display: none; }
.guess-who-alias-panel section + section { margin-top: 0.75rem; }
.guess-who-alias-panel h3 { margin: 0 0 0.55rem; }
.guess-who-alias-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
.guess-who-alias-list .bounty-mission-pool-item small { display: block; margin-top: 0.3rem; }

.minigame-practice-control { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .45rem; padding: .65rem; border: 2px solid #c9b4e8; border-radius: 12px; background: var(--theme-control-bg, #fff3ec); color: var(--theme-text, #5b4c62); font-weight: bold; cursor: pointer; }
.minigame-practice-control[hidden] { display: none; }
.minigame-practice-control .ozoz-toggle { margin-left: auto; }
.minigame-practice-control small { flex-basis: 100%; text-align: center; font-weight: normal; }
body.minigame-practice-mode :is(#balloonGameModal, #gemCatchGameModal, #frenzyGameModal, #memoryGameModal, #memorySpeedModal, #jigsawGameModal, #charmShooterModal, #guessWhoGameModal, #snakeGameModal, #minesweeperGameModal).active > .modal-content::before {
  content: 'Practice round: no gems or leaderboard score';
  display: block;
  margin: .75rem 2rem;
  padding: .4rem .6rem;
  border: 2px solid #c9b4e8;
  border-radius: 10px;
  background: var(--theme-control-bg, #fff3ec);
  color: var(--theme-text, #5b4c62);
  text-align: center;
  font: bold .8rem 'Courier New', monospace;
}

@media (max-width: 600px) {
  .festival-mission-toggle {
    top: calc(var(--nav-height, 160px) + 0.5rem);
    right: 0.75rem;
    font-size: 0.76rem;
  }

  .festival-mission-panel {
    top: calc(var(--nav-height, 160px) + 6.4rem);
    right: 0.75rem;
    width: calc(100vw - 1.5rem);
    max-height: calc(100dvh - var(--nav-height, 160px) - 7.4rem);
  }

  .festival-mission-modal {
    max-width: 95vw;
  }

  .festival-mission-claim {
    grid-column: 1 / -1;
    width: 100%;
  }

  .bounty-board-header,
  .bounty-board-item {
    grid-template-columns: 1fr;
  }

  .bounty-board-item .shop-price-pill {
    width: 100%;
  }

  .bounty-active-card {
    flex-direction: column;
    align-items: stretch;
  }

  .bounty-cancel-btn {
    width: auto;
  }
}

/* Disable interaction with cloned slides to prevent duplicate event handlers */
.carousel-clone {
  pointer-events: none !important;
}

.carousel-clone * {
  pointer-events: none !important;
}

/* SVG Container */
.tent-scene-background {
  display: none;
  image-rendering: pixelated;
}

.tent-scene-ground {
  display: none;
  position: absolute;
  z-index: 0;
  inset: 76.83% 0 0;
  background: #b7ce84;
  pointer-events: none;
}

.tent-scene-tiles {
  display: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
}

.tent-scene-extension {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  background-repeat: repeat;
  background-position: center top;
  image-rendering: pixelated;
  pointer-events: none;
}

.tent-scene-copy,
.tent-scene-main,
.sweet-snack-icing {
  position: absolute;
  pointer-events: none;
  image-rendering: pixelated;
}

html:is([data-theme="light"], [data-theme="dark"], [data-theme="grey"], [data-theme^="festival-"]) #mainView :is(.tent-scene-background, .tent-scene-ground, .tent-scene-tiles) {
  display: block;
}

html:is([data-theme="light"], [data-theme="dark"], [data-theme="grey"], [data-theme^="festival-"]) #mainView .tent-scene-background {
  visibility: hidden;
}

html:is([data-theme="dark"], [data-theme="festival-starlight"]) #mainView .tent-scene-ground {
  background: #817f9d;
}

html[data-theme="grey"] #mainView .tent-scene-ground {
  background: #b1baaa;
}

html[data-theme="festival-october-harvest"] #mainView .tent-scene-ground {
  background: #b6a9a0;
}

html[data-theme="festival-october-harvest"] #mainView .tent-scene-tiles {
  filter: grayscale(0.94) sepia(0.34) saturate(0.72) contrast(1.07) brightness(1.08);
}

html[data-page-gradient="colorful"]:not([data-theme^="festival-"]) #mainView .tent-scene-ground {
  background: #b7ce84;
}

.tent-svg {
  position: absolute;
  z-index: 1;
  height: 95vh;
  width: auto;
  pointer-events: none;
  top: 42%;  /* Moved up from 50% to clear buttons below */
  left: 50%;
  transform: translate(-50%, -50%);
  overflow: visible;
  max-width: 100vw;  /* Prevent SVG from overflowing viewport on narrow screens */
}

/* Image styles - now targeting SVG groups */
.tent,
.sparkles,
.charm,
.flag,
.wheel {
  pointer-events: none;
}

/* Clickable elements - CRITICAL FIX: Must override parent pointer-events: none */
.balloon,
.gems,
.memory,
.guesswho,
.jigsaw,
#play_balloon,
#play_gems,
#play_memory,
#play_guesswho,
#play_jigsaw,
g#play_balloon,
g#play_gems,
g#play_memory,
g#play_guesswho,
g#play_jigsaw,
[id="play_balloon"],
[id="play_gems"],
[id="play_memory"],
[id="play_guesswho"],
[id="play_jigsaw"],
#gem_charm,
g#gem_charm,
.clickable {
  pointer-events: auto !important;
  cursor: pointer !important;
  z-index: 200 !important;
  opacity: 1 !important;
  position: relative !important;
}

/* CRITICAL FIX: Children must also be clickable, NOT none! */
.balloon *,
.gems *,
.memory *,
.guesswho *,
.jigsaw *,
#play_balloon *,
#play_gems *,
#play_memory *,
#play_guesswho *,
#play_jigsaw *,
g#play_balloon *,
g#play_gems *,
g#play_memory *,
g#play_guesswho *,
g#play_jigsaw *,
#gem_charm *,
g#gem_charm *,
.clickable * {
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* CRITICAL: Ensure SVG elements are clickable AND preserve their colors */
#play_balloon,
#play_balloon *,
#play_gems,
#play_gems *,
g#play_balloon,
g#play_balloon *,
g#play_gems,
g#play_gems * {
  pointer-events: auto !important;
  cursor: pointer !important;
  z-index: 250 !important;  /* Ensure gems/balloon appear above tent */
  /* DO NOT set fill property - let inline SVG styles handle colors */
}

/* Arrow groups in tent SVGs */
.arrow-left,
.arrow-right,
g.arrow-left,
g.arrow-right,
#arrow_left,
#arrow_right {
  pointer-events: auto !important;
  cursor: pointer !important;
  transition: transform 0.2s ease, filter 0.2s ease;
  transform-origin: center center;
  position: relative;
  z-index: 50 !important;
}

.arrow-left:hover,
.arrow-right:hover,
g.arrow-left:hover,
g.arrow-right:hover,
#arrow_left:hover,
#arrow_right:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 4px 10px rgba(199, 153, 232, 0.5));
}

/* Gacha calendar icon — must be clickable despite tent-svg pointer-events: none */
#gacha_calendar,
#gacha_calendar * {
  pointer-events: auto !important;
  cursor: pointer !important;
  animation: none !important;
}

/* Ozoz icon in claw machine tent — must be clickable */
#claw_ozoz,
#claw_ozoz * {
  pointer-events: auto !important;
  cursor: pointer !important;
}

.clickable {
  pointer-events: auto;
  cursor: pointer; /* optional, shows a hand icon */
}

/* Animation: Float - for sparkles and charm only */
.sparkles,
.charm,
#gem_charm,  /* Gem shop charm */
#gem_sparkles,
#gem_parkles,  /* Typo in HTML, but animate it anyway */
#gacha_sparkles,
#play_sparkles,
#claw_sparkles,
#wheel_sparkles {
  animation: float 2.5s ease-in-out infinite !important;
}

/* Flag waving animation */
.flag,
#play_flag {
  animation: flagWave 1.5s ease-in-out infinite !important;
  transform-origin: left center;
}

/* Balloon floats only on hover */
.balloon:hover,
#play_balloon:hover,
g#play_balloon:hover {
  animation: float 2s ease-in-out infinite !important;
}

/* Gems bounce on hover - apply to parent and ALL descendants at all levels */
.gems:hover,
.gems:hover *,
#play_gems:hover,
#play_gems:hover *,
#play_gems:hover > *,
#play_gems:hover g,
#play_gems:hover g *,
g#play_gems:hover,
g#play_gems:hover *,
g#play_gems:hover > *,
g#play_gems:hover g,
g#play_gems:hover g * {
  animation: gemBounce 1s ease-in-out infinite !important;
  animation-fill-mode: both !important;
}

/* Memory group shine animation on hover */
#play_memory:hover,
g#play_memory:hover,
#play_guesswho:hover,
g#play_guesswho:hover {
  animation: memoryShine 1.5s ease-in-out infinite !important;
  animation-fill-mode: both !important;
}

/* Jigsaw tilts gently side-to-side on hover (pivots at its own centre, like the
   charm swing). transform-box: fill-box keeps the origin within the group's bbox so
   it rocks in place and stays under the cursor. */
#play_jigsaw:hover,
g#play_jigsaw:hover {
  transform-box: fill-box;
  transform-origin: center;
  animation: jigsawTilt 1.4s ease-in-out infinite !important;
}

/* Charms sway gently side-to-side on hover, pivoting at the top like a dangling
   charm. transform-box: fill-box makes the origin relative to the group's own
   bbox so it swings in place. Charms had no hover animation at all before. */
#play_charms:hover,
g#play_charms:hover {
  transform-box: fill-box;
  transform-origin: top center;
  animation: charmSwing 1.7s ease-in-out infinite !important;
}

/* Ensure play_gems appears on top of tent when bouncing */
#play_gems,
g#play_gems {
  position: relative;
  z-index: 100 !important;
}

@keyframes jigsawTilt {
  0%, 100% { transform: rotate(-5deg); }
  50%      { transform: rotate(5deg); }
}

@keyframes charmSwing {
  0%, 100% { transform: rotate(-1.5deg); }
  50%      { transform: rotate(1.5deg); }
}

/* Snake shimmer on hover — a fill-opacity wave that travels left→right across the
   segments rather than the whole icon flashing at once. Every segment runs the same
   fade, but each carries a per-segment animation-delay (set in core.js from its x
   position), so the dim band sweeps along the snake. fill-opacity rather than
   opacity: the tent forces opacity:1 !important on clickable groups, which beats
   animations in the cascade, so an opacity animation would be silently ignored. */
#play_snake:hover rect {
  animation: snakeTick 2.4s linear infinite;
}

/* Hard square pulse (no fade): each segment holds dim for a quarter of the cycle
   then snaps back to full. Combined with the per-ball quantised delays set in
   core.js, the dim "tick" jumps discretely from one snake ball to the next. */
@keyframes snakeTick {
  0%, 24.99% { fill-opacity: 0.6; }
  25%, 100%  { fill-opacity: 1; }
}

/* Minesweeper tent icon — pulses with a faint gold glow on hover (matches its
   flag). Filter-only (no transform) so the element stays under the cursor. */
#play_minesweeper:hover,
g#play_minesweeper:hover {
  animation: minesweeperPulse 0.95s ease-in-out infinite !important;
}
@keyframes minesweeperPulse {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.18) drop-shadow(0 0 5px rgba(247, 205, 132, 0.85)); }
}

@keyframes memoryShine {
  0%, 100% {
    filter: brightness(1);
    opacity: 1;
  }
  50% {
    filter: brightness(1.3) drop-shadow(0 0 8px rgba(255, 243, 236, 0.8));
    opacity: 0.95;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-15px);
  }
}

@keyframes gemBounce {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-12px);
  }
}

@keyframes flagWave {
  0%, 100% {
    transform: translateX(0px) scaleX(1);
  }
  50% {
    transform: translateX(1.5px) scaleX(0.99);
  }
}

/* Animation: Sway (for balloon) - up and down on hover */
.sway {
  transform-origin: bottom center;
  transition: animation 0.3s;
  cursor: pointer;
  z-index: 10;
  pointer-events: auto !important;
}

.sway:hover {
  animation: balloonFloat 2s ease-in-out infinite;
}

@keyframes balloonFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* Animation: Wave (for flag) */
.wave {
  animation: wave 2s ease-in-out infinite;
  transform-origin: left center;
}

@keyframes wave {
  0%, 100% {
    transform: skewX(0deg);
  }
  25% {
    transform: skewX(2deg);
  }
  75% {
    transform: skewX(-2deg);
  }
}

/* Wheel (hover spin, speed up on click) */
.wheel {
  z-index: 10;
  cursor: pointer;
  pointer-events: auto !important;
  max-height: 30vh;
  max-width: 30vw;
  transform-origin: 50% 50%;
  transform-box: fill-box;
  transform-style: flat;
}

.wheel.spin {
  animation: spin 2s linear infinite;
}

.wheel.fast {
  animation-duration: 0.5s !important;
}

@keyframes spin {
  0% {
    transform: rotateZ(0deg);
  }
  100% {
    transform: rotateZ(360deg);
  }
}

@keyframes clawToastFade {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Layering */
.tent {
  z-index: 2;
  pointer-events: none;
}
.sparkles {
  z-index: 15;
  pointer-events: none;
}
.charm,
.flag {
  z-index: 3;
  pointer-events: none;
}
.balloon,
.gems {
  z-index: 100;
}
.wheel {
  z-index: 10;
}

/* Top Navigation Bar */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: var(--theme-nav-bg);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 2rem;
  padding-top: max(0px, env(safe-area-inset-top));
  padding-left: max(2rem, calc(2rem + env(safe-area-inset-left)));
  padding-right: max(2rem, calc(2rem + env(safe-area-inset-right)));
  z-index: 1000;
  box-shadow: 0 4px 20px var(--theme-shadow-strong);
  border-bottom: none;
  border-radius: 0 0 20px 20px;
}

.nav-brand {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--theme-text);
  text-shadow: 2px 2px 0 var(--theme-heading-shadow-strong);
  letter-spacing: 1px;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  justify-self: center;
}

.user-stats {
  justify-self: end;
  padding-left: 0.75rem;
}

/* The menu receives the existing nav controls only while Collapsible is active. */
.mobile-nav-menu { display: contents; }
.mobile-nav-actions { display: none; align-items: center; }
.mobile-nav-toggle, .mobile-nav-trial-note { display: none; }

.nav-link {
  background: var(--theme-control-bg);
  border: none;
  color: var(--theme-control-text);
  font-size: 0.95rem;
  font-weight: bold;
  padding: 0.5rem 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px var(--theme-shadow);
  font-family: 'Courier New', monospace;
  border-radius: 20px;
  position: relative;
}

.nav-link:hover {
  background: var(--theme-control-hover-bg);
  box-shadow: 0 6px 20px var(--theme-selected-glow);
}

.nav-link.active {
  background: var(--theme-control-active-bg);
  color: var(--theme-control-active-text);
  transform: translateY(0);
  box-shadow: 0 4px 15px var(--theme-selected-glow-strong);
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: linear-gradient(135deg, #ff4757 0%, #e84118 100%);
  color: white;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 0 4px;
  box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
  border: 2px solid white;
  animation: pulse-badge 2s ease-in-out infinite;
}

.notification-badge.is-hidden {
  display: none;
}

@keyframes pulse-badge {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.6);
  }
}

.notification-btn {
  position: relative;
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  padding: 8px;
  margin-right: 10px;
  transition: transform 0.2s;
}

.notification-btn:hover {
  transform: scale(1.1);
}

.notifications-modal {
  max-width: 500px;
  max-height: 600px;
  overflow-y: auto;
}

.notifications-header {
  display: flex;
  gap: 0.65rem;
  justify-content: flex-end;
  margin-bottom: 15px;
}

.notifications-list {
  max-height: 450px;
  overflow-y: auto;
}

.notification-item {
  background: #e8e8e8;
  border-left: 4px solid #888;
  padding: 1.25rem;
  margin-bottom: 10px;
  border-radius: 15px;
  cursor: default;
  transition: all 0.3s;
  color: var(--theme-control-text);
}

.notification-item.unread, .notification-item.actionable { cursor: pointer; }

.notification-item.unread:hover, .notification-item.actionable:hover {
  box-shadow: 0 6px 20px var(--theme-shadow);
  transform: translateY(-2px);
}

.notification-item.unread {
  background: color-mix(in srgb, var(--notification-accent, #c9b4e8) 22%, #fff3ec);
  border-left-color: var(--notification-accent, #c9b4e8);
}

[data-notification-category="pets"] { --notification-accent: #5dd4de; }
[data-notification-category="auctions"] { --notification-accent: #ffd98d; }
[data-notification-category="collections"] { --notification-accent: #c9b4e8; }
[data-notification-category="admin"] { --notification-accent: #f79ab5; }
[data-notification-category="training"] { --notification-accent: #93c9d5; }
[data-notification-category="market"] { --notification-accent: #8b709d; }
[data-notification-category="social"] { --notification-accent: #e889a9; }
[data-notification-category="rewards"] { --notification-accent: #ffe5a8; }
[data-notification-category="other"] { --notification-accent: #5b4c62; }

#notificationFilters [data-notification-category] .ozoz-settings-label::before {
  content: '';
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--notification-accent);
  border: 1px solid rgba(91, 76, 98, 0.25);
  margin-right: 0.4rem;
}

.notification-message {
  font-size: 0.95em;
  color: var(--theme-control-text);
  margin-bottom: 5px;
}

.notification-admin-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-user-select: text;
  user-select: text;
}

.notification-admin-message a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  -webkit-user-select: text;
  user-select: text;
}

.notification-time {
  font-size: 0.8em;
  color: #7a6a83;
}

.notification-gems {
  color: #7c3aed;
  font-weight: bold;
}

.user-stats {
  display: flex;
  gap: 0.75rem;
  font-size: 1.1rem;
  align-items: center;
}

.stat-item {
  font-weight: bold;
  color: var(--theme-on-accent-3);
  background: linear-gradient(180deg, #ffe5a8 0%, var(--theme-accent-3) 100%);
  padding: 0.5rem 1rem;
  border: none;
  box-shadow: 0 4px 15px var(--theme-shadow);
  border-radius: 25px;
}

/* Merged stats pill — all three counts in one container */
.stat-item--merged {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--theme-control-bg);
  box-shadow: 0 4px 15px var(--theme-shadow);
}

.stat-sep {
  opacity: 0.35;
  font-weight: normal;
}

/* Remove background from userDisplay since it contains the login button */
#userDisplay {
  background: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.header-username-btn {
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--theme-text);
  font: inherit;
  font-weight: bold;
  cursor: pointer;
}

.header-username-btn:hover {
  background: var(--theme-control-hover-bg);
  color: var(--theme-control-text);
}

.header-username-btn:focus-visible {
  outline: 2px solid var(--theme-border-strong);
}

.nav-account {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
  min-width: 108px;
  max-width: 160px;
}

.nav-account #userDisplay { max-width: 100%; min-width: 0; }
.nav-account .header-username-btn {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-quick-settings {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 1102;
  width: min(320px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--theme-border);
  border-radius: 14px;
  background: var(--theme-nav-bg);
  box-shadow: 0 8px 24px var(--theme-shadow-strong);
  color: var(--theme-text);
}

#headerQuickSettings[hidden],
#headerQuickBackground[hidden],
#headerQuickWebsiteStatus[hidden] { display: none !important; }

.header-quick-title {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: bold;
}

.header-quick-group {
  padding: 9px 0;
  border-top: 1px solid var(--theme-border);
}

.header-quick-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.76rem;
  font-weight: bold;
}

.header-quick-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.header-quick-options .display-toggle-btn {
  flex: 1 1 72px;
  min-height: 32px;
  padding: 5px 8px;
  font-size: 0.75rem;
}

.header-quick-status {
  margin: 6px 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
}

.header-wallet-settings {
  display: flex;
  align-items: center;
  gap: 3px;
}

.header-wallet-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.header-wallet-connect { position: relative; }

.header-wallet-actions .action-btn {
  min-height: 22px;
  margin: 0;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 0.68rem;
  line-height: 1.15;
  white-space: nowrap;
}

.header-wallet-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 1101;
  min-width: 160px;
  max-width: min(260px, 80vw);
  padding: 4px;
  border: 1px solid var(--theme-border);
  border-radius: 10px;
  background: var(--theme-nav-bg);
  box-shadow: 0 4px 15px var(--theme-shadow);
}

.header-wallet-option {
  display: block;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--theme-text);
  font: 0.76rem 'Courier New', monospace;
  text-align: left;
  cursor: pointer;
}

.header-wallet-option:hover,
.header-wallet-option:focus-visible {
  background: var(--theme-control-hover-bg);
  color: var(--theme-control-text);
}

.header-wallet-empty {
  margin: 0;
  padding: 7px 9px;
  color: var(--theme-text);
  font-size: 0.72rem;
}

.header-wallet-status:not(:empty) {
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  z-index: 1100;
  max-width: min(260px, 80vw);
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--theme-nav-bg);
  color: var(--theme-text);
  box-shadow: 0 4px 15px var(--theme-shadow);
  font-size: 0.72rem;
  text-align: right;
  overflow-wrap: anywhere;
}

.header-wallet-status:not(:empty) { top: calc(100% + 5px); }

.user-btn {
  background: var(--theme-accent-3) !important;
  background-image: none !important;
  background-clip: padding-box !important;
  border: 3px solid var(--theme-border-strong) !important;
  color: var(--theme-on-accent-3) !important;
  font-size: 1rem;
  font-weight: bold;
  padding: 0.6rem 1rem; /* Slightly more padding to make button bigger than stat-items */
  cursor: pointer !important;
  pointer-events: auto !important;
  box-shadow: 0 4px 15px rgba(255, 217, 141, 0.3) !important; /* Match stat-item shadow */
  font-family: 'Courier New', monospace;
  transition: all 0.3s ease;
  border-radius: 25px;
  outline: none !important;
  box-sizing: border-box !important;
  z-index: 1001;
  position: relative;
  display: inline-block;
  -webkit-background-clip: padding-box !important;
  margin: 0; /* Remove any default margins */
  line-height: normal; /* Prevent line-height from affecting size */
}

.user-btn:hover {
  background: color-mix(in srgb, var(--theme-accent-3) 78%, white) !important;
  background-image: none !important;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(91, 76, 98, 0.2) !important;
}

/* Views */
:root {
  --nav-height: 80px; /* Updated dynamically by JS based on actual nav height */
  --theme-colorful-page-bg: linear-gradient(135deg, #93c9d5 0%, #c9b4e8 25%, #f79ab5 50%, #ffd98d 75%, #ffe0fa 100%);
  --theme-text: #5b4c62;
  --theme-body-text: #fff3ec;
  --theme-text-inverse: #fff3ec;
  --theme-muted: #7a6a83;
  --theme-heading-shadow: #ffd98d;
  --theme-heading-shadow-strong: #f79ab5;
  --theme-page-bg: var(--theme-colorful-page-bg);
  --theme-nav-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 230, 238, 0.9) 46%, rgba(233, 221, 255, 0.86) 100%);
  --theme-panel-bg: linear-gradient(135deg, #fff9f5, #ffe6ee);
  --theme-card-bg: linear-gradient(135deg, #ffffff 0%, #ffe6ee 46%, #e9ddff 100%);
  --theme-filterbar-bg: rgba(255, 255, 255, 0.3);
  --theme-modal-bg: linear-gradient(135deg, #ffffff 0%, #ffe6ee 46%, #e9ddff 100%);
  --theme-control-bg: linear-gradient(180deg, #fff9f5 0%, #fff3ec 100%);
  --theme-control-hover-bg: linear-gradient(180deg, #ffe8f7 0%, #ffe0fa 100%);
  --theme-control-active-bg: linear-gradient(180deg, #ffa8c5 0%, #f79ab5 100%);
  --theme-control-active-text: #fff3ec;
  --theme-button-bg: #e889a9;
  --theme-button-hover-bg: #f79ab5;
  --theme-button-text: #fff3ec;
  --theme-button-accent-bg: linear-gradient(135deg, #f79ab5 0%, #ffd98d 100%);
  --theme-button-accent-hover-bg: linear-gradient(135deg, #ffa8c5 0%, #ffe3a8 100%);
  --theme-button-accent-text: #5b4c62;
  --theme-selected-tab-bg: linear-gradient(180deg, #ffa8c5 0%, #f79ab5 100%);
  --theme-selected-tab-text: #fff3ec;
  --theme-selected-glow: rgba(247, 154, 181, 0.4);
  --theme-selected-glow-strong: rgba(247, 154, 181, 0.5);
  --theme-control-text: #5b4c62;
  --theme-input-bg: #fff3ec;
  --theme-border: rgba(91, 76, 98, 0.16);
  --theme-border-strong: #5b4c62;
  --theme-shadow: rgba(91, 76, 98, 0.18);
  --theme-shadow-strong: rgba(91, 76, 98, 0.34);
  --theme-accent: #f79ab5;
  --theme-accent-2: #5dd4de;
  --theme-on-accent-2: #fff3ec;
  --theme-accent-3: #ffd98d;
  --theme-on-accent-3: #5b4c62;
  --theme-focus: rgba(93, 212, 222, 0.24);
  --select-arrow-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%235dd4de' d='M0 0l5 5 5-5z'/%3E%3C/svg%3E");
}

html[data-theme="dark"] {
  --theme-surface-deep: #3a3042;
  --theme-surface-deep-rgb: 58, 48, 66;
  --theme-surface-deeper: #43364a;
  --theme-surface-base: #5b4c62;
  --theme-surface-base-rgb: 91, 76, 98;
  --theme-surface-mid: #8b709d;
  --theme-surface-mid-rgb: 139, 112, 157;
  --theme-surface-light: #c9b4e8;
  --theme-surface-light-rgb: 201, 180, 232;
}

html[data-theme="grey"] {
  --theme-surface-deep: #3d3938;
  --theme-surface-deep-rgb: 61, 57, 56;
  --theme-surface-deeper: #3d3938;
  --theme-surface-base: #575352;
  --theme-surface-base-rgb: 87, 83, 82;
  --theme-surface-mid: #7c7978;
  --theme-surface-mid-rgb: 124, 121, 120;
  --theme-surface-light: #a5a5a5;
  --theme-surface-light-rgb: 165, 165, 165;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) {
  color-scheme: dark;
  --theme-text: #fff3ec;
  --theme-body-text: #fff3ec;
  --theme-text-inverse: var(--theme-surface-base);
  --theme-muted: #fff3ec;
  --theme-heading-shadow: var(--theme-surface-base);
  --theme-heading-shadow-strong: var(--theme-surface-light);
  --theme-page-bg: linear-gradient(135deg, #93c9d5 0%, var(--theme-surface-light) 25%, #f79ab5 50%, #ffd98d 75%, #ffe0fa 100%);
  --theme-nav-bg: linear-gradient(135deg, rgba(var(--theme-surface-deep-rgb), 0.96) 0%, rgba(var(--theme-surface-base-rgb), 0.94) 36%, rgba(var(--theme-surface-mid-rgb), 0.9) 72%, rgba(var(--theme-surface-light-rgb), 0.86) 100%);
  --theme-panel-bg: linear-gradient(135deg, var(--theme-surface-deep) 0%, var(--theme-surface-base) 48%, var(--theme-surface-mid) 100%);
  --theme-card-bg: linear-gradient(135deg, var(--theme-surface-deep) 0%, var(--theme-surface-base) 36%, var(--theme-surface-mid) 72%, var(--theme-surface-light) 100%);
  --theme-filterbar-bg: var(--theme-surface-base);
  --theme-modal-bg: var(--theme-card-bg);
  --theme-control-bg: linear-gradient(180deg, var(--theme-surface-base) 0%, var(--theme-surface-base) 100%);
  --theme-control-hover-bg: linear-gradient(180deg, var(--theme-surface-light) 0%, var(--theme-surface-base) 100%);
  --theme-control-active-bg: linear-gradient(180deg, var(--theme-surface-light) 0%, var(--theme-surface-base) 100%);
  --theme-control-active-text: #fff3ec;
  --theme-button-bg: linear-gradient(180deg, var(--theme-surface-light) 0%, var(--theme-surface-mid) 100%);
  --theme-button-hover-bg: linear-gradient(180deg, var(--theme-surface-light) 0%, var(--theme-surface-base) 100%);
  --theme-button-text: #fff3ec;
  --theme-button-accent-bg: linear-gradient(135deg, var(--theme-surface-light) 0%, var(--theme-surface-mid) 100%);
  --theme-button-accent-hover-bg: linear-gradient(135deg, var(--theme-surface-light) 0%, var(--theme-surface-base) 100%);
  --theme-button-accent-text: #fff3ec;
  --theme-selected-tab-bg: linear-gradient(180deg, var(--theme-surface-light) 0%, var(--theme-surface-mid) 100%);
  --theme-selected-tab-text: #fff3ec;
  --theme-selected-glow: rgba(var(--theme-surface-light-rgb), 0.4);
  --theme-selected-glow-strong: rgba(var(--theme-surface-light-rgb), 0.54);
  --theme-control-text: #fff3ec;
  --theme-input-bg: var(--theme-surface-base);
  --theme-border: rgba(255, 243, 236, 0.18);
  --theme-border-strong: #fff3ec;
  --theme-shadow: rgba(var(--theme-surface-base-rgb), 0.28);
  --theme-shadow-strong: rgba(var(--theme-surface-base-rgb), 0.44);
  --theme-accent: #f79ab5;
  --theme-accent-2: #5dd4de;
  --theme-on-accent-2: #fff3ec;
  --theme-accent-3: #ffd98d;
  --theme-on-accent-3: var(--theme-surface-base);
  --theme-focus: rgba(var(--theme-surface-light-rgb), 0.34);
  --select-arrow-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%235dd4de' d='M0 0l5 5 5-5z'/%3E%3C/svg%3E");
}

html[data-theme="dark"] {
  --theme-page-bg: linear-gradient(135deg, #3a3042 0%, #5b4c62 25%, #7a6385 50%, #a187b8 75%, #c9b4e8 100%);
}

html[data-theme="grey"] {
  --theme-page-bg: linear-gradient(135deg, #3d3938 0%, #575352 25%, #716e6d 50%, #8b8988 75%, #a5a5a5 100%);
  --theme-nav-bg: linear-gradient(135deg, rgba(61, 57, 56, 0.96) 0%, rgba(87, 83, 82, 0.94) 25%, rgba(113, 110, 109, 0.92) 50%, rgba(139, 137, 136, 0.89) 75%, rgba(165, 165, 165, 0.86) 100%);
  --theme-panel-bg: linear-gradient(135deg, #3d3938 0%, #575352 25%, #716e6d 50%, #8b8988 75%, #a5a5a5 100%);
  --theme-card-bg: var(--theme-panel-bg);
  --theme-modal-bg: var(--theme-panel-bg);
  --theme-control-hover-bg: linear-gradient(180deg, #a5a5a5 0%, #7c7978 50%, #575352 100%);
  --theme-control-active-bg: linear-gradient(180deg, #a5a5a5 0%, #7c7978 50%, #575352 100%);
}

/* Standard buttons keep the default solid fill in Purple and Grey skins. */
:is(html[data-theme="dark"], html[data-theme="grey"]) {
  --theme-button-bg: var(--theme-surface-mid);
  --theme-button-hover-bg: var(--theme-surface-light);
}

html[data-theme="festival-starlight"] {
  --theme-surface-deep: #1f2944;
  --theme-surface-deep-rgb: 31, 41, 68;
  --theme-surface-deeper: #192138;
  --theme-surface-base: #314268;
  --theme-surface-base-rgb: 49, 66, 104;
  --theme-surface-mid: #4d5788;
  --theme-surface-mid-rgb: 77, 87, 136;
  --theme-surface-light: #8f92c2;
  --theme-surface-light-rgb: 143, 146, 194;
  --theme-page-bg: linear-gradient(135deg, #26314b 0%, #374467 25%, #4b5683 50%, #606899 75%, #7d83ad 100%);
}

html[data-theme="festival-sweet-snack"] {
  --theme-surface-deep: #512936;
  --theme-surface-deep-rgb: 81, 41, 54;
  --theme-surface-deeper: #44212d;
  --theme-surface-base: #7d3d50;
  --theme-surface-base-rgb: 125, 61, 80;
  --theme-surface-mid: #b65370;
  --theme-surface-mid-rgb: 182, 83, 112;
  --theme-surface-light: #dd6b89;
  --theme-surface-light-rgb: 221, 107, 137;
  --theme-page-bg: linear-gradient(135deg, #512f3c 0%, #704354 25%, #92576d 50%, #b47389 75%, #d6a3b0 100%);
}

html[data-theme="festival-lucky-pull"] {
  --theme-surface-deep: #304635;
  --theme-surface-deep-rgb: 48, 70, 53;
  --theme-surface-deeper: #26382b;
  --theme-surface-base: #49684c;
  --theme-surface-base-rgb: 73, 104, 76;
  --theme-surface-mid: #6f8c65;
  --theme-surface-mid-rgb: 111, 140, 101;
  --theme-surface-light: #91ad7b;
  --theme-surface-light-rgb: 145, 173, 123;
  --theme-page-bg: linear-gradient(135deg, #344838 0%, #4d634b 25%, #687e5e 50%, #849a77 75%, #a5bdab 100%);
}

html[data-theme="festival-ozoz-birthday"] {
  --theme-surface-deep: #542a24;
  --theme-surface-deep-rgb: 84, 42, 36;
  --theme-surface-deeper: #45211d;
  --theme-surface-base: #7c3e31;
  --theme-surface-base-rgb: 124, 62, 49;
  --theme-surface-mid: #9e4f3e;
  --theme-surface-mid-rgb: 158, 79, 62;
  --theme-surface-light: #bc5e48;
  --theme-surface-light-rgb: 188, 94, 72;
  --theme-page-bg: linear-gradient(135deg, #56372e 0%, #764c3c 25%, #985f49 50%, #b87b58 75%, #d3a777 100%);
}

html[data-theme="festival-october-harvest"] {
  --theme-surface-deep: #242424;
  --theme-surface-deep-rgb: 36, 36, 36;
  --theme-surface-deeper: #1b1b1b;
  --theme-surface-base: #353535;
  --theme-surface-base-rgb: 53, 53, 53;
  --theme-surface-mid: #9b552d;
  --theme-surface-mid-rgb: 155, 85, 45;
  --theme-surface-light: #e87d34;
  --theme-surface-light-rgb: 232, 125, 52;
  --theme-page-bg: var(--festival-october-harvest-gradient);
  --theme-accent: #e87d34;
  --theme-accent-2: #f5a362;
  --theme-accent-3: #ffc58b;
  --theme-on-accent-3: #242424;
  --theme-selected-glow: rgba(232, 125, 52, 0.4);
  --theme-selected-glow-strong: rgba(232, 125, 52, 0.54);
  --theme-focus: rgba(232, 125, 52, 0.34);
}

html[data-theme="festival-october-harvest"] .top-nav {
  background: var(--theme-page-bg);
}

.view {
  display: none;
  padding-top: var(--nav-height);
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.view.active {
  display: block;
}

@media (min-width: 901px) {
  /* Start the scroll container itself below the fixed navigation. */
  .view:not(#mainView) {
    margin-top: var(--nav-height);
    padding-top: 0;
    height: calc(100vh - var(--nav-height));
    height: calc(100dvh - var(--nav-height));
  }

  :is(.view, .modal-content, .notifications-modal, .notifications-list,
      .festival-mission-panel, .shop-stall-body,
      .ozoz-modal-content, .ozoz-feed-modal-content,
      #friendTradeCardsGrid, #allFriendsTradeCardsGrid)::-webkit-scrollbar {
    width: 24px;
    height: 24px;
  }
}

#mainView {
  overflow: hidden;
  position: relative;
  /* Enable touch events for swipe detection */
  touch-action: pan-y; /* Allow vertical scroll, capture horizontal swipes */
  pointer-events: auto;
}

#galleryView,
#profileView {
  overflow-y: auto;
  overflow-x: hidden;
}

/* Navigation buttons for carousel */
.nav-btn {
  position: absolute;
  bottom: 8%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 5;
  transition: all 0.3s;
  width: auto;
  height: 25%;
  max-height: 280px;
  min-height: 150px;
  image-rendering: pixelated;
  pointer-events: auto;
}

.nav-btn img {
  height: 100%;
  width: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5));
}

.nav-btn:hover {
  transform: scale(1.05);
}

.nav-btn:hover img {
  filter: drop-shadow(0 6px 12px rgba(199, 153, 232, 0.6));
}

#prevBtn {
  left: 2%;
}

#nextBtn {
  right: 2%;
}

.tent-carousel-dots {
  position: absolute;
  left: 50%;
  bottom: 2%;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 243, 236, 0.58);
  box-shadow: 0 6px 18px rgba(91, 76, 98, 0.22);
  transform: translateX(-50%);
  pointer-events: auto;
}

.bounty-mission-toggle {
  display: inline-flex;
  background: linear-gradient(135deg, #f7f0ff 0%, #c9b4e8 50%, #93c9d5 100%);
}

.bounty-hidden {
  display: none;
}

.bounty-mission-toggle-icon {
  background: #5b4c62;
  color: #c9b4e8;
}

.bounty-mission-panel {
  top: calc(var(--nav-height, 80px) + 3.75rem);
  max-height: calc(100dvh - var(--nav-height, 80px) - 5rem);
}

.tent-carousel-dot {
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #fff3ec;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.tent-carousel-dot:hover,
.tent-carousel-dot:focus-visible {
  background: #ffd98d;
  transform: scale(1.16);
  outline: none;
  box-shadow: 0 0 0 4px rgba(255, 217, 141, 0.38);
}

.tent-carousel-dot.active {
  background: #e889a9;
  transform: scale(1.25);
}

.token-purchase-page[hidden] { display: none; }
.token-purchase-dots {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin: 1rem 0;
}
.token-purchase-dot-label { display: none; }
#tokenPurchaseModal #playClawGameBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
@media (hover: none) {
  .token-purchase-dot:hover:not(:focus-visible) {
    background: #fff3ec;
    transform: none;
    box-shadow: none;
  }
  .token-purchase-dot.active:hover:not(:focus-visible) {
    background: #e889a9;
    transform: scale(1.25);
  }
}
.token-paid-bundles { display: grid; gap: 0.8rem; }
.token-paid-bundle {
  padding: 10px;
  background: #fff9f5;
}
.token-paid-bundle h3 { margin: 0 0 0.25rem; color: #5b4c62; font-size: 1rem; }
.token-paid-bundle p { margin: 0; color: #5b4c62; font-size: 0.85rem; }
.token-paid-bundle .token-paid-bundle-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 0.6rem; }
.token-paid-bundle[data-website-mode="web2"] .token-paid-bundle-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.token-paid-bundle .shop-gem-pack-price { grid-column: 1 / -1; }
.token-paid-bundle .shop-price-pill { min-width: 0; width: 100%; }
#tokenPurchaseModal .token-paid-bundle {
  background: var(--theme-card-bg);
  border-color: var(--theme-border-strong);
  box-shadow: 0 6px 0 var(--theme-shadow);
}
#tokenPurchaseModal .token-paid-bundle :is(h3, p) { color: var(--theme-text); }
#tokenPurchaseModal .token-paid-bundle .shop-gem-pack-price {
  background: var(--theme-input-bg);
  color: var(--theme-control-text);
  box-shadow: 0 3px 0 var(--theme-shadow);
}
.claw-blocker-toggle { display: flex; align-items: center; justify-content: center; gap: 0.6rem; color: #5b4c62; font-weight: bold; cursor: pointer; }
.claw-blocker-toggle small { font-weight: normal; }
.claw-blocker-toggle--game { margin-top: 0.7rem; font-size: 0.82rem; }
.claw-blocker-toggle input:disabled + .ozoz-toggle-slider { opacity: 0.5; cursor: default; }
.claw-blocker-help { color: #5b4c62; font-size: 0.72rem; text-align: center; margin: 0.4rem 0 0; }

@media (max-width: 768px) {
  .tent-carousel-dots {
    display: none;
  }
}

/* Tent Info Sections - removed top section, only bottom remains */

.tent-info-bottom {
  position: absolute;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
  background: transparent;
  padding: 0;
  border: none;
  text-align: center;
  z-index: 15;
  width: 75%;
  max-width: 500px;
  pointer-events: auto;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.5rem;
}

.action-btn {
  appearance: none;
  -webkit-appearance: none;
  background: var(--theme-button-bg);
  border: none;
  outline: none;
  color: var(--theme-button-text);
  font-size: 0.75rem;
  font-weight: bold;
  padding: 0.8rem 2rem;
  cursor: pointer;
  margin-top: 1rem;
  pointer-events: auto !important;  /* Override parent pointer-events: none */
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px var(--theme-selected-glow);
  font-family: 'Press Start 2P', 'Courier New', monospace;
  text-transform: uppercase;
  line-height: 1.4;
  width: 100%;
  border-radius: 30px;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.action-btn:hover:not(:disabled) {
  background: var(--theme-button-hover-bg);
  transform: translateZ(0) translateY(-3px);
  box-shadow: 0 8px 25px var(--theme-selected-glow-strong);
}

.action-btn:active:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px var(--theme-selected-glow);
}

.action-btn:disabled {
  background: #a8e8ff;
  color: #5b4c62;
  cursor: pointer;
  opacity: 1;
  box-shadow: 0 4px 15px rgba(168, 232, 255, 0.3);
  pointer-events: auto;
}

.cooldown-text {
  font-size: 0.85rem;
  color: #ffffff;
  margin: 0;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  min-height: 1.2rem;
}

/* Gallery View */
.gallery-container {
  padding: 2rem;
  width: min(100%, 1650px);
  box-sizing: border-box;
  margin: 0 auto;
  background: transparent;
}

/* Shared page title style — used by all view headings for consistency */
.page-title,
.gallery-header h1,
.profile-container h1,
.groups-container h1,
.friends-container h1 {
  font-size: 2rem;
  color: var(--theme-text);
  text-shadow: 3px 3px 0 var(--theme-heading-shadow);
  margin: 0 0 2rem 0;
  line-height: 1.5;
  text-align: center !important;
  width: 100%;
}

.profile-section h2,
.friends-section h2,
.trading-section h2,
.auction-section h2,
.group-section h2,
.era-section h3,
.modal-content h2,
#supportModal .support-modal-content h2,
.shop-stall-hero h2 {
  margin: 0 0 1rem 0;
  font-size: 1.2rem;
  color: var(--theme-text);
  text-shadow: 2px 2px 0 var(--theme-heading-shadow-strong);
  line-height: 1.6;
}

.gallery-header {
  margin-bottom: 2rem;
}

.gallery-controls {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

#galleryCardsTab .gallery-controls {
  margin-bottom: 2.75rem;
}

#galleryCraftingTab .gallery-header {
  margin-bottom: 0;
}

#galleryCraftingTab .gallery-sort-row {
  margin-bottom: 2rem;
}

.gallery-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.gallery-sort-row {
  display: flex;
  gap: 2rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

#galleryCardsTab .gallery-sort-row {
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--theme-filterbar-bg);
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  box-shadow: 0 2px 10px var(--theme-shadow);
}

.gallery-selection-controls {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}

.gallery-selection-controls[hidden] {
  display: none;
}

.gallery-selection-bar {
  display: flex;
  align-items: center;
  justify-content: safe center;
  gap: 0.8rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  width: max-content;
  max-width: 100%;
  background: var(--theme-filterbar-bg);
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  box-shadow: 0 2px 10px var(--theme-shadow);
  box-sizing: border-box;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.gallery-selection-bar::-webkit-scrollbar {
  display: none;
}

#bulkActions,
#gallerySelectControls {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0.75rem;
  flex-wrap: nowrap;
  width: max-content;
  max-width: none;
  overflow: visible;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

#gallerySelectControls {
  border-left: 1px solid var(--theme-border-strong);
  padding-left: 0.8rem;
}

#gallerySelectControls [hidden],
.gallery-filterbar .filterbar-eye[hidden] {
  display: none;
}

.gallery-bulk-actions-row {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  justify-content: flex-start;
  flex-wrap: nowrap;
  align-items: center;
  width: max-content;
}

.gallery-selected-count {
  position: absolute;
  top: calc(100% + 0.825rem);
  left: 50%;
  transform: translateX(-50%);
  color: var(--theme-text);
  font-weight: bold;
  white-space: nowrap;
  min-height: 1.1rem;
}

@media (min-width: 769px) {
  #gallerySelectionBar {
    gap: 0.55rem;
    padding-inline: 1rem;
  }

  #gallerySelectionBar .gallery-bulk-actions-row,
  #gallerySelectionBar #gallerySelectControls {
    gap: 0.5rem;
  }

  #gallerySelectionBar #bulkActions .action-btn {
    min-width: 105px;
    padding-inline: 0.75rem;
  }

  #gallerySelectionBar #gallerySelectControls .gallery-select-btn {
    padding-inline: 0.9rem;
  }
}

/* Shared sort/group/type/search pill. Holds related controls in one rounded
   section; on narrow screens it becomes a single horizontal swipe strip instead
   of stacking into multiple rows or getting cropped at the viewport edge. */
.gallery-filterbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: min(100%, 95vw);
  min-width: 0;
  box-sizing: border-box;
  background: var(--theme-filterbar-bg);
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  box-shadow: 0 2px 10px var(--theme-shadow);
  /* hide scrollbar track but keep swipe scrollability */
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.gallery-filterbar::-webkit-scrollbar {
  display: none;
}

#galleryFilterBar {
  width: 100%;
  max-width: 100%;
  gap: 0.7rem;
}

@media (min-width: 769px) {
  #galleryFilterBar {
    justify-content: flex-start;
    gap: 0.5rem;
    padding-inline: 1rem;
  }

  #galleryFilterBar .filterbar-group {
    gap: 0.35rem;
  }

  #galleryFilterBar > .filterbar-group:last-child {
    flex: 1 1 0;
    min-width: 200px;
  }

  #galleryFilterBar > .filterbar-group:last-child .search-wrap {
    flex: 1 1 auto;
    min-width: 0;
  }

  #memberSearch {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
}

.filter-scroll-shell {
  position: relative;
  display: flex;
  align-items: stretch;
  flex: 0 1 auto;
  width: max-content;
  max-width: 100%;
  min-width: 0;
}

.filter-scroll-shell > :first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.filter-scroll-shell--alphabet {
  width: min(100%, 95vw);
  margin-inline: auto;
}

.filter-scroll-shell--gallery-filter {
  width: 100%;
}

.filter-scroll-shell--bulk,
.filter-scroll-shell--select {
  flex: 0 0 auto;
  width: max-content;
  max-width: none;
  min-width: max-content;
}

.filter-scroll-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 18px;
  height: 28px;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.85);
  font-size: 2.1rem;
  font-weight: 400;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(91, 76, 98, 0.35);
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.filter-scroll-arrow[hidden] {
  display: none;
}

.filter-scroll-arrow--left { left: 4px; }
.filter-scroll-arrow--right { right: 4px; }

@media (hover: hover) {
  .filter-scroll-shell:hover > .filter-scroll-arrow {
    opacity: 0;
  }
}

:is(.gallery-filterbar, .filterbar-control-row, #alphabetNav, .gallery-selection-bar, #gallerySelectControls, #bulkActions).filter-pill-scrollable {
  cursor: grab;
}

:is(.gallery-filterbar, .filterbar-control-row, #alphabetNav, .gallery-selection-bar, #gallerySelectControls, #bulkActions).filter-pill-dragging,
:is(.gallery-filterbar, .filterbar-control-row, #alphabetNav, .gallery-selection-bar, #gallerySelectControls, #bulkActions).filter-pill-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
}

.filterbar-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 0 0 auto; /* don't shrink — keeps each control full-size so the bar scrolls */
}

.filterbar-control-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.trade-search-wrap {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.uft-controls {
  margin-bottom: 1rem;
}

.uft-filterbar {
  justify-content: safe center;
  gap: 0.9rem;
}

.uft-search-group {
  flex: 1 1 260px;
  min-width: 220px;
}

.uft-filterbar .trade-search-wrap {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 360px;
}

.uft-filterbar .search-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.uft-filter-chip {
  margin: 0;
}

.gallery-filterbar .styled-select,
.gallery-filterbar .search-wrap {
  flex: 0 0 auto;
}

.gallery-filterbar.uft-filterbar .trade-search-wrap {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 360px;
}

.gallery-filterbar.uft-filterbar .search-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.gallery-filterbar .search-input,
.filterbar-control-row .search-input,
.profile-album-picker-filters .search-input {
  width: 150px;
  flex: 0 0 auto;
  padding: 0.6rem 2.5rem 0.6rem 1rem;
  border: 2px solid var(--theme-accent-2);
  border-radius: 15px;
  background: var(--theme-input-bg);
  color: var(--theme-control-text);
  font-size: 1rem;
  cursor: text;
}

.filterbar-control-row .search-input {
  width: 100%;
}

/* Labels live inside .filterbar-group now (not .sort-control), so restate the dark
   color here — otherwise they inherit the page's light text and vanish against the
   lighter end of the translucent pill's gradient. */
.gallery-filterbar label {
  color: var(--theme-text);
  font-weight: bold;
  font-size: 0.9rem;
  white-space: nowrap;
  text-shadow: 0 1px 1px color-mix(in srgb, var(--theme-modal-bg) 68%, transparent);
}

/* The Mark-all-seen eye button rides at the end of the bar — override .action-btn's
   width:100% so it stays a compact square and doesn't get shrunk by flex. */
.gallery-filterbar .filterbar-eye {
  width: auto;
  flex: 0 0 auto;
  align-self: center;
}

.site-mark-seen-btn {
  width: auto;
  min-width: 42px;
  aspect-ratio: 1;
  padding: 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.site-mark-seen-btn img {
  width: 22px;
  height: 22px;
  display: block;
}

.filterbar-command-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  background: var(--theme-input-bg);
  color: var(--theme-control-text);
  border: 2px solid var(--theme-border-strong);
  border-radius: 15px;
  padding: 0.6rem 1.4rem;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
}

.filterbar-command-btn:hover {
  background: var(--theme-control-hover-bg);
}

.stats-list-heading {
  color: var(--theme-text);
  font-weight: bold;
  margin: 0.25rem 0;
}

.stats-list-heading-spaced {
  margin-top: 1rem;
}

.stats-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 0.25rem;
  border-bottom: 1px solid var(--theme-border);
  color: var(--theme-text);
}

.stats-list-value {
  font-weight: bold;
}

.stats-list-empty {
  color: var(--theme-muted);
  padding: 0.5rem 0.25rem;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--theme-text);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  line-height: 1;
}

.empty-state-title {
  margin: 0 0 0.5rem;
  color: var(--theme-text);
  font-size: 1.2rem;
  text-shadow: 2px 2px 0 var(--theme-heading-shadow-strong);
  line-height: 1.6;
}

.empty-state-text {
  margin: 0;
  color: var(--theme-muted);
}

.sort-control label {
  color: var(--theme-text);
  font-weight: bold;
  font-size: 0.9rem;
  white-space: nowrap;
}

.styled-select {
  padding: 0.6rem 2.5rem 0.6rem 1rem;
  border: 2px solid var(--theme-accent-2);
  background-color: var(--theme-input-bg);
  color: var(--theme-control-text);
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 15px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: var(--select-arrow-icon, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%235dd4de' d='M0 0l5 5 5-5z'/%3E%3C/svg%3E"));
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 10px;
  min-width: 140px;
}

.styled-select:hover {
  border-color: var(--theme-accent-2);
  box-shadow: 0 2px 8px var(--theme-focus);
}

.styled-select:focus {
  outline: none;
  border-color: var(--theme-accent-2);
  box-shadow: 0 0 0 3px var(--theme-focus);
}

.styled-select option {
  background: var(--theme-input-bg);
  color: var(--theme-control-text);
  padding: 0.5rem;
}

.compact-control {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.ozoz-feed-select,
.ozoz-feed-select-fill,
.ozoz-feed-select-full {
  font-size: 0.8rem;
  border-radius: 8px;
  padding: 0.3rem 1.8rem 0.3rem 0.5rem;
}

.ozoz-feed-select-fill {
  flex: 1;
}

.ozoz-feed-select-full {
  width: 100%;
}

.modal-search-input {
  width: 100%;
  margin-bottom: 1rem;
  border: 2px solid var(--theme-accent-2);
  border-radius: 15px;
  background: var(--theme-input-bg);
  color: var(--theme-control-text);
  box-shadow: none;
}

.modal-search-input-fill {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}

.modal-control-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.modal-pagination {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 1rem 0 0.5rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
}

.modal-pagination-btn {
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  background: #5b4c62;
  color: #fff3ec;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.7rem;
  line-height: 1;
}

.modal-pagination-btn:disabled {
  background: #ccc;
  color: #777;
  cursor: default;
}

.modal-pagination-status,
.modal-pagination-count {
  color: #5b4c62;
}

.modal-pagination-count {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.7rem;
  margin-top: -0.25rem;
}

.native-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}

.custom-select {
  position: relative;
  display: inline-block;
  min-width: 140px;
  flex: 0 0 auto;
  vertical-align: middle;
}

.custom-select-trigger {
  position: relative;
  width: 100%;
  min-width: inherit;
  padding: 0.6rem 2.5rem 0.6rem 1rem;
  border: 2px solid var(--theme-accent-2);
  border-radius: 15px;
  background: var(--theme-input-bg);
  color: var(--theme-control-text);
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  font-weight: bold;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.custom-select-trigger::after {
  content: '';
  position: absolute;
  right: 0.85rem;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--theme-accent-2);
  transform: translateY(-50%);
  pointer-events: none;
}

.custom-select-trigger:hover {
  border-color: var(--theme-accent-2);
  box-shadow: 0 2px 8px var(--theme-focus);
}

.custom-select-trigger:focus-visible,
.custom-select.open .custom-select-trigger {
  outline: none;
  border-color: var(--theme-accent-2);
  box-shadow: 0 0 0 3px var(--theme-focus);
}

.custom-select-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.custom-select-menu {
  position: fixed;
  z-index: 10000;
  display: none;
  max-width: calc(100vw - 16px);
  max-height: min(320px, calc(100vh - 24px));
  overflow-y: auto;
  padding: 0.35rem;
  border: 2px solid var(--theme-accent-2);
  border-radius: 12px;
  background: var(--theme-input-bg);
  box-shadow: 0 10px 28px var(--theme-shadow-strong);
  font-family: 'Courier New', monospace;
  color: var(--theme-control-text);
  scrollbar-color: rgba(91, 76, 98, 0.42) transparent;
}

.custom-select-menu::-webkit-scrollbar {
  -webkit-appearance: none;
  width: 14px;
}

.custom-select-menu::-webkit-scrollbar-track,
.custom-select-menu::-webkit-scrollbar-track-piece,
.custom-select-menu::-webkit-scrollbar-corner {
  background: transparent;
}

.custom-select-menu::-webkit-scrollbar-thumb {
  background: rgba(91, 76, 98, 0.42);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
  min-height: 36px;
}

.custom-select-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(91, 76, 98, 0.58);
  background-clip: content-box;
}

.custom-select-menu.open {
  display: block;
}

.custom-select-option {
  display: block;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--theme-control-text);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: bold;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.custom-select-option:hover,
.custom-select-option.active {
  background: var(--theme-focus);
}

.custom-select-option.selected {
  background: var(--theme-accent-2);
  color: var(--theme-on-accent-2);
}

.custom-select-option:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.sort-direction-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid var(--theme-accent-2);
  background: var(--theme-input-bg);
  color: var(--theme-control-text);
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 10px;
  flex-shrink: 0;
}

.sort-direction-btn:hover {
  border-color: var(--theme-accent-2);
  background: var(--theme-accent-2);
  color: var(--theme-on-accent-2);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--theme-focus);
}

.sort-direction-btn .sort-arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}

.sort-direction-btn.ascending .sort-arrow {
  transform: rotate(180deg);
}

.filter-btn,
.collection-feature-btn {
  background: linear-gradient(180deg, #5dd4de 0%, #4ebfcc 100%);
  border: none;
  color: #fff3ec;
  padding: 0.7rem 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(78, 191, 204, 0.3);
  font-family: 'Courier New', monospace;
  font-weight: bold;
  border-radius: 20px;
}

.filter-btn:hover,
.collection-feature-btn:hover {
  background: linear-gradient(180deg, #6ddeea 0%, #5dd4de 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(78, 191, 204, 0.4);
}

.filter-btn.active,
.collection-feature-btn.active {
  background: linear-gradient(180deg, #d9c9f5 0%, #c9b4e8 100%);
  color: #fff3ec;
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(201, 180, 232, 0.5), inset 0 -2px 10px rgba(0, 0, 0, 0.1);
}

#gallerySelectBtn {
  background: var(--theme-selected-tab-bg);
  color: #fff3ec;
  box-shadow: 0 4px 15px var(--theme-selected-glow), inset 0 -2px 10px rgba(0, 0, 0, 0.1);
}

#gallerySelectBtn:hover {
  background: var(--theme-button-hover-bg);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--theme-selected-glow-strong), inset 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.gallery-mark-seen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
}

.gallery-mark-seen-btn img {
  display: block;
  width: 20px;
  height: 20px;
}

.site-subpage-btn,
.bulk-actions .action-btn,
.gallery-select-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: auto;
  min-width: 0;
  min-height: 38px;
  box-sizing: border-box;
  margin-top: 0;
  padding: 0.5rem 1.25rem;
  border: none !important;
  border-radius: 20px !important;
  background: linear-gradient(180deg, #fff9f5 0%, #fff3ec 100%) !important;
  color: #5b4c62 !important;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  font-weight: bold;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(91, 76, 98, 0.2) !important;
  text-transform: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.alphabet-nav {
  margin: 1rem 0 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  box-sizing: border-box;
  overflow: visible;
}

.alphabet-nav-features {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.alphabet-nav-letters {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  width: max-content;
  min-width: 0;
  max-width: 100%;
  gap: 0.5rem;
}

.alphabet-nav-label {
  flex: 0 0 auto;
  color: var(--theme-text);
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  font-weight: bold;
  white-space: nowrap;
}

.alphabet-nav-letters > .filter-scroll-shell {
  flex: 0 1 auto;
  width: max-content;
  min-width: 0;
}

.alphabet-btn {
  padding: 0.35rem 0.4rem !important;
  border: 2px solid var(--theme-border-strong) !important;
  border-radius: 9px !important;
  color: var(--theme-control-text) !important;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem !important;
  box-shadow: none !important;
}

.alphabet-btn--letter { flex: none; min-width: 1.85rem; padding: 0.35rem 0.3rem !important; }
.alphabet-btn--feature { flex: none; white-space: nowrap; }

#collectionCardsTab .alphabet-nav-inner {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.125rem;
  width: max-content;
  max-width: 100%;
  padding: 0.4rem 0.5rem;
  box-sizing: border-box;
}

@media (max-width: 1450px) {
  #alphabetNav {
    flex-direction: column;
    gap: 1.25rem;
  }

  .alphabet-nav-letters {
    flex: 1 1 auto;
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 1200px) {
  .alphabet-btn--letter {
    min-width: 2.35rem;
    padding-inline: 0.4rem !important;
  }
}

#collectionCardsTab .gallery-controls {
  margin-top: 1.25rem;
}

#collectionFilterBar {
  margin-inline: auto;
}

.alphabet-btn--unclaimed {
  background: rgba(255, 217, 141, 0.45) !important;
}

.alphabet-btn--training {
  background: rgba(216, 229, 179, 0.52) !important;
}

.alphabet-btn--group {
  background: rgba(247, 154, 181, 0.42) !important;
}

.site-subpage-btn:hover,
.bulk-actions .action-btn:hover,
.gallery-select-btn:hover {
  background: var(--theme-control-hover-bg);
}

.collection-letter-filter {
  margin: 0;
}

.collection-letter-filter .styled-select {
  min-width: 170px;
}

.site-subpage-btn.is-active,
.gallery-select-btn.is-active,
.alphabet-btn.active {
  background: var(--theme-selected-tab-bg) !important;
  color: var(--theme-selected-tab-text) !important;
  border-color: transparent !important;
  box-shadow: 0 4px 12px var(--theme-selected-glow) !important;
}

.alphabet-btn--unclaimed.active {
  background: linear-gradient(135deg, #ffd98d 0%, #f8c471 100%) !important;
  color: #5b4c62 !important;
  border-color: var(--theme-border-strong) !important;
}

.alphabet-btn--training.active {
  background: linear-gradient(135deg, #d8e5b3 0%, #c4d39f 100%) !important;
  color: #5b4c62 !important;
  border-color: var(--theme-border-strong) !important;
}

.alphabet-btn--group.active {
  background: linear-gradient(135deg, #f79ab5 0%, #e8c8f5 100%) !important;
  color: #5b4c62 !important;
  border-color: var(--theme-border-strong) !important;
}

.bulk-actions .action-btn img {
  width: 16px;
  height: 16px;
  display: block;
}

.site-mark-seen-btn img {
  width: 20px;
  height: 20px;
  display: block;
}

.site-mark-seen-btn {
  width: auto;
  flex: 0 0 auto;
  align-self: center;
  margin-top: 0;
  padding: 0.5rem 0.65rem;
  line-height: 0;
  box-shadow: none;
}

.site-mark-seen-btn--text {
  aspect-ratio: auto;
  line-height: 1.2;
  padding: 0.55rem 0.85rem;
}

.site-danger-btn {
  background: #5b4c62;
  color: #fff3ec;
}

.modal-inline-cancel,
.modal-inline-confirm {
  margin-top: 0;
  padding: 12px;
  font-size: 0.9rem;
  border-radius: 10px;
}

.modal-inline-cancel {
  flex: 1;
}

.modal-inline-confirm {
  flex: 2;
}

.profile-edit-main-btn {
  max-width: 300px;
  padding: 0.5rem 1.5rem;
}

.profile-edit-small-btn {
  width: auto;
  margin-top: 0;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

.delete-account-btn {
  margin-top: 2rem;
}

.notification-action-btn {
  padding: 8px 15px;
  font-size: 0.9em;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

#galleryGrid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

#friendTradeCardsGrid,
#allFriendsTradeCardsGrid {
  align-content: start;
  align-items: stretch;
  grid-auto-rows: auto;
}

.card-item {
  background: linear-gradient(135deg, #fff9f5 0%, #fff3ec 100%);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  position: relative;
  box-shadow: 0 6px 20px rgba(91, 76, 98, 0.2);
  border-radius: 20px;
}

.card-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(91, 76, 98, 0.3);
}

.card-item.common {
  background: linear-gradient(135deg, #d8e5b3 100%, #ade9ff 100%);
}

.card-item.rare {
  background: linear-gradient(135deg, #a8e8ff 100%, #8fd7ea 100%);
}

.card-item.epic {
  background: linear-gradient(135deg, #d9c9f5 100%, #c9b4e8 100%);
}

.card-item.legendary {
  background: linear-gradient(135deg, #ffe5a8 100%, #ffd98d 100%);
  /* no outer glow — only Holo glows; SSR uses the standard tile shadow */
}

.card-item.holo {
  background: linear-gradient(135deg, #f79ab5 0%, #c9b4e8 25%, #93c9d5 50%, #b7ce84 75%, #ffd98d 100%);
  box-shadow: 0 6px 20px rgba(247, 154, 181, 0.35), 0 0 28px rgba(201, 180, 232, 0.2);
  animation: holo-shimmer 3s ease-in-out infinite;
}

.card-item.group {
  background: linear-gradient(135deg, #fff9f5 0%, #fff3ec 100%);
}

@keyframes holo-shimmer {
  0%, 100% {
    filter: brightness(1) saturate(1);
  }
  50% {
    filter: brightness(1.06) saturate(1.1);
  }
}

/* ---- Slim rarity-frame card look (gallery + trade/UFT grids) ----
   In-between of the original (thick rarity frame) and the flush footer: the
   whole tile keeps its rarity color, but with a SLIM frame so the image is
   bigger while still sitting in its rarity color. The image keeps its own
   4.85% card radius (no crop), and the labels sit bottom-left on the rarity
   color. Applied to any .slim-card-grid (#galleryGrid + the friend/all-friends
   trade grids) so packs / pack-opening keep the classic tiles; the per-rarity
   tile colors + the Holo glow come from the global .card-item.<rarity> rules. */
.slim-card-grid .card-item {
  /* background + glow inherited from the global .card-item.<rarity> rules */
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* don't run the shimmer filter — it would tint the inset image */
.slim-card-grid .card-item.holo {
  animation: none;
}

.slim-card-grid .card-placeholder {
  margin-bottom: 0.45rem;
  border-radius: 4.85% / 3.45%;  /* the card art's own rounded corners → no cropping */
  box-shadow: none;
  background: transparent;  /* rounded corners reveal the rarity FRAME behind the art */
}

.slim-card-grid .card-footer {
  flex: 1 0 auto;          /* fills uneven row heights so the color reaches the bottom */
  min-width: 0;            /* allow long labels to shrink within narrow grid tracks */
  background: transparent; /* labels sit directly on the tile's rarity color */
  padding: 0.1rem 0.5rem 2rem 0.6rem; /* bottom room so name/era clear the pinned rarity */
  text-align: left;        /* idol / group / rarity aligned bottom-left */
}

/* gallery tiles carry 💎/⏫ buttons → extra bottom room so name/era clear them */
#galleryGrid .card-footer { padding-bottom: 2.9rem; }

#galleryGrid .card-footer .card-era {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  width: 100%;
  height: calc(2.4em + 0.6rem);
  line-height: 1.2;
  margin-bottom: 0.3rem;
}

#galleryGrid .card-number {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  color: #5b4c62;
}

#friendTradeCardsGrid .card-footer,
#allFriendsTradeCardsGrid .card-footer {
  flex: 1 0 auto;
}

/* all-friends trade tiles add an "Owner:" line above the pinned rarity → a touch
   more bottom room so the owner line clears it */
#allFriendsTradeCardsGrid .card-footer { padding-bottom: 2.6rem; }

.slim-card-grid .card-footer .card-name { margin: 0 0 0.25rem; }
.slim-card-grid .card-footer .card-era {
  margin: 0 0 0.45rem;
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* rarity pinned to the tile's bottom-left corner — always the same spot,
   not tied to the name/era flowing above it */
.slim-card-grid .card-footer .card-rarity {
  position: absolute;
  left: 1.1rem;   /* matches the name/era indent: 0.5rem tile padding + 0.6rem footer padding */
  bottom: 0.75rem;
  margin: 0;
}

.card-placeholder {
  width: 100%;
  aspect-ratio: 3.6715/5.159;  /* Real card dimensions: 3.6715" x 5.159" */
  background: linear-gradient(135deg, #fff9f5 0%, #fff3ec 100%);
  border: none;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  border-radius: 4.85% / 3.45%;  /* 0.1779" radius / 3.6715" width = 4.85% */
  box-shadow: inset 0 2px 10px rgba(91, 76, 98, 0.1);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  position: relative; /* Contain absolutely-positioned children (e.g. Owned badge) */
}

.card-placeholder img {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
}

.card-name {
  font-weight: bold;
  margin: 0.5rem 0 0.1rem 0;
  font-size: 1rem;
  color: #5b4c62;
}

.card-era {
  font-size: 0.9rem;
  color: #5b4c62;
  margin: 0.2rem 0 2.5rem 0;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(201, 180, 232, 0.3) 0%, rgba(147, 201, 213, 0.3) 100%);
  padding: 0.3rem 0.6rem;
  border-radius: 10px;
  display: inline-block;
}

.card-rarity {
  font-size: 0.85rem;
  text-transform: uppercase;
  font-weight: bold;
  color: #5b4c62;
}

.card-count {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: #e889a9;
  color: #fff3ec;
  padding: 0.35rem 0.7rem;
  border: none;
  font-size: 0.85rem;
  font-weight: bold;
  border-radius: 15px;
  box-shadow: 0 4px 10px rgba(232, 137, 169, 0.35);
}

.convert-gem-btn {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  background: linear-gradient(135deg, #fff3ec 100%, #fff3ec 100%);
  border: none;
  color: #fff3ec;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 217, 141, 0.4);
  z-index: 10;
  border-radius: 20px;
}

.convert-gem-btn:hover {
  background: linear-gradient(135deg, #ffd98d 0%, #f7cd84 100%);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 217, 141, 0.5);
}

/* Library View */
.library-container {
  padding: 2rem;
  max-width: 1900px;
  margin: 0 auto;
  background: transparent;
}

.library-container h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: #5b4c62;
  text-align: center;
}

/* Shared sub-tab button bar — used by Library, Profile, and Tournament */
.view-subtabs {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  padding: 2rem 1rem 0;
  flex-wrap: wrap;
}

/* Shared sub-tab button style (mirrors .library-tab) */
.view-subtab {
  padding: 0.5rem 1.5rem;
  background: linear-gradient(180deg, #fff9f5 0%, #fff3ec 100%);
  border: none;
  border-radius: 20px;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(91, 76, 98, 0.2);
  transition: all 0.2s ease;
}
.view-subtab:hover {
  box-shadow: 0 4px 15px var(--theme-selected-glow);
}
.view-subtab.active {
  background: var(--theme-selected-tab-bg);
  color: var(--theme-selected-tab-text);
  box-shadow: 0 4px 15px var(--theme-selected-glow-strong);
}

.view-subtab--with-badge {
  position: relative;
}

.library-tabs {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  padding: 0 1rem 0;
  flex-wrap: wrap;
  margin-bottom: 0;
  position: relative;
  z-index: 10;
}

.library-tab {
  padding: 0.5rem 1.5rem;
  background: linear-gradient(180deg, #fff9f5 0%, #fff3ec 100%);
  border: none;
  border-radius: 20px;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(91, 76, 98, 0.2);
  transition: all 0.2s ease;
}

.library-tab:hover {
  box-shadow: 0 4px 15px var(--theme-selected-glow);
}

.library-tab.active {
  background: var(--theme-selected-tab-bg);
  color: var(--theme-selected-tab-text);
  box-shadow: 0 4px 15px var(--theme-selected-glow-strong);
}

.library-tab-content {
  display: none;
  padding-top: 2rem;
}

.collection-tab-content {
  display: none;
}

.library-tab-content.active,
.collection-tab-content.active {
  display: block;
}

.nft-collection { max-width: 1240px; margin: 0 auto; padding: 2rem 1rem 5rem; }
.nft-collection-note, .nft-collection-status { color: #66556c; line-height: 1.5; }
.nft-section { margin-top: 2rem; }
.nft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.nft-pack-tile, .nft-card-tile { display: flex; flex-direction: column; gap: .5rem; padding: .75rem; border: 2px solid #bba6c5; border-radius: 14px; background: #fff8f5; }
.nft-pack-tile img, .nft-card-tile img { display: block; width: 100%; aspect-ratio: 5 / 8; object-fit: contain; border-radius: 8px; }
.nft-card-tile img { aspect-ratio: 3.6715 / 5.159; object-fit: cover; }
.nft-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; }
.nft-action { font-size: .75rem; min-width: 0; flex: 1; }
.nft-reveal { padding: 1.25rem; margin: 1rem 0; border: 2px solid #c4a5d7; border-radius: 16px; background: #fff6fc; }
.nft-opening-pack { position: relative; display: grid; place-items: center; height: 230px; margin: .4rem auto .8rem; overflow: hidden; animation: nft-pack-stage 1.45s ease-in both; }
.nft-opening-pack::before { content: ''; position: absolute; width: 110px; height: 110px; border: 8px solid #efd3ff; border-radius: 50%; box-shadow: 0 0 42px #dc99ff; animation: nft-pack-flash 1.45s ease-out both; }
.nft-opening-pack img { position: relative; height: 205px; max-width: 75%; object-fit: contain; filter: drop-shadow(0 10px 12px #775385aa); animation: nft-pack-open 1.45s ease-in both; }
.nft-reveal-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.nft-reveal-card { width: min(17%, 170px); min-width: 120px; display: flex; flex-direction: column; gap: .4rem; animation: nft-card-flip .65s both; transform-origin: center; }
.nft-reveal-card img { width: 100%; aspect-ratio: 3.6715 / 5.159; object-fit: cover; border-radius: 8px; }
@keyframes nft-pack-open { 0% { transform: scale(.72) rotate(-8deg); opacity: .6; } 48% { transform: scale(1) rotate(7deg); opacity: 1; } 75% { transform: scale(1.13) rotate(-4deg); opacity: 1; } 100% { transform: scale(1.8) rotate(3deg); opacity: 0; } }
@keyframes nft-pack-flash { 0%, 55% { transform: scale(.2); opacity: 0; } 78% { opacity: .95; } 100% { transform: scale(4); opacity: 0; } }
@keyframes nft-pack-stage { 0%, 80% { height: 230px; } 100% { height: 0; margin: 0; } }
@media (prefers-reduced-motion: reduce) { .nft-opening-pack, .nft-opening-pack::before, .nft-opening-pack img, .nft-reveal-card { animation: none !important; } .nft-opening-pack { height: 0; margin: 0; } }
@keyframes nft-card-flip { from { opacity: 0; transform: perspective(600px) rotateY(90deg) scale(.8); } to { opacity: 1; transform: perspective(600px) rotateY(0) scale(1); } }
.nft-picker-shade { position: fixed; z-index: 12000; inset: 0; display: grid; place-items: center; background: rgba(36, 20, 46, .6); }
.nft-picker { display: flex; flex-wrap: wrap; gap: .7rem; max-width: min(90vw, 480px); padding: 1.5rem; border-radius: 16px; background: #fff8f5; }
.nft-picker h3, .nft-picker select { width: 100%; }

.market-ping-container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.market-ping-modal {
  width: min(94vw, 1080px);
}

.market-ping-modal .market-ping-container {
  padding: 0.25rem 0 0;
}

.market-ping-header {
  text-align: center;
  margin-bottom: 1rem;
}

.market-ping-header .page-title {
  margin-bottom: 0.35rem;
}

.market-ping-copy {
  margin: 0;
  color: #6b5773;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.45;
}

.market-ping-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 1rem;
  align-items: stretch;
}

.market-ping-panel,
.market-ping-status-card {
  border: 3px solid #5b4c62;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 249, 245, 0.96), rgba(255, 243, 236, 0.98)),
    radial-gradient(circle at top left, rgba(93, 212, 222, 0.18), transparent 34%);
  box-shadow: 0 6px 0 rgba(91, 76, 98, 0.14);
}

.market-ping-panel {
  display: grid;
  align-content: start;
  padding: 1rem;
}

.market-ping-panel h2,
.market-ping-status-card h3 {
  margin: 0 0 0.8rem;
  color: #5b4c62;
  font-size: 1rem;
  line-height: 1.5;
  text-align: center;
  text-shadow: none;
}

.market-ping-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 0.8rem;
}

.market-ping-field {
  display: grid;
  gap: 0.35rem;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 0.88rem;
  font-weight: 900;
}

.market-ping-field:first-child {
  grid-column: 1 / -1;
}

.market-ping-field span {
  padding-left: 0.15rem;
}

.market-ping-input {
  width: 100%;
  min-width: 0;
}

.market-ping-preview {
  margin: 0.9rem 0 0;
  min-height: 54px;
  padding: 0.75rem 0.85rem;
  border: 2px solid rgba(91, 76, 98, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  color: #6b5773;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  display: grid;
  place-items: center;
}

.market-ping-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-top: 0.9rem;
}

.market-ping-current {
  min-height: 100%;
  display: grid;
}

.market-ping-status-card {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  padding: 1rem;
  text-align: center;
}

.market-ping-card-shell {
  display: grid;
  justify-items: center;
  gap: 0.85rem;
  min-height: 100%;
}

.market-ping-card-shell--inactive {
  align-content: start;
}

.market-ping-card-face {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.9rem;
  width: min(100%, 245px);
  min-height: 336px;
  padding: 1rem;
  border: 4px solid #5b4c62;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 224, 250, 0.84), rgba(255, 217, 141, 0.82)),
    repeating-linear-gradient(45deg, rgba(91, 76, 98, 0.08) 0 8px, rgba(255, 255, 255, 0.15) 8px 16px);
  box-shadow: 0 9px 0 rgba(91, 76, 98, 0.2), 0 14px 24px rgba(91, 76, 98, 0.18);
  overflow: hidden;
}

.market-ping-card-face > * {
  position: relative;
  z-index: 1;
}

.market-ping-card-face--active {
  background:
    linear-gradient(135deg, rgba(183, 206, 132, 0.78), rgba(255, 217, 141, 0.76)),
    repeating-linear-gradient(45deg, rgba(91, 76, 98, 0.08) 0 8px, rgba(255, 255, 255, 0.15) 8px 16px);
}

.market-ping-card-face--inactive {
  background:
    linear-gradient(135deg, rgba(255, 224, 250, 0.84), rgba(246, 173, 179, 0.66)),
    repeating-linear-gradient(45deg, rgba(91, 76, 98, 0.08) 0 8px, rgba(255, 255, 255, 0.15) 8px 16px);
}

.market-ping-card-face h3 {
  margin-bottom: 0;
  min-height: 3rem;
  display: grid;
  place-items: center;
  color: #5b4c62;
  font-size: 1rem;
  line-height: 1.35;
  text-align: center;
  text-shadow: none;
}

.market-ping-meta {
  display: grid;
  gap: 0.55rem;
}

.market-ping-meta p {
  display: grid;
  gap: 0.2rem;
  margin: 0;
  padding: 0.65rem;
  border: 2px solid rgba(91, 76, 98, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
  color: #6b5773;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.3;
}

.market-ping-meta span {
  color: #5b4c62;
  font-size: 0.72rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.market-ping-status-card--inactive {
  opacity: 0.82;
}

.market-ping-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.75rem;
  min-height: 220px;
  padding: 1rem;
  border: 2px solid rgba(91, 76, 98, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
  text-align: center;
}

.market-ping-empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 3px solid #5b4c62;
  border-radius: 50%;
  background: #ffd98d;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 1.35rem;
  font-weight: 900;
  box-shadow: 0 4px 0 rgba(91, 76, 98, 0.14);
}

.market-ping-cancel-btn {
  justify-self: center;
  width: min(100%, 180px);
  margin-top: 0.15rem;
}

/* Album Shelf */
.album-shelf {
  display: grid;
  grid-template-columns: repeat(5, 170px);
  justify-content: center;
  gap: 1.25rem 1rem;
  max-width: 950px;
  margin: 0 auto;
}

.shelf-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.shelf-divider {
  height: 8px;
  background: linear-gradient(to bottom, #8b6f4e 0%, #6b5538 50%, #4a3a28 100%);
  border-radius: 4px;
  margin: 1rem auto;
  max-width: 900px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.album-slot {
  width: 170px;
  text-align: center;
  transition: transform 0.3s ease;
}

.album-slot:hover {
  transform: translateY(-5px);
}

.album-placeholder {
  width: 170px;
  height: 170px;
  background: rgba(255, 249, 245, 0.22);
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: #d0a0b0;
  margin-bottom: 0.5rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.album-art-wrap {
  position: relative;
  margin-bottom: 0.4rem;
}

.album-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 26px;
  margin-bottom: 0.3rem;
}

.album-count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: bold;
  font-family: 'Press Start 2P', monospace;
  line-height: 1;
  background: rgba(91, 76, 98, 0.9);
  color: #fff;
}

.album-display-toggle {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #5b4c62;
  color: #5b4c62;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.album-slot:hover .album-display-toggle,
.album-slot:focus-within .album-display-toggle {
  opacity: 1;
  pointer-events: auto;
}

.album-display-toggle:hover {
  transform: scale(1.05);
}

.album-display-toggle.is-displayed {
  background: #5dd4de;
  border-color: #5dd4de;
  color: #fff;
}

@media (hover: none) {
  .album-display-toggle {
    opacity: 1;
    pointer-events: auto;
  }
}

.album-meta-row .merge-btn {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 7px;
  background: linear-gradient(180deg, #5dd4de 0%, #4ebfcc 100%);
  color: #fff3ec;
  font-size: 0.6rem;
  box-shadow: 0 2px 6px rgba(78, 191, 204, 0.28);
}

.album-meta-row .merge-btn:hover {
  background: linear-gradient(180deg, #6ddeea 0%, #5dd4de 100%);
  box-shadow: 0 4px 10px rgba(78, 191, 204, 0.35);
}

.album-slot.empty .album-placeholder {
  opacity: 0.5;
}

.album-name {
  font-size: 0.85rem;
  color: #5b4c62;
  margin: 0;
  font-weight: bold;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:is(html[data-theme="dark"], html[data-theme="grey"]) #libraryAlbumsTab .album-name,
:is(html[data-theme="dark"], html[data-theme="grey"]) #displayAlbumsSection p[title] {
  color: #fff3ec !important;
}

/* Sticker Collection */
.sticker-collection {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}

.sticker-set {
  text-align: center;
}

.sticker-strip {
  background: linear-gradient(180deg, #ffffff 0%, #f5f5f5 100%);
  border: 3px solid #e88aa9;
  border-radius: 12px;
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease;
}

.sticker-strip:hover {
  transform: translateY(-5px);
}

.sticker-slot {
  width: 100%;
  aspect-ratio: 1.5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sticker-placeholder {
  width: 90%;
  height: 90%;
  background: linear-gradient(135deg, #fce4d8 0%, #ffe0fa 100%);
  border: 2px solid #d0a0b0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #d0a0b0;
}

.sticker-slot.empty .sticker-placeholder {
  opacity: 0.5;
}

.sticker-set-name {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #5b4c62;
  font-weight: bold;
}

.book-sticker-pack {
  width: 100%;
  padding: 0.35rem 0 0.8rem;
}

.sticker-set-divider {
  width: 100%;
  height: 2px;
  margin: 0.5rem 0 0.8rem;
  background: repeating-linear-gradient(90deg, #e88aa9 0 8px, transparent 8px 14px);
}

.site-divider,
.sticker-set-divider,
.settings-divider,
.ozoz-settings-divider,
.auction-section-divider {
  border: 0;
  background: repeating-linear-gradient(90deg, rgba(91, 76, 98, 0.45) 0 8px, transparent 8px 14px);
}

.site-divider {
  width: 100%;
  height: 2px;
  margin: 0.75rem 0 1rem;
}

.sticker-panel-sidebar {
  position: sticky;
  top: 1rem;
  width: 260px;
  flex-shrink: 0;
  margin-left: 1.25rem;
  padding: 1rem;
  background: var(--theme-card-bg);
  border-radius: 15px;
  box-shadow: 0 4px 12px rgba(91, 76, 98, 0.1);
  max-height: 80vh;
  overflow-y: auto;
}

.sticker-panel-header {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px dashed rgba(91, 76, 98, 0.45);
  text-align: center;
}

.sticker-panel-header .site-mark-seen-btn {
  margin: 0.6rem auto 0;
}

.sticker-panel-header h3 {
  margin: 0;
  color: #5b4c62;
  font-size: 1rem;
  text-align: center;
}

.sticker-panel-tracker {
  text-align: center;
  color: #5b4c62;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.55rem;
  line-height: 1.45;
  margin: 0.55rem 0 0;
}

.sticker-panel-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-start;
  min-height: 100px;
}

.sticker-panel-empty {
  width: 100%;
  text-align: center;
  color: #999;
  padding: 1rem;
  font-size: 0.85rem;
}

.sticker-set-header {
  width: calc(100% - 0.25rem);
  margin: 0 0 0.7rem;
  color: #5b4c62;
  font-size: 0.68rem;
  font-weight: bold;
  line-height: 1.3;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.sticker-pack-count {
  color: rgba(91, 76, 98, 0.68);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.48rem;
  white-space: nowrap;
}

.sticker-set-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 0.95rem;
  justify-content: flex-start;
  align-items: center;
  padding: 0 0.15rem;
}

.draggable-sticker,
.placed-sticker {
  background-color: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

.draggable-sticker {
  position: relative;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  cursor: grab;
  transition: transform 0.2s ease;
}

.draggable-sticker:active {
  cursor: grabbing;
}

.draggable-sticker.is-hovered {
  transform: scale(1.08);
}

.sticker-art,
.sticker-display {
  filter:
    drop-shadow(1px 0 0 #fff)
    drop-shadow(-1px 0 0 #fff)
    drop-shadow(0 1px 0 #fff)
    drop-shadow(0 -1px 0 #fff)
    drop-shadow(1px 1px 0 #fff)
    drop-shadow(-1px 1px 0 #fff)
    drop-shadow(1px -1px 0 #fff)
    drop-shadow(-1px -1px 0 #fff)
    drop-shadow(0 2px 2px rgba(91, 76, 98, 0.22));
}

.placed-sticker {
  filter: drop-shadow(0 2px 2px rgba(91, 76, 98, 0.22)) !important;
}

.sticker-art {
  position: absolute;
  inset: 0;
  display: block;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

.sticker-display {
  background-color: transparent !important;
}

.placed-sticker.is-hovered {
  filter: drop-shadow(0 3px 3px rgba(91, 76, 98, 0.28)) !important;
}

.placed-sticker,
.placed-sticker.tier-silver,
.placed-sticker.tier-gold,
.placed-sticker.tier-glitter {
  animation: none !important;
}

.sticker-count-pill {
  position: absolute;
  top: -4px;
  left: -4px;
  min-height: 18px;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(91, 76, 98, 0.9);
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.55rem;
  font-weight: bold;
  line-height: 1.4;
  z-index: 12;
  box-shadow: 0 2px 5px rgba(0,0,0,0.22);
}

.draggable-sticker .sticker-merge-btn {
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  padding: 3px 6px;
  border-radius: 999px;
  font-size: 0.48rem;
  white-space: nowrap;
}

.draggable-sticker .sticker-merge-btn:hover {
  transform: translateX(-50%) scale(1.04);
}

/* Collectible Tier Effects (for albums and stickers) */
/* Tier 1 - Silver shine */
.tier-silver {
  position: relative;
  box-shadow: 0 0 15px rgba(192, 192, 192, 0.8), inset 0 0 10px rgba(255, 255, 255, 0.3);
  border: 3px solid #c0c0c0 !important;
}

.tier-silver::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: silverShine 3s infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes silverShine {
  0% { left: -100%; }
  50%, 100% { left: 100%; }
}

/* Tier 2 - Gold shine */
.tier-gold {
  position: relative;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), inset 0 0 15px rgba(255, 255, 255, 0.4);
  border: 3px solid #ffd700 !important;
}

.tier-gold::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 223, 100, 0.6), transparent);
  animation: goldShine 2.5s infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes goldShine {
  0% { left: -100%; }
  50%, 100% { left: 100%; }
}

/* Tier 3 - Glitter/Holographic effect */
.tier-glitter {
  position: relative;
  box-shadow: 0 0 25px rgba(255, 100, 200, 0.6), 0 0 50px rgba(100, 200, 255, 0.4);
  border: 3px solid transparent !important;
  background-clip: padding-box;
  overflow: visible;
}

.tier-glitter::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  background: linear-gradient(45deg, #ff6b6b, #ffd93d, #6bcf63, #4ecdc4, #a78bfa, #ff6b9d, #ff6b6b);
  background-size: 400% 400%;
  border-radius: inherit;
  z-index: -1;
  animation: glitterBorder 3s ease infinite;
}

.tier-glitter::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 25%,
    rgba(255, 255, 255, 0) 50%,
    rgba(255, 255, 255, 0.3) 75%,
    rgba(255, 255, 255, 0) 100%);
  background-size: 200% 200%;
  animation: glitterSparkle 2s ease infinite;
  pointer-events: none;
  z-index: 2;
  border-radius: inherit;
}

@keyframes glitterBorder {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes glitterSparkle {
  0% { background-position: 200% 200%; }
  100% { background-position: -200% -200%; }
}

/* Sticker-specific tier effects - use drop-shadow to follow sticker outline */
.sticker-display.tier-silver,
.draggable-sticker.tier-silver,
.placed-sticker.tier-silver {
  box-shadow: none !important;
  border: none !important;
  background-color: transparent !important;
  animation: stickerSilverPulse 2.5s ease-in-out infinite;
}
.sticker-display.tier-silver::before,
.draggable-sticker.tier-silver::before,
.placed-sticker.tier-silver::before {
  display: none !important;
}

.sticker-display.tier-gold,
.draggable-sticker.tier-gold,
.placed-sticker.tier-gold {
  box-shadow: none !important;
  border: none !important;
  background-color: transparent !important;
  animation: stickerGoldPulse 2.5s ease-in-out infinite;
}
.sticker-display.tier-gold::before,
.draggable-sticker.tier-gold::before,
.placed-sticker.tier-gold::before {
  display: none !important;
}

.sticker-display.tier-glitter,
.draggable-sticker.tier-glitter,
.placed-sticker.tier-glitter {
  box-shadow: none !important;
  border: none !important;
  background-color: transparent !important;
  animation: stickerGlitterPulse 3s ease infinite;
}
.sticker-display.tier-glitter::before,
.sticker-display.tier-glitter::after,
.draggable-sticker.tier-glitter::before,
.draggable-sticker.tier-glitter::after,
.placed-sticker.tier-glitter::before,
.placed-sticker.tier-glitter::after {
  display: none !important;
}

.placed-sticker.tier-silver,
.placed-sticker.tier-gold,
.placed-sticker.tier-glitter {
  animation: none !important;
  filter: drop-shadow(0 2px 2px rgba(91, 76, 98, 0.22)) !important;
}

@keyframes stickerSilverPulse {
  0%, 100% {
    filter: drop-shadow(0 0 1px #fff)
           drop-shadow(0 0 2px #fff)
           drop-shadow(0 0 3px rgba(255, 255, 255, 0.9))
           drop-shadow(0 0 8px rgba(230, 230, 235, 0.8))
           drop-shadow(0 0 15px rgba(200, 200, 210, 0.5))
           drop-shadow(0 2px 3px rgba(91, 76, 98, 0.28));
  }
  50% {
    filter: drop-shadow(0 0 1px #fff)
           drop-shadow(0 0 2px #fff)
           drop-shadow(0 0 5px rgba(255, 255, 255, 1))
           drop-shadow(0 0 14px rgba(230, 230, 235, 1))
           drop-shadow(0 0 22px rgba(200, 200, 210, 0.7))
           drop-shadow(0 2px 3px rgba(91, 76, 98, 0.28));
  }
}

@keyframes stickerGoldPulse {
  0%, 100% {
    filter: drop-shadow(0 0 1px #fff)
           drop-shadow(0 0 2px #fff)
           drop-shadow(0 0 3px rgba(255, 255, 200, 0.9))
           drop-shadow(0 0 8px rgba(255, 215, 0, 0.7))
           drop-shadow(0 0 15px rgba(255, 180, 0, 0.4))
           drop-shadow(0 2px 3px rgba(91, 76, 98, 0.28));
  }
  50% {
    filter: drop-shadow(0 0 1px #fff)
           drop-shadow(0 0 2px #fff)
           drop-shadow(0 0 5px rgba(255, 255, 200, 1))
           drop-shadow(0 0 14px rgba(255, 215, 0, 0.9))
           drop-shadow(0 0 22px rgba(255, 180, 0, 0.6))
           drop-shadow(0 2px 3px rgba(91, 76, 98, 0.28));
  }
}

@keyframes stickerGlitterPulse {
  0% {
    filter: drop-shadow(0 0 1px #fff)
           drop-shadow(0 0 2px #fff)
           drop-shadow(0 0 5px rgba(255, 100, 200, 0.9))
           drop-shadow(0 0 12px rgba(255, 100, 200, 0.5))
           drop-shadow(0 0 20px rgba(100, 200, 255, 0.3))
           drop-shadow(0 2px 3px rgba(91, 76, 98, 0.28));
  }
  33% {
    filter: drop-shadow(0 0 1px #fff)
           drop-shadow(0 0 2px #fff)
           drop-shadow(0 0 5px rgba(100, 200, 255, 0.9))
           drop-shadow(0 0 12px rgba(100, 200, 255, 0.5))
           drop-shadow(0 0 20px rgba(160, 139, 250, 0.3))
           drop-shadow(0 2px 3px rgba(91, 76, 98, 0.28));
  }
  66% {
    filter: drop-shadow(0 0 1px #fff)
           drop-shadow(0 0 2px #fff)
           drop-shadow(0 0 5px rgba(160, 139, 250, 0.9))
           drop-shadow(0 0 12px rgba(160, 139, 250, 0.5))
           drop-shadow(0 0 20px rgba(255, 100, 200, 0.3))
           drop-shadow(0 2px 3px rgba(91, 76, 98, 0.28));
  }
  100% {
    filter: drop-shadow(0 0 1px #fff)
           drop-shadow(0 0 2px #fff)
           drop-shadow(0 0 5px rgba(255, 100, 200, 0.9))
           drop-shadow(0 0 12px rgba(255, 100, 200, 0.5))
           drop-shadow(0 0 20px rgba(100, 200, 255, 0.3))
           drop-shadow(0 2px 3px rgba(91, 76, 98, 0.28));
  }
}

/* Tier badge indicator */
.tier-badge {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.tier-badge.silver {
  background: linear-gradient(135deg, #e8e8e8, #c0c0c0);
  color: #666;
  border: 2px solid #a0a0a0;
}

.tier-badge.gold {
  background: linear-gradient(135deg, #fff4c4, #ffd700);
  color: #8b6914;
  border: 2px solid #daa520;
}

.tier-badge.glitter {
  background: linear-gradient(135deg, #ff9a9e, #fecfef, #a78bfa);
  background-size: 200% 200%;
  animation: glitterBorder 2s ease infinite;
  color: #fff;
  border: 2px solid #ff6b9d;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Merge button for collectibles */
.merge-btn {
  position: absolute;
  bottom: 5px;
  left: 5px;
  padding: 4px 8px;
  background: linear-gradient(135deg, #a78bfa, #8b5cf6);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 0.65rem;
  font-family: 'Press Start 2P', monospace;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 10;
  transition: transform 0.2s, box-shadow 0.2s;
}

.merge-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.merge-btn:disabled {
  background: #999;
  cursor: not-allowed;
  transform: none;
}

/* NEW badge for recently-caught albums/stickers (mirrors the gallery card NEW badge) */
.lib-new-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: #f79ab5;
  color: #fff;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 11;
  pointer-events: none;
}
.lib-new-badge-sm {
  bottom: 4px;
  right: 4px;
  padding: 2px 5px;
  font-size: 0.6rem;
}

/* Profile View */
.profile-container {
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
  background: transparent;
}

.profile-section {
  background: var(--theme-panel-bg);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--theme-border);
  box-shadow: 0 6px 18px var(--theme-shadow);
  border-radius: 20px;
}

.album-cover-surface {
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.profile-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 1rem 1.25rem;
  align-items: start;
  justify-items: center;
  max-width: 680px;
  margin: 0 auto;
}

.profile-edit-grid > div {
  width: 100% !important;
  max-width: 300px !important;
}

.profile-edit-grid > button.action-btn {
  width: auto !important;
  min-width: 150px;
  max-width: 210px !important;
  padding: 0.5rem 1rem !important;
  justify-self: center;
}

.profile-edit-grid #selectProfileCardBtn {
  order: 1;
}

.profile-edit-grid #resetProfilePictureBtn {
  order: 2;
}

.profile-edit-grid > div:nth-of-type(1) {
  order: 3;
}

.profile-edit-grid > div:nth-of-type(2) {
  order: 4;
}

.profile-edit-grid > #profileStatusControls {
  order: 5;
  grid-column: 1 / -1;
  max-width: 520px !important;
}

.profile-edit-grid #profileBorderColorPicker,
.profile-edit-grid #headerGradientPicker,
.profile-edit-grid #tagColorPicker,
.profile-edit-grid #customHeaderGradientControls {
  justify-content: center !important;
}

.profile-edit-panel {
  display: grid;
  gap: 0.8rem;
  min-width: 0;
  padding: 1rem;
  border: 2px solid rgba(91, 76, 98, 0.16);
  border-radius: 12px;
  background: rgba(255, 249, 245, 0.72);
}

.profile-edit-panel h3 {
  margin: 0;
  color: #5b4c62;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: left;
}

.profile-edit-panel p,
.profile-edit-note {
  margin: 0;
  color: rgba(91, 76, 98, 0.82);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-edit-control {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.profile-edit-control label {
  color: #5b4c62;
  font-weight: bold;
}

.profile-edit-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.profile-edit-actions .action-btn {
  flex: 1 1 140px;
}

.profile-edit-swatch-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

#tagColorPicker.profile-edit-swatch-row,
.profile-edit-modal-swatches .profile-edit-swatch-row {
  max-width: 292px;
  margin-inline: auto;
  min-height: 88px;
  align-content: center;
}

.profile-edit-warning {
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: rgba(247, 154, 181, 0.16);
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.35;
}

.profile-inline-edit-btn {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  min-width: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(91, 76, 98, 0.55);
  color: #fff9f5;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  box-shadow: none;
}

#myProfilePreview {
  position: relative;
}

#myProfilePicturePreview:hover .profile-inline-edit-btn,
#myProfilePreview:hover #profileHeaderEditBtn,
.profile-tag-inline-wrap:hover #profileTagEditBtn,
.profile-inline-edit-btn:focus {
  opacity: 1;
  pointer-events: auto;
}

#myProfilePicturePreview .profile-inline-edit-btn {
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  font-size: 1.15rem;
}

#myProfilePicturePreview {
  cursor: pointer;
}

.profile-header-edit-zone {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 42px;
  height: 42px;
}

#profileHeaderEditBtn {
  top: 7px;
  right: 7px;
}

.profile-preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  align-items: flex-start;
  gap: 1.5rem;
}

.profile-preview-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  max-width: 100%;
}

.friend-profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem 2rem;
}

.friend-profile-identity {
  display: flex;
  align-items: center;
  flex: 1 1 250px;
  gap: 1.5rem;
  min-width: 0;
  max-width: 100%;
}

#myProfilePicturePreview,
#friendProfilePicture {
  flex: 0 0 100px;
  width: 100px;
  min-width: 100px;
  max-width: 100px;
  height: 100px;
  min-height: 100px;
  max-height: 100px;
  box-sizing: content-box;
}

.profile-preview-text {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.friend-profile-text {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  text-align: left;
}

#myProfileUsernamePreview,
#friendProfileUsername,
#myProfileStatusPreview,
#friendProfileStatus {
  overflow-wrap: anywhere;
}

.profile-tag-inline-wrap {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-width: 0;
  width: 100%;
}

#myProfileTagPreview,
#friendProfileTag {
  box-sizing: border-box;
  max-width: min(100%, 260px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

#myProfileTagPreview {
  flex: 1 1 auto;
  min-width: 0;
}

#myProfileTagPreview.profile-tag-placeholder {
  border: 1px dashed currentColor;
  opacity: 0.72;
}

.profile-tag-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-tag-star { flex: 0 0 auto; margin-left: 0.25em; }

#notificationsModal .notifications-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 16px;
}
#notificationsModal .notifications-title-row h2 { margin: 0; min-width: 0; }
#notificationsModal .notifications-title-row .close-modal { position: relative; top: auto; right: auto; }
.notification-filters {
  min-width: 0;
}
.notification-filters[hidden] { display: none; }
.notification-filters .ozoz-settings-row { min-height: 32px; gap: 12px; cursor: pointer; }
.notification-filters .ozoz-settings-row:last-child { margin-bottom: 0; }
#stackQuantityPicker .alert-buttons { flex-wrap: wrap; }

#profileTagEditBtn {
  position: static;
  display: inline-grid;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-left: 0.35rem;
  vertical-align: middle;
  font-size: 0.8rem;
}

.profile-inline-status-wrap {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.45rem;
  max-width: min(100%, 300px);
  min-width: 0;
}

.profile-inline-status-input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: 26px;
  padding: 0.25rem 0.45rem;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 249, 245, 0.2);
  color: inherit;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  font-weight: 900;
  line-height: 1.2;
  cursor: text;
}

.profile-inline-status-input:focus {
  outline: 2px solid rgba(255, 249, 245, 0.45);
  outline-offset: 1px;
}

.profile-inline-status-save {
  align-self: center;
  flex: 0 0 24px;
  min-width: 24px;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  line-height: 1;
  margin-top: 0;
  transform: none;
  -webkit-transform: none;
  box-shadow: 0 3px 10px rgba(232, 137, 169, 0.32);
}

.profile-inline-status-save:hover:not(:disabled) {
  transform: none;
  -webkit-transform: none;
}

.profile-inline-rules {
  margin: 0.75rem 0 0;
  color: #6b5773;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.35;
}

.profile-edit-modal-grid {
  display: grid;
  gap: 0.9rem;
  justify-items: center;
}

.profile-edit-modal-grid > :where(select, button) {
  width: min(100%, 340px);
}

.profile-edit-modal-swatches,
.profile-edit-modal-gradients {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.profile-edit-modal-gradients .header-gradient-btn,
.profile-edit-modal-swatches .tag-color-btn,
.profile-edit-modal-swatches .profile-border-color-btn {
  width: 42px !important;
  height: 42px !important;
  border: 3px solid transparent !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  outline: none !important;
  padding: 0 !important;
  box-sizing: border-box;
}

.profile-edit-swatch,
.profile-border-color-btn,
.header-gradient-btn,
.tag-color-btn {
  width: 40px;
  height: 40px;
  border: 3px solid transparent;
  border-radius: 50%;
  background: var(--swatch-bg, transparent);
  background-clip: padding-box;
  cursor: pointer;
  box-shadow: none;
  outline: none;
  padding: 0;
  box-sizing: border-box;
}

.tag-color-btn.gold-gradient-swatch {
  --swatch-bg: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FFD700 100%);
  background: var(--swatch-bg) !important;
  background-clip: padding-box !important;
}

.tag-color-btn.is-hidden-swatch {
  visibility: hidden;
  pointer-events: none;
}

.profile-edit-swatch.is-selected,
.profile-border-color-btn.is-selected,
.header-gradient-btn.is-selected,
.tag-color-btn.is-selected {
  border-color: #5b4c62;
  transform: scale(1.08);
}

.profile-edit-modal-gradients .header-gradient-btn {
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  text-shadow: none !important;
  background-clip: padding-box !important;
}

.profile-tag-modal-swatches {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-left: auto;
  margin-right: auto;
  width: min(100%, 340px);
  max-width: 100%;
}

.profile-tag-modal-swatches .tag-color-placeholder {
  visibility: hidden;
  pointer-events: none;
}

.profile-tags-edit-section #tagSelectionContainer {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.profile-tags-edit-section #tagColorPicker {
  justify-content: center !important;
}

.profile-tags-edit-section #tagSelectionContainer > div:last-child {
  justify-content: center;
  flex-wrap: wrap;
}

.profile-tags-edit-section #applyTagBtn,
.profile-tags-edit-section #removeTagBtn {
  width: auto;
  min-width: 128px;
  padding: 0.5rem 1rem !important;
}

@media (max-width: 820px) {
  .profile-container {
    padding: 1rem;
  }

  .profile-edit-grid,
  .profile-tags-edit-section #tagSelectionContainer {
    grid-template-columns: 1fr;
  }

  #profilePictureModal .modal-content {
    width: calc(100vw - 1rem) !important;
    max-width: calc(100vw - 1rem) !important;
    padding: 1rem !important;
    border-radius: 16px;
    overflow-x: hidden;
  }

  #profilePictureModal .modal-content > div {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 1rem !important;
  }

  #profilePictureModal .modal-content > div > div {
    min-width: 0;
  }

  #profileCardSearch,
  #profileCardSelectorGrid,
  #profileZoomSlider {
    max-width: 100%;
    box-sizing: border-box;
  }

  #profileCardSelectorGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.55rem !important;
    max-height: 42vh !important;
    padding: 0.55rem !important;
  }

  #profileCropPreviewFrame {
    width: min(300px, calc(100vw - 4rem)) !important;
    height: min(300px, calc(100vw - 4rem)) !important;
  }
}

/* First-party "Join our Discord" card — replaces the blockable discord.com/widget
   iframe. Pure HTML/CSS so ad/privacy blockers can never hide it. */
.discord-join-card {
  max-width: 360px;
  width: 100%;
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 16px rgba(91, 76, 98, 0.12);
  text-align: center;
}
.discord-join-icon {
  width: 60px;
  height: auto;
  margin-bottom: 0.25rem;
}
.discord-join-tagline {
  color: #5b4c62;
  font-weight: bold;
  margin: 0.5rem 0 1rem;
  line-height: 1.4;
}
.discord-join-list {
  list-style: none;
  text-align: left;
  color: #5b4c62;
  line-height: 1.6;
  padding: 0;
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
}
.discord-join-list li {
  margin-bottom: 0.4rem;
}
.discord-join-actions {
  display: grid;
  gap: 0.7rem;
}

.discord-join-btn,
.discord-connect-btn {
  display: block;
  width: 100%;
  background: #e889a9;  /* site palette pink (matches .action-btn) */
  color: #fff3ec;
  text-decoration: none;
  padding: 0.9rem 1.5rem;
  border-radius: 30px;
  border: 0;
  font-weight: bold;
  font-size: 1rem;
  box-shadow: 0 6px 20px rgba(232, 137, 169, 0.4);
  transition: background 0.2s;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}

.discord-connect-btn {
  background: #5dd4de;
  color: #5b4c62;
  box-shadow: 0 6px 20px rgba(93, 212, 222, 0.32);
}

.discord-join-btn:hover,
.discord-connect-btn:hover {
  background: #d77a9a;
}

.discord-connect-btn:hover {
  background: #42c4cf;
}

.discord-connect-btn:disabled {
  background: rgba(93, 212, 222, 0.45);
  color: #5b4c62;
  box-shadow: none;
  cursor: default;
}

.profile-info p {
  margin: 0.75rem 0;
  font-size: 1.1rem;
  color: #5b4c62;
}

.support-floating-btn {
  position: fixed;
  bottom: 14px;
  left: 14px;
  align-items: center;
  gap: 0.55rem;
  justify-content: flex-start;
  min-height: 60px;
  min-width: 206px;
  background: linear-gradient(135deg, #fff3ec 0%, #ffd98d 48%, #f79ab5 100%);
  border: 3px solid #5b4c62;
  border-radius: 999px;
  box-shadow: 0 5px 0 rgba(91, 76, 98, 0.22), 0 0 18px rgba(255, 217, 141, 0.55);
  color: #5b4c62;
  cursor: pointer;
  display: none;
  font-family: 'Courier New', monospace;
  font-weight: 900;
  line-height: 1.4;
  padding: 0.65rem 1.1rem 0.65rem 0.7rem;
  z-index: 101;
  animation: supportPulse 2.6s ease-in-out infinite;
  overflow: visible;
}

.support-floating-btn.visible {
  display: inline-flex;
  opacity: 1;
}

.support-floating-btn:hover {
  background: linear-gradient(135deg, #fff9f5 0%, #ffe5a8 48%, #ffa9c2 100%);
  animation-play-state: paused;
  box-shadow: 0 4px 0 rgba(91, 76, 98, 0.24), 0 0 22px rgba(247, 154, 181, 0.45);
}

.support-floating-icon {
  background: #5b4c62;
  border-radius: 50%;
  color: #ffd98d;
  display: grid;
  flex: 0 0 auto;
  font: 900 1.28rem 'Courier New', monospace;
  height: 2.35rem;
  line-height: 1;
  place-items: center;
  padding-bottom: 1px;
  width: 2.35rem;
}

.support-floating-copy {
  display: grid;
  gap: 0.05rem;
  text-align: left;
}

.support-floating-kicker {
  font-size: 0.78rem;
  line-height: 1;
}

.support-floating-label {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.72rem;
  line-height: 1.25;
}

@keyframes supportPulse {
  0%, 100% {
    box-shadow: 0 5px 0 rgba(91, 76, 98, 0.22), 0 0 18px rgba(255, 217, 141, 0.55);
  }
  50% {
    box-shadow: 0 5px 0 rgba(91, 76, 98, 0.22), 0 0 28px rgba(247, 154, 181, 0.75);
  }
}

/* Character Creator */
.character-creator {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.character-preview {
  flex: 0 0 250px;
}

.character-display {
  width: 250px;
  height: 350px;
  background: linear-gradient(180deg, #c9b4e8 0%, #b39fd3 100%);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(91, 76, 98, 0.3);
  border: 4px solid #fff3ec;
}

.character-options {
  flex: 1;
  min-width: 300px;
}

.option-group {
  margin-bottom: 1.5rem;
}

.option-group h3 {
  font-size: 1rem;
  color: #5b4c62;
  margin-bottom: 0.75rem;
  font-weight: bold;
}

.color-options,
.style-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.color-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid #5b4c62;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(91, 76, 98, 0.2);
}

.color-btn:hover,
.color-btn.active {
  transform: scale(1.1);
  border-width: 4px;
  box-shadow: 0 4px 12px rgba(91, 76, 98, 0.4);
}

.style-btn {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(180deg, #5dd4de 0%, #4ebfcc 100%);
  border: none;
  border-radius: 15px;
  color: #fff3ec;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 3px 10px rgba(78, 191, 204, 0.3);
}

.style-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(78, 191, 204, 0.4);
}

.style-btn.active {
  background: linear-gradient(180deg, #f79ab5 0%, #f08fa9 100%);
  box-shadow: 0 4px 12px rgba(247, 154, 181, 0.4);
}

.friends-list {
  display: grid;
  gap: 1rem;
}

.placeholder-text {
  color: #5b4c62;
  font-style: italic;
  opacity: 0.7;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(91, 76, 98, 0.85);
  backdrop-filter: blur(5px);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

#balloonGameModal.modal.active,
#gemCatchGameModal.modal.active,
#memoryGameModal.modal.active,
#guessWhoGameModal.modal.active,
#memorySpeedModal.modal.active,
#frenzyGameModal.modal.active,
#jigsawGameModal.modal.active,
#charmShooterModal.modal.active,
#clawGameModal.modal.active,
#snakeGameModal.modal.active,
#minesweeperGameModal.modal.active {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#packAnimationModal.modal {
  background-color: rgba(91, 76, 98, 0.95);
  backdrop-filter: blur(10px);
}

.modal-content {
  background: var(--theme-modal-bg);
  color: var(--theme-text);
  padding: 2.5rem;
  max-width: 90%;
  max-height: calc(100% - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 40px);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  border: none;
  outline: none;
  box-shadow: 0 10px 40px var(--theme-shadow-strong);
  border-radius: 30px;
}

.minigames-menu-modal {
  max-width: 540px;
}

.minigames-menu-modal h2 {
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-content .modal-title-with-close {
  padding-right: 2.5rem;
}

.modal-content .modal-title-centered {
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-compact {
  max-width: 340px;
}

.modal-narrow {
  max-width: 400px;
}

.modal-medium {
  max-width: 500px;
}

.modal-wide {
  max-width: 900px;
}

.modal-readable {
  max-width: 520px;
}

.modal-copy {
  text-align: left;
  line-height: 1.8;
  color: var(--theme-control-text);
}

.modal-copy p {
  margin: 0 0 1rem;
}

.modal-copy ul,
.modal-copy ol {
  margin: 0 0 1.5rem;
  padding-left: 1.5rem;
}

.modal-copy li {
  margin-bottom: 1rem;
}

.modal-copy-heading {
  color: var(--theme-accent);
  font-size: 1rem;
  margin: 1rem 0 0.5rem;
  text-shadow: none;
}

.modal-copy-intro {
  font-weight: bold;
  margin-bottom: 1.5rem;
}

.modal-acknowledge-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--theme-input-bg);
  padding: 1rem;
  border-radius: 10px;
}

.site-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  flex: 0 0 auto;
  color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 1.2rem;
  font-weight: bold;
  line-height: 1;
}

.site-checkbox:checked {
  background: #5dd4de;
}

.site-checkbox:checked::before {
  content: "✓";
}

.site-checkbox:focus-visible {
  outline: 3px solid rgba(93, 212, 222, 0.35);
  outline-offset: 2px;
}

.modal-acknowledge-checkbox {
  margin: 0;
}

.modal-acknowledge-label {
  cursor: pointer;
  user-select: none;
}

.modal-primary-full {
  margin-top: 2rem;
  width: 100%;
}

.claw-game-modal {
  max-width: 900px;
  width: fit-content;
  overflow-y: auto;
}

.claw-modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 600px) 220px;
  gap: 1.5rem;
  align-items: start;
}

.claw-machine-wrap {
  min-width: 0;
}

#clawGameArea {
  position: relative;
  width: min(600px, calc(95vw - 320px));
  height: min(700px, calc(95vh - 8.5rem));
  min-height: 560px;
  background: #a8e8ff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.2);
}

#clawImage .claw-sprite {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.18s ease-in-out;
}

#clawImage .claw-closed-sprite,
#clawImage.is-closed .claw-open-sprite {
  opacity: 0;
}

#clawImage.is-closed .claw-closed-sprite {
  opacity: 1;
}

.claw-held-ball {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  pointer-events: none;
}

.claw-controls-column {
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.claw-side-panel {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 10px;
}

.claw-session-panel {
  text-align: center;
}

.claw-how-to-panel {
  font-size: 0.85rem;
  color: #5b4c62;
}

.patch-notes-modal {
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-centered-content {
  text-align: center;
}

.modal-full-height-scroll {
  max-height: 90vh;
  overflow-y: auto;
}

#packAnimationModal .modal-content {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  max-width: 100%;
  max-height: 100%;
}

#cardModal .modal-content {
  background: var(--theme-modal-bg);
  max-width: 450px;  /* Prevent excessive width on large screens */
  overflow-y: auto;  /* Allow vertical scrolling for long content */
  overflow-x: hidden;  /* Hide horizontal scroll */
  padding-left: 3rem;  /* Make space for left arrow */
  padding-right: 3rem;  /* Make space for right arrow */
}

.modal-content:not(.support-modal-content):not(.shop-stall-modal):not(.card-detail) {
  background: var(--theme-modal-bg);
}

#packAnimationModal .modal-content {
  background: transparent;
}

/* Card navigation arrows (prev/next card in gallery) */
.card-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(232, 137, 169, 0.9);
  border: none;
  border-radius: 50%;
  color: #fff3ec;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  font-weight: bold;
  line-height: 1;
  transition: box-shadow 0.18s ease, background 0.18s ease;
  width: 50px;
  height: 50px;
  font-size: 1.2rem;
  z-index: 10;
}

.card-nav-arrow.site-arrow-btn:hover:not(:disabled):not(.is-disabled) {
  transform: translateY(-50%) translateY(-1px);
}

.card-nav-prev { left: -2.5rem; }
.card-nav-next { right: -2.5rem; }

.site-arrow-btn {
  background: rgba(232, 137, 169, 0.9);
  border: none;
  border-radius: 50%;
  color: #fff3ec;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  font-weight: bold;
  line-height: 1;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.site-arrow-btn:hover:not(:disabled) {
  background: rgba(247, 154, 181, 0.98);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(91, 76, 98, 0.28);
}

.site-arrow-btn:disabled,
.site-arrow-btn.is-disabled {
  opacity: 0.3;
  pointer-events: none;
}

.site-arrow-btn--copy {
  position: absolute;
  top: 50%;
  width: 28px;
  height: 28px;
  font-size: 1rem;
  z-index: 20;
}

.site-arrow-btn--copy.site-arrow-btn--prev {
  left: 0;
  transform: translateY(-50%);
}

.site-arrow-btn--copy.site-arrow-btn--next {
  right: 0;
  transform: translateY(-50%);
}

.site-arrow-btn--large {
  width: 58px;
  height: 58px;
  font-size: 2rem;
}

.friend-trade-modal {
  min-width: 80%;
  max-width: 1200px;
}

.uft-modal {
  width: min(1120px, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  max-height: 90vh;
}

.uft-controls,
.uft-filterbar {
  width: 100%;
}

.uft-filterbar {
  align-items: center;
}

.uft-search-group {
  flex: 1 1 260px;
  min-width: 220px;
}

.uft-search-group .trade-search-wrap,
.uft-search-group .search-input {
  width: 100%;
  min-width: 0;
}

.uft-card-grid {
  max-height: 60vh;
  overflow-y: auto;
  align-items: stretch;
}

.uft-card-grid.uft-grid-has-pagination {
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

.uft-card-placeholder {
  position: relative;
}

.uft-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4.85% / 3.45%;
}

.uft-owned-badge {
  position: absolute;
  right: 0.4rem;
  bottom: 0.4rem;
  background: rgba(91, 76, 98, 0.9);
  color: #fff3ec;
  padding: 0.25rem 0.55rem;
  border-radius: 15px;
  font-size: 0.68rem;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(91, 76, 98, 0.25);
}

.uft-owner-list {
  font-size: 0.72rem;
  color: #5b4c62;
  margin-top: 0.3rem;
  font-weight: bold;
  line-height: 1.25;
}

.uft-owner-row {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
}

.uft-owner-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uft-owner-count {
  white-space: nowrap;
}

.uft-owner-overflow {
  margin-top: 0.1rem;
  opacity: 0.78;
}

.site-floating-pagination,
.uft-floating-pagination {
  position: sticky;
  bottom: max(6px, calc(env(safe-area-inset-bottom) - 18px));
  z-index: 900;
  display: flex;
  width: fit-content;
  margin: 0 auto;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 30px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.8rem;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.site-pagination-btn,
.uft-pagination-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  background: #5b4c62;
  color: #fff3ec;
  cursor: pointer;
  font-family: 'Press Start 2P', monospace;
}

.site-pagination-btn:disabled,
.uft-pagination-btn:disabled {
  background: #ccc;
  color: #fff;
  cursor: not-allowed;
}

.site-pagination-page,
.uft-pagination-page {
  min-width: 3ch;
  padding: 6px 8px;
  text-align: center;
  border: 2px solid #5b4c62;
  border-radius: 5px;
  font-family: inherit;
  font-size: inherit;
  color: #5b4c62;
  background: #fff;
  display: inline-block;
  cursor: text;
  outline: none;
}

.site-pagination-total,
.uft-pagination-total {
  color: #5b4c62;
  padding: 0 5px;
}

.site-floating-pagination.auction-pagination {
  margin: 1rem auto;
}

.uft-detail-modal {
  max-width: 420px;
  background: var(--theme-modal-bg);
}

.card-detail-body {
  text-align: center;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  position: relative;
}

.card-detail-image-wrap {
  width: min(300px, 100%);
  margin: 0 auto 1rem;
  aspect-ratio: 3.6715 / 5.159;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4.85% / 3.45%;
  overflow: hidden;
  position: relative;
}

.card-detail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4.85% / 3.45%;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.card-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  height: 100%;
}

.card-detail-title {
  margin: 1rem 0 0.15rem;
  color: #5b4c62;
}

.card-detail-subtitle {
  margin: 0 0 1rem;
  color: #5b4c62;
}

.card-detail-line {
  color: #5b4c62;
  font-size: 0.9rem;
  margin: 0.25rem 0;
}

.card-detail-muted {
  color: #9b7bb8;
}

.card-detail-note {
  margin: 1rem auto;
  max-width: 300px;
}

.card-detail-label {
  display: block;
  color: #5b4c62;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.card-detail-note-input {
  width: 100%;
  min-height: 80px;
  resize: vertical;
}

.card-detail-action-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 300px;
  margin: 0 auto;
}

.card-detail-action-row .action-btn {
  flex: 1;
  min-width: 140px;
}

.card-detail-action--danger {
  background: #5b4c62;
  color: #fff3ec;
}

.card-detail-status {
  width: min(100%, 300px);
  margin: 0 auto 1rem;
  padding: 0.75rem;
  border: 2px solid var(--theme-border-strong, #5b4c62);
  border-radius: 10px;
  background: var(--theme-control-bg, #fff3ec);
  color: var(--theme-text, #5b4c62);
  text-align: left;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.12);
}

.card-detail-status-title {
  display: block;
  color: inherit;
  font-weight: 900;
}

.card-detail-status-copy {
  margin: 0.5rem 0 0;
  color: inherit !important;
  font-size: 0.85rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.card-detail-status .modal-inline-cancel { margin-top: 0.75rem; }

.uft-detail-owner-section {
  margin: 1rem auto 0;
  width: min(300px, 100%);
  text-align: left;
}

.uft-detail-owner-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.uft-detail-owner-heading label {
  display: block;
  color: #5b4c62;
  font-weight: bold;
}

.uft-detail-owner-heading span {
  color: #7a6a7a;
  font-size: 0.8rem;
}

.uft-detail-owner-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 0.25rem 0.4rem 0.25rem 0;
  color: #5b4c62;
  font-size: 0.9rem;
}

.uft-detail-owner-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(91, 76, 98, 0.12);
}

.uft-detail-owner-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #5b4c62;
  font-weight: bold;
}

.uft-detail-owner-count {
  color: #7a6a7a;
  white-space: nowrap;
}

.card-modal-rarity {
  font-size: 1.2rem;
  font-weight: bold;
  text-align: center;
  margin-top: auto !important;
  margin-bottom: 1rem !important;
}

/* Custom Scrollbar Styling */
.modal-content,
.view,
.notifications-modal,
.notifications-list,
.festival-mission-panel,
.shop-stall-body,
.ozoz-modal-content,
.ozoz-feed-modal-content,
#friendTradeCardsGrid,
#allFriendsTradeCardsGrid {
  scrollbar-width: auto;
  scrollbar-color: rgba(91, 76, 98, 0.42) transparent;
}

/* Keep the embedded app's scroll indicators slim on every scrollable panel. */
html.kpg-native-app body * {
  scrollbar-width: thin;
}

html.kpg-native-app body *::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.modal-content::-webkit-scrollbar,
.view::-webkit-scrollbar,
.notifications-modal::-webkit-scrollbar,
.notifications-list::-webkit-scrollbar,
.festival-mission-panel::-webkit-scrollbar,
.shop-stall-body::-webkit-scrollbar,
.ozoz-modal-content::-webkit-scrollbar,
.ozoz-feed-modal-content::-webkit-scrollbar,
#friendTradeCardsGrid::-webkit-scrollbar,
#allFriendsTradeCardsGrid::-webkit-scrollbar {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
}

.modal-content::-webkit-scrollbar-track,
.view::-webkit-scrollbar-track,
.notifications-modal::-webkit-scrollbar-track,
.notifications-list::-webkit-scrollbar-track,
.festival-mission-panel::-webkit-scrollbar-track,
.shop-stall-body::-webkit-scrollbar-track,
.ozoz-modal-content::-webkit-scrollbar-track,
.ozoz-feed-modal-content::-webkit-scrollbar-track,
#friendTradeCardsGrid::-webkit-scrollbar-track,
#allFriendsTradeCardsGrid::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
  margin: 28px 0;
}

.modal-content::-webkit-scrollbar-track-piece,
.view::-webkit-scrollbar-track-piece,
.notifications-modal::-webkit-scrollbar-track-piece,
.notifications-list::-webkit-scrollbar-track-piece,
.festival-mission-panel::-webkit-scrollbar-track-piece,
.shop-stall-body::-webkit-scrollbar-track-piece,
.ozoz-modal-content::-webkit-scrollbar-track-piece,
.ozoz-feed-modal-content::-webkit-scrollbar-track-piece,
#friendTradeCardsGrid::-webkit-scrollbar-track-piece,
#allFriendsTradeCardsGrid::-webkit-scrollbar-track-piece {
  background: transparent;
  margin: 28px 0;
}

.modal-content::-webkit-scrollbar-thumb,
.view::-webkit-scrollbar-thumb,
.notifications-modal::-webkit-scrollbar-thumb,
.notifications-list::-webkit-scrollbar-thumb,
.festival-mission-panel::-webkit-scrollbar-thumb,
.shop-stall-body::-webkit-scrollbar-thumb,
.ozoz-modal-content::-webkit-scrollbar-thumb,
.ozoz-feed-modal-content::-webkit-scrollbar-thumb,
#friendTradeCardsGrid::-webkit-scrollbar-thumb,
#allFriendsTradeCardsGrid::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(247, 154, 181, 0.82), rgba(201, 180, 232, 0.82));
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
  min-height: 48px;
}

.modal-content::-webkit-scrollbar-thumb:hover,
.view::-webkit-scrollbar-thumb:hover,
.notifications-modal::-webkit-scrollbar-thumb:hover,
.notifications-list::-webkit-scrollbar-thumb:hover,
.festival-mission-panel::-webkit-scrollbar-thumb:hover,
.shop-stall-body::-webkit-scrollbar-thumb:hover,
.ozoz-modal-content::-webkit-scrollbar-thumb:hover,
.ozoz-feed-modal-content::-webkit-scrollbar-thumb:hover,
#friendTradeCardsGrid::-webkit-scrollbar-thumb:hover,
#allFriendsTradeCardsGrid::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(247, 154, 181, 0.95), rgba(201, 180, 232, 0.95));
  background-clip: content-box;
}

.modal-content::-webkit-scrollbar-button,
.view::-webkit-scrollbar-button,
.notifications-modal::-webkit-scrollbar-button,
.notifications-list::-webkit-scrollbar-button,
.festival-mission-panel::-webkit-scrollbar-button,
.shop-stall-body::-webkit-scrollbar-button,
.ozoz-modal-content::-webkit-scrollbar-button,
.ozoz-feed-modal-content::-webkit-scrollbar-button,
#friendTradeCardsGrid::-webkit-scrollbar-button,
#allFriendsTradeCardsGrid::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}

.modal-content::-webkit-scrollbar-button:single-button,
.modal-content::-webkit-scrollbar-button:start:decrement,
.modal-content::-webkit-scrollbar-button:end:increment,
.modal-content::-webkit-scrollbar-button:vertical:start:decrement,
.modal-content::-webkit-scrollbar-button:vertical:end:increment,
.modal-content::-webkit-scrollbar-button:horizontal:start:decrement,
.modal-content::-webkit-scrollbar-button:horizontal:end:increment,
.view::-webkit-scrollbar-button:single-button,
.view::-webkit-scrollbar-button:start:decrement,
.view::-webkit-scrollbar-button:end:increment,
.view::-webkit-scrollbar-button:vertical:start:decrement,
.view::-webkit-scrollbar-button:vertical:end:increment,
.view::-webkit-scrollbar-button:horizontal:start:decrement,
.view::-webkit-scrollbar-button:horizontal:end:increment,
.notifications-modal::-webkit-scrollbar-button:single-button,
.notifications-modal::-webkit-scrollbar-button:start:decrement,
.notifications-modal::-webkit-scrollbar-button:end:increment,
.notifications-modal::-webkit-scrollbar-button:vertical:start:decrement,
.notifications-modal::-webkit-scrollbar-button:vertical:end:increment,
.notifications-modal::-webkit-scrollbar-button:horizontal:start:decrement,
.notifications-modal::-webkit-scrollbar-button:horizontal:end:increment,
.notifications-list::-webkit-scrollbar-button:single-button,
.notifications-list::-webkit-scrollbar-button:start:decrement,
.notifications-list::-webkit-scrollbar-button:end:increment,
.notifications-list::-webkit-scrollbar-button:vertical:start:decrement,
.notifications-list::-webkit-scrollbar-button:vertical:end:increment,
.notifications-list::-webkit-scrollbar-button:horizontal:start:decrement,
.notifications-list::-webkit-scrollbar-button:horizontal:end:increment,
.festival-mission-panel::-webkit-scrollbar-button:single-button,
.festival-mission-panel::-webkit-scrollbar-button:start:decrement,
.festival-mission-panel::-webkit-scrollbar-button:end:increment,
.festival-mission-panel::-webkit-scrollbar-button:vertical:start:decrement,
.festival-mission-panel::-webkit-scrollbar-button:vertical:end:increment,
.festival-mission-panel::-webkit-scrollbar-button:horizontal:start:decrement,
.festival-mission-panel::-webkit-scrollbar-button:horizontal:end:increment,
.shop-stall-body::-webkit-scrollbar-button:single-button,
.shop-stall-body::-webkit-scrollbar-button:start:decrement,
.shop-stall-body::-webkit-scrollbar-button:end:increment,
.shop-stall-body::-webkit-scrollbar-button:vertical:start:decrement,
.shop-stall-body::-webkit-scrollbar-button:vertical:end:increment,
.shop-stall-body::-webkit-scrollbar-button:horizontal:start:decrement,
.shop-stall-body::-webkit-scrollbar-button:horizontal:end:increment,
.ozoz-modal-content::-webkit-scrollbar-button:single-button,
.ozoz-modal-content::-webkit-scrollbar-button:start:decrement,
.ozoz-modal-content::-webkit-scrollbar-button:end:increment,
.ozoz-modal-content::-webkit-scrollbar-button:vertical:start:decrement,
.ozoz-modal-content::-webkit-scrollbar-button:vertical:end:increment,
.ozoz-modal-content::-webkit-scrollbar-button:horizontal:start:decrement,
.ozoz-modal-content::-webkit-scrollbar-button:horizontal:end:increment,
.ozoz-feed-modal-content::-webkit-scrollbar-button:single-button,
.ozoz-feed-modal-content::-webkit-scrollbar-button:start:decrement,
.ozoz-feed-modal-content::-webkit-scrollbar-button:end:increment,
.ozoz-feed-modal-content::-webkit-scrollbar-button:vertical:start:decrement,
.ozoz-feed-modal-content::-webkit-scrollbar-button:vertical:end:increment,
.ozoz-feed-modal-content::-webkit-scrollbar-button:horizontal:start:decrement,
.ozoz-feed-modal-content::-webkit-scrollbar-button:horizontal:end:increment,
#friendTradeCardsGrid::-webkit-scrollbar-button:single-button,
#friendTradeCardsGrid::-webkit-scrollbar-button:start:decrement,
#friendTradeCardsGrid::-webkit-scrollbar-button:end:increment,
#friendTradeCardsGrid::-webkit-scrollbar-button:vertical:start:decrement,
#friendTradeCardsGrid::-webkit-scrollbar-button:vertical:end:increment,
#friendTradeCardsGrid::-webkit-scrollbar-button:horizontal:start:decrement,
#friendTradeCardsGrid::-webkit-scrollbar-button:horizontal:end:increment,
#allFriendsTradeCardsGrid::-webkit-scrollbar-button:single-button,
#allFriendsTradeCardsGrid::-webkit-scrollbar-button:start:decrement,
#allFriendsTradeCardsGrid::-webkit-scrollbar-button:end:increment,
#allFriendsTradeCardsGrid::-webkit-scrollbar-button:vertical:start:decrement,
#allFriendsTradeCardsGrid::-webkit-scrollbar-button:vertical:end:increment,
#allFriendsTradeCardsGrid::-webkit-scrollbar-button:horizontal:start:decrement,
#allFriendsTradeCardsGrid::-webkit-scrollbar-button:horizontal:end:increment {
  -webkit-appearance: none;
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}

.modal-content::-webkit-scrollbar-corner,
.view::-webkit-scrollbar-corner,
.notifications-modal::-webkit-scrollbar-corner,
.notifications-list::-webkit-scrollbar-corner,
.festival-mission-panel::-webkit-scrollbar-corner,
.shop-stall-body::-webkit-scrollbar-corner,
.ozoz-modal-content::-webkit-scrollbar-corner,
.ozoz-feed-modal-content::-webkit-scrollbar-corner,
#friendTradeCardsGrid::-webkit-scrollbar-corner,
#allFriendsTradeCardsGrid::-webkit-scrollbar-corner {
  background: transparent;
}

.close-modal,
.modal-close {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  top: 0.85rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 0;
  line-height: 1;
  color: transparent;
  cursor: pointer;
  transition: opacity 0.1s;
  font-weight: bold;
  z-index: 1000;
  /* Prevent 300ms tap delay on iOS Safari and ensure span is always tappable */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.close-modal::before,
.close-modal::after,
.modal-close::before,
.modal-close::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: #5b4c62;
  transform-origin: center;
}

.close-modal::before,
.modal-close::before {
  transform: rotate(45deg);
}

.close-modal::after,
.modal-close::after {
  transform: rotate(-45deg);
}

.close-modal:hover,
.modal-close:hover {
  opacity: 0.75;
}

.close-modal:hover::before,
.close-modal:hover::after,
.modal-close:hover::before,
.modal-close:hover::after {
  background: #f79ab5;
}

/* Shop Items */
.shop-items {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.shop-item {
  background: linear-gradient(135deg, #ffeaff 0%, #ffe0fa 100%);
  padding: 2.5rem;
  text-align: center;
  border: none;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(255, 224, 250, 0.4);
  border-radius: 25px;
  flex: 0 1 280px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
}

.shop-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(255, 224, 250, 0.5);
}

.shop-item h3 {
  margin-top: 0;
  font-size: 1.2rem;
  color: #5b4c62;
  text-shadow: 2px 2px 0 #f79ab5;
  line-height: 1.6;
}

.pack-description {
  color: #5b4c62;
  margin-top: auto;
  margin-bottom: 1rem;
}

.pack-image {
  width: 100%;
  max-width: 200px;
  height: auto;
  margin: 0 auto 1rem;
  display: block;
  image-rendering: pixelated;
}

.pack-cost {
  font-size: 1.1rem;
  font-weight: bold;
  color: #5b4c62;
  background: linear-gradient(135deg, #ffe5a8 0%, #ffd98d 100%);
  padding: 0.75rem 1.5rem;
  border: none;
  margin: 0 auto;
  display: block;
  border-radius: 30px;
  box-shadow: 0 4px 15px rgba(255, 217, 141, 0.4);
  width: fit-content;
  white-space: nowrap;
}

.pack-cost.clickable {
  cursor: pointer;
  transition: all 0.3s ease;
}

.pack-cost.clickable:hover {
  background: linear-gradient(135deg, #ffd98d 0%, #f7cd84 100%);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 217, 141, 0.5);
}

.pack-cost.clickable:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(255, 217, 141, 0.4);
}

.pack-cost.bulk-pack {
  background: linear-gradient(135deg, #d9c9f5 0%, #c9b4e8 100%);
  margin-top: 0.5rem;
  box-shadow: 0 4px 15px rgba(201, 180, 232, 0.4);
}

.pack-cost.bulk-pack:hover {
  background: linear-gradient(135deg, #c9b4e8 0%, #b39fd3 100%);
  box-shadow: 0 6px 20px rgba(201, 180, 232, 0.5);
}

/* Support modal uses the same stall frame proportions as the gem shop. */
#supportModal .support-modal-content {
  width: min(1240px, calc(100vw - 28px));
  max-width: 1240px;
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 4px solid #5b4c62;
  border-radius: 12px;
  background: #fff9f5;
  color: var(--theme-text);
  box-shadow: 0 22px 50px rgba(91, 76, 98, 0.35);
  overflow-y: auto;
}

.shop-stall-modal .close-modal,
#supportModal .support-modal-content .close-modal {
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff9f5;
  border-radius: 50%;
  background: #5b4c62;
  color: #fff9f5;
  line-height: 1;
  text-shadow: none;
  box-shadow: 0 3px 0 rgba(255, 249, 245, 0.35), 0 4px 14px rgba(91, 76, 98, 0.32);
}

.shop-stall-modal .close-modal::before,
.shop-stall-modal .close-modal::after,
#supportModal .support-modal-content .close-modal::before,
#supportModal .support-modal-content .close-modal::after {
  width: 18px;
  height: 3px;
  background: #fff9f5;
}

#supportModal .support-stall-hero {
  padding: 22px 22px 16px;
  border-bottom: 4px solid #5b4c62;
  background:
    repeating-linear-gradient(90deg, #f79ab5 0 38px, #ffd98d 38px 76px, #5dd4de 76px 114px),
    #f79ab5;
}

#supportModal .support-stall-hero-inner {
  padding: 18px;
  border: 3px solid #5b4c62;
  border-radius: 10px;
  background: rgba(255, 249, 245, 0.94);
}

#supportModal .support-stall-copy {
  margin: 8px 0 0;
  color: #6b5773;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.35;
}

#supportModal .support-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

#supportModal .support-tabs-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: 18px;
}

#supportModal .support-tab {
  border: 2px solid #5b4c62;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.16);
}

#supportModal .support-tab {
  flex: 0 0 auto;
  padding: 9px 13px;
  border-radius: 8px;
  background: #fff3ec;
  cursor: pointer;
}

#supportModal .support-tab.active {
  background: #ffd98d;
}

#supportModal .support-tab[hidden] {
  display: none;
}

#supportModal .support-tab:disabled {
  cursor: default;
  opacity: 0.72;
}

#supportModal .support-plan-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}

#supportModal .support-plan-choices[hidden] { display: none; }

#supportModal .support-plan-choices button {
  padding: 9px 13px;
  border: 2px solid #5b4c62;
  border-radius: 8px;
  background: #fff9f5;
  color: #5b4c62;
  font: 900 0.9rem 'Courier New', monospace;
  cursor: pointer;
}

#supportModal .support-plan-choices button.active { background: #ffd98d; }

#supportModal .support-stall-body {
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 249, 245, 0.96), rgba(255, 243, 236, 0.96)),
    repeating-linear-gradient(0deg, rgba(201, 180, 232, 0.2) 0 16px, transparent 16px 32px);
}

#supportModal .support-stall-label {
  margin-bottom: 12px;
  color: #5b4c62;
  font-family: 'Press Start 2P', monospace;
  font-size: 1rem;
  line-height: 1.5;
}

#supportModal .support-tier-card {
  border: 3px solid #5b4c62;
  border-radius: 4.85% / 3.45%;
  background: rgba(255, 224, 250, 0.72);
  box-shadow: 0 6px 0 rgba(91, 76, 98, 0.14);
}

#supportModal .support-tier-card[data-tier-id="balloon_artist"] {
  background: rgba(183, 206, 132, 0.72);
}

#supportModal .support-tier-card:is([data-tier-id="face_painter"], [data-tier-id="face_painter_no_discord"]) {
  background: rgba(93, 212, 222, 0.64);
}

#supportModal .support-tier-card:is([data-tier-id="fortune_teller"], [data-tier-id="fortune_teller_no_discord"]) {
  background: rgba(201, 180, 232, 0.72);
}

#supportModal .support-tier-card:is([data-tier-id="performer"], [data-tier-id="performer_no_discord"]) {
  background: rgba(255, 217, 141, 0.76);
}

#supportModal .support-tier-pending {
  margin: auto 0 8px;
  color: #5b4c62;
  font-size: 0.75rem;
  font-weight: 800;
}

#supportModal .support-status {
  margin: 0;
  padding: 9px 12px;
  border: 2px solid #5b4c62;
  border-radius: 8px;
  background: #fff3ec;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.16);
}


#supportModal .support-status.empty {
  display: none;
}

#supportModal .support-management {
  margin-top: 10px;
  padding: 12px;
  border: 2px solid #5b4c62;
  border-radius: 8px;
  background: #fff9f5;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 0.86rem;
  line-height: 1.4;
}

#supportModal .support-management[hidden] { display: none; }
#supportModal .support-management p { margin: 0 0 10px; }
#supportModal .support-management-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#supportModal .support-management-actions button {
  min-width: 150px;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: #ffd98d;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.2;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.18);
  cursor: pointer;
}
#supportModal .support-management-actions button:focus-visible { outline: 3px solid #8054aa; outline-offset: 2px; }
#supportModal .support-tier-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
  justify-content: stretch;
  justify-items: stretch;
  width: 100%;
  margin-right: auto;
  margin-left: auto;
  margin-top: 12px;
}

#supportModal .support-tier-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  min-height: 0;
  padding: 10px 12px 12px;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#supportModal .support-tier-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 0 rgba(91, 76, 98, 0.14);
}

#supportModal .support-tier-heading {
  display: grid;
  grid-template-rows: 112px 32px;
  gap: 0;
  justify-items: center;
  align-items: start;
  margin-bottom: 2px;
}

#supportModal .support-tier-art {
  width: clamp(112px, 48%, 122px);
  height: clamp(112px, 48%, 122px);
  align-self: start;
  object-fit: contain;
  filter: drop-shadow(0 4px 0 rgba(91, 76, 98, 0.14));
}

#supportModal .support-tip-art {
  width: clamp(154px, 66%, 182px);
  height: clamp(154px, 66%, 182px);
}

#supportModal .support-tier-card h2 {
  margin: 0;
  align-self: start;
  color: var(--theme-text);
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.74rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-align: center;
  text-shadow: none;
}

#supportModal .support-tier-price-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 4px 7px;
  border: 2px solid rgba(91, 76, 98, 0.78);
  border-radius: 999px;
  background: rgba(255, 249, 245, 0.82);
  color: var(--theme-text);
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(91, 76, 98, 0.14);
}

#supportModal .support-tier-price-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  justify-items: center;
  align-self: end;
  margin-top: 6px;
  padding-top: 4px;
}

#supportModal .support-tier-price {
  width: min(100%, 178px);
  min-width: 0;
  max-width: 178px;
  margin: 0 auto;
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  background: #ffd98d;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.18);
  cursor: pointer;
  transition: none;
}

.arc-checkout-modal { z-index: 10010; }
.arc-checkout-content { max-width: 460px; position: relative; padding: 28px; }
.arc-checkout-content .close-modal { background: none; border: none; }
.arc-wallet-list { display: flex; flex-wrap: wrap; gap: 8px; }
.arc-network-help { white-space: pre-line; overflow-wrap: anywhere; margin: 16px 0; }
.arc-order-summary, .arc-checkout-status { overflow-wrap: anywhere; margin: 16px 0; }
.arc-transaction-link { display: block; margin-bottom: 16px; }
.arc-checkout-content [hidden] { display: none; }

#supportModal .support-tier-price-stripe {
  background: #d9d2ff;
  color: #5142a7;
}

#supportModal .support-tier-price-stripe:hover {
  background: #d9d2ff;
  color: #5142a7;
}

#supportModal .support-tier-price.support-tier-price-stablecoin,
#supportModal .support-tier-price.support-tier-price-stablecoin:hover,
#supportModal .support-tier-price.support-tier-price-stablecoin:disabled {
  background: var(--theme-accent-2);
  color: #5b4c62;
}

.referral-code-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.referral-code-controls .form-input {
  flex: 1 1 240px;
  width: auto;
  min-width: 0;
  margin: 0;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.referral-code-controls .action-btn {
  margin: 0;
}

.referral-code-controls [hidden] {
  display: none !important;
}

.tent-hover-outline,
.tent-hover-tracer,
#gacha_calendar .tent-hover-outline,
#gacha_calendar .tent-hover-tracer,
#gacha_notes .tent-hover-outline,
#gacha_notes .tent-hover-tracer,
#claw_ozoz .tent-hover-outline,
#claw_ozoz .tent-hover-tracer {
  fill: none;
  stroke: #fff3ec;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  pointer-events: none !important;
}

#gacha_calendar:hover .tent-hover-outline,
#gacha_notes:hover .tent-hover-outline,
#claw_ozoz:hover .tent-hover-outline,
#claw_corn_maze_sign:is(:hover, :focus-visible) .tent-hover-outline,
#gacha_calendar:hover .tent-hover-tracer,
#gacha_notes:hover .tent-hover-tracer,
#claw_ozoz:hover .tent-hover-tracer,
#claw_corn_maze_sign:is(:hover, :focus-visible) .tent-hover-tracer {
  opacity: 1;
}

#gacha_calendar .tent-hover-tracer,
#gacha_notes .tent-hover-tracer,
#claw_ozoz .tent-hover-tracer,
#claw_corn_maze_sign .tent-hover-tracer {
  stroke-width: 4;
  stroke-dasharray: 9 91;
}

#gacha_calendar:hover .tent-hover-tracer,
#gacha_notes:hover .tent-hover-tracer,
#claw_ozoz:hover .tent-hover-tracer,
#claw_corn_maze_sign:is(:hover, :focus-visible) .tent-hover-tracer {
  animation: tent-outline-trace 2.2s linear infinite !important;
}

@keyframes tent-outline-trace {
  to { stroke-dashoffset: -100; }
}

@media (prefers-reduced-motion: reduce) {
  #gacha_calendar:hover .tent-hover-tracer,
  #gacha_notes:hover .tent-hover-tracer,
  #claw_ozoz:hover .tent-hover-tracer,
  #claw_corn_maze_sign:is(:hover, :focus-visible) .tent-hover-tracer {
    animation: none !important;
    opacity: 0;
  }
}

#supportModal .support-tier-price:hover,
#supportModal .support-tier-price:disabled {
  background: #ffd98d;
  color: #5b4c62;
  transform: none;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.18);
}

#supportModal .support-tier-price:disabled {
  cursor: default;
  opacity: 0.45;
}

#supportModal .support-tier-price-stripe:disabled {
  background: #d9d2ff;
  color: #5142a7;
}

#supportModal .support-tier-price.is-current-plan:disabled,
#supportModal .support-tier-price.support-tier-price-stablecoin.is-current-plan:disabled {
  background: #d7d4da;
  color: #615b67;
  opacity: 1;
  box-shadow: none;
  cursor: default;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #supportModal .support-tier-price-badge {
  background: var(--theme-surface-base);
  color: #fff3ec;
}

#supportModal .support-tier-description {
  margin: 0 0 6px;
  padding: 0;
  color: #6b5773;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.24;
  list-style: none;
  overflow-wrap: anywhere;
  text-align: left;
}

#supportModal .support-tier-description li {
  position: relative;
  padding: 5px 7px 5px 19px;
  border-radius: 6px;
  background: rgba(255, 249, 245, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

#supportModal .support-tier-description li + li {
  margin-top: 4px;
}

#supportModal .support-tier-description li::before {
  content: '\2022';
  position: absolute;
  top: 7px;
  left: 8px;
  color: var(--theme-text);
  font-size: 0.82rem;
  line-height: 1;
}

#supportModal .support-tip-card {
  grid-column: 1 / -1;
  max-width: 300px;
  width: 100%;
  margin: 0 auto;
  background: rgba(247, 154, 181, 0.68);
}

#supportModal .support-tip-control {
  display: grid;
  gap: 9px;
  margin: 2px 0 14px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 249, 245, 0.68);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-weight: 900;
  text-align: left;
}

#supportModal .support-tip-control label {
  font-size: 0.88rem;
}

#supportModal .support-tip-amount-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #5b4c62;
  font-size: 1.1rem;
}

#supportModal .support-tip-amount-row input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 2px solid #5b4c62;
  border-radius: 8px;
  background: #fff9f5;
  color: #5b4c62;
  font: 900 1rem 'Courier New', monospace;
}

#supportModal .support-tip-slider {
  width: 100%;
  height: 24px;
  margin: 2px 0;
  background: transparent;
  accent-color: #ffd98d;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

#supportModal .support-tip-slider:focus {
  outline: none;
}

#supportModal .support-tip-slider::-webkit-slider-runnable-track {
  height: 12px;
  border: 2px solid #5b4c62;
  border-radius: 999px;
  background: linear-gradient(90deg, #b7ce84 0%, #5dd4de 33%, #c9b4e8 66%, #ffd98d 100%) border-box;
  box-shadow: inset 0 2px 0 rgba(255, 249, 245, 0.58), 0 3px 0 rgba(91, 76, 98, 0.16);
}

#supportModal .support-tip-slider::-webkit-slider-thumb {
  width: 28px;
  height: 28px;
  margin-top: -10px;
  border: 3px solid #5b4c62;
  border-radius: 50%;
  background: #fff9f5;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.22);
  -webkit-appearance: none;
  appearance: none;
}

#supportModal .support-tip-slider:focus::-webkit-slider-thumb {
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.22), 0 0 0 4px rgba(247, 154, 181, 0.42);
}

#supportModal .support-tip-slider::-moz-range-track {
  height: 12px;
  border: 2px solid #5b4c62;
  border-radius: 999px;
  background: linear-gradient(90deg, #b7ce84 0%, #5dd4de 33%, #c9b4e8 66%, #ffd98d 100%) border-box;
  box-shadow: inset 0 2px 0 rgba(255, 249, 245, 0.58), 0 3px 0 rgba(91, 76, 98, 0.16);
}

#supportModal .support-tip-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 3px solid #5b4c62;
  border-radius: 50%;
  background: #fff9f5;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.22);
}

#supportModal .support-tip-slider:focus::-moz-range-thumb {
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.22), 0 0 0 4px rgba(247, 154, 181, 0.42);
}

#supportModal .support-square-note,
.shop-gem-checkout-note {
  margin: 12px 0 0;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: #6b5773;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.4;
  text-align: center;
}

#supportModal .support-loading,
#supportModal .support-empty {
  grid-column: 1 / -1;
  padding: 28px;
  border: 3px solid #5b4c62;
  border-radius: 10px;
  background: #fff9f5;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 6px 0 rgba(91, 76, 98, 0.14);
}

@media (max-width: 900px) {
  #supportModal .support-modal-content {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  #supportModal .support-tier-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #supportModal .support-stall-hero {
    padding: 12px 12px 10px;
  }

  #supportModal .support-stall-hero-inner {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  #supportModal .support-stall-body {
    padding: 12px;
  }

  #supportModal .support-stall-label {
    font-size: 0.78rem;
  }

  #supportModal .support-tabs {
    align-items: stretch;
  }

  #supportModal .support-tab {
    flex: 1 1 100%;
  }

  #supportModal .support-tier-grid {
    grid-template-columns: minmax(0, min(100%, 340px));
    justify-content: center;
  }

  #supportModal .support-tier-card {
    grid-template-rows: auto 1fr auto;
    padding: 8px 12px 13px;
  }

  #supportModal .support-tier-heading {
    grid-template-rows: 124px 40px;
    gap: 0;
    margin-bottom: 2px;
  }

  #supportModal .support-tier-art {
    width: clamp(126px, 50%, 134px);
    height: clamp(126px, 50%, 134px);
  }

  #supportModal .support-tier-card h2 {
    font-size: 0.86rem;
  }

  #supportModal .support-tier-description {
    font-size: 0.92rem;
    line-height: 1.3;
  }

  #supportModal .support-tier-description li {
    padding: 7px 9px 7px 23px;
  }

  #supportModal .support-tier-description li + li {
    margin-top: 5px;
  }

  #supportModal .support-tier-description li::before {
    top: 9px;
    left: 10px;
    font-size: 0.92rem;
  }

  #supportModal .support-tier-price {
    min-width: 118px;
    font-size: 0.94rem;
    padding: 9px 15px;
  }

}

@media (max-width: 768px) {
  .market-ping-container {
    padding: 1rem 0.75rem 2rem;
  }

  .market-ping-layout,
  .market-ping-form {
    grid-template-columns: 1fr;
  }

  .market-ping-panel {
    padding: 0.85rem;
  }
}

#supportFloatingBtn .support-floating-icon {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0 0 2px 0;
  border-radius: 50%;
  background: #5b4c62;
  color: #ffd98d;
  font-family: 'Courier New', monospace;
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
}

/* Shop swipe layout */
.shop-pages-wrapper {
  overflow: hidden;
  touch-action: pan-y;
  width: 100%;
}

.shop-pages-track {
  display: grid;
  width: 100%;
  cursor: grab;
  user-select: none;
}

.shop-pages-track:active {
  cursor: grabbing;
}

/* Both pages share the same grid cell — grid height = tallest page, width = one page */
#shopPage1,
#shopPage2 {
  grid-row: 1;
  grid-column: 1;
  width: 100%;
  overflow: hidden; /* establishes BFC, prevents margin-top collapse on .shop-items */
  will-change: transform;
  transition: transform 0.3s ease;
}

/* Page 2 starts off-screen to the right */
#shopPage2 {
  transform: translateX(100%);
}

/* Page navigation row */
.shop-page-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1rem 0 0.5rem;
}

.shop-page-arrow {
  background: rgba(232, 137, 169, 0.9);
  border: 0;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.5rem;
  line-height: 1;
  color: #fff3ec;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  padding: 0;
}

.shop-page-arrow:hover {
  background: rgba(247, 154, 181, 0.98);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(91, 76, 98, 0.28);
}

.shop-page-arrow:disabled {
  opacity: 0.3;
  cursor: default;
  transform: none;
}

.shop-page-dots {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.shop-page-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d4a8e0;
  transition: background 0.2s ease, transform 0.2s ease;
}

.shop-page-dot.active {
  background: #5b4c62;
  transform: scale(1.3);
}

/* Daily limit badge */
.pack-limit-badge {
  font-size: 0.7rem;
  font-family: 'Press Start 2P', monospace;
  color: #5b4c62;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid #d4a8e0;
  border-radius: 20px;
  padding: 0.25rem 0.6rem;
  margin: 0.25rem 0;
  text-align: center;
}

.pack-limit-badge.sold-out {
  opacity: 0.5;
}

/* Group pack artist hints */
.group-pack-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
  margin: 0.3rem 0;
}

.group-hint-badge {
  font-size: 0.65rem;
  font-family: 'Press Start 2P', monospace;
  background: linear-gradient(135deg, #fff0ff, #ffe0ff);
  color: #5b4c62;
  border: 1px solid #e0a0e8;
  border-radius: 12px;
  padding: 0.2rem 0.5rem;
  white-space: nowrap;
}

/* Sold-out purchase button */
.pack-cost.pack-sold-out {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* Shop stall redesign */
.shop-stall-modal {
  position: relative;
  width: min(1040px, calc(100vw - 28px));
  max-width: 1040px;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 0;
  border: 4px solid #5b4c62;
  border-radius: 12px;
  background: #fff9f5;
  color: var(--theme-text);
  box-shadow: 0 22px 50px rgba(91, 76, 98, 0.35);
}

@media (min-width: 901px) and (min-height: 1081px) {
  #shopModal .shop-stall-modal {
    transform: scale(var(--shop-resolution-scale));
    transform-origin: center center;
  }
}

.shop-stall-hero {
  display: block;
  padding: 18px 22px 12px;
  border-bottom: 4px solid #5b4c62;
  background:
    repeating-linear-gradient(90deg, #f79ab5 0 38px, #ffd98d 38px 76px, #5dd4de 76px 114px),
    #f79ab5;
}

.shop-stall-hero-inner {
  display: block;
  padding: 16px;
  border: 3px solid #5b4c62;
  border-radius: 10px;
  background: rgba(255, 249, 245, 0.94);
}

.shop-stall-hero-inner > h2 { margin: 0 52px 12px 0; }
.shop-stall-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }
#shopModal .shop-stall-modal > .close-modal { position: absolute !important; top: 14px !important; right: 14px !important; z-index: 5; }

.shop-stall-tabs,
.shop-stall-currency {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.shop-stall-tabs {
  margin-top: 0;
}
.shop-stall-currency { justify-content: flex-end; flex-wrap: nowrap; }

.shop-stall-tab,
.shop-stall-pill {
  border: 2px solid #5b4c62;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.16);
}

.shop-stall-tab {
  flex: 0 0 auto;
  padding: 9px 13px;
  border-radius: 8px;
  background: #fff3ec;
  cursor: pointer;
}

.shop-stall-tab.active {
  background: #ffd98d;
}

.shop-stall-pill {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: #fff3ec;
  white-space: nowrap;
}

.shop-stall-body {
  height: 528px;
  background:
    linear-gradient(180deg, rgba(255, 249, 245, 0.96), rgba(255, 243, 236, 0.96)),
    repeating-linear-gradient(0deg, rgba(201, 180, 232, 0.2) 0 16px, transparent 16px 32px);
}
.shop-stall-body:has(> .shop-tab-panel[data-shop-panel="packs"].active) { height: auto; }
.shop-stall-body:has(> .shop-tab-panel[data-shop-panel="festival"].active) { height: auto; }

.shop-tab-panel {
  display: none;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  height: 528px;
  overflow: hidden;
  padding: 18px;
}

.shop-tab-panel.active {
  display: grid;
}

@media (min-width: 901px) {
  .shop-tab-panel[data-shop-panel="packs"] {
    height: auto;
    min-height: 528px;
    overflow: visible;
  }

  .shop-tab-panel[data-shop-panel="packs"] > div:first-child {
    display: flex;
    flex-direction: column;
  }

  .shop-tab-panel[data-shop-panel="packs"] .shop-pack-shelf {
    flex: 1;
  }
}

.shop-tab-panel--single {
  grid-template-columns: 1fr;
}

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

.shop-stall-label {
  margin-bottom: 12px;
  color: #5b4c62;
  font-family: 'Press Start 2P', monospace;
  font-size: 1rem;
  line-height: 1.5;
}

.shop-pack-shelf,
.shop-rotating-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.shop-gem-pack-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, 132px);
  gap: 12px;
  align-content: start;
}

.shop-stall-card {
  border: 3px solid #5b4c62;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff9f5, #fff3ec);
  box-shadow: 0 6px 0 rgba(91, 76, 98, 0.14);
}

.shop-pack-card {
  min-height: 456px;
  height: auto;
  padding: 10px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #ffe0fa, #fff3ec);
}

.shop-pack-card .pack-image {
  max-width: 150px;
  margin-bottom: 0;
}

.shop-pack-card h3,
.shop-boost-item h3,
.shop-festival-feature h3 {
  margin: 0 0 8px;
  color: #5b4c62;
  font-size: 15px;
  line-height: 1.5;
  text-shadow: none;
}

.shop-pack-card h3 {
  min-height: 50px;
  margin-top: 10px;
  margin-bottom: 8px;
  font-size: 15px;
  text-shadow: none;
}

.shop-boost-item.shop-gem-pack-card {
  min-height: 0;
  grid-template-columns: 56px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  background: #fff9f5;
}

.shop-gem-pack-card h3 { margin-bottom: 4px; }

.shop-gem-pack-card[data-gem-pack="pouch"] {
  grid-column: 1;
  grid-row: 1;
}

.shop-gem-pack-card[data-gem-pack="pink"] {
  grid-column: 1;
  grid-row: 2;
}

.shop-gem-pack-card[data-gem-pack="green"] {
  grid-column: 1;
  grid-row: 3;
}

.shop-gem-pack-card[data-gem-pack="purple"] {
  grid-column: 2;
  grid-row: 2;
}

.shop-gem-pack-card[data-gem-pack="yellow"] {
  grid-column: 2;
  grid-row: 3;
}

.shop-boost-item.shop-gem-pack-card[data-gem-pack="basket"] {
  grid-column: 2;
  grid-row: 1;
}

.shop-gem-pack-card .boost-icon.shop-gem-pack-art {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.shop-gem-pack-card[data-gem-pack="basket"] .shop-gem-pack-art {
  width: 56px;
  height: 56px;
}

.shop-gem-pack-art {
  filter: drop-shadow(0 4px 0 rgba(91, 76, 98, 0.15));
}

.shop-gem-pack-price {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 999px;
  background: #fff3ec;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.18);
}

.shop-gem-provider-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  width: 100%;
}

.shop-gem-pack-card[data-gem-pack="basket"] .shop-gem-provider-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.shop-gem-pack-card[data-website-mode="web2"] .shop-gem-provider-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.shop-gem-pack-card[data-website-mode="web2"][data-gem-pack="basket"] .shop-gem-provider-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.shop-gem-provider-row .shop-price-pill {
  min-width: 0;
  width: 100%;
  padding: 7px 6px;
  font-size: max(14px, 0.9rem);
}

.shop-gem-provider-row .shop-stablecoin-btn {
  padding: 2px 4px;
  font-size: 0.78rem;
  line-height: 1;
}

.shop-gem-checkout-btn--stripe {
  background: #d9d2ff;
  color: #5142a7;
}

.shop-gem-pack-login {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  align-content: center;
  justify-items: center;
  min-height: 220px;
  padding: 24px;
  text-align: center;
}

.shop-potion-shelf {
  height: 420px;
}

.shop-potion-card {
  display: grid;
  grid-template-rows: 145px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-content: stretch;
  justify-items: center;
  height: 100%;
  padding: 18px;
  text-align: center;
  background: linear-gradient(135deg, rgba(247, 154, 181, 0.28), rgba(93, 212, 222, 0.24), rgba(255, 217, 141, 0.58));
}

.shop-potion-display {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.shop-potion-arrow {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: #fff3ec;
  color: #5b4c62;
  font: 900 1.5rem 'Courier New', monospace;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.18);
  cursor: pointer;
}

.shop-potion-art {
  justify-self: center;
  width: 80px;
  height: 124px;
  object-fit: contain;
  filter: drop-shadow(0 6px 0 rgba(91, 76, 98, 0.16));
}

.shop-potion-copy {
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 0;
}

.shop-potion-copy p,
.shop-potion-note {
  margin: 0;
  color: #6b5773;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.28;
}

.shop-potion-note {
  color: #8a7890;
}

.shop-potion-active,
.shop-potion-ready {
  color: #5b4c62;
  font: 900 0.78rem 'Courier New', monospace;
  line-height: 1.25;
}

.shop-potion-buy-btn {
  min-width: 132px;
}

.shop-side-stack,
.shop-boost-stack {
  display: grid;
  gap: 12px;
  align-content: start;
}

.shop-side-stack .shop-stall-label {
  margin-bottom: 0;
}

.shop-feature-row {
  position: relative;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 174px;
  gap: 12px;
  align-items: center;
  min-height: 144px;
  height: auto;
  padding: 12px;
  background: #fff9f5;
}
.shop-feature-row[data-pack="recent"],
.shop-feature-row[data-pack="group"] { min-height: 176px; }

.shop-feature-copy {
  min-width: 0;
  overflow: hidden;
}

#customAlertModal.shop-pack-info-dialog .custom-alert-modal {
  background: var(--theme-input-bg) !important;
}

#customAlertModal.shop-pack-info-dialog #alertTitle {
  color: var(--theme-text);
  text-shadow: none;
}

#customAlertModal.shop-pack-info-dialog #alertMessage {
  color: var(--theme-text);
}

.shop-feature-row .pack-image {
  max-width: 58px;
  margin-bottom: 0;
}

.shop-buy-row {
  display: grid;
  gap: 7px;
  margin-top: auto;
}

.shop-buy-row .pack-cost[data-quantity="10"] { grid-column: 1 / -1; }
.shop-stall-modal .pack-cost:disabled { opacity: 0.6; cursor: not-allowed; }
.shop-stall-modal .pack-cost:focus-visible { outline: 2px solid #5b4c62; outline-offset: 3px; }

.shop-feature-row .shop-buy-row {
  min-width: 0;
  margin-top: 0;
}
.shop-feature-actions { display: grid; gap: 7px; align-content: center; min-width: 0; }
.shop-feature-actions .shop-buy-row { width: 100%; }
.shop-feature-actions .pack-cost { width: 100%; min-width: 0; margin: 0; }

.shop-stall-modal .pack-cost {
  font-family: inherit;
  min-width: 86px;
  padding: 7px 10px;
  margin: 0 auto;
  border: 0;
  border-radius: 999px;
  background: #ffd98d;
  color: #5b4c62;
  font-size: 0.95rem;
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.18);
  transition: none;
}

.shop-stall-modal .pack-cost:not(:disabled):not(.pack-sold-out) { cursor: pointer; }

.shop-stall-modal .pack-cost.bulk-pack,
.shop-stall-modal .pack-cost.bulk-pack:hover,
.shop-stall-modal .pack-cost.clickable:hover {
  background: #ffd98d;
  color: #5b4c62;
  transform: none;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.18);
}

.shop-stall-modal .pack-description {
  margin: 0;
  color: #6b5773;
  font-size: 0.88rem;
  font-weight: 900;
}

.shop-pack-card .pack-description {
  margin-bottom: 6px;
  font-size: max(10px, 0.72rem);
  line-height: 1.2;
}

.shop-feature-row strong {
  display: block;
  color: #5b4c62;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.3;
}

.shop-stall-modal .pack-limit-badge {
  position: absolute;
  top: -7px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 26px;
  margin: 0;
  padding: 3px 7px;
  border: 2px solid #5b4c62;
  border-radius: 999px;
  background: #fff3ec;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.16);
  pointer-events: none;
}

.shop-limited-count-badge {
  position: absolute;
  top: -7px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 26px;
  padding: 3px 7px;
  border: 2px solid #5b4c62;
  border-radius: 999px;
  background: #fff3ec;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.16);
  pointer-events: none;
}

.shop-limited-count-badge.sold-out {
  opacity: 0.5;
}

.shop-stall-modal .group-pack-hints {
  justify-content: flex-start;
  margin-top: 8px;
  width: 100%;
  max-height: none;
  overflow: visible;
}

.shop-stall-modal .group-hint-badge {
  max-width: 96px;
  padding: 2px 5px;
  border: 1.5px solid #5b4c62;
  border-radius: 999px;
  background: #fff3ec;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-feature-row[data-pack="group"] .pack-image {
  max-width: 58px;
}

.shop-feature-row[data-pack="group"] .shop-buy-row {
  min-width: 0;
}

.shop-festival-grid {
  --shop-festival-feature-height: 136px;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  height: 100%;
}

.shop-festival-feature p,
.shop-boost-item p,
.shop-stall-subtitle {
  margin: 0;
  color: #6b5773;
  font-size: 0.88rem;
  font-weight: 800;
}

.shop-festival-column {
  display: grid;
  gap: 8px;
  height: 100%;
  align-content: stretch;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.shop-festival-column .shop-stall-label {
  margin-bottom: 2px;
}

.shop-festival-column--bonus {
  grid-template-rows: auto auto auto minmax(var(--shop-festival-feature-height), 1fr) var(--shop-festival-feature-height);
  align-content: stretch;
}

.shop-festival-card {
  padding: 10px 12px;
  min-height: 0;
  overflow: hidden;
}

.shop-festival-section-title {
  margin: 0 0 6px;
  color: #5b4c62;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  line-height: 1.5;
  text-shadow: none;
}

.shop-festival-row + .shop-festival-section-title {
  margin-top: 12px;
}

.shop-festival-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 2px dashed rgba(91, 76, 98, 0.24);
}

.shop-festival-row:last-child {
  border-bottom: 0;
}

.shop-festival-name {
  display: flex;
  gap: 9px;
  align-items: center;
  min-width: 0;
  color: #5b4c62;
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.25;
}

.shop-festival-name span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-festival-theme-copy {
  min-width: 0;
}

.shop-festival-theme-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-festival-background {
  display: block;
  margin-top: 2px;
  color: #6b5773;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
}

.shop-festival-name .tag-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 190px;
  padding: 6px 10px;
  border: 2px solid #5b4c62;
  border-radius: 999px;
  background: #5b4c62;
  color: #fff9f5;
  font-size: 0.8rem;
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.16);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-color-dot {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 2px solid #5b4c62;
  border-radius: 50%;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.16);
}

.shop-festival-buy {
  min-width: 86px;
  padding: 7px 10px;
  border: 0;
  border-radius: 999px;
  background: #ffd98d;
  color: #5b4c62;
  font: 900 1rem 'Courier New', monospace;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.18);
  cursor: pointer;
}

.shop-festival-buy:disabled {
  opacity: 0.45;
  cursor: default;
}

.shop-festival-feature {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  height: var(--shop-festival-feature-height);
  overflow: visible;
}

.shop-festival-column--counter .shop-festival-feature {
  align-self: end;
}

.shop-festival-column--counter {
  grid-template-rows: auto minmax(0, 1fr);
}

.shop-festival-row--appearance {
  border-bottom: 0;
}

.shop-festival-feature--bundle {
  align-self: stretch;
  height: auto;
  min-height: var(--shop-festival-feature-height);
}

.shop-festival-feature--group {
  align-self: end;
  height: var(--shop-festival-feature-height);
}

.shop-festival-bundle-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
  width: 74px;
}

.shop-banner-preview {
  width: 68px;
  aspect-ratio: 3.6715 / 5.159;
  border: 3px solid #5b4c62;
  border-radius: 4.85% / 3.45%;
  box-shadow: 0 5px 0 rgba(91, 76, 98, 0.18);
}

.shop-group-piece-icon,
.shop-festival-icon {
  display: grid;
  place-items: center;
  border: 3px solid #5b4c62;
  color: #fff9f5;
  font-family: 'Press Start 2P', monospace;
  text-shadow: 2px 2px 0 #5b4c62;
}

.shop-group-piece-icon {
  width: 68px;
  height: 68px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.42), rgba(255,255,255,0)),
    repeating-linear-gradient(45deg, #93c9d5 0 12px, #ffd98d 12px 24px, #f79ab5 24px 36px);
  box-shadow: 0 5px 0 rgba(91, 76, 98, 0.14);
  transform: rotate(-3deg);
}

.shop-festival-icon {
  display: none;
}

.shop-boost-item {
  position: relative;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  height: 132px;
  padding: 12px;
  background: linear-gradient(135deg, #fff9f5, #fff3ec);
}

.shop-boost-item .boost-icon {
  width: 66px;
  height: 66px;
  object-fit: contain;
  filter: drop-shadow(0 4px 0 rgba(91, 76, 98, 0.15));
}

.shop-boost-item .shard-dot {
  width: 36px;
  height: 36px;
  justify-self: center;
}

.boost-actions {
  display: grid;
  gap: 7px;
}

.shop-price-pill {
  display: inline-flex;
  justify-content: center;
  min-width: 86px;
  padding: 7px 10px;
  border: 0;
  border-radius: 999px;
  background: #ffd98d;
  color: #5b4c62;
  font: 900 1rem 'Courier New', monospace;
  text-align: center;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.18);
  cursor: pointer;
}

.shop-price-pill--disabled,
.shop-price-pill:disabled {
  opacity: 0.45;
  cursor: default;
}

.shop-rotating-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 12px;
}

.shop-rotating-header .shop-stall-label {
  margin-bottom: 0;
}

.shop-rotating-header .shop-stall-subtitle {
  text-align: right;
  max-width: 260px;
  font-size: 0.8rem;
  line-height: 1.35;
}

.shop-rotating-refresh-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.shop-rotating-refresh-row .shop-stall-subtitle {
  margin: 0;
}

.shop-rotating-action.rotating-shop-refresh-btn {
  min-width: 116px;
  padding: 6px 9px;
  background: linear-gradient(180deg, #aad9e6 0%, #93c9d5 100%);
  color: var(--theme-text);
  box-shadow: 0 6px 20px rgba(147, 201, 213, 0.35);
  font-size: 0.86rem;
}

.claw-refresh-btn {
  background: linear-gradient(180deg, #aad9e6 0%, #93c9d5 100%);
  color: var(--theme-text);
  box-shadow: 0 6px 20px rgba(147, 201, 213, 0.35);
}

.claw-refresh-btn:hover:not(:disabled),
.shop-rotating-action.rotating-shop-refresh-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #c0f0ff 0%, #a8e8ff 100%);
}

.shop-rotating-card {
  position: relative;
  height: 456px;
  padding: 14px;
  border: 3px solid #5b4c62;
  border-radius: 10px;
  background: linear-gradient(135deg, #ffe0fa, #fff3ec);
  box-shadow: 0 6px 0 rgba(91, 76, 98, 0.14);
  display: flex;
  flex-direction: column;
  text-align: center;
}

.shop-rotating-art {
  width: min(100%, 205px);
  aspect-ratio: 3.6715 / 5.159;
  object-fit: cover;
  margin: 0 auto 12px;
  border: 0;
  border-radius: 4.85% / 3.45%;
  background: linear-gradient(135deg, #ffe0fa, #f79ab5);
  box-shadow: 0 5px 0 rgba(91, 76, 98, 0.14);
}

.shop-rotating-art--empty {
  display: grid;
  place-items: center;
  font-size: 3.25rem;
}

.shop-rotating-card h3 {
  min-height: 42px;
  margin: 0 0 6px;
  color: #5b4c62;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.94rem;
  line-height: 1.5;
  text-shadow: none;
}

.shop-rotating-card p {
  margin: 0;
  color: #6b5773;
  font-size: 0.88rem;
  font-weight: 900;
}

.shop-rotating-count {
  top: 0.75rem;
  right: 0.35rem;
  left: auto;
  z-index: 2;
}

.shop-rotating-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  margin-top: auto;
}

.shop-rotating-action {
  min-width: 96px;
  padding: 7px 10px;
  border: 0;
  border-radius: 999px;
  background: #ffd98d;
  color: #5b4c62;
  font: 900 1rem 'Courier New', monospace;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.18);
  cursor: pointer;
}

.shop-rotating-action.rotating-shop-unlock-btn {
  background: #f79ab5;
}

.shop-stall-modal .shard-buy-btn.shop-price-pill {
  width: auto !important;
  min-width: 86px;
  margin: 0 !important;
  padding: 7px 10px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: #ffd98d !important;
  color: #5b4c62 !important;
  font: 900 0.9rem 'Courier New', monospace !important;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.18) !important;
}

.shop-rotating-action.is-disabled {
  opacity: 0.62;
  cursor: default;
}

@media (max-width: 900px) {
  #shopModal.modal.active { align-items: flex-start; }
  .shop-stall-modal {
    width: min(100% - 16px, 620px);
    max-height: calc(100% - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .shop-stall-hero {
    padding: 14px;
  }

  .shop-stall-hero-inner {
    gap: 12px;
    padding: 14px;
  }

  .shop-stall-hero h2,
  #supportModal .support-modal-content h2 {
    font-size: 1rem;
  }

  .shop-stall-hero-inner,
  .shop-tab-panel,
  .shop-gem-pack-grid,
  .shop-festival-grid,
  .shop-festival-feature,
  .shop-boost-item {
    grid-template-columns: 1fr;
  }

  .shop-stall-toolbar { grid-template-columns: 1fr; }

  .shop-stall-body,
  .shop-tab-panel {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .shop-tab-panel {
    gap: 14px;
    padding: 14px;
  }

  .shop-stall-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .shop-stall-tab {
    width: 100%;
    padding: 8px 9px;
    text-align: center;
    font-size: 0.88rem;
  }

  .shop-stall-currency {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .shop-stall-pill {
    justify-content: center;
    min-width: 0;
    padding: 6px 7px;
    font-size: 0.82rem;
  }

  .shop-stall-label {
    margin-bottom: 9px;
    font-size: 0.78rem;
  }

  .shop-rotating-header {
    grid-template-columns: 1fr;
    gap: 7px;
    align-items: stretch;
  }

  .shop-rotating-header .shop-stall-subtitle {
    max-width: none;
    text-align: left;
  }

  .shop-rotating-refresh-row {
    justify-content: flex-start;
    gap: 7px;
  }

  .shop-pack-shelf,
  .shop-gem-pack-grid,
  .shop-rotating-grid {
    grid-template-columns: 1fr;
  }

  .shop-gem-pack-grid {
    grid-template-rows: none;
  }

  .shop-boost-item.shop-gem-pack-card {
    grid-column: auto !important;
    grid-row: auto !important;
    min-height: 0;
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-rows: auto auto;
    justify-items: stretch;
    text-align: left;
    padding: 12px;
  }

  .shop-boost-item.shop-gem-pack-card[data-gem-pack="basket"] {
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-rows: auto auto;
    height: auto;
    justify-items: stretch;
    text-align: left;
  }

  .shop-gem-pack-card .shop-gem-pack-art {
    grid-row: 1;
    width: 56px;
    height: 56px;
  }

  .shop-gem-pack-card[data-gem-pack="basket"] .shop-gem-pack-art {
    width: 56px;
    height: 56px;
  }

  .shop-gem-provider-row,
  .shop-gem-pack-card[data-gem-pack="basket"] .shop-gem-provider-row {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: none;
    margin-top: 2px;
  }

  .shop-gem-pack-price { grid-column: 1 / -1; }

  .shop-gem-pack-card[data-website-mode="web2"] .shop-gem-provider-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shop-potion-shelf {
    height: auto;
  }

  .shop-potion-card {
    height: auto;
    min-height: 360px;
    grid-template-rows: auto auto auto auto;
  }

  .shop-rotating-card {
    height: auto;
    min-height: 456px;
  }

  .shop-rotating-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 7px;
  }

  .shop-rotating-actions .is-disabled {
    grid-column: 1 / -1;
  }

  .shop-pack-card {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    height: auto;
    min-height: 108px;
    padding: 10px;
    text-align: left;
  }

  .shop-pack-card .pack-image {
    max-width: 50px;
    margin: 0 auto;
    grid-row: span 2;
  }

  .shop-pack-card h3 {
    min-height: 0;
    margin: 0 0 4px;
    font-size: 0.78rem;
  }

  .shop-pack-card .pack-description {
    margin: 0;
    font-size: 0.82rem;
  }

  .shop-pack-card .shop-buy-row {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .shop-feature-row {
    grid-template-columns: 56px minmax(0, 1fr);
    height: auto;
    min-height: 108px;
    padding: 10px;
    text-align: left;
  }

  .shop-feature-row .pack-image {
    max-width: 50px;
    margin: 0 auto;
  }

  .shop-feature-row .shop-buy-row {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .shop-feature-row .shop-feature-actions { grid-column: 1 / -1; width: 100%; }

  .shop-feature-row[data-pack="group"] .shop-feature-copy { display: contents; }
  .shop-feature-row[data-pack="group"] .shop-feature-copy strong { grid-column: 2; }
  .shop-feature-row[data-pack="group"] .group-pack-hints {
    grid-column: 1 / -1;
    margin-top: 0;
  }
  .shop-feature-row[data-pack="group"] .group-hint-badge {
    max-width: 100%;
    padding: 3px 7px;
    font-size: max(11px, 0.75rem);
  }

  .shop-stall-modal .pack-cost,
  .shop-price-pill,
  .shop-festival-buy,
  .shop-rotating-action {
    min-width: 0;
    width: 100%;
    font-size: 0.88rem;
  }

  .shop-stall-modal .shop-gem-provider-row .shop-price-pill { font-size: 14px; }

  .shop-rotating-action {
    padding-inline: 6px;
    white-space: nowrap;
  }

  .shop-rotating-action.rotating-shop-refresh-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 106px;
    padding: 5px 8px;
    font-size: 0.78rem;
  }

  .shop-stall-modal .pack-limit-badge {
    top: -8px;
    right: 8px;
    min-height: 24px;
  }

  .shop-stall-modal .group-pack-hints {
    gap: 4px;
    margin-top: 6px;
  }

  .shop-stall-modal .group-hint-badge {
    max-width: 84px;
    font-size: 0.6rem;
  }

  .shop-festival-feature,
  .shop-boost-item {
    height: auto;
  }

  .shop-festival-grid {
    height: auto;
  }

  .shop-festival-column,
  .shop-festival-column--bonus {
    grid-template-rows: none;
    height: auto;
  }

  .shop-festival-card {
    overflow: visible;
  }

  .shop-festival-feature {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
    min-height: 108px;
    padding: 10px;
    text-align: left;
  }

  .shop-festival-feature--bundle,
  .shop-festival-feature--group {
    height: auto;
    min-height: 108px;
  }

  .shop-festival-feature h3,
  .shop-boost-item h3 {
    margin: 0 0 6px;
    font-size: 10px;
  }

  .shop-festival-feature p,
  .shop-boost-item p {
    font-size: 0.8rem;
  }

  .shop-banner-preview {
    width: 52px;
  }

  .shop-group-piece-icon {
    width: 52px;
    height: 52px;
    font-size: 16px;
  }

  .shop-festival-bundle-dots {
    width: 56px;
    justify-content: flex-start;
  }

  .shop-festival-bundle-dots .shop-color-dot {
    width: 24px;
    height: 24px;
  }

  .shop-festival-feature .shop-festival-buy {
    grid-column: 1 / -1;
    width: 100%;
  }

  .shop-stall-currency,
  .shop-stall-tabs,
  .shop-festival-name {
    justify-content: center;
  }

  .shop-festival-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    text-align: left;
  }

  .shop-festival-name {
    justify-content: flex-start;
    text-align: left;
  }

  .shop-festival-name span:last-child,
  .shop-festival-name .tag-preview {
    white-space: normal;
  }

  .shop-boost-item {
    grid-template-columns: 56px minmax(0, 1fr);
    min-height: 108px;
    text-align: left;
  }

  .shop-boost-item .boost-icon {
    width: 52px;
    height: 52px;
  }

  .boost-actions,
  .shop-toy-counter .shop-price-pill {
    grid-column: 1 / -1;
    width: 100%;
  }

  .shop-stall-modal .shard-buy-btn.shop-price-pill {
    width: 100% !important;
  }

  .shop-feature-row .shop-buy-row,
  .shop-boost-item .action-btn {
    justify-self: center;
  }

  .shop-festival-buy {
    justify-self: start;
  }
}

.buy-btn {
  background: var(--theme-button-bg);
  border: none;
  color: #fff3ec;
  padding: 0.9rem 2.5rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px var(--theme-selected-glow);
  font-family: 'Courier New', monospace;
  border-radius: 30px;
}

.buy-btn:hover {
  background: var(--theme-button-hover-bg);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px var(--theme-selected-glow-strong);
}

.buy-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px var(--theme-selected-glow);
}

/* Pack Opening Animation */
.pack-opening-image {
  max-width: 700px;
  max-height: 85vh;
  width: auto;
  height: auto;
  image-rendering: pixelated;
  animation: packPop 1.5s ease-out forwards;
  filter: drop-shadow(0 15px 40px rgba(255, 217, 141, 0.9));
  z-index: 3000;
  display: block;
  margin: 0 auto;
  overflow: visible;
}

@keyframes packPop {
  0% {
    transform: scale(0.3) rotate(-15deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.15) rotate(8deg);
    opacity: 1;
  }
  80% {
    transform: scale(0.9) rotate(-3deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Pack Opening */
.pack-opening {
  min-width: 600px;
  background: var(--theme-modal-bg);
  border: 0;
  box-shadow: 0 16px 48px rgba(91, 76, 98, 0.32);
  backdrop-filter: blur(14px);
}

.pack-opening h2 {
  margin-right: 2.5rem;
  color: #5b4c62;
  text-shadow: none;
}

/* Narrower modal for single card displays (wheel prize, merge result) */
.pack-opening.single-card-modal {
  min-width: auto;
  max-width: 320px;
}

.pack-opening.single-card-modal .pack-cards-grid {
  display: flex;
  justify-content: center;
}

.pack-opening.single-card-modal .pack-card {
  max-width: 250px;
}

.pack-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.ssr-selection-copy,
.ssr-choice-card-member {
  color: var(--theme-text);
}

.ssr-choice-card-era {
  color: var(--theme-muted-text);
}

.ssr-choice-card-number {
  color: #999;
}

.ssr-choice-card-owned {
  color: var(--theme-text);
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.pack-card {
  background: linear-gradient(135deg, #fff9f5 0%, #fff3ec 100%);
  padding: 0.5rem;
  border: none;
  text-align: center;
  animation: cardReveal 0.5s ease-out;
  box-shadow: 0 6px 20px rgba(91, 76, 98, 0.25);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: scale(0.8) rotateY(180deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotateY(0deg);
  }
}

/* Card flip animation removed - back images no longer used */

.pack-card-placeholder {
  width: 100%;
  max-width: 280px;  /* Limit width to maintain proper aspect ratio */
  aspect-ratio: 3.6715 / 5.159;  /* Real card dimensions: 3.6715" x 5.159" = 0.711 */
  background: linear-gradient(135deg, #ffeaff 0%, #ffe0fa 100%);
  border: none;
  margin: 0 auto 0.8rem auto;  /* Center the card with bottom margin */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  border-radius: 4.85% / 3.45%;  /* 0.1779" radius / 3.6715" width = 4.85% */
  box-shadow: inset 0 2px 10px rgba(91, 76, 98, 0.15);
}

.pack-card {
  padding: 0.5rem;  /* Consistent padding around cards */
}

.pack-card-era {
  min-height: 1rem;
  margin-top: 0.25rem;
  color: #5b4c62;
  font-size: 0.65rem;
  line-height: 1.2;
}

.pack-card-owned-count {
  align-self: stretch;
  margin-top: auto;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(91, 76, 98, 0.9);
  color: #fff;
  font-size: 0.75rem;
  font-weight: bold;
  line-height: 1;
}

.pack-card-owned-count.is-empty {
  visibility: hidden;
}

.close-pack-btn {
  width: 100%;
  background: linear-gradient(135deg, #f79ab5 0%, #ffd98d 100%);
  color: #5b4c62;
  box-shadow: 0 5px 0 rgba(91, 76, 98, 0.14), 0 10px 24px rgba(247, 154, 181, 0.24);
}

.close-pack-btn:hover {
  background: linear-gradient(135deg, #ffa8c5 0%, #ffe3a8 100%);
  color: #5b4c62;
}

/* Card Detail */
.card-detail {
  min-width: 400px;
  background: var(--theme-modal-bg);
}

/* Keep close controls above the artwork, outside replaceable card details. */
:is(#cardModal, #uftCardDetailModal) > .modal-content.card-detail {
  padding-top: max(4rem, 68px);
}
:is(#cardModal, #uftCardDetailModal) > .modal-content > .close-modal {
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
}

/* Groups View */
.groups-container {
  padding: 2rem;
  width: min(100%, 1650px);
  box-sizing: border-box;
  margin: 0 auto;
  background: transparent;
}

.groups-grid {
  display: grid;
  gap: 2rem;
  width: 100%;
  min-height: 55vh;
  align-content: start;
}

#alphabetNav,
.gallery-controls {
  width: 100%;
}

.alphabet-btn {
  line-height: 1.1;
  border-style: solid !important;
}

.group-section {
  background: var(--theme-card-bg);
  padding: 2rem;
  border-radius: 25px;
  box-shadow: 0 6px 20px var(--theme-shadow);
}

.collection-artist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  cursor: pointer;
  user-select: none;
}

.collection-artist-header:focus-visible {
  outline: 2px solid var(--theme-border-strong);
  outline-offset: 4px;
  border-radius: 8px;
}

.collection-artist-header h2 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.collection-artist-header-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-left: auto;
}

.collection-artist-era-stats {
  margin: 0;
  line-height: 1.5;
  text-align: right;
  white-space: nowrap;
}

.collection-collapse-arrow {
  color: var(--theme-text);
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.eras-container {
  display: grid;
  gap: 1.5rem;
}

.era-section {
  background: var(--theme-card-bg);
  padding: 1.5rem;
  border-radius: 20px;
  box-shadow: 0 4px 15px var(--theme-shadow);
}

.era-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.era-card {
  background: #fff;
  padding: 0.5rem;  /* slim frame → bigger card image (matches the gallery tiles); star-border colors still read around it */
  border-radius: 15px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px var(--theme-shadow);
}

.era-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(91, 76, 98, 0.25);
}

.era-card.bronze-border:hover {
  box-shadow:
    0 10px 30px rgba(184, 115, 51, 0.5),
    0 0 14px rgba(230, 160, 90, 0.9),
    0 0 25px rgba(205, 127, 50, 0.6),
    inset 0 0 12px rgba(255, 220, 180, 0.4);
}

.era-card.silver-border:hover {
  box-shadow:
    0 10px 30px rgba(180, 180, 200, 0.6),
    0 0 18px rgba(240, 240, 255, 0.95),
    0 0 32px rgba(200, 200, 220, 0.6),
    inset 0 0 14px rgba(255, 255, 255, 0.5);
}

.era-card.gold-border:hover {
  box-shadow:
    0 10px 30px rgba(218, 165, 32, 0.6),
    0 0 20px rgba(255, 223, 50, 0.95),
    0 0 40px rgba(255, 215, 0, 0.7),
    inset 0 0 14px rgba(255, 250, 200, 0.4);
}

.era-card-placeholder {
  width: 100%;
  aspect-ratio: 3.6715/5.159;  /* Real card dimensions: 3.6715" x 5.159" */
  background: transparent;  /* rounded corners reveal the era/star FRAME behind the art */
  border-radius: 4.85% / 3.45%;  /* 0.1779" radius / 3.6715" width = 4.85% */
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: none;  /* slim look, matches the gallery card art (no inset shadow) */
}

.era-card-name {
  font-size: 0.9rem;
  color: #5b4c62;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.era-card-rarity {
  font-size: 0.75rem;
  font-weight: bold;
}

.era-complete-btn {
  background: linear-gradient(180deg, #ffd98d 0%, #f7cd84 100%);
  border: none;
  color: #5b4c62;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(247, 205, 132, 0.3);
  font-family: 'Courier New', monospace;
  font-weight: bold;
  border-radius: 15px;
  font-size: 0.9rem;
}

.era-complete-btn:hover {
  background: linear-gradient(180deg, #ffe0a0 0%, #ffd98d 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(247, 205, 132, 0.5);
}

/* ==================== ERA TRAINING SYSTEM ==================== */

/* Era section star borders - subtle indicator only */
.era-section.bronze-era {
  border: 2px solid rgba(184, 115, 51, 0.5);
  box-shadow: inset 0 0 20px rgba(205, 127, 50, 0.1);
}

.era-section.silver-era {
  border: 2px solid rgba(192, 192, 210, 0.5);
  box-shadow: inset 0 0 20px rgba(200, 200, 220, 0.1);
}

.era-section.gold-era {
  border: 2px solid rgba(218, 165, 32, 0.5);
  box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.1);
}

/* Card star borders - shiny metallic effects with tinted backgrounds */
.era-card.bronze-border {
  border: none;
  background: linear-gradient(145deg, #D4A574, #B87333, #CD853F, #DEB887, #CD7F32, #8B5A2B, #D4A574);
  background-size: 400% 400%;
  box-shadow:
    0 0 8px rgba(205, 127, 50, 0.7),
    0 0 16px rgba(184, 115, 51, 0.5),
    inset 0 0 8px rgba(255, 200, 150, 0.3);
  animation: bronzeShimmer 4s ease infinite;
}

.era-card.bronze-border .era-card-name {
  color: #4a2c17;
  text-shadow: 0 1px 1px rgba(255, 200, 150, 0.3);
}

.era-card.silver-border {
  border: none;
  background: linear-gradient(145deg, #E8E8E8, #B8B8B8, #DCDCDC, #F5F5F5, #C0C0C0, #A8A8A8, #E8E8E8);
  background-size: 400% 400%;
  box-shadow:
    0 0 10px rgba(192, 192, 192, 0.8),
    0 0 20px rgba(200, 200, 220, 0.5),
    inset 0 0 10px rgba(255, 255, 255, 0.4);
  animation: silverShimmer 3.5s ease infinite;
}

.era-card.silver-border .era-card-name {
  color: #3a3a4a;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

.era-card.gold-border {
  border: none;
  background: linear-gradient(145deg, #D4AF37, #E8C84A, #FFF8DC, #E8C84A, #D4AF37, #E8C84A, #FFF8DC);
  background-size: 400% 400%;
  box-shadow:
    0 0 13px rgba(212, 175, 55, 0.85),
    0 0 26px rgba(197, 160, 40, 0.55),
    0 0 44px rgba(180, 140, 0, 0.3),
    inset 0 0 12px rgba(255, 248, 220, 0.45);
  animation: goldShimmer 3s ease infinite;
}

.era-card.gold-border .era-card-name {
  color: #5a4a10;
  text-shadow: 0 1px 1px rgba(255, 236, 139, 0.4);
}

@keyframes bronzeShimmer {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes silverShimmer {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes goldShimmer {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Cards in training */
.era-card.in-training {
  opacity: 0.6;
  filter: grayscale(30%);
}

.training-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 0.65rem;
  font-weight: bold;
  white-space: nowrap;
  z-index: 2;
}

/* Era stars display */
.era-stars {
  font-size: 0.9rem;
  letter-spacing: 1px;
}

/* Training section below cards */
.era-training-section {
  margin-top: 1rem;
  padding: 0.75rem;
  padding-right: 170px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 240, 255, 0.5) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  position: relative;
}

/* Training buttons */
.training-btn {
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.training-btn .training-icon {
  font-size: 1rem;
}

.training-btn.training-start {
  background: linear-gradient(180deg, #d8e5b3 0%, #c4d39f 100%);
  color: #5b4c62;
  box-shadow: 0 3px 10px rgba(200, 211, 159, 0.4);
}

.training-btn.training-start:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(200, 211, 159, 0.6);
}

.training-btn.training-active {
  background: linear-gradient(180deg, #e0d4f0 0%, #c9b4e8 100%);
  color: #5b4c62;
  cursor: default;
  opacity: 0.9;
}

.training-btn.training-paused {
  background: linear-gradient(180deg, #ffe0b2 0%, #ffcc80 100%);
  color: #5b4c62;
  cursor: default;
  border: 2px dashed #f5a623;
}

.training-cancel-btn {
  flex: 0 0 auto;
}

/* Training XP bar */
.training-xp-bar {
  flex: 1;
  min-width: 80px;
  max-width: 200px;
  height: 16px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.training-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #d8e5b3 0%, #c4d39f 50%, #b0c18b 100%);
  border-radius: 8px;
  transition: width 0.5s ease;
}

.training-xp-text {
  font-size: 0.75rem;
  color: var(--theme-text);
  font-weight: bold;
  white-space: nowrap;
}

.training-boost-text {
  font-size: 0.8rem;
  color: #6f8f3f;
  font-weight: bold;
  white-space: nowrap;
}

.training-max-badge {
  font-size: 0.85rem;
  color: #FFD700;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.training-slot-unlock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 20px;
  background: var(--theme-card-bg);
  box-shadow: 0 6px 20px var(--theme-shadow);
}

.training-slot-unlock-copy {
  display: grid;
  gap: 0.25rem;
  color: var(--theme-text);
}

.training-slot-unlock-copy span {
  font-size: 0.85rem;
}

.training-slot-buy-btn {
  flex: 0 0 auto;
}

/* Mobile responsive for training section */
@media (max-width: 600px) {
  .training-slot-unlock {
    align-items: stretch;
    flex-direction: column;
  }

  .training-slot-buy-btn {
    width: 100%;
  }

  .era-training-section {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding-right: 0.75rem;
  }

  .era-training-section .shard-cluster {
    position: static;
    transform: none;
    align-self: center;
  }

  .training-xp-bar {
    flex: none;
    width: 100%;
    max-width: none;
    min-height: 16px;
  }

  .training-btn {
    justify-content: center;
  }
}

/* Friends View */
.friends-container {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  background: transparent;
}

.friends-section {
  background: var(--theme-panel-bg);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(91, 76, 98, 0.1);
  box-shadow: 0 6px 18px rgba(91, 76, 98, 0.08);
  border-radius: 20px;
}

.friend-search {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
}

.friend-search .search-wrap {
  flex: 1;
  min-width: 0;
}

/* Firefox mobile gives inputs a UA-default minimum width that prevents the
   search-wrap from shrinking to make room for the Search button.  Explicitly
   zeroing min-width and setting width:100% keeps everything on one row. */
.friend-search .search-input {
  min-width: 0;
  width: 100%;
  min-height: 48px;
  box-sizing: border-box;
  padding: 0.8rem 1.2rem;
}

/* The base .action-btn rule sets width:100%, which makes the Search button
   expand to fill the whole container and overflow on top of the input.
   Override with auto so the button is only as wide as its "Search" label. */
.friend-search .action-btn {
  flex: 0 0 auto;
  width: auto;
  min-height: 48px;
  margin-top: 0;
  align-self: stretch;
  position: relative;
  z-index: 1;
}

.trade-bulk-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.trade-bulk-actions-bottom {
  margin-top: 1rem;
  margin-bottom: 0;
}

.trade-bulk-actions .action-btn {
  width: 100%;
  min-width: 0;
  margin-top: 0;
  padding: 0.8rem 1rem;
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

.trade-bulk-actions .mobile-label {
  display: none;
}

.trade-bulk-actions .action-btn.reject {
  background: #5b4c62;
  box-shadow: 0 6px 20px rgba(91, 76, 98, 0.3);
}

@media (max-width: 600px) {
  .trade-bulk-actions {
    gap: 0.5rem;
  }

  .trade-bulk-actions .action-btn {
    padding: 0.7rem 0.45rem;
    font-size: 0.62rem;
    line-height: 1.35;
  }

  .trade-bulk-actions .desktop-label {
    display: none;
  }

  .trade-bulk-actions .mobile-label {
    display: inline;
  }
}

.search-input,
.form-input,
.text-input {
  flex: 1;
  padding: 0.9rem 1.2rem;
  border: none;
  background: var(--theme-input-bg);
  color: var(--theme-control-text);
  font-size: 1rem;
  font-family: 'Courier New', monospace;
  border-radius: 20px;
  box-shadow: inset 0 2px 10px var(--theme-shadow);
}

.search-input:focus,
.form-input:focus,
.text-input:focus {
  outline: none;
  background: var(--theme-input-bg);
  color: var(--theme-control-text);
  box-shadow: inset 0 2px 10px var(--theme-shadow), 0 0 0 3px var(--theme-focus);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f79ab5 0%, #c9b4e8 100%);
  box-shadow: inset 0 2px 6px rgba(91, 76, 98, 0.18);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -7px;
  border: 3px solid #5b4c62;
  border-radius: 50%;
  background: #fff3ec;
  box-shadow: 0 3px 8px rgba(91, 76, 98, 0.25);
}

input[type="range"]::-moz-range-track {
  height: 10px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #f79ab5 0%, #c9b4e8 100%);
  box-shadow: inset 0 2px 6px rgba(91, 76, 98, 0.18);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid #5b4c62;
  border-radius: 50%;
  background: #fff3ec;
  box-shadow: 0 3px 8px rgba(91, 76, 98, 0.25);
}

.username-change-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

.username-change-form #changeUsernameBtn {
  margin-top: 0;
  white-space: nowrap;
}

.username-change-limit {
  grid-column: 1 / -1;
  margin: -0.25rem 0 0;
  color: var(--theme-text);
  font-size: 0.85rem;
  opacity: 0.8;
}

.settings-divider {
  height: 1px;
  margin: 1rem 0;
  background: var(--theme-border);
}

/* Change Password form: Current Password (full width), then New + Confirm grouped
   on one row, then the submit button (full width). Without an explicit layout the
   inputs (flex:1 inside a non-flex parent) fell back to inline flow and wrapped
   2-then-1, splitting the two new-password fields awkwardly. */
.password-change-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: start;
}
.password-change-form #currentPassword,
.password-change-form #changePasswordBtn {
  grid-column: 1 / -1;
}
.password-change-form #changePasswordBtn {
  margin-top: 0; /* grid gap already spaces it; cancel .action-btn's margin-top */
}
#emailRecoverySettings {
  grid-template-columns: minmax(0, 1fr);
}
#emailRecoverySettings .display-setting-description,
#emailRecoverySettings #verifyRecoveryEmailBtn {
  margin: 0;
}
@media (max-width: 768px) {
  .username-change-form { grid-template-columns: 1fr; }
  .password-change-form { grid-template-columns: 1fr; }
}

/* X button that appears inside search inputs to clear text */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.search-clear-btn {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.6rem;
  height: 1.6rem;
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--theme-control-text);
  font-size: 1rem;
  font-weight: bold;
  line-height: 1.6rem;
  text-align: center;
  padding: 0;
  opacity: 0.58;
}

.search-clear-btn:hover {
  opacity: 1;
  background: var(--theme-focus);
}

/* Profile albums display */
.profile-preview-row {
  grid-template-columns: minmax(220px, 1fr) minmax(0, 760px);
}

.profile-showcase-deck {
  display: flex;
  --showcase-slot-size: clamp(44px, 4.3vw, 58px);
  flex: 2 1 720px;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
}

.profile-showcase-deck[hidden],
.profile-showcase[hidden] { display: none !important; }

.profile-showcase {
  min-width: 0;
  flex: 0 1 auto;
}

.profile-showcase-label {
  min-height: 1.5rem;
  margin-bottom: 0.55rem;
  color: #5b4c62;
  font-size: 0.82rem;
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
}

.profile-showcase-deck #myDisplayAlbumsPreview,
.profile-showcase-deck #friendDisplayAlbums {
  display: block;
  flex: 0 1 auto !important;
  min-width: 0 !important;
  margin-left: 0;
  padding-left: 0;
}

.profile-showcase-deck .profile-albums-display {
  max-width: none;
  width: auto;
  justify-content: center;
  gap: 0.35rem;
}

.profile-showcase-deck .profile-albums-display > .profile-album-display-slot {
  flex: 0 0 var(--showcase-slot-size, 58px);
  width: var(--showcase-slot-size, 58px) !important;
  height: var(--showcase-slot-size, 58px) !important;
}

.profile-showcase-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.profile-showcase-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,249,245,.45);
}

.profile-showcase-deck .profile-showcase-slot:not(.profile-album-display-empty-slot) {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none !important;
}

#friendProfileShowcases .profile-showcase-slot { cursor: default; }

.profile-showcase-tabs { display: none; }

.profile-showcase-tab {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.profile-showcase-tab::before {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff3ec;
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.profile-showcase-tab.active::before {
  background: #e889a9;
  transform: scale(1.25);
}

.profile-showcase-tab:hover::before,
.profile-showcase-tab:focus-visible::before {
  background: #ffd98d;
  transform: scale(1.16);
  box-shadow: 0 0 0 4px rgba(255, 217, 141, .38);
}

.profile-showcase-tab.active:hover::before,
.profile-showcase-tab.active:focus-visible::before {
  background: #e889a9;
  transform: scale(1.25);
}

.profile-showcase-tab:focus-visible { outline: 2px solid #5b4c62; outline-offset: 2px; }

@media (min-width: 961px) {
  #myProfilePreview .profile-preview-row {
    grid-template-columns: minmax(180px, 1fr) minmax(0, 320px);
  }
}

#myProfileShowcases {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  flex: 0 1 320px;
  width: 100%;
  max-width: 320px;
  gap: .6rem;
}

#myProfileShowcases .profile-showcase {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  padding: .5rem 2.7rem .5rem .6rem;
  border: 1px solid rgba(155, 138, 168, .5);
  border-radius: 10px;
  background: rgba(255, 249, 245, .7);
}

#myProfileShowcases .profile-showcase.is-dragging {
  opacity: .6;
  border-style: dashed;
}

#myProfileShowcases #myDisplayAlbumsPreview {
  flex: 0 0 auto !important;
  margin-left: 0;
  padding-left: .6rem;
}

#myProfileShowcases .profile-showcase-heading {
  margin-bottom: .4rem;
}

#myProfileShowcases .profile-showcase-label {
  display: block;
  min-height: 0;
  margin: 0;
  text-align: left;
}

#myProfileShowcases .profile-showcase-drag-handle {
  position: absolute;
  top: 50%;
  right: .35rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #5b4c62;
  font: bold 1.2rem/1 sans-serif;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

#myProfileShowcases .profile-showcase-drag-handle:active { cursor: grabbing; }
#myProfileShowcases .profile-showcase-drag-handle:focus-visible { outline: 2px solid #9b8aa8; outline-offset: 2px; }

@media (max-width: 960px) {
  .profile-preview-row { grid-template-columns: 1fr; }
  .profile-showcase-deck {
    width: 100%;
    display: block;
    flex: 1 1 100%;
    --showcase-slot-size: min(74px, calc((100% - 1.05rem) / 4));
  }
  .profile-showcase-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .25rem;
    width: max-content;
    max-width: 100%;
    margin: 0 auto .6rem;
    padding: .3rem .45rem;
    border-radius: 999px;
    background: rgba(91, 76, 98, .36);
    box-shadow: 0 6px 18px rgba(91, 76, 98, .22);
  }
  .profile-showcase-tab {
    flex: 0 0 36px;
  }
  .profile-showcase-deck .profile-showcase { display: none !important; }
  .profile-showcase-deck .profile-showcase.active { display: block !important; }
  #myProfileShowcases.profile-showcase-deck .profile-showcase { display: block !important; }
  #myProfileShowcases .profile-showcase-tabs { display: none; }
  .profile-showcase-label { display: none; }
  .profile-showcase-deck .profile-albums-display { width: 100%; justify-content: flex-start; }
}

@media (max-width: 768px) {
  .profile-showcase-tab::before { width: 12px; height: 12px; }
}

.profile-public-preview-button { margin-bottom: 1rem; }

.public-profile-preview-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  margin: 0 0 1.25rem;
}
.public-profile-preview-controls[hidden] { display: none; }
.public-profile-preview-controls .action-btn { padding: .5rem 1rem; }
.public-profile-preview-controls .action-btn.active { outline: 3px solid #9b8aa8; outline-offset: 2px; }

#friendTradeCardsModal.public-profile-preview .uft-controls,
#friendTradeCardsModal.public-profile-preview #friendTradeCardsGrid,
#friendTradeCardsModal.public-profile-preview #friendTradeFloatingPagination { display: none !important; }
#friendTradeCardsModal.public-profile-preview #friendProfileSection { margin-bottom: 0 !important; }
#friendTradeCardsModal.public-profile-preview .modal-content { overflow-x: auto; }

#friendTradeCardsModal.public-profile-preview-mobile .modal-content {
  width: min(390px, calc(100vw - 1rem));
  min-width: 0;
  max-width: calc(100vw - 1rem);
  box-sizing: border-box;
  padding: 1.25rem;
}
#friendTradeCardsModal.public-profile-preview-mobile .friend-profile-row {
  flex-direction: column;
  align-items: stretch;
}
#friendTradeCardsModal.public-profile-preview-mobile .friend-profile-identity { flex: 0 1 auto; }
#friendTradeCardsModal.public-profile-preview-mobile #friendProfileShowcases {
  display: block;
  width: 100%;
  flex: 0 1 auto;
  --showcase-slot-size: min(74px, calc((100% - 1.05rem) / 4));
}
#friendTradeCardsModal.public-profile-preview-mobile .profile-showcase-tabs { display: flex; align-items: center; justify-content: center; gap: .25rem; width: max-content; max-width: 100%; margin: 0 auto .6rem; padding: .3rem .45rem; border-radius: 999px; background: rgba(91,76,98,.36); }
#friendTradeCardsModal.public-profile-preview-mobile #friendProfileShowcases .profile-showcase { display: none !important; }
#friendTradeCardsModal.public-profile-preview-mobile #friendProfileShowcases .profile-showcase.active { display: block !important; }
#friendTradeCardsModal.public-profile-preview-mobile .profile-showcase-label { display: none; }
#friendTradeCardsModal.public-profile-preview-mobile .profile-albums-display { width: 100%; justify-content: flex-start; }
#friendTradeCardsModal.public-profile-preview-mobile #friendDisplayAlbums { flex: 1 1 100% !important; margin-left: 0; }

@media (max-width: 960px) {
  #friendTradeCardsModal.public-profile-preview-desktop { justify-content: flex-start; overflow-x: auto; }
  #friendTradeCardsModal.public-profile-preview-desktop .modal-content { max-width: none; width: 1120px; min-width: 1120px; }
  #friendTradeCardsModal.public-profile-preview-desktop #friendProfileShowcases { display: flex; width: auto; flex: 2 1 720px; --showcase-slot-size: 58px; }
  #friendTradeCardsModal.public-profile-preview-desktop .profile-showcase-tabs { display: none; }
  #friendTradeCardsModal.public-profile-preview-desktop #friendProfileShowcases .profile-showcase:not([hidden]) { display: block !important; }
  #friendTradeCardsModal.public-profile-preview-desktop .profile-showcase-label { display: block; }
  #friendTradeCardsModal.public-profile-preview-desktop #friendDisplayAlbums { flex: 0 1 auto !important; }
}

.profile-albums-display {
  display: flex;
  gap: 0.75rem;
  width: fit-content; /* shrink to actual albums, no empty gap */
  max-width: 340px;
  margin-left: auto; /* right-align within its container */
}

.profile-albums-display > div {
  flex-shrink: 0;
  position: relative !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
  cursor: pointer;
}

.profile-albums-display > div > div {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.profile-albums-display {
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0.45rem;
  width: 100%;
  max-width: 340px;
}

#myProfilePreview > div {
  flex-wrap: nowrap !important;
}

#myDisplayAlbumsPreview,
#friendDisplayAlbums {
  flex: 0 1 340px !important;
  min-width: 0 !important;
  margin-left: auto;
}

#myDisplayAlbumsPreview {
  padding-left: 0.5rem;
}

.profile-albums-display > div {
  flex: 0 0 clamp(58px, 12vw, 74px);
  aspect-ratio: 1;
  width: clamp(58px, 12vw, 74px) !important;
  height: auto !important;
}

.profile-albums-display > .profile-album-display-slot {
  flex: 0 0 clamp(58px, 12vw, 74px);
  aspect-ratio: 1;
  width: clamp(58px, 12vw, 74px) !important;
  height: auto !important;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, outline-color 0.15s ease, box-shadow 0.15s ease;
}

.profile-album-display-slot,
.album-placeholder {
  background-color: rgba(255, 249, 245, 0.22);
  background-size: cover;
  background-position: center;
  border-radius: 0;
}

#myDisplayAlbumsContainer .profile-album-display-slot:hover,
#myDisplayAlbumsContainer .profile-album-display-slot:focus-visible {
  transform: translateY(-2px);
  outline: 2px solid #5dd4de;
  outline-offset: 2px;
  box-shadow: 0 5px 14px rgba(91, 76, 98, 0.28) !important;
}

.profile-albums-display > .profile-album-display-empty-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(255, 249, 245, 0.78);
  background: rgba(255, 249, 245, 0.22);
  color: #fff9f5;
  font-family: 'Press Start 2P', monospace;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
}

.profile-album-placeholder-plus {
  pointer-events: none;
}

.profile-album-slot-edit-btn {
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  font-size: 1.15rem;
}

#myDisplayAlbumsContainer .profile-album-display-slot:hover .profile-album-slot-edit-btn,
#myDisplayAlbumsContainer .profile-album-display-slot:focus-within .profile-album-slot-edit-btn,
#myDisplayAlbumsContainer .profile-album-display-slot:focus-visible .profile-album-slot-edit-btn {
  opacity: 1;
  pointer-events: auto;
}

.profile-album-slot-edit-btn:hover {
  transform: translate(-50%, -50%) scale(1.08);
}

.profile-albums-display > .profile-album-friend-empty-slot {
  background: transparent;
  border-color: transparent;
  box-shadow: none !important;
  cursor: default;
}

@media (max-width: 700px) {
  #myProfilePreview > div,
  .profile-preview-row {
    display: flex;
    flex-wrap: wrap !important;
  }

  .profile-preview-identity {
    padding-right: 0;
  }

  .profile-preview-text {
    max-width: 100%;
  }

  #myDisplayAlbumsPreview {
    padding-left: 0;
  }

  #myDisplayAlbumsPreview,
  #friendDisplayAlbums {
    flex: 1 1 100% !important;
    margin-left: 0;
  }

  .profile-albums-display {
    justify-content: flex-start;
    margin-left: 0;
  }
}

.profile-album-picker-modal {
  max-width: 720px;
}

.profile-album-picker-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(2, minmax(130px, 0.65fr));
  gap: 0.7rem;
  margin-top: 1rem;
}

.profile-album-picker-filters label {
  display: grid;
  gap: 0.3rem;
  color: var(--theme-text);
  font-size: 0.78rem;
  font-weight: bold;
}

.profile-album-picker-search-group {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.profile-album-picker-search-group .search-wrap,
.profile-album-picker-filters .styled-select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.profile-album-picker-filters .profile-album-picker-search {
  width: 100%;
  min-width: 0;
  margin-bottom: 0;
  padding-right: 2.5rem;
}

.profile-album-picker-search-clear:not([hidden]) {
  display: inline-flex;
}

.profile-album-picker-count,
.profile-album-picker-empty {
  margin: 0.7rem 0 0;
  font-size: 0.8rem;
  text-align: center;
}

.profile-album-picker-card[hidden],
.profile-album-picker-empty[hidden] { display: none; }

@media (max-width: 600px) {
  .profile-album-picker-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-album-picker-search-group { grid-column: 1 / -1; }
}

.profile-album-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
  max-height: min(58vh, 520px);
  overflow-y: auto;
  padding: 0.25rem;
}

.profile-album-picker-card {
  border: 2px solid transparent;
  border-radius: 8px;
  background: rgba(255, 249, 245, 0.72);
  color: var(--theme-text);
  cursor: pointer;
  padding: 0.45rem;
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.profile-album-picker-card:hover,
.profile-album-picker-card:focus-visible,
.profile-album-picker-card.selected {
  transform: translateY(-2px);
  border-color: #5dd4de;
  box-shadow: 0 4px 12px rgba(91, 76, 98, 0.22);
  outline: none;
}

.profile-album-picker-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 0.45rem;
}

.profile-album-picker-name,
.profile-album-picker-artist {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-album-picker-name {
  font-weight: bold;
  font-size: 0.78rem;
}

.profile-album-picker-artist {
  color: #777;
  font-size: 0.72rem;
  margin-top: 0.15rem;
}

.profile-album-clear-slot {
  display: block;
  width: min(220px, 100%);
  margin: 1rem auto 0;
  background: #999;
}

.search-results,
.friends-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

/* Pending friend request cards — visually distinct so they're never missed */
.friend-card.pending {
  background: linear-gradient(135deg, #fff8e0 0%, #fef0c0 100%);
  border: 1.5px solid #f5c842;
  border-radius: 15px;
}

.friend-card,
.search-result-card {
  background: var(--theme-input-bg);
  padding: 1.25rem;
  border-radius: 15px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.friend-card:hover,
.search-result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--theme-shadow);
}
.friend-card:focus-within { position: relative; z-index: 20; }

.friend-card.is-clickable {
  cursor: pointer;
}

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

.friend-name {
  font-weight: bold;
  color: #5b4c62;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.friend-status {
  font-size: 0.85rem;
  color: #5b4c62;
  opacity: 0.7;
}

.friend-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.friend-more { position: relative; }
.friend-more > summary { display: grid; place-items: center; width: 42px; height: 42px; border: 2px solid var(--theme-border-strong); border-radius: 12px; background: var(--theme-control-bg); color: var(--theme-text); font-size: 1.5rem; line-height: 1; cursor: pointer; list-style: none; }
.friend-more > summary::-webkit-details-marker { display: none; }
.friend-more-actions { position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; display: grid; min-width: 190px; padding: 5px; border: 2px solid var(--theme-border-strong); border-radius: 10px; background: var(--theme-modal-bg); box-shadow: 0 8px 18px var(--theme-shadow); }
.friend-more-actions button { border: 0; border-radius: 7px; padding: 10px; background: transparent; color: var(--theme-text); font: inherit; text-align: left; cursor: pointer; }
.friend-more-actions button:hover, .friend-more-actions button:focus-visible { background: var(--theme-control-bg); }
.blocked-players-panel { margin-top: 1.5rem; }
.blocked-players-panel > summary { cursor: pointer; font-weight: bold; color: var(--theme-text); }
.friend-report-dialog { max-width: 520px; }
.friend-report-dialog label { display: block; margin-top: 14px; font-weight: bold; }
.friend-report-dialog textarea { width: 100%; resize: vertical; }

.friend-btn {
  background: linear-gradient(180deg, #aad9e6 0%, #93c9d5 100%);
  border: none;
  color: #fff3ec;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  transition: all 0.3s ease;
  border-radius: 18px;
  box-shadow: 0 4px 12px rgba(147, 201, 213, 0.3);
}

.friend-btn:hover {
  background: linear-gradient(180deg, #c0f0ff 0%, #a8e8ff 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(168, 232, 255, 0.4);
}

.friend-btn.danger {
  background: linear-gradient(180deg, #ffa8c5 0%, #f79ab5 100%);
  color: #fff3ec;
  box-shadow: 0 4px 12px rgba(247, 154, 181, 0.3);
}

.friend-btn.danger:hover {
  background: linear-gradient(180deg, #ff98ba 0%, #e889a9 100%);
  box-shadow: 0 6px 18px rgba(247, 154, 181, 0.4);
}

/* Custom Alert Modal */
.custom-alert-modal {
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--theme-modal-bg);
  text-align: center;
  padding: 3rem 2.5rem;
}

.custom-alert-modal h2 {
  margin-bottom: 1.5rem;
  color: #5b4c62;
  font-size: 1.5rem;
}

.custom-alert-modal p {
  color: #5b4c62;
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  white-space: pre-line;
}

/* Error details must remain selectable so players can copy them for support. */
#customAlertModal .custom-alert-modal,
#customAlertModal #alertTitle,
#customAlertModal #alertMessage {
  -webkit-user-select: text !important;
  user-select: text !important;
}

.alert-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.alert-buttons .action-btn {
  width: auto;
  min-width: 120px;
}

.bulk-actions {
  width: fit-content;
}

.bulk-actions .action-btn {
  width: auto;
  min-width: 120px;
}

/* Login/Signup Modals */
.login-modal {
  width: min(430px, calc(100vw - 28px));
  max-width: 430px;
  padding: 0;
  border: 4px solid #5b4c62;
  border-radius: 24px;
  background: #fff9f5;
  box-shadow: 0 22px 50px rgba(91, 76, 98, 0.35);
  overflow-x: hidden;
  overflow-y: auto;
}

.login-modal h2 {
  margin: 0;
  padding: 28px 58px 24px 28px;
  border-bottom: 4px solid #5b4c62;
  background: repeating-linear-gradient(90deg, #f79ab5 0 36px, #ffd98d 36px 72px, #5dd4de 72px 108px);
  color: #fff9f5;
  font-size: 1.05rem;
  line-height: 1.5;
  text-align: left;
  text-shadow: 2px 2px 0 #5b4c62;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 30px 28px 32px;
}

#socialUsernameForm[hidden], .social-auth-button[hidden] { display: none !important; }
.social-auth-options { display: grid; gap: 8px; margin-top: 10px; }
.login-form .social-auth-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 5px 0 rgba(91, 76, 98, 0.14), 0 10px 24px var(--theme-selected-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.login-form .social-auth-google { border: 1px solid #747775; background: #fff; color: #1f1f1f; font-family: Arial, sans-serif; }
.login-form .social-auth-apple { border: 1px solid #000; background: #000; color: #fff; font-family: -apple-system, BlinkMacSystemFont, Arial, sans-serif; }
.login-form .social-auth-button img { position: absolute; top: 50%; transform: translateY(-50%); display: block; }
.login-form .social-auth-google img { left: 12px; width: 24px; height: auto; }
.login-form .social-auth-apple img { left: 0; width: 48px; height: 48px; }
.login-form .social-auth-button:focus-visible { outline: 3px solid var(--theme-border-strong, #5b4c62); outline-offset: 3px; }
.login-form .social-auth-button:hover {
  filter: brightness(0.94);
  transform: translateY(-3px);
  box-shadow: 0 5px 0 rgba(91, 76, 98, 0.14), 0 12px 28px var(--theme-selected-glow-strong);
}

.username-change-form[hidden],
.password-change-form[hidden],
#registerEmailFields[hidden],
#registerWalletBackupField[hidden],
#loginWalletOptions[hidden],
#registerWalletProvider[hidden],
#loginWalletProvider[hidden],
#accountCredentialsDivider[hidden],
#walletAccountSettingsNote[hidden] {
  display: none !important;
}

.auth-mode-copy {
  margin: 2px 0 12px;
  color: var(--theme-text);
  font-size: 0.86rem;
  line-height: 1.4;
}

.auth-mode-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 15px;
  color: var(--theme-text);
  font-size: 0.8rem;
  font-weight: bold;
}

.auth-mode-dots .tent-carousel-dot { flex: none; }
.auth-mode-dots span + .tent-carousel-dot { margin-left: 15px; }

.login-form .form-input {
  width: 100%;
  min-height: 48px;
  margin: 0 0 1.05rem;
  border: 0;
  border-radius: 24px;
  background: #fff3ec;
  color: #5b4c62;
  caret-color: #5b4c62;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.75), 0 5px 18px rgba(91, 76, 98, 0.14);
  font-size: 0.95rem;
}

.login-form .form-input:focus {
  background: #fff9f5;
  color: #5b4c62;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.9), 0 6px 20px rgba(93, 212, 222, 0.26);
}

.login-form .form-input::placeholder {
  color: #75667b;
  opacity: 1;
}

.login-form .action-btn {
  min-height: 48px;
  margin-top: 0.35rem;
  border: none;
  border-radius: 30px;
  box-shadow: 0 6px 20px var(--theme-selected-glow);
}

#registerVerificationPanel:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.05rem;
}

#registerVerificationPanel .auth-mode-copy,
#registerVerificationPanel .form-input,
#registerVerificationPanel .action-btn {
  margin: 0;
}

#loginWalletOptions { margin-top: 1.1rem; }
#loginWalletOptions .action-btn { width: 100%; }

#registerWalletProvider:not([hidden]) { margin-bottom: 2.1rem; }

.login-form .action-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px var(--theme-selected-glow-strong);
}

.login-form .action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.78;
}

.form-link {
  text-align: center;
  color: var(--theme-text);
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 1rem 0 0;
}

.link-text {
  color: #e889a9;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  font-weight: bold;
}

.link-text:hover {
  color: #f79ab5;
}

.forgot-password-panel {
  padding: 30px 28px 32px;
}

.forgot-password-copy {
  margin: 0 0 1.2rem;
  color: var(--theme-control-text);
  font-size: 0.92rem;
  line-height: 1.55;
  text-align: center;
}

.forgot-password-panel .form-input {
  width: 100%;
  min-height: 48px;
  margin: 0 0 1.05rem;
  border: 0;
  border-radius: 24px;
  background: #fff3ec;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.75), 0 5px 18px rgba(91, 76, 98, 0.14);
  font-size: 0.95rem;
}

.forgot-password-panel .form-input:focus {
  background: #fff9f5;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.9), 0 6px 20px rgba(93, 212, 222, 0.26);
}

.forgot-password-panel .action-btn {
  min-height: 48px;
  margin-top: 0.35rem;
  border-radius: 30px;
}

.forgot-password-status {
  min-height: 1.2rem;
  margin: 0.85rem 0 0;
  color: var(--theme-muted);
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: center;
}

.forgot-password-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 1.25rem;
  color: var(--theme-muted);
  font-size: 0.78rem;
}

.forgot-password-fallback a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.forgot-password-fallback img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.forgot-password-fallback .mobile-support-label { display: none; }

.walkthrough-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  pointer-events: none;
}

.walkthrough-overlay.active {
  display: block;
}

.walkthrough-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: auto;
}

.walkthrough-highlight {
  position: fixed;
  border: 3px solid #ffd98d;
  border-radius: 18px;
  box-shadow: 0 0 0 4px rgba(255, 217, 141, 0.24), 0 0 24px rgba(255, 217, 141, 0.7);
  pointer-events: none;
  transition: left 0.2s ease, top 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.walkthrough-card {
  position: fixed;
  width: min(360px, calc(100vw - 28px));
  padding: 1.15rem;
  border: 3px solid #5b4c62;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff9f5 0%, #fff3ec 100%);
  color: #5b4c62;
  box-shadow: 0 16px 40px rgba(26, 20, 31, 0.34);
  pointer-events: auto;
}

.walkthrough-card-centered {
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%);
}

.walkthrough-card:not(.walkthrough-card-centered) {
  transform: none;
}

.walkthrough-progress {
  margin-bottom: 0.55rem;
  color: #7a6a83;
  font-size: 0.72rem;
  font-weight: bold;
  text-transform: uppercase;
}

.walkthrough-card h2 {
  margin: 0 0 0.7rem;
  color: #5b4c62;
  font-size: 1rem;
  line-height: 1.35;
  text-shadow: none;
}

.walkthrough-card p {
  margin: 0;
  color: #5b4c62;
  font-size: 0.86rem;
  line-height: 1.55;
}

.walkthrough-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.walkthrough-btn {
  border: 0;
  border-radius: 18px;
  padding: 0.55rem 0.9rem;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  font-weight: bold;
  cursor: pointer;
}

.walkthrough-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.walkthrough-btn-primary {
  background: var(--theme-button-bg);
  color: var(--theme-button-accent-text);
}

.walkthrough-btn-secondary {
  background: linear-gradient(180deg, #fff9f5 0%, #fff3ec 100%);
  box-shadow: inset 0 0 0 2px rgba(91, 76, 98, 0.18);
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .walkthrough-card {
  background: linear-gradient(135deg, var(--theme-surface-base) 0%, var(--theme-surface-deeper) 100%);
  color: #fff3ec;
  border-color: #fff3ec;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .walkthrough-card h2,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .walkthrough-card p,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .walkthrough-progress {
  color: #fff3ec;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .login-modal,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .forgot-password-panel {
  color: var(--theme-text);
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .forgot-password-panel .form-input {
  background: var(--theme-input-bg);
  color: var(--theme-control-text);
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .forgot-password-panel .form-input::placeholder {
  color: rgba(255, 243, 236, 0.72);
}

.auth-terms-check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0.15rem 0 1.15rem;
  padding: 1rem 1.1rem;
  border: 0;
  border-radius: 24px;
  background: #fff3ec;
  box-shadow: 0 5px 18px rgba(91, 76, 98, 0.12);
  color: #5b4c62;
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1.45;
}

.auth-terms-check input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: #e889a9;
  cursor: pointer;
}

.terms-policy-modal {
  width: min(720px, calc(100vw - 28px));
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
}

.terms-policy-body {
  padding: 28px;
  color: #5b4c62;
  font-size: 0.92rem;
  line-height: 1.65;
  text-align: left;
}

.terms-policy-body p {
  margin: 0 0 1.2rem;
}

.terms-policy-body ul {
  margin: 0 0 1.2rem;
  padding-left: 1.25rem;
}

.terms-policy-body strong {
  color: #4a3d52;
}

/* Chat Modal */
.chat-modal {
  min-width: 500px;
  max-width: 600px;
  background: #a8e8ff;
}

.chat-messages {
  height: 400px;
  overflow-y: auto;
  background: #fff3ec;
  border: 3px solid #5b4c62;
  padding: 1rem;
  margin: 1rem 0;
}

.chat-message {
  margin-bottom: 1rem;
  padding: 0.75rem;
  border: 2px solid #5b4c62;
  background: #ffe0fa;
}

.chat-message.own {
  background: #c9b4e8;
  margin-left: 2rem;
}

.chat-sender {
  font-weight: bold;
  color: #5b4c62;
  margin-bottom: 0.25rem;
}

.chat-text {
  color: #5b4c62;
}

.chat-input-area {
  display: flex;
  gap: 0.5rem;
}

/* Trade Modal */
.trade-modal {
  min-width: 500px;
  max-width: 600px;
  background: var(--theme-modal-bg);
}

.trade-modal-copy {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.trade-modal-search {
  margin-bottom: 1rem;
}

.trade-modal-search .text-input {
  width: 100%;
}

.trade-modal-card-preview {
  width: 200px;
  margin: 0 auto 1rem;
  aspect-ratio: 3.6715 / 5.159;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4.85% / 3.45%;
  overflow: hidden;
}

.trade-modal-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4.85% / 3.45%;
}

.trade-modal-card-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  height: 100%;
}

.trade-modal-rarity {
  font-weight: bold;
}

.trade-modal-era {
  font-size: 0.9rem;
  color: #5b4c62;
}

/* Mobile adjustments for trade modal */
@media (max-width: 768px) {
  .trade-modal {
    min-width: 90%;
    max-width: 90%;
  }
}

.trade-card-info {
  padding: 0.5rem;
  margin: 0.5rem 0;
  text-align: center;
}

.trade-friends-list {
  display: grid;
  background: transparent;
  border: 0;
  border-radius: 0;
  gap: 1rem;
  margin-top: 1rem;
  max-height: 300px;
  overflow-y: auto;
  padding: 0;
}
.trade-friends-list[hidden], .trade-modal-search[hidden] { display: none; }
.trade-friends-list > button.friend-card { width: 100%; border: 0; appearance: none; font: inherit; text-align: left; cursor: pointer; }
.purchase-recipient-choices { max-height: none; overflow: visible; padding: 8px 2px 2px; }
.purchase-recipient-search { margin-top: 1.25rem; }
.purchase-recipient-friends { padding: 8px 4px; }
.purchase-recipient-friends .friend-name { margin-bottom: 0; }

/* Shared minigame modal chrome. Boards/canvases keep game-specific rules below. */
.balloon-game-modal,
.gem-catch-game-modal,
.memory-game-modal,
.claw-game-modal {
  background: var(--theme-modal-bg);
  max-height: 95vh;
  padding: 1.5rem;
}

.balloon-game-modal {
  min-width: 700px;
  max-width: 900px;
  padding: 2rem;
}

.minigame-modal-medium {
  max-width: 620px;
}

.minigame-modal-wide {
  max-width: 800px;
}

/* Compact width only while the mode-select screen is showing */
.balloon-game-modal.mode-select-active,
.memory-game-modal.mode-select-active {
  min-width: unset;
  width: fit-content;
  max-width: min(500px, 95vw);
}

.mode-selection > p {
  color: #5b4c62;
}

.minigame-mode-prompt {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.minigame-mode-options {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.minigame-mode-btn {
  flex: 1;
  max-width: 200px;
  margin-top: 0;
}

.minigame-mode-name,
.minigame-mode-detail {
  display: block;
}

.minigame-mode-detail {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  opacity: 0.8;
}

/* Tournament image wrapper — blocks right-click / save-image on card images */
.tournament-img-wrap {
  position: relative;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none; /* iOS long-press callout */
}
.tournament-img-wrap--winner::after {
  content: '';
  position: absolute;
  inset: 0;
  border: var(--tournament-winner-border, 2px) solid #ffd700;
  border-radius: inherit;
  box-sizing: border-box;
  pointer-events: none;
}
.tournament-img-wrap img {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

/* Jigsaw Puzzle Game */
.jigsaw-game-modal {
  max-width: 1050px;
  user-select: none;
  -webkit-user-select: none;
}

#jigsawGameModal .modal-content {
  overflow-y: auto; /* scroll if content exceeds modal height (e.g. DPI-scaled screens) */
}

.jigsaw-main {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.jigsaw-board {
  display: grid;
  /* 6 cols × 71px, 8 rows × 75px → board = 426×600 ≈ card aspect ratio 3.6715/5.159 */
  grid-template-columns: repeat(6, 71px);
  grid-template-rows: repeat(8, 75px);
  gap: 3px;
  background: #9b8aa8;
  border: 4px solid #9b8aa8;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(91, 76, 98, 0.25);
  flex-shrink: 0;
}

.jigsaw-board-wrap {
  position: relative;
  flex-shrink: 0;
}

.jigsaw-reference-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 4px solid #9b8aa8;
  border-radius: 14px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

.jigsaw-board-wrap.reference-visible .jigsaw-reference-overlay { opacity: 1; }
.jigsaw-reference-toolbar { display: none; }
.jigsaw-reference-hold { display: none; }

/* Tray sits below board+sidebar on desktop — 12-col grid shows all 48 pieces at once */
/* On desktop, .balloon-game-content inside the jigsaw modal uses a 2-col grid so the
   tray can span the bottom-left cell (below the board) while the sidebar spans both rows */
.jigsaw-game-modal .balloon-game-content {
  display: grid;
  grid-template-columns: 1fr 220px;
  grid-template-rows: auto auto;
  grid-template-areas:
    "board sidebar"
    "tray  sidebar";
  gap: 1.5rem;
  align-items: start;
}
.jigsaw-game-modal .game-main    { grid-area: board; }
.jigsaw-game-modal .game-sidebar { grid-area: sidebar; }
.jigsaw-game-modal .jigsaw-tray  { grid-area: tray; }

.jigsaw-tray {
  display: grid;
  grid-template-columns: repeat(8, 48px);
  grid-template-rows: repeat(6, var(--jigsaw-tray-piece-height, 51px));
  gap: 4px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.35);
  border: 2px solid rgba(155, 138, 168, 0.35);
  border-radius: 14px;
  align-content: start;
}

.balloon-game-content {
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
}

.game-main {
  flex: 1;
}

#charmShooterModal .game-main {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-sidebar {
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gem-catch-game-modal {
  width: fit-content;
  max-width: min(1100px, 95vw);
}

.gem-catch-container {
  position: relative;
  width: 476px;
  max-width: 100%;
  height: 476px;
  /* Use same animated gradient as main website */
  background: linear-gradient(135deg, #93c9d5 0%, #c9b4e8 25%, #f79ab5 50%, #ffd98d 75%, #ffe0fa 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.2);
}

.gem-catch-canvas {
  width: 100%;
  height: 100%;
  display: block;
  will-change: transform;
  transform: translateZ(0); /* Force GPU compositing layer */
}

.game-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.game-stat {
  background: linear-gradient(135deg, #fff9f5 0%, #fff3ec 100%);
  border: none;
  padding: 1rem 1.25rem;
  text-align: center;
  box-shadow: 0 4px 15px var(--theme-shadow);
  border-radius: 20px;
}

.stat-label {
  display: block;
  font-size: 0.85rem;
  color: #5b4c62;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  color: #f79ab5;
  font-weight: bold;
  font-family: 'Press Start 2P', monospace;
  line-height: 1.4;
}

.balloon-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  background: linear-gradient(135deg, #d9c9f5 0%, #c9b4e8 100%);
  border: none;
  padding: 12px;
  aspect-ratio: 1;
  width: 100%;
  max-width: 476px;
  border-radius: 20px;
  box-shadow: inset 0 4px 15px rgba(91, 76, 98, 0.2);
}

.balloon-cell {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, border-color 0.15s ease-out, background-color 0.15s ease-out;
  user-select: none;
  position: relative;
  padding: 8px;
  touch-action: none; /* Prevent touch interference */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

.balloon-cell:hover {
  transform: scale(1.05);
  z-index: 10;
}

.balloon-cell:active {
  transform: scale(0.95);
}

.balloon-cell.pointer-dragging {
  opacity: 0.5;
}

.balloon-cell.selected {
  background: #ffd98d;
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(247, 154, 181, 1),
              0 0 25px rgba(247, 154, 181, 0.6);
  z-index: 5;
  border: 2px solid #f79ab5;
  border-radius: 8px;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 15px rgba(247, 154, 181, 1),
                0 0 25px rgba(247, 154, 181, 0.6);
  }
  100% {
    box-shadow: 0 0 20px rgba(247, 154, 181, 1),
                0 0 35px rgba(247, 154, 181, 0.8);
  }
}

.balloon-cell.matched {
  animation: balloonPop 0.5s ease-out;
}

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

.balloon-cell.frozen {
  position: relative;
}

.balloon-cell.frozen img {
  filter: brightness(0.65) saturate(0.25) hue-rotate(180deg);
}

@keyframes freeze {
  0% { filter: brightness(1) saturate(1) hue-rotate(0deg); }
  100% { filter: brightness(0.65) saturate(0.25) hue-rotate(180deg); }
}

.balloon-cell.just-frozen img {
  animation: freeze 0.3s ease-out;
}

@keyframes cascadeCombo {
  0%   { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  30%  { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  70%  { transform: translate(-50%, -50%) scale(1.0); opacity: 1; }
  100% { transform: translate(-50%, -80%) scale(0.9); opacity: 0; }
}

.game-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.game-controls.is-offset {
  margin-top: 1rem;
}

.game-controls .action-btn {
  width: 100%;
}

:is(
  #startGameBtn,
  #playExtraBtn,
  #reshuffleBtn,
  #startEndlessBtn,
  #finishEndlessBtn,
  #startGemGameBtn,
  #playGemExtraBtn,
  #startFrenzyBtnInline,
  #startFrenzyBtn,
  #startMemoryBtn,
  #playExtraMemoryBtn,
  #startMemorySpeedBtn,
  #startGuessWhoBtn,
  #submitGuessWhoBtn,
  #startJigsawBtn,
  #startCharmBtn,
  #startSnakeBtn,
  #startMinesweeperBtn,
  #playClawGameBtn,
  #clawGrabBtn,
  #clawRefreshBtn,
  #clawStartSessionBtn
) {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
  font-weight: bold;
}

.minigame-play-btn,
.token-buy-btn {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
  font-weight: bold;
}

#playClawGameBtn,
#clawGrabBtn {
  padding: 1rem 1.25rem;
  font-size: 1rem;
}

#finishEndlessBtn,
#minesweeperFlagToggle {
  background: #5b4c62 !important;
  color: #fff3ec !important;
}

#minesweeperFlagToggle.is-flag-mode-active {
  background: linear-gradient(180deg, #b7ce84 0%, #93c9d5 100%) !important;
  color: #3a2942 !important;
  box-shadow: 0 4px 15px rgba(91, 76, 98, 0.25), 0 0 0 3px rgba(183, 206, 132, 0.35) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #minesweeperFlagToggle.is-flag-mode-active {
  background: linear-gradient(180deg, #93c9d5 0%, #b7ce84 100%) !important;
  color: #1f2a24 !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(147, 201, 213, 0.35) !important;
}

.minigame-back-btn {
  margin-top: 0.75rem;
  background: rgba(255, 255, 255, 0.2);
  color: #5b4c62;
}

.game-result {
  background: linear-gradient(135deg, #fff9f5 0%, #fff3ec 100%);
  border: none;
  padding: 2rem;
  margin-top: 1rem;
  text-align: center;
  box-shadow: 0 6px 20px rgba(91, 76, 98, 0.25);
  border-radius: 25px;
  width: 100%;
  box-sizing: border-box;
}

.game-result h3 {
  margin: 0 0 0.5rem 0;
  color: #5b4c62;
  font-size: 1.2rem;
  line-height: 1.6;
}

.game-result p {
  margin: 0.5rem 0;
  color: #5b4c62;
  font-size: 1rem;
  line-height: 1.35;
}

.game-result strong {
  color: #5b4c62;
}

.game-result .game-result-muted {
  color: #7a6a7a;
  font-size: 0.9rem;
}

.game-result .game-result-small {
  font-size: 0.85rem;
}

.game-result .game-result-emphasis {
  color: #ffd98d;
  font-weight: bold;
}

.game-result .game-result-error {
  color: #c0392b;
}

.game-result-divider {
  margin: 1rem 0;
  border: 0;
  border-top: 1px solid rgba(91, 76, 98, 0.18);
}

.minigame-how-to {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-size: 0.85rem;
  color: #5b4c62;
}

.minigame-how-to--compact {
  margin-top: 0;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  font-size: 0.8rem;
}

.token-purchase-options {
  padding: 1.5rem;
  background: transparent;
  border-radius: 10px;
  margin-bottom: 1.5rem;
}

/* Snake mobile D-pad (shown only on touch devices while playing). A 3×3 grid with
   the four arrows in a cross; centre cell is empty. touch-action:none + JS
   preventDefault keep taps from scrolling the modal or nudging the window — see the
   iOS window-scroll pin note in PROJECT_CONTEXT.md. JS sets display:grid to show it. */
.snake-dpad {
  /* display toggled to grid by JS */
  grid-template-columns: repeat(3, 58px);
  grid-template-rows: repeat(3, 58px);
  gap: 6px;
  justify-content: center;
  margin: 1rem auto 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.snake-dpad-btn {
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #f79ab5 0%, #e07a9a 100%);
  color: #fff3ec;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(91, 76, 98, 0.3);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.snake-dpad-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(91, 76, 98, 0.3);
}
.snake-dpad-up    { grid-column: 2; grid-row: 1; }
.snake-dpad-left  { grid-column: 1; grid-row: 2; }
.snake-dpad-right { grid-column: 3; grid-row: 2; }
.snake-dpad-down  { grid-column: 2; grid-row: 3; }

#snakeCanvas {
  border: 3px solid transparent;
  box-sizing: border-box;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #snakeCanvas {
  border-color: #fff3ec;
}

/* Mobile: cap the snake board height (52vh) so the board + D-pad both fit on screen
   without scrolling — otherwise the bigger board pushed the controls below the fold
   and players reported the controls "not appearing". !important overrides the inline
   max-width on the <canvas>. */
@media (max-width: 768px) {
  #snakeCanvas { max-width: min(100%, 52vh) !important; }
}

/* Mobile: keep the close (×) button up beside the title on EVERY minigame modal so it
   never overlaps the play area (it was hiding cards/gems near the board's top-right).
   The shared .close-modal uses top: max(1rem, env(safe-area-inset-top)), but .modal
   already pads for the safe area, so on notched phones the × was double-offset DOWN
   onto the game. Pinning it to a small fixed corner inset puts it in the title band. */
@media (max-width: 768px) {
  .balloon-game-modal .close-modal,
  .gem-catch-game-modal .close-modal,
  .memory-game-modal .close-modal,
  #clawGameModal .close-modal {
    top: 0.5rem;
    right: 0.75rem;
  }
}

/* Minigame menu — responsive card grid. auto-fill + minmax means it flows into
   2 cols on mobile / 3 on desktop and GROWS automatically as games are added, no
   markup changes needed per new game. */
.minigame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.85rem;
}
.minigame-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  aspect-ratio: 1 / 1;
  padding: 0.75rem 0.5rem;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  color: #5b4c62;
  font-family: inherit;
  box-shadow: 0 3px 10px rgba(91, 76, 98, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.minigame-card--pink {
  background: linear-gradient(180deg, #fcc0d4 0%, #f48fb0 100%);
}

.minigame-card--blue {
  background: linear-gradient(180deg, #a8e8ff 0%, #7dc4e8 100%);
}

.minigame-card--purple {
  background: linear-gradient(180deg, #dccbf3 0%, #b39ad6 100%);
}

.minigame-card--cream {
  background: linear-gradient(180deg, #fff7f0 0%, #ffe5d2 100%);
}

.minigame-card--yellow {
  background: linear-gradient(180deg, #ffe7af 0%, #f5c25a 100%);
}

.minigame-card--green {
  background: linear-gradient(180deg, #cfe39c 0%, #b7ce84 100%);
}
.minigame-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 18px rgba(91, 76, 98, 0.3);
}
.minigame-card:active {
  transform: translateY(-1px);
}
.minigame-card .mg-icon {
  font-size: 2.3rem;
  line-height: 1;
}
.minigame-card .mg-name {
  font-size: 1.05rem;   /* bigger so the game name stands out */
  font-weight: 800;
  text-align: center;
  line-height: 1.1;
}
.minigame-card .mg-plays {
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  line-height: 1;
  opacity: 0.85;
}
.minigame-card .mg-plays.mg-plays-empty {
  opacity: 0.55;
}

.minigame-menu-leaderboard-btn {
  margin-top: 1rem;
  width: 100%;
  padding: 0.9rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

@media (min-width: 769px) {
  .balloon-grid {
    width: 476px;
  }
}

/* Guess Who */
.guess-who-game-modal {
  max-width: 900px;
}

.guess-who-main {
  min-height: 0;
}

.guess-who-game-modal .balloon-game-content {
  align-items: center;
}

.guess-who-card-stage {
  display: grid;
  justify-items: center;
  gap: 0.8rem;
  width: 100%;
  align-content: start;
}

.guess-who-card-frame {
  position: relative;
  width: 426px;
  max-width: min(426px, 100%);
  aspect-ratio: 3.6715 / 4.05;
  overflow: hidden;
  border-radius: 18px;
  clip-path: inset(0 round 18px);
  background: #fff3ec;
  box-shadow: 0 6px 20px rgba(91, 76, 98, 0.28);
}

.guess-who-card-frame img {
  position: absolute;
  left: -1.25%;
  top: -10.83%;
  width: 102.5%;
  height: 127.39%;
  display: block;
  object-fit: cover;
  image-rendering: auto;
  image-rendering: smooth;
  user-select: none;
  -webkit-user-drag: none;
}

.guess-who-feedback {
  min-height: 1.4rem;
  color: #5b4c62;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
}

.guess-who-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  width: min(426px, 100%);
}

.guess-who-inputs .form-input {
  width: 100%;
  min-height: 48px;
  margin: 0;
  border: 0;
  border-radius: 24px;
  background: #fff3ec;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.75), 0 5px 18px rgba(91, 76, 98, 0.14);
  font-size: 0.95rem;
}

.guess-who-inputs .form-input:focus {
  background: #fff9f5;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.9), 0 6px 20px rgba(93, 212, 222, 0.26);
}

.guess-who-inputs .form-input::placeholder {
  color: rgba(91, 76, 98, 0.52);
}

.guess-who-inputs .form-input:disabled {
  opacity: 0.55;
}

.guess-who-controls {
  width: min(426px, 100%);
  gap: 0.5rem;
}

.guess-who-nav-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.guess-who-nav-controls .action-btn {
  margin-top: 0;
  background: rgba(255,255,255,0.2);
  color: #5B4C62;
}

.guess-who-answer-review {
  margin-top: 1rem;
  color: var(--theme-text);
}

.guess-who-answer-review > .action-btn {
  width: fit-content;
  margin: 0 auto;
  cursor: pointer;
  flex-shrink: 0;
}

.guess-who-answer-review :focus-visible {
  outline: 2px solid var(--theme-border-strong);
  outline-offset: 2px;
}

.guess-who-review-scroll {
  max-height: min(320px, 40dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
  padding: 3px;
  scrollbar-gutter: stable;
}

.guess-who-review-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
  text-align: left;
}

.guess-who-review-card {
  padding: 0.75rem;
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  background: var(--theme-card-bg);
  overflow-wrap: anywhere;
}

.guess-who-review-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.guess-who-review-content {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.guess-who-review-content img {
  width: 56px;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

.guess-who-review-answers {
  min-width: 0;
  display: grid;
  gap: 0.75rem;
}

.guess-who-review-answer {
  display: grid;
  gap: 0.25rem;
  font-size: 0.8rem;
  line-height: 1.5;
}

.guess-who-review-typed {
  white-space: pre-wrap;
}

@media (max-width: 768px) {
  .guess-who-card-stage,
  .guess-who-inputs,
  .guess-who-controls {
    max-width: 100%;
  }

  .guess-who-card-frame {
    width: min(58vw, 224px);
    border-radius: 14px;
    clip-path: inset(0 round 14px);
  }

  .guess-who-inputs {
    width: min(100%, 360px);
    gap: 0.45rem;
  }

  .guess-who-controls {
    width: min(100%, 360px);
  }

  .guess-who-inputs .form-input {
    min-width: 0;
    font-size: 16px;
  }
}

/* Minesweeper board — sits inside the standard .game-main; the modal frame,
   sidebar, stat pills and Game Over box reuse the shared minigame classes.
   All colours come from the site palette; numbers use the title font. */
.minesweeper-board {
  display: grid;
  gap: 2px;
  background: #c9b4e8;            /* palette lavender (frame / grid lines) */
  padding: 5px;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(91, 76, 98, 0.3);
  width: 100%;
  max-width: 396px;
  margin: 0 auto;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
/* Bigger board on desktop (mobile stays responsive at the base max-width).
   An explicit width (not just max-width) is required: a width:100% div has no
   intrinsic size, so it would just fill the narrow modal and never reach 480.
   The fixed width pushes the modal wider to fit (board 480 + sidebar + padding). */
@media (min-width: 769px) {
  .minesweeper-board { width: 476px; max-width: 476px; }
}
.minesweeper-cell {
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 4px;
  background: linear-gradient(180deg, #e1d2f7 0%, #c9b4e8 100%);  /* palette lavenders */
  box-shadow: inset 0 -2px 0 rgba(91, 76, 98, 0.18), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  cursor: pointer;
  font-family: 'Press Start 2P', 'Courier New', monospace;  /* site title font */
  font-size: clamp(0.45rem, 2.3vw, 0.78rem);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5b4c62;
  transition: filter 0.1s ease;
  padding: 0;
}
.minesweeper-cell:hover:not(.revealed) { filter: brightness(1.06); }
.minesweeper-cell.revealed {
  background: #fff3ec;            /* palette cream */
  box-shadow: inset 0 0 0 1px rgba(91, 76, 98, 0.08);
  cursor: default;
}
.minesweeper-cell.mine { background: #5b4c62; color: #fff; }      /* palette plum */
.minesweeper-cell.mine-hit { background: #e889a9; color: #fff; }  /* palette pink */
/* end-of-game flag feedback */
.minesweeper-cell.ms-correct-flag { background: #b7ce84; color: #3a4a1f; }  /* correctly flagged mine — green */
.minesweeper-cell.ms-wrong-flag { background: #f3a6c0; color: #fff; }       /* flag on a safe cell — pink, shows ❌ */
/* number colours — palette only; 1/2/3 (the common ones) are the most distinct */
.minesweeper-cell.n1 { color: #5b4c62; }  /* plum  */
.minesweeper-cell.n2 { color: #b7ce84; }  /* green */
.minesweeper-cell.n3 { color: #e889a9; }  /* pink  */
.minesweeper-cell.n4 { color: #93c9d5; }  /* teal  */
.minesweeper-cell.n5 { color: #f79ab5; }  /* pink  */
.minesweeper-cell.n6 { color: #c9b4e8; }  /* lavender */
.minesweeper-cell.n7 { color: #5b4c62; }  /* plum  */
.minesweeper-cell.n8 { color: #93c9d5; }  /* teal  */

/* Memory Game Modal */
.memory-game-modal {
  width: fit-content;
  max-width: min(1100px, 95vw);
}

.memory-game-content {
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
}

.memory-game-content .game-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(65px, min(12vw, calc((95vh - 200px) / 9))));
  gap: clamp(3px, 0.5vw, 6px);
  background: linear-gradient(135deg, #d9c9f5 0%, #c9b4e8 100%);
  border: none;
  padding: clamp(6px, 1vw, 10px);
  border-radius: 20px;
  box-shadow: inset 0 4px 15px rgba(91, 76, 98, 0.2);
  max-width: 100%;
  width: fit-content;
  margin: 0 auto;
}

.memory-card {
  background: #fff3ec;
  border: 2px solid #5b4c62;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s, background-color 0.15s;
  user-select: none;
  position: relative;
  overflow: hidden;
  aspect-ratio: 3.6715 / 5.159;
  width: 100%;
}

.memory-card:hover:not(.flipped):not(.matched) {
  box-shadow: 0 4px 12px rgba(91, 76, 98, 0.4);
  border-color: #f79ab5;
}

.memory-card.flipped {
  background: #fff;
  border-color: #f79ab5;
}

.memory-card.matched {
  background: #c9f5d9;
  border-color: #4caf50;
  opacity: 0.6;
  cursor: default;
}

.memory-card .card-back {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: linear-gradient(135deg, #f79ab5 0%, #ffd98d 100%);
  color: #fff;
}

.memory-card .card-front {
  width: 100%;
  height: 100%;
  display: none;
  padding: 2px;
}

.memory-card.flipped .card-back {
  display: none;
}

.memory-card.flipped .card-front {
  display: block;
}

.memory-card .card-front img {
  -webkit-user-drag: none;
  user-select: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4.85% / 3.45%;
}

/* Hide arrows on mobile phones - uses width-based detection since hover/pointer
   media features are unreliable on Samsung and other Android devices */
@media (max-width: 480px) {
  /* Hide SVG arrow groups inside tents */
  .arrow-left,
  .arrow-right,
  g.arrow-left,
  g.arrow-right,
  #arrow_left,
  #arrow_right,
  [id="arrow_left"],
  [id="arrow_right"],
  /* Also hide old button elements if they exist */
  .nav-btn,
  #prevBtn,
  #nextBtn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* Hide ALL children of arrow groups too */
  .arrow-left *,
  .arrow-right *,
  g.arrow-left *,
  g.arrow-right *,
  #arrow_left *,
  #arrow_right * {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }
}

/* Also hide arrows on touch devices (as backup for tablets and larger phones) */
@media (hover: none) and (pointer: coarse) and (max-width: 768px) {
  .arrow-left,
  .arrow-right,
  g.arrow-left,
  g.arrow-right,
  #arrow_left,
  #arrow_right,
  [id="arrow_left"],
  [id="arrow_right"],
  .nav-btn,
  #prevBtn,
  #nextBtn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .arrow-left *,
  .arrow-right *,
  g.arrow-left *,
  g.arrow-right *,
  #arrow_left *,
  #arrow_right * {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }
}

/* Ensure tent buttons remain visible on mobile */
@media (max-width: 768px) {
  .tent-info-bottom {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  #gachaBtn,
  #wheelBtn,
  #shopBtn {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

}

/* Jigsaw: medium scale for ~930px viewport (1080p at 100% DPI, or 1440p scaled) */
@media (max-height: 1000px) and (min-width: 769px) {
  .jigsaw-game-modal {
    padding: 1.25rem;
  }

  .jigsaw-game-modal h2 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
  }

  .jigsaw-board {
    /* 6×48px cols, 8×51px rows → board = 288×408px */
    grid-template-columns: repeat(6, 48px);
    grid-template-rows: repeat(8, 51px);
  }

  .jigsaw-game-modal .jigsaw-tray {
    grid-template-columns: repeat(8, 44px);
  }
}

/* Jigsaw: small scale for ~730px viewport (1080p at 125% DPI scaling, or 900p displays) */
@media (max-height: 850px) and (min-width: 769px) {
  .claw-game-modal {
    padding: 1rem;
  }

  .claw-game-modal h2 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
  }

  #clawGameArea {
    height: min(640px, calc(95vh - 7rem));
    min-height: 500px;
  }

  .claw-modal-layout {
    gap: 1rem;
  }

  .claw-side-panel {
    padding: 0.8rem;
  }

  .jigsaw-game-modal {
    padding: 0.75rem;
  }

  .jigsaw-game-modal h2 {
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
  }

  .jigsaw-board {
    /* 6×34px cols, 8×37px rows → board = 209×305px */
    grid-template-columns: repeat(6, 34px);
    grid-template-rows: repeat(8, 37px);
  }

  .jigsaw-game-modal .jigsaw-tray {
    grid-template-columns: repeat(8, 36px);
    gap: 3px;
    padding: 8px;
  }
}

/* Jigsaw: extra small scale for very short viewports (landscape phones, very small windows) */
@media (max-height: 700px) and (min-width: 769px) {
  .jigsaw-game-modal {
    padding: 0.5rem;
  }

  .jigsaw-board {
    /* 6×26px cols, 8×28px rows */
    grid-template-columns: repeat(6, 26px);
    grid-template-rows: repeat(8, 28px);
    gap: 2px;
  }

  .jigsaw-game-modal .jigsaw-tray {
    grid-template-columns: repeat(8, 28px);
    gap: 2px;
    padding: 6px;
  }
}

/* Short viewports - landscape phones or short windows */
@media (max-height: 700px) {
  .memory-game-modal {
    max-height: 100vh;
    padding: 0.5rem;
  }

  .memory-game-modal h2 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
  }

  .memory-grid {
    grid-template-columns: repeat(7, minmax(35px, min(12vw, calc((100vh - 150px) / 9))));
    gap: 2px;
    padding: 4px;
  }

  .game-sidebar {
    width: 200px;
  }

  .game-stat {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
  }
}

/* Responsive nav bar - scales down proportionally to maintain spacing */
/* 1651-1920px: Slightly smaller for high-res with scaling */
@media (max-width: 1920px) and (min-width: 1651px) {
  .top-nav {
    padding: 0 1.8rem;
  }

  .nav-brand {
    font-size: 1.15rem;
  }

  .nav-links {
    gap: 0.9rem;
  }

  .nav-link {
    padding: 0.65rem 1.4rem;
    font-size: 0.98rem;
  }

  .user-stats {
    font-size: 0.98rem;
  }
}

/* 1401-1650px: Medium scaling */
@media (max-width: 1650px) and (min-width: 1401px) {
  .top-nav {
    padding: 0 1.6rem;
  }

  .nav-brand {
    font-size: 1.08rem;
  }

  .nav-links {
    gap: 0.85rem;
  }

  .nav-link {
    padding: 0.6rem 1.3rem;
    font-size: 0.95rem;
  }

  .user-stats {
    font-size: 0.95rem;
  }
}

/* 1201-1400px: Further scaling */
@media (max-width: 1400px) and (min-width: 1201px) {
  .top-nav {
    padding: 0 1.4rem;
  }

  .nav-brand {
    font-size: 1rem;
  }

  .nav-links {
    gap: 0.5rem;
  }

  .nav-link {
    padding: 0.5rem 0.9rem;
    font-size: 0.88rem;
  }

  .user-stats {
    font-size: 0.92rem;
  }
}

/* 901-1200px: Tablets and smaller laptops */
@media (max-width: 1200px) and (min-width: 901px) {
  .memory-game-modal {
    max-width: 95vw;
  }

  .memory-grid {
    grid-template-columns: repeat(7, minmax(58px, min(11vw, calc((95vh - 180px) / 9))));
    gap: 4px;
    padding: 8px;
  }

  .top-nav {
    padding: 0 1.2rem;
  }

  .nav-brand {
    font-size: 0.95rem;
  }

  .nav-links {
    gap: 0.4rem;
  }

  .nav-link {
    padding: 0.45rem 0.7rem;
    font-size: 0.82rem;
  }

  .user-stats {
    font-size: 0.88rem;
  }
}

/* 769-900px: Small tablets */
@media (max-width: 900px) and (min-width: 769px) {
  .top-nav {
    padding: 0 1rem;
  }

  .nav-brand {
    font-size: 0.9rem;
  }

  .nav-links {
    gap: 0.35rem;
  }

  .nav-link {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }

  .user-stats {
    font-size: 0.85rem;
  }
}

/* Responsive - Adjust layout for narrow screens (keep arrows visible for desktop) */
@media (max-width: 768px) {
  /* CRITICAL: Do NOT hide arrows based on width alone - desktop users may have narrow windows
     Arrows are hidden ONLY on actual touch devices via @media (hover: none) and (pointer: coarse) */

  /* CRITICAL: Ensure tent buttons remain visible and clickable */
  .tent-info-bottom {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  #gachaBtn,
  #wheelBtn,
  #shopBtn {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .top-nav {
    padding: 0 1rem;
  }

  .nav-brand {
    font-size: 1.2rem;
  }

  .nav-links {
    gap: 0.5rem;
  }

  .nav-link {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }

  .user-stats {
    font-size: 0.9rem;
    gap: 1rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
  }

  #galleryGrid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  /* Tiles roughly halve in width on mobile (200px → ~100px) but the fixed 20px
     frame corner does not, so the outer frame looked far rounder than the
     image's proportional 4.85% corner. Tighten the frame radius so the framed
     tile corners stay concentric with the card art on small screens. Applies to
     the gallery + the trade/UFT grids (all .slim-card-grid). */
  .slim-card-grid .card-item {
    border-radius: 12px;
  }

  .gallery-container {
    padding-right: 1rem;
    padding-left: 1rem;
    padding-bottom: 6rem;
  }

  .groups-container {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  #alphabetNav {
    margin: 0.75rem 0 0 !important;
    padding: 0 !important;
    border-radius: 12px !important;
  }

  #alphabetNav > .filter-scroll-shell > div {
    gap: 0.24rem !important;
    align-items: center !important;
  }

  .alphabet-btn {
    font-size: 1rem !important;
  }

  .alphabet-btn[data-letter="unclaimed"],
  .alphabet-btn[data-letter="training"],
  .alphabet-btn[data-letter="group-cards"] {
    padding: 0.6rem 1.4rem !important;
  }

  /* Collections era cards - ensure 3-4 cards per row on mobile */
  .era-cards {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.75rem;
  }

  .era-card {
    padding: 0.5rem;
    /* era cards shrink to ~90px on mobile but the 15px frame corner doesn't —
       tighten it so the frame stays concentric with the card art's 4.85% corner */
    border-radius: 10px;
  }

  .era-card-name {
    font-size: 0.7rem;
  }

  .pack-opening {
    min-width: 90%;
  }

  .pack-cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem;
  }

  .auctions-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.75rem !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Auction cards - ensure equal sizing on mobile */
  .auctions-grid .auction-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
  }

  /* Ensure the auctions container has symmetric padding */
  .auctions-container {
    padding: 2rem 1rem !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  /* Auction sections */
  #myAuctionsSection,
  #myAuctionsContent,
  #friendsAuctionsSection {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Sticker collection in library - responsive grid for tablets/mobile */
  .sticker-collection {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    padding: 0 1rem !important;
    box-sizing: border-box !important;
  }

  .sticker-set {
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .sticker-strip {
    max-width: 100% !important;
    overflow-x: auto !important;
  }

  .tent-interaction {
    min-width: 250px;
    padding: 1.5rem;
  }

  .tent-interaction {
    max-width: 280px;
    right: 5%;
  }

  .balloon-game-modal {
    width: 95vw;
    min-width: unset;
    max-width: 95vw;
    padding: 0.75rem;
  }

  .balloon-game-modal.mode-select-active,
  .memory-game-modal.mode-select-active {
    min-width: unset;
    width: fit-content;
    max-width: 95%;
  }

  .balloon-game-content {
    flex-direction: column;
  }

  .game-sidebar {
    width: 100%;
  }

  #charmShooterModal .game-sidebar {
    display: flex;
    flex-direction: column;
  }

  #charmShooterModal .balloon-game-content {
    align-items: center;
  }

  #charmShooterModal .game-main {
    width: 100%;
  }

  #charmShooterModal .charm-next-preview {
    order: 1;
    margin-top: 0 !important;
    margin-bottom: 0.75rem;
  }

  #charmShooterModal .game-info {
    order: 2;
  }

  #charmShooterModal .game-controls {
    order: 3;
  }

  #charmShooterModal #charmHowToPlay {
    order: 4;
  }

  .jigsaw-board {
    /* 6×48px cols, 8×51px rows → board = 288×408, ratio 0.706 ≈ card ratio */
    grid-template-columns: repeat(6, 48px);
    grid-template-rows: repeat(8, 51px);
    gap: 1px; /* tighter gap on mobile so pieces look larger */
  }

  .jigsaw-reference-toolbar:not([hidden]) {
    display: flex;
    justify-content: center;
    width: 301px;
    max-width: 100%;
    margin-top: -14px;
    margin-bottom: -14px;
  }

  .jigsaw-reference-hold:not([hidden]) {
    display: block;
    padding: 8px 12px;
    border: 2px solid #5b4c62;
    border-radius: 999px;
    background: #fff9f5;
    color: #5b4c62;
    box-shadow: 0 3px 8px rgba(91, 76, 98, 0.25);
    font: 700 0.85rem 'Courier New', monospace;
    touch-action: none;
    cursor: pointer;
  }

  .jigsaw-reference-hold:active { background: #ffd98d; }

  /* Override the desktop grid layout — stack as flex column with tray between board and sidebar */
  .jigsaw-game-modal .balloon-game-content {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .jigsaw-game-modal .game-main    { order: 1; width: 100%; }
  .jigsaw-game-modal .jigsaw-reference-toolbar { order: 2; }
  .jigsaw-game-modal .jigsaw-tray  { order: 3; }
  .jigsaw-game-modal .game-sidebar { order: 4; width: 100%; }

  /* Tray: 8 cols × 33px pieces — outer width matches the 301px board.
     The tray no longer scrolls; the whole modal-content scrolls instead.
     JS (jigsawGetTrayPieceSize) returns tw:33 for mobile to stay in sync. */
  .jigsaw-tray {
    grid-template-columns: repeat(8, 33px);
    gap: 2px;
    max-height: none;
    overflow-y: visible;
    margin-top: 0.5rem;
  }

  /* Modal scrolls so users can reach the sidebar below the tray */
  #jigsawGameModal .modal-content {
    overflow-y: auto;
  }


  .balloon-grid {
    max-width: 100%;
    padding: 6px;
    gap: 4px;
  }

  .balloon-cell {
    font-size: 1rem;
    padding: 4px;
  }

  .gem-catch-game-modal {
    width: 95vw;
    min-width: unset;
    max-width: 95vw;
    padding: 0.75rem;
  }

  .gem-catch-container {
    height: 400px;
  }

  .game-stat {
    padding: 0.75rem 1rem;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .memory-game-modal {
    width: min(100vw, 95vw);
    max-width: 95vw;
    max-height: 95vh;
    padding: 0.75rem;
  }

  .memory-game-content {
    flex-direction: column;
    gap: 0.75rem;
  }

  .memory-grid {
    grid-template-columns: repeat(7, minmax(46px, min(12vw, calc((100vh - 250px) / 9))));
    gap: 2px;
    padding: 4px;
  }

  .memory-card {
    font-size: 0.65rem;
    border-width: 1px;
  }

  .memory-card .card-back {
    font-size: 1rem;
  }

  .memory-card img {
    object-fit: cover;
  }

  .game-info {
    gap: 0.5rem;
  }

  .game-stat {
    padding: 0.5rem 0.75rem;
  }

  #charmCanvas {
    width: 100%;
    max-width: 400px;
    height: auto;
    aspect-ratio: 400 / 560;
  }
}

/* Scroll to Top Button */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.9);
  color: #8b6db8;
  border: none;
  border-radius: 50%;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(91, 76, 98, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding-bottom: 2px;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  background: rgba(255, 255, 255, 1);
  color: #5b4c62;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(91, 76, 98, 0.4);
}

/* ── Server clock (Tents tab, top-left) ───────────────────────────────── */
#serverClock {
  position: fixed;
  top: calc(var(--nav-height, 80px) + 12px);
  left: 14px;
  background: linear-gradient(135deg, rgba(255, 249, 245, 0.82) 0%, rgba(255, 243, 236, 0.76) 100%);
  color: #5b4c62;
  font-size: 0.95rem;
  font-family: 'Courier New', monospace;
  padding: 6px 13px;
  border-radius: 20px;
  box-shadow: 0 6px 18px rgba(91, 76, 98, 0.22);
  pointer-events: none;
  display: none;
  z-index: 100;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

#serverClock.visible {
  display: block;
}

@media (max-width: 768px) {
  #serverClock {
    font-size: 0.85rem;
    padding: 5px 11px;
    top: calc(var(--nav-height, 80px) + 8px);
    left: 10px;
  }

  .support-floating-btn {
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    left: calc(16px + env(safe-area-inset-left, 0px));
    justify-content: center;
    gap: 0;
    width: 56px;
    min-width: 56px;
    height: 56px;
    min-height: 56px;
    padding: 0;
  }

  .support-floating-icon {
    height: 1.85rem;
    width: 1.85rem;
    font-size: 1rem;
  }

  .support-floating-kicker {
    display: none;
  }

  .support-floating-copy {
    display: none;
  }

  .support-floating-label {
    display: none;
  }

  .tent-carousel-dots {
    bottom: 10px;
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
  }

  .tent-carousel-dot {
    width: 12px;
    height: 12px;
  }

  #supportModal .support-tier-grid {
    grid-template-columns: minmax(0, min(100%, 340px));
    justify-content: center;
  }

}

/* Clock format toggle buttons (Profile tab) */
.clock-format-btn,
.display-toggle-btn {
  padding: 0.4rem 1.4rem;
  border-radius: 20px;
  border: 2px solid #c9b4e8;
  background: #fff3ec;
  color: #5b4c62;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.clock-format-btn.clock-format-active,
.display-toggle-btn.clock-format-active {
  background: #5b4c62;
  color: #ffe0fa;
  border-color: #5b4c62;
}

.display-setting-description {
  color: #5b4c62;
  margin-bottom: 1rem;
  opacity: 0.8;
}

.display-setting-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.display-setting-group[hidden] {
  display: none;
}

#backgroundGradientSetting {
  width: 100%;
}

.display-setting-control {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

@media (max-width: 520px) {
  .display-setting-control {
    justify-content: center;
  }
}

/* ========================================
   RESPONSIVE DESIGN - VIEWPORT SCALING
   ======================================== */

/* Base root font size for rem scaling */
html {
  font-size: 16px; /* Base size for larger screens */
}

/* Scale down for smaller viewports */
@media (max-width: 1600px) {
  #mainView.festival-active {
    --festival-art-height: 92vh;
  }

  html {
    font-size: 15px;
  }

  .tent-svg {
    height: 92vh;
  }

  .top-nav {
    height: 65px;
  }
}

@media (max-width: 1400px) {
  #mainView.festival-active {
    --festival-art-height: 88vh;
  }

  html {
    font-size: 14px;
  }

  .tent-svg {
    height: 88vh;
  }

  .top-nav {
    height: 60px;
  }

  .tent-info-bottom {
    bottom: 12%;
  }
}

@media (max-width: 1200px) {
  #mainView.festival-active {
    --festival-art-height: 85vh;
  }

  html {
    font-size: 13px;
  }

  .tent-svg {
    height: 85vh;
  }

  .top-nav {
    height: 55px;
  }

  .nav-links {
    gap: 0.35rem;
  }

  .nav-link {
    padding: 0.4rem 0.65rem;
  }

  .tent-info-bottom {
    bottom: 11%;
  }
}

@media (max-width: 1024px) {
  #mainView.festival-active {
    --festival-art-height: 82vh;
  }

  html {
    font-size: 12px;
  }

  .tent-svg {
    height: 82vh;
  }

  .top-nav {
    height: 50px;
    padding: 0.5rem 1rem;
  }

  .nav-links {
    gap: 0.25rem;
  }

  .nav-link {
    padding: 0.35rem 0.55rem;
  }

  .stat-item {
    font-size: 0.8rem;
  }

  .tent-info-bottom {
    bottom: 10%;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 11px;
  }

  .modal {
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .modal.active {
    align-items: center;
  }

  .modal-content {
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    margin-top: 0;
    margin-bottom: 0;
  }

  /* Safe fallback nav height on mobile — the column-stacked nav is taller than the
     80px desktop default. JS (updateNavHeightVar) corrects this on every view switch,
     but this prevents a flash of content hidden behind the nav on first render. */
  :root {
    --nav-height: 160px;
  }

  /* Scale only the friends view to 80% — the user confirmed that 80% browser zoom
     gives comfortable spacing on this page.  Scoped here (not html/body) so the
     tent carousel is completely unaffected.
     padding-top is divided by 0.8 so that after zoom it equals exactly
     var(--nav-height), keeping content flush below the (unzoomed) fixed nav. */
  #friendsView {
    zoom: 0.8;
    /* padding-top divided by zoom so the zoomed value equals the actual nav height */
    padding-top: calc(var(--nav-height) / 0.8);
    /* 100dvh (dynamic viewport height) shrinks when Safari's bottom toolbar is
       visible, so the element always fills exactly the visible viewport after zoom.
       100vh fallback for browsers that don't support dvh. */
    height: calc(100vh / 0.8);
    height: calc(100dvh / 0.8);
  }

  /* Safari has a bug where padding-bottom on a child inside an overflow:auto
     container is ignored when computing the scrollable area. Using a ::after
     pseudo-element creates a real block spacer that Safari always respects.
     The height accounts for Safari's bottom toolbar (~83px) + home indicator
     (env safe-area-inset-bottom, ~34px), divided by 0.8 to offset the zoom. */
  #friendsView .friends-container::after {
    content: '';
    display: block;
    height: calc((8rem + env(safe-area-inset-bottom, 100px)) / 0.8);
  }

  .tent-svg {
    height: 90vh;
  }

  /* Position buttons above Safari's safe area - uses env() for iOS bottom bar */
  .tent-info-bottom {
    bottom: calc(28% + env(safe-area-inset-bottom, 0px));
  }

  /* Add extra padding to modal close buttons on mobile */
  .close-modal {
    top: max(1.5rem, calc(env(safe-area-inset-top) + 0.5rem));
    padding: 0;
    background: transparent;
    border-radius: 0;
    width: 40px;
    height: 40px;
    line-height: 1;
  }

  /* Compact mobile nav bar to prevent overlapping page content */
  .top-nav {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: auto;
    padding: max(0.5rem, env(safe-area-inset-top)) 1rem 0.5rem 1rem;
    gap: 0.5rem;
    grid-template-columns: 1fr; /* Override grid layout */
  }

  /* Keep brand compact */
  .nav-brand {
    font-size: 1rem;
    text-align: center;
    margin-bottom: 0.25rem;
  }

  /* Compact nav links */
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    order: 2; /* Put nav links after stats */
  }

  .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  /* Compact user stats */
  .user-stats {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    order: 1; /* Put stats before nav links */
    position: relative;
    width: 100%;
    padding-left: 0;
    min-height: 48px;
  }

  .user-stats .stat-item--merged {
    margin-inline: auto;
  }

  .user-stats .nav-account {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
  }

  .stat-item {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  /* Note: view padding-top is set dynamically via --nav-height CSS variable in JS */

  /* Library tabs - add top margin to prevent being hidden behind nav */
  .library-tabs {
    margin-top: 1rem;
    padding-top: 0.5rem;
  }

  .library-container {
    padding-top: 0.5rem;
  }

  /* Claw modal mobile styles */
  #clawGameModal .modal-content {
    max-width: 95vw !important;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1rem !important;
  }

  #clawGameModal .claw-modal-layout {
    flex-direction: column !important;
    align-items: center !important;
    gap: 1rem !important;
    display: flex !important;
  }

  #clawGameModal #clawGameArea {
    width: calc(100vw - 3rem) !important;
    max-width: 350px !important;
    height: min(400px, calc(90dvh - 18rem)) !important;
    min-height: 0 !important;
    margin: 0 auto;
  }

  #clawGameModal #clawImage {
    width: 400px !important;
    height: 400px !important;
    /* NOTE: Do NOT use !important on 'top' - it breaks JS grab animation */
  }

  /* Controls sidebar becomes full width below game on mobile */
  #clawGameModal .claw-controls-column {
    width: 100% !important;
    max-width: 350px !important;
  }

  /* Album shelf mobile styles - keep covers readable, with fewer per row */
  .album-shelf {
    grid-template-columns: repeat(2, 135px);
    justify-content: center;
    gap: 1rem 0.85rem;
    max-width: 100%;
    padding: 0 0.5rem;
  }

  .shelf-row {
    flex-wrap: wrap;
    gap: 0.85rem;
  }

  .album-slot {
    width: 135px;
  }

  .album-placeholder {
    width: 135px;
    height: 135px;
  }

  .album-placeholder img {
    max-width: 125px;
    max-height: 125px;
  }

  .album-slot p {
    font-size: 0.7rem;
  }

  .shelf-divider {
    max-width: 100%;
  }
}

@media (max-width: 900px) {
  /* Keep desktop layout but reduce font size for smaller screens/tablets */
  html {
    font-size: 12px;
  }

  .tent-svg {
    height: 68vh;
  }

  /* Note: tent-info-bottom positioning is handled in 768px and 600px breakpoints for mobile Safari */
}

@media (max-width: 600px) {
  /* Very small phones - further refinements */
  html {
    font-size: 10px;
  }

  .tent-svg {
    height: 85vh;
  }

  /* Position buttons above Safari's safe area on very small phones */
  .tent-info-bottom {
    bottom: calc(30% + env(safe-area-inset-bottom, 0px));
  }

  /* Further reduce nav spacing on very small screens */
  .top-nav {
    padding: 0.4rem 0.8rem;
  }

  .nav-brand {
    font-size: 0.9rem;
  }

  .nav-link {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
  }

  .stat-item {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
  }

  /* Note: view padding-top is set dynamically via --nav-height CSS variable in JS */

  /* Library tabs - tighter gap on very small screens */
  .library-tabs,
  .view-subtabs {
    gap: 0.5rem;
  }

  /* Make sure page titles are visible and consistent across all views */
  .page-title,
  .gallery-container h1,
  .groups-container h1,
  .friends-container h1,
  .profile-container h1 {
    margin-top: 1rem;
    font-size: 1.5rem;
  }

  /* Sub-tab buttons — smaller on mobile */
  .view-subtab,
  .library-tab {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  /* Card detail modal: remove min-width that causes edge-to-edge on small screens.
     Use calc so the modal always has equal margins for the nav arrows to sit in. */
  .card-detail {
    min-width: unset;
  }
  #cardModal .modal-content {
    /* 4rem total horizontal margin = 2rem each side; arrows sit at -1.5rem from edge */
    width: calc(100vw - 4rem);
    max-width: calc(100vw - 4rem);
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  .card-nav-arrow {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
  .card-nav-prev { left: -1.5rem; }
  .card-nav-next { right: -1.5rem; }

  /* Claw modal - smaller game area for very small phones */
  #clawGameModal #clawGameArea {
    width: calc(100vw - 2rem) !important;
    max-width: 300px !important;
    height: min(350px, calc(90dvh - 17rem)) !important;
  }

  #clawGameModal #clawImage {
    width: 350px !important;
    height: 350px !important;
    /* NOTE: Do NOT use !important on 'top' - it breaks JS grab animation */
  }

  /* Smaller buttons on very small phones */
  #clawGameModal button {
    padding: 0.6rem 1rem !important;
    font-size: 0.9rem !important;
  }

  #clawGameModal #clawLeftBtn,
  #clawGameModal #clawRightBtn {
    padding: 0.5rem 1rem !important;
    font-size: 1.5rem !important;
  }

  /* Album shelf - compact but still large enough to inspect artwork */
  .album-shelf {
    grid-template-columns: repeat(3, 112px);
    gap: 0.9rem 0.75rem;
  }

  .album-slot {
    width: 112px;
  }

  .album-placeholder {
    width: 112px;
    height: 112px;
  }

  .album-placeholder img {
    max-width: 104px;
    max-height: 104px;
  }

  .album-slot p {
    font-size: 0.65rem;
  }

  /* Consistent modal side margins: ensure minigame, leaderboard, and mode-select
     popups never go edge-to-edge. All minigame modals use 95vw / 0.75rem on mobile. */
  #minigamesModal .modal-content,
  .leaderboard-modal,
  .memory-game-modal {
    max-width: 95vw !important;
    width: min-content;
    min-width: min(95vw, 320px);
  }

  /* Trim the active Memory board on small phones. Mode selection uses the shared
     minigame dialog dimensions instead. */
  .memory-game-modal:not(.mode-select-active) {
    width: 95vw !important;
    padding: 0.5rem !important;
  }

  .memory-game-modal:not(.mode-select-active) h2 {
    font-size: 1rem !important;
    margin-bottom: 0.25rem !important;
  }

  .memory-grid {
    grid-template-columns: repeat(7, minmax(32px, min(11vw, calc((100vh - 160px) / 9)))) !important;
    gap: 1px !important;
    padding: 2px !important;
  }
}

@media (max-width: 480px) {
  .album-shelf {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem 0.45rem;
    width: 100%;
    max-width: 100%;
    padding: 0 0.5rem;
    box-sizing: border-box;
  }

  .album-slot {
    width: 100%;
    min-width: 0;
  }

  .album-placeholder {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .album-placeholder img {
    max-width: 92%;
    max-height: 92%;
  }

  .album-meta-row {
    gap: 0.2rem;
    min-height: 22px;
  }

  .album-count-pill,
  .album-meta-row .merge-btn {
    min-height: 20px;
    padding: 2px 4px;
    font-size: 0.52rem;
  }

  .album-display-toggle {
    top: 4px;
    right: 4px;
    width: 26px;
    height: 26px;
    font-size: 0.95rem;
  }
}

/* ==================== PHOTOCARD BOOK STYLES ==================== */

/* Gallery Tab Buttons */
.gallery-tab-btn {
  background: #fff3ec;
  color: #5b4c62;
  border: 2px solid #e88aa9;
  padding: 0.8rem 2rem;
  border-radius: 15px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Courier New', monospace;
}

.gallery-tab-btn:hover {
  background: #e88aa9;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.gallery-tab-btn.active {
  background: #e88aa9;
  color: white;
  box-shadow: 0 4px 12px rgba(232, 138, 169, 0.4);
}

/* Gallery Tab Content */
.gallery-tab-content {
  display: none;
}

.gallery-tab-content.active {
  display: block;
}

/* Photocard Book Container */
.photocard-book-container {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Photocard Book SVG - scale entire book container larger */
.photocard-book-svg-container {
  transform: scale(1.22);
  transform-origin: top center;
}

.book-wrapper {
  position: relative;
}

#leftPageSlots,
#rightPageSlots {
  overflow: hidden;
}

/* Book Cover */
.book-cover {
  width: 600px;
  height: 700px;
  margin: 0 auto;
  position: relative;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.book-cover:hover {
  transform: scale(1.02);
}

.book-spine {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 100%;
  background: linear-gradient(90deg, #5b4c62 0%, #7d6a82 50%, #5b4c62 100%);
  border-radius: 8px 0 0 8px;
}

.book-front-cover {
  position: absolute;
  left: 40px;
  top: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(135deg, #e88aa9 0%, #f5a8c3 50%, #e88aa9 100%);
  border-radius: 0 8px 8px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border: 3px solid #5b4c62;
}

/* Open Book */
.open-book {
  display: flex;
  justify-content: center;
  align-items: stretch;
  max-width: 1200px;
  margin: 0 auto;
  gap: 0;
}

.book-page {
  width: 550px;
  min-height: 700px;
  background: linear-gradient(135deg, #fff9f5 0%, #fff3ec 100%);
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  position: relative;
  border: 3px solid #5b4c62;
}

.left-page {
  border-radius: 8px 0 0 8px;
  border-right: none;
}

.right-page {
  border-radius: 0 8px 8px 0;
  border-left: none;
}

.book-middle {
  width: 20px;
  background: linear-gradient(90deg, #5b4c62 0%, #7d6a82 50%, #5b4c62 100%);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.page-content {
  position: relative;
  height: 100%;
}

.page-number {
  position: absolute;
  bottom: -1rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.9rem;
  color: #5b4c62;
  font-weight: bold;
}

/* Card Slots */
.card-slots {
  position: relative;
  min-height: 650px;
  padding: 1rem 0;
}

.card-slot {
  aspect-ratio: 3.6715 / 5.159;
  border-radius: 4.85% / 3.45%;
  background: rgba(93, 212, 222, 0.1);
  border: 3px dashed #5dd4de;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: absolute;
  overflow: hidden;
  width: 180px;
}

/* Scattered positioning and rotation for each slot */
.card-slot[data-slot="1"] {
  top: 5%;
  left: 8%;
  transform: rotate(-5deg);
}

.card-slot[data-slot="2"] {
  top: 3%;
  right: 12%;
  transform: rotate(3deg);
}

.card-slot[data-slot="3"] {
  top: 42%;
  left: 5%;
  transform: rotate(4deg);
}

.card-slot[data-slot="4"] {
  top: 45%;
  right: 8%;
  transform: rotate(-3deg);
}

.card-slot[data-slot="5"] {
  bottom: 2%;
  left: 50%;
  margin-left: -90px; /* Half of width to center */
  transform: rotate(-2deg);
}

.card-slot:hover {
  background: rgba(93, 212, 222, 0.2);
  border-color: #e88aa9;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.slot-placeholder {
  font-size: 3rem;
  color: #5dd4de;
  font-weight: bold;
  pointer-events: none;
}

.card-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4.85% / 3.45%;
}

.card-slot .remove-card-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(255, 255, 255, 0.9);
  color: #e74c3c;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  z-index: 10;
}

.card-slot:hover .remove-card-btn {
  display: flex;
}

.card-slot .remove-card-btn:hover {
  background: #e74c3c;
  color: white;
}

/* Stickers Layer */
.stickers-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 5;
}

.page-sticker {
  position: absolute;
  cursor: move;
  pointer-events: auto;
  transition: transform 0.1s ease;
}

.page-sticker img {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.page-sticker:hover {
  transform: scale(1.1);
  z-index: 10;
}

.page-sticker .remove-sticker-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  background: rgba(255, 255, 255, 0.95);
  color: #e74c3c;
  border: 2px solid #e74c3c;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 1rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  z-index: 20;
}

.page-sticker:hover .remove-sticker-btn {
  display: flex;
}

.page-sticker .remove-sticker-btn:hover {
  background: #e74c3c;
  color: white;
}

/* Page Navigation */
.book-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-top: 2rem;
}

.page-nav-btn {
  background: #e88aa9;
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Courier New', monospace;
}

.page-nav-btn:hover:not(:disabled) {
  background: #d4718f;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.page-nav-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.5;
}

/* Responsive Book Design */
@media (max-width: 1300px) {
  .book-page {
    width: 450px;
    min-height: 600px;
    padding: 1.5rem;
  }

  .card-slot {
    width: 150px;
  }

  .card-slot[data-slot="5"] {
    margin-left: -75px; /* Adjust for smaller width */
  }
}

@media (max-width: 1000px) {
  .open-book {
    flex-direction: column;
    align-items: center;
  }

  .book-page {
    width: 90%;
    max-width: 500px;
    min-height: 650px;
  }

  .left-page,
  .right-page {
    border-radius: 8px;
    border: 3px solid #5b4c62;
    margin-bottom: 2rem;
  }

  .book-middle {
    display: none;
  }

  .card-slot {
    width: 160px;
  }

  .card-slot[data-slot="5"] {
    margin-left: -80px; /* Adjust for smaller width */
  }
}

/* Mobile adjustments for photocard book title — on narrow screens the SVG
   renders with a taller aspect ratio so the title bar sits higher than 8% */
@media (max-width: 768px) {
  #pageTitle {
    top: 5.5% !important;
  }
}

/* Desktop adjustments for photocard book title alignment */
@media (min-width: 769px) {
  #pageTitle {
    top: 9.5% !important;
  }

  /* Cap sticker panel height so it never overflows the viewport.
     300px accounts for nav + library tabs + page title + spacing above the panel. */
  .sticker-panel-sidebar {
    max-height: calc(100vh - var(--nav-height) - 300px) !important;
  }

  #leftPageSlots,
  #rightPageSlots {
    top: 13% !important;
    height: 69% !important;
  }

  .book-card-slot[data-slot="3"] {
    top: 34.5% !important;
  }
}

/* Tablet adjustments for photocard book (768px) */
@media (max-width: 768px) {
  /* Stack book and sticker panel vertically on tablets */
  .book-and-sticker-layout {
    flex-direction: column !important;
    align-items: center !important;
  }

  /* Hide the left spacer on tablet/mobile — no longer needed */
  .book-layout-spacer {
    display: none !important;
  }

  /* Center the book */
  .photocard-book-svg-container {
    max-width: 100% !important;
    margin: 0 auto !important;
    flex: none !important;
  }

  /* Sticker panel below book on tablets */
  .sticker-panel-sidebar {
    position: static !important;
    width: 100% !important;
    max-width: 500px !important;
    margin: 0.5rem auto !important;
    max-height: 120px !important;
    padding: 0.5rem !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  /* Fix sticker panel white gap - hide header on tablets */
  .sticker-panel-sidebar > div:first-child {
    display: none !important;
  }

  /* Sticker panel horizontal layout on tablets */
  .sticker-panel-sidebar #stickerPanelContainer {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 0.5rem !important;
    align-items: center !important;
    padding: 0 !important;
  }

  /* Stickers smaller on tablets */
  .sticker-panel-sidebar .draggable-sticker {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    flex-shrink: 0 !important;
  }

  /* Set dividers vertical on tablets */
  .sticker-panel-sidebar .sticker-set-divider {
    width: 2px !important;
    height: 30px !important;
    background: #e88aa9 !important;
    flex-shrink: 0 !important;
  }

  /* Set headers vertical on tablets */
  .sticker-panel-sidebar .sticker-set-header {
    writing-mode: vertical-rl !important;
    font-size: 0.6rem !important;
    padding: 0.25rem !important;
    flex-shrink: 0 !important;
  }

  /* Set containers horizontal on tablets */
  .sticker-panel-sidebar .sticker-set-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 0.35rem !important;
    flex-shrink: 0 !important;
  }

  /* Page title positioning for tablets */
  #pageTitle {
    top: 9.5% !important;
    left: 76% !important;
    width: 10% !important;
    font-size: 0.5rem !important;
  }

  /* Placed stickers on book */
  .placed-sticker {
    width: 40px !important;
    height: 40px !important;
  }
}

@media (max-width: 600px) {
  .photocard-book-container {
    padding: 1rem;
  }

  .book-page {
    padding: 1rem;
  }

  .card-slots {
    min-height: 550px;
  }

  .card-slot {
    width: 130px;
  }

  .card-slot[data-slot="5"] {
    margin-left: -65px; /* Adjust for smaller width */
  }

  .gallery-tab-btn {
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
  }

  .page-nav-btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  /* Photocard Book SVG - Mobile Adjustments */
  .photocard-book-svg-container {
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    min-width: 320px !important;
  }

  /* Adjust left and right page slots for mobile - constrain to fit within book */
  #leftPageSlots,
  #rightPageSlots {
    top: 12.6% !important;
    height: 57% !important;
  }

  /* Adjust card slot widths on mobile - bigger to reduce empty space */
  .book-card-slot {
    width: 32.5% !important;
    max-width: 32.5% !important;
  }

  .book-card-slot[data-slot="3"] {
    top: 33% !important;
  }

  /* Page title font size for mobile */
  #pageTitle {
    font-size: 0.4rem !important;
  }

  /* Slot plus icon size */
  .slot-plus {
    font-size: 0.8rem !important;
  }

  /* Book and Sticker Panel Layout - Stack on mobile */
  .book-and-sticker-layout {
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
  }

  /* Hide left spacer on mobile */
  .book-layout-spacer {
    display: none !important;
  }

  /* Photocard book container - centered and full width on mobile for larger book */
  .photocard-book-svg-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    flex: none !important;
  }

  /* Sticker panel - horizontal scroll on mobile */
  .sticker-panel-sidebar {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 132px !important;
    max-height: 132px !important;
    margin-top: 1.5rem !important;
    padding: 0.6rem 0.5rem !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    background: rgba(255, 255, 255, 0.9) !important;
    display: flex !important;
    align-items: center !important;
    touch-action: pan-x !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Sticker panel container - horizontal layout, centered vertically */
  .sticker-panel-sidebar #stickerPanelContainer {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 0.75rem !important;
    overflow: visible !important;
    padding: 0 !important;
    min-width: max-content !important;
    align-items: center !important;
    margin: 0 !important;
    height: auto !important;
  }

  .sticker-panel-sidebar .book-sticker-pack {
    width: auto !important;
    min-width: max-content !important;
    padding: 0.2rem 0.2rem 0.35rem !important;
    flex: 0 0 auto !important;
  }

  /* Make stickers readable in the mobile tray */
  .sticker-panel-sidebar .draggable-sticker {
    flex-shrink: 0 !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    flex-basis: 42px !important;
    touch-action: pan-x !important;
  }

  /* Hide the header on mobile to save space */
  .sticker-panel-sidebar > div:first-child {
    display: none !important;
  }

  /* Set dividers in sticker panel - vertical line on mobile */
  .sticker-panel-sidebar .sticker-set-divider {
    width: 2px !important;
    height: 88px !important;
    min-height: 88px !important;
    background: #e88aa9 !important;
    margin: 0 0.25rem !important;
    flex-shrink: 0 !important;
  }

  /* Set headers in sticker panel - compact horizontal text on mobile */
  .sticker-panel-sidebar .sticker-set-header {
    writing-mode: horizontal-tb !important;
    text-orientation: initial !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 0 0.25rem !important;
    flex-shrink: 0 !important;
    font-size: 0.62rem !important;
    white-space: nowrap !important;
    gap: 0.4rem !important;
    justify-content: flex-start !important;
  }

  .sticker-panel-sidebar .sticker-pack-count {
    font-size: 0.44rem !important;
  }

  /* Set containers - compact two-row packs on mobile */
  .sticker-panel-sidebar .sticker-set-container {
    display: grid !important;
    grid-auto-flow: column !important;
    grid-template-rows: repeat(2, 42px) !important;
    grid-auto-columns: 42px !important;
    flex-shrink: 0 !important;
    gap: 0.5rem 0.45rem !important;
    margin: 0 !important;
    padding: 0.25rem 0.15rem 0 !important;
    align-items: center !important;
    overflow: visible !important;
  }

  .sticker-panel-sidebar .sticker-art {
    inset: 1px !important;
  }

  .sticker-panel-sidebar .sticker-count-pill {
    top: -1px !important;
    left: -1px !important;
    min-height: 14px !important;
    padding: 1px 3px !important;
    font-size: 0.4rem !important;
    line-height: 1.25 !important;
  }

  .sticker-panel-sidebar .draggable-sticker .sticker-merge-btn {
    bottom: -4px !important;
    min-height: 22px !important;
    padding: 4px 7px !important;
    font-size: 0.5rem !important;
    z-index: 20 !important;
  }

  /* Placed stickers on the book - smaller on mobile */
  .placed-sticker {
    width: 22px !important;
    height: 22px !important;
  }

  /* Fix sticker panel white gap at top - remove header margin/padding on mobile */
  .sticker-panel-sidebar > div:first-child {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    height: 0 !important;
  }

  /* Sticker panel container - center stickers vertically, remove top gap */
  .sticker-panel-sidebar #stickerPanelContainer {
    padding-top: 0 !important;
    margin-top: 0 !important;
    height: auto !important;
    align-items: center !important;
  }

  /* Sticker panel itself - keep spacing from jump-to-page */
  .sticker-panel-sidebar {
    border-top: none !important;
  }

  /* Page title positioning - align with tab asset on mobile */
  #pageTitle {
    top: 7.4% !important;
    left: 75.95% !important;
    width: 10.3% !important;
  }

  /* Keep duplicate mobile tray sticker rule in sync with the first override */
  .sticker-panel-sidebar .draggable-sticker {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    flex-basis: 42px !important;
  }

  /* Placed stickers smaller to match new draggable size */
  .placed-sticker {
    width: 22px !important;
    height: 22px !important;
  }

  /* Sticker collection in library - responsive grid for mobile */
  .sticker-collection {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    padding: 0 0.5rem !important;
    box-sizing: border-box !important;
  }

  .sticker-set {
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .sticker-strip {
    max-width: 100% !important;
    overflow-x: auto !important;
  }

  /* Photocard book - scale larger now that the in-SVG arrows are removed */
  .photocard-book-svg-container {
    transform: scale(1.35) !important;
    transform-origin: top center !important;
  }

  /* Clip the scaled book's horizontal overflow so the page doesn't grow a
     horizontal scrollbar for content that is visually inside the screen. */
  #libraryView {
    overflow-x: hidden !important;
  }

  /* Page indicator and jump controls - position above sticker menu */
  .photocard-book-svg-container + div {
    position: relative !important;
    z-index: 10 !important;
    margin-top: 8rem !important;
  }

  #bookPaginationBar {
    gap: 6px !important;
    margin-top: 0.65rem !important;
    padding: 5px 9px !important;
    font-size: 0.58rem !important;
  }

  #bookPrevBtn,
  #bookNextBtn {
    width: 30px !important;
    height: 30px !important;
    font-size: 0.62rem !important;
  }

  #bookPageInput {
    padding: 4px 6px !important;
    border-width: 2px !important;
  }

  /* Sticker panel - ensure it appears above scaled book content */
  .sticker-panel-sidebar {
    position: relative !important;
    z-index: 20 !important;
  }

  /* Tent SVG - larger on mobile for better visibility */
  .tent-svg {
    height: 92vh !important;
  }

  /* Auctions grid - equal columns on mobile */
  .auctions-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
    justify-content: center !important;
    justify-items: center !important;
  }

  #myAuctionsList,
  #friendsAuctionsList {
    grid-template-columns: 1fr 1fr !important;
    justify-content: center !important;
    justify-items: center !important;
  }

  .auction-card {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 170px !important;
  }
}

@media (max-width: 768px), (max-height: 500px) and (hover: none) and (pointer: coarse) {
  /* Include phones in landscape without changing desktop window sizing. */
  #mainView {
    overflow: hidden;
    overflow: clip;
    scrollbar-gutter: auto;
    touch-action: pinch-zoom;
  }

  #mainView .carousel {
    height: 100%;
    touch-action: pinch-zoom;
  }

  #mainView .carousel-slide {
    min-width: 100%;
    width: 100%;
    height: 100%;
  }

  /* Reserve measured space for buttons, cooldown text, dots, and the safe area. */
  #mainView {
    --tent-art-height: max(0px, calc(100% - var(--tent-actions-height, 80px) - 5.5rem - env(safe-area-inset-bottom, 0px)));
    --tent-art-offset: min(12rem, max(0px, calc((var(--tent-art-height) - 220px) / 2)));
  }

  #mainView .tent-info-bottom {
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  }

  #mainView .tent-svg {
    height: calc(var(--tent-art-height) - var(--tent-art-offset)) !important;
    top: calc((var(--tent-art-height) + var(--tent-art-offset)) / 2);
  }

  /* Keep October scenery and its apple hit area on the tent SVG's visible 16:9 art. */
  #mainView .october-festival-art,
  #mainView .october-background-ghosts,
  #mainView .october-apple-picker {
    width: auto;
    height: min(calc(var(--tent-art-height) - var(--tent-art-offset)), 56.25vw);
    top: calc((var(--tent-art-height) + var(--tent-art-offset)) / 2);
  }

  #mainView .tent-scene-ground {
    bottom: calc(-1 * max(20px, env(safe-area-inset-bottom)));
  }

  #mainView .tent-scene-tiles {
    bottom: calc(-1 * max(20px, env(safe-area-inset-bottom)));
  }

  #mainView.festival-active .carousel-slide::before,
  #mainView.festival-active .carousel-slide::after {
    width: 100%;
    height: calc(var(--tent-art-height) - var(--tent-art-offset));
    top: calc((var(--tent-art-height) + var(--tent-art-offset)) / 2);
    aspect-ratio: auto;
    background-size: contain;
  }
}

@media (min-width: 769px) and (max-width: 1100px) {
  #mainView {
    --festival-tent-layer-height: var(--festival-art-height, 85vh);
  }

  #mainView.festival-active .carousel-slide::before,
  #mainView.festival-active .carousel-slide::after,
  #mainView .october-festival-art,
  #mainView .october-background-ghosts,
  #mainView .october-apple-picker {
    width: min(calc(var(--festival-tent-layer-height) * 16 / 9), 100vw);
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

@media (min-width: 769px) and (max-width: 900px) {
  #mainView {
    --festival-tent-layer-height: 68vh;
  }
}

/* ── Leaderboard Modal ────────────────────────────────── */
.leaderboard-modal {
  max-width: 520px;
  background: var(--theme-modal-bg);
}

.leaderboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

#leaderboardTabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#leaderboardTabs .lb-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 0;
  width: 100%;
  padding-inline: 0.3rem;
}

#leaderboardTabs .lb-tab-icon {
  flex: none;
  font-size: 0.9rem;
  line-height: 1;
}

@media (max-width: 480px) {
  #leaderboardTabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.lb-tab {
  flex: 1 1 auto;
  padding: 0.45rem 0.6rem;
  border: 2px solid rgba(91, 76, 98, 0.2);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.4);
  color: #5b4c62;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.lb-tab:hover {
  background: rgba(255, 255, 255, 0.65);
}

.lb-tab.active {
  background: #5b4c62;
  color: #fff;
  border-color: #5b4c62;
}

.leaderboard-score-label {
  font-size: 0.75rem;
  color: #9b8aa8;
  text-align: center;
  margin-bottom: 0.75rem;
  font-style: italic;
}

.leaderboard-content {
  min-height: 120px;
}

.lb-table-scroll {
  max-height: min(420px, 52vh);
  overflow-y: auto;
  border-bottom: 1px solid rgba(155, 138, 168, 0.18);
}

.lb-loading,
.lb-empty {
  text-align: center;
  color: #9b8aa8;
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.lb-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(135deg, rgba(247, 154, 181, 0.24) 0%, rgba(247, 154, 181, 0.15) 100%);
  text-align: left;
  padding: 0.4rem 0.6rem;
  color: #9b8aa8;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid rgba(155, 138, 168, 0.25);
}

.lb-table tbody tr {
  border-bottom: 1px solid rgba(155, 138, 168, 0.15);
  transition: background 0.1s;
}

.lb-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.35);
}

.lb-table tbody tr.lb-me {
  background: rgba(247, 154, 181, 0.2);
  font-weight: 700;
}

.lb-table td {
  padding: 0.5rem 0.6rem;
  color: #5b4c62;
}

.lb-rank {
  width: 2.5rem;
  font-size: 1rem;
  text-align: center;
}

.lb-username {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  font-weight: 700;
  color: #7a5c8a;
}

.lb-date {
  color: #9b8aa8;
  font-size: 0.8rem;
  white-space: nowrap;
}

.lb-user-entry {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: rgba(247, 154, 181, 0.15);
  border: 1px dashed rgba(155, 138, 168, 0.4);
  border-radius: 10px;
  font-size: 0.85rem;
  color: #5b4c62;
}

.lb-user-rank {
  font-weight: 700;
  color: #7a5c8a;
  white-space: nowrap;
}

.lb-not-ranked {
  justify-content: center;
  font-style: italic;
  color: #9b8aa8;
}

.header-gradient-btn,
.tag-color-btn {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  overflow: hidden;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  box-shadow: none;
  outline: none;
  border: 3px solid transparent;
  border-radius: 50%;
}

.custom-gradient-color-row {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  width: 100%;
}

.custom-gradient-color-btn {
  width: 34px;
  height: 34px;
  border: 3px solid transparent;
  border-radius: 50%;
  box-shadow: none;
  cursor: pointer;
}

.custom-gradient-color-btn.active {
  border-color: #5b4c62;
  box-shadow: none;
  transform: scale(1.08);
}

/* ============================================================
   OZOZ PET SYSTEM
   ============================================================ */

.ozoz-nav-btn {
  font-size: 1.1rem;
  margin-right: 4px;
}

.ozoz-hungry-badge {
  background: #e05555;
  font-weight: bold;
  font-size: 0.65rem;
}

/* Modal */
.ozoz-modal-content {
  max-width: 560px;
  width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.5rem;
  border-radius: 24px;
  background: var(--theme-modal-bg);
  box-shadow: 0 8px 32px rgba(91, 76, 98, 0.18);
  position: relative;
}

.ozoz-tab-panel {
  animation: fadeIn 0.2s ease;
}

/* Sprite area — two-tone teal scene using site palette */
.ozoz-sprite-area {
  --ozoz-ground-h: 50px;
  touch-action: pan-y;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 1rem;
  /* Site teal palette: light teal → main teal (#5dd4de) */
  background: linear-gradient(180deg, #e0f9fb 0%, #5dd4de 100%);
  min-height: 220px;
  box-shadow: inset 0 -4px 12px rgba(0,0,0,0.1), 0 4px 16px rgba(93,212,222,0.2);
}

/* Clouds — float in the upper sky, behind trees */
.ozoz-cloud {
  position: absolute;
  width: 50%;
  height: auto;
  pointer-events: none;
  z-index: 0;
}
.ozoz-cloud-1 { top: 4%;  left: 2%; }
.ozoz-cloud-2 { top: 10%; right: 2%; }

/* Trees — absolutely positioned, edges flush, bottom at ground plane */
.ozoz-tree {
  position: absolute;
  top: 0;
  height: calc(100% - var(--ozoz-ground-h));
  width: auto;
  pointer-events: none;
  z-index: 0;
}
.ozoz-tree-left  { left: 0; }
.ozoz-tree-right { right: 0; }

.ozoz-sprite {
  height: 175px;
  width: auto;
  object-fit: contain;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.15));
  margin-top: 20px;
  z-index: 2;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s;
}
.ozoz-sprite:hover { transform: scale(1.04); }
.ozoz-sprite:active { transform: scale(0.96); }
.ozoz-sprite.already-petted { cursor: default; }
.ozoz-sprite.already-petted:hover { transform: none; }
.ozoz-sprite.expedition-leaving {
  pointer-events: none;
  animation: ozozExpeditionLeave 0.8s ease-in forwards;
}
.ozoz-sprite.expedition-away {
  pointer-events: none;
  opacity: 0;
  transform: translateX(-190px);
}
.ozoz-sprite.expedition-returning {
  pointer-events: none;
  animation: ozozExpeditionReturn 0.7s ease-out forwards;
}

@keyframes ozozExpeditionLeave {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(-190px); opacity: 0; }
}

@keyframes ozozExpeditionReturn {
  0% { transform: translateX(190px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

/* Petting hearts animation */
.ozoz-pet-hearts {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.5rem;
  pointer-events: none;
  animation: ozozHeartsFloat 1s ease-out forwards;
  z-index: 10;
}

@keyframes ozozHeartsFloat {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-55px) scale(1.4); }
}

.ozoz-poop {
  position: absolute;
  bottom: 42px;
  right: 32px;
  height: 48px;
  cursor: pointer;
  animation: ozozWobble 1s infinite ease-in-out;
  z-index: 2;
}

@keyframes ozozWobble {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

/* Ground strip */
.ozoz-ground {
  width: 100%;
  margin-top: auto;
  background: #b7ce84;
  height: 50px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* Food bowl — sits on the ground, clickable to feed */
.ozoz-bowl {
  height: 38px;
  width: auto;
  cursor: pointer;
  transition: transform 0.2s, filter 0.2s;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.ozoz-bowl:hover:not(.bowl-full) { transform: scale(1.12) rotate(-3deg); }
.ozoz-bowl.bowl-full { filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15)) saturate(0.3) brightness(0.85); cursor: default; }

.ozoz-form-name {
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  font-weight: bold;
  color: #5b4c62;
  margin-bottom: 0.75rem;
  background: rgba(255,255,255,0.7);
  display: inline-block;
  padding: 4px 16px;
  border-radius: 20px;
  border: 1.5px solid rgba(91,76,98,0.15);
  align-self: center;
}
/* wrapper needed to center the inline-block */
#ozozFormName {
  display: block;
  text-align: center;
}

/* Stats */
.ozoz-stats {
  background: rgba(255,255,255,0.6);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ozoz-stat-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
}

.ozoz-stat-label {
  min-width: 100px;
  color: #5b4c62;
}

.ozoz-stat-val {
  color: #5b4c62;
  font-weight: bold;
}

.ozoz-progress-bar {
  flex: 1;
  margin-bottom: 0;
}

.ozoz-progress-fill {
  transition: width 0.4s ease;
}

.ozoz-run-stat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.35rem;
  min-width: 0;
  color: #5b4c62;
  font-weight: bold;
}

.ozoz-run-stat-value,
.ozoz-run-stat-separator {
  color: #5b4c62;
  font-size: 0.82rem;
  font-weight: bold;
}

.ozoz-run-stat-separator {
  opacity: 0.55;
}

.ozoz-run-stat-empty {
  color: #888;
  font-size: 0.76rem;
  font-style: italic;
}

.ozoz-hunger-status {
  font-weight: bold;
  font-size: 0.82rem;
  border-radius: 10px;
  padding: 2px 10px;
}

.ozoz-hunger-status.hungry {
  background: #fde8e8;
  color: #c0392b;
}

.ozoz-hunger-status.full {
  background: #eaf7ea;
  color: #a8c67f;
}

/* Actions */
.ozoz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.ozoz-modal-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pet-variant-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 10px 0 16px;
}
.pet-variant-dots[hidden], #ozozPetDetails[hidden], .pet-unlock-panel[hidden] { display: none; }
.pet-variant-dots .tent-carousel-dot { min-width: 14px; min-height: 14px; }
.pet-variant-dots .tent-carousel-dot:disabled { cursor: wait; opacity: 0.5; }
.pet-viewport-name {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.85);
  color: #5b4c62;
  font-weight: 700;
  font-size: 0.8rem;
}
.pet-adopt-prompt {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  width: min(82%, 290px);
  padding: 16px;
  box-sizing: border-box;
  border-radius: 16px;
  background: rgba(255,255,255,0.94);
  text-align: center;
  color: #5b4c62;
  box-shadow: 0 4px 14px rgba(91,76,98,0.12);
}
.pet-adopt-prompt p { margin: 0 0 12px; font-weight: 600; }
.pet-adopt-prompt button { margin: 0 auto; }
.pet-sprite-placeholder {
  position: absolute; top: 62px; z-index: 2; border: 0; background: transparent;
  color: #5b4c62; cursor: pointer; display: flex; flex-direction: column; align-items: center;
}
.pet-sprite-placeholder span { font-size: 3.5rem; }
.pet-sprite-placeholder small { background: #fff; border-radius: 10px; padding: 3px 8px; }
.pet-sprite-placeholder[hidden] { display: none; }
.pet-unlock-button { padding: 4px; }
.pet-unlock-button:hover { transform: none; }
.pet-unlock-panel { margin-bottom: 14px; padding: 14px; border-radius: 14px; background: var(--theme-modal-bg); border: 1px solid #dccde7; }
.pet-unlock-panel h3 { margin: 0 0 6px; }
.pet-unlock-panel p, .pet-unlock-card small { font-size: 0.78rem; line-height: 1.5; }
#petUnlockList { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pet-unlock-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,0.55); text-align: center; }
.pet-unlock-preview-frame { position: relative; width: 100%; height: 110px; overflow: hidden; }
.pet-unlock-preview { position: absolute; bottom: 0; left: 50%; width: 225px; max-width: none; height: 180px; transform: translateX(-50%); object-fit: contain; image-rendering: pixelated; }
.pet-unlock-card small { display: block; margin-bottom: 4px; }
.pet-unlock-card .pet-unlock-action { width: 100%; min-height: 40px; margin-top: auto; padding: 8px; }
@media (max-width: 480px) {
  #petUnlockList { gap: 8px; }
  .pet-unlock-card { padding: 10px 6px; }
  .pet-unlock-card .pet-unlock-action { font-size: 0.65rem; }
}
/* Override global absolute positioning for the × inside the ozoz header */
.ozoz-modal-header .close-modal {
  position: static;
  top: auto;
  right: auto;
}

.modal-content .modal-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.modal-content .modal-title-row > h2 {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
  overflow-wrap: anywhere;
}
.modal-content .modal-title-row > .close-modal {
  position: static !important;
  flex: 0 0 auto;
  margin: 0;
}

/* Auth dialogs have an edge-to-edge striped header, unlike padded body dialogs. */
.login-modal > .modal-title-row {
  box-sizing: border-box;
  min-height: 104px;
  padding: 24px;
  margin-bottom: 0;
  border-bottom: 4px solid #5b4c62;
  background: repeating-linear-gradient(90deg, #f79ab5 0 36px, #ffd98d 36px 72px, #5dd4de 72px 108px);
}
.login-modal > .modal-title-row > h2 {
  background: none;
  border-bottom: 0;
}
.ozoz-modal-header > .ozoz-gear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  box-sizing: border-box;
}

.ozoz-gear-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.65;
  transition: opacity 0.15s, transform 0.2s;
}
.ozoz-gear-btn:hover { opacity: 1; transform: rotate(30deg); }

.minigame-help-header .minigame-help-btn {
  width: 36px;
  height: 36px;
  color: var(--theme-control-text);
  font-family: 'Courier New', monospace;
  font-weight: bold;
}
.minigame-help-header .minigame-help-btn:hover { transform: none; }
.minigame-help-header .close-modal { position: static !important; }
.minigame-help-panel[hidden] { display: none; }
.minigame-help-panel .minigame-how-to[hidden] { display: none; }
.minigame-help-panel .minigame-how-to,
.minigame-help-panel .claw-how-to-panel { margin: 0; padding: 0; background: none; border: 0; box-shadow: none; line-height: 1.6; }
.minigame-help-panel > :not(:first-child) { margin-top: 1rem; }
.ozoz-toggle input:focus-visible + .ozoz-toggle-slider { outline: 2px solid var(--theme-control-text); outline-offset: 3px; }

.ozoz-settings-panel {
  background: rgba(255,255,255,0.75);
  border: 1.5px solid #e0c8f0;
  border-radius: 16px;
  padding: 1rem 1.1rem 0.9rem;
  margin-bottom: 1rem;
  animation: fadeIn 0.15s ease;
}
.minigame-help-panel.ozoz-settings-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.minigame-help-panel :is(.minigame-how-to, .claw-how-to-panel) {
  background: transparent !important;
  color: var(--theme-text) !important;
}
.ozoz-settings-title {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.85rem;
  color: #5b4c62;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ozoz-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.ozoz-settings-label {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: #5b4c62;
}
.ozoz-settings-divider {
  height: 1px;
  background: #e0c8f0;
  margin: 0.75rem 0;
}
.ozoz-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.ozoz-toggle input { opacity: 0; width: 0; height: 0; }
.ozoz-toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s;
}
.ozoz-toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.ozoz-toggle input:checked + .ozoz-toggle-slider { background: #5dd4de; }
.ozoz-toggle input:checked + .ozoz-toggle-slider::before { transform: translateX(18px); }

.ozoz-abandon-btn {
  background: none;
  border: 1.5px solid #c0607a;
  border-radius: 12px;
  padding: 0.4rem 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: #c0607a;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s, color 0.15s;
}
.ozoz-abandon-btn:hover { background: #c0607a; color: #fff; }
.ozoz-abandon-note {
  font-size: 0.7rem;
  color: #999;
  margin: 0.35rem 0 0;
  text-align: center;
  font-family: 'Courier New', monospace;
}

.ozoz-action-btn {
  background: linear-gradient(135deg, #f9b8df 0%, #e88ecb 100%);
  border: none;
  border-radius: 14px;
  padding: 0.5rem 1.1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  font-weight: bold;
  color: #5b4c62;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.ozoz-action-btn:hover:not(:disabled) { opacity: 0.85; transform: scale(1.03); }
.ozoz-action-btn:disabled { opacity: 0.5; cursor: default; }

.ozoz-reset-btn {
  background: linear-gradient(135deg, #ddd 0%, #bbb 100%);
  color: #555;
}

.ozoz-explore-panel {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  margin: 0.45rem 0 0.75rem;
  padding: 0.65rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.4);
}

.ozoz-explore-btn {
  min-width: 128px;
  background: linear-gradient(135deg, #5dd4de 0%, #9ce7ee 100%);
}

.ozoz-explore-status,
.ozoz-explore-result {
  max-width: 100%;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 0.76rem;
  line-height: 1.25;
  text-align: center;
}

.ozoz-explore-result {
  color: #6b5773;
  font-weight: 700;
  gap: 0.35rem;
}

.ozoz-expedition-route {
  color: #4b8790;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.25;
}

.ozoz-expedition-dialog {
  font-style: italic;
}

.ozoz-expedition-rewards {
  display: grid;
  justify-items: center;
  gap: 0.18rem;
  margin-top: 0.1rem;
}

.ozoz-expedition-rewards-label {
  color: #5b4c62;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.58rem;
  line-height: 1.4;
  text-transform: uppercase;
  margin-bottom: 0.08rem;
}

.ozoz-expedition-reward {
  color: #5b4c62;
  font-weight: 900;
  line-height: 1.3;
}

/* Toys inventory */
.ozoz-toys-inventory {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: #5b4c62;
}

.ozoz-toy-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0.5rem 0.75rem;
  border-radius: 14px;
  background: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
  border: 2px solid transparent;
  user-select: none;
}

.ozoz-toy-item:hover:not(.ozoz-toy-empty) {
  background: #fddff0;
  border-color: #f9b8df;
  transform: scale(1.07);
}

.ozoz-toy-item.ozoz-toy-empty {
  opacity: 0.4;
  cursor: default;
}

.ozoz-toy-icon {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.ozoz-toy-label {
  font-size: 0.72rem;
  color: #5b4c62;
  font-weight: bold;
}

.ozoz-toy-buy-btn {
  margin-top: 4px;
  padding: 5px 9px;
  border: 0;
  border-radius: 999px;
  background: #ffd98d;
  color: #5b4c62;
  font: 900 0.72rem 'Courier New', monospace;
  box-shadow: 0 3px 0 rgba(91, 76, 98, 0.18);
  cursor: pointer;
}

.ozoz-toy-buy-btn:disabled {
  opacity: 0.48;
  cursor: default;
}

/* Next feed timer */
.ozoz-next-feed {
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  color: #888;
  margin-bottom: 0.5rem;
}

html:is([data-theme="grey"], [data-theme="festival-october-harvest"]) .ozoz-next-feed {
  color: #fff3ec;
}

.ozoz-feed-rarity-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.ozoz-rarity-btn {
  padding: 0.3rem 0.75rem;
  border: 2px solid #5dd4de;
  border-radius: 10px;
  background: #fff3ec;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.ozoz-rarity-btn.active {
  background: #5dd4de;
  color: #fff;
}

.ozoz-rarity-btn:hover:not(.active) { background: #e0f9fb; }

/* Dupes toggle button — uses a separator gap and a warm active color so it reads
   as a separate filter rather than another rarity option */
.ozoz-dupes-btn {
  margin-left: 0.5rem;
  border-color: #f79ab5;
}
.ozoz-dupes-btn.active {
  background: #f79ab5;
  color: #fff;
}
.ozoz-dupes-btn:hover:not(.active) { background: #fde8f0; }

/* Feed card modal (card-picker style) */
.ozoz-feed-modal-content {
  max-width: 720px;
  width: 94vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem;
  border-radius: 20px;
  background: var(--theme-modal-bg);
}

.ozoz-feed-search {
  padding: 0.6rem 1rem;
  border: 2px solid #5dd4de;
  border-radius: 10px;
  background: #fff3ec;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 1rem;
}

.ozoz-feed-search-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.ozoz-feed-search-row .ozoz-feed-search {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
}

.ozoz-feed-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem;
  max-height: 460px;
  overflow-y: auto;
  padding: 1rem;
  background: #fce4d8;
  border-radius: 10px;
}

.ozoz-feed-card-item {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid transparent;
  border-radius: 4.85% / 3.45%;
}

.ozoz-feed-card-item:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(91, 76, 98, 0.3);
  border-color: #e88ecb;
}

.ozoz-feed-count-badge {
  position: absolute;
  bottom: 5%;
  right: 4%;
  background: rgba(91, 76, 98, 0.82);
  color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 1px 5px;
  border-radius: 6px;
  pointer-events: none;
  line-height: 1.4;
}

/* Profile-picture card picker — bare card art (no thick white .card-item frame),
   styled like the Ozoz feed card picker: transparent border → pink on hover,
   teal when selected. */
.profile-card-selector {
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid transparent;
  border-radius: 4.85% / 3.45%;
}

.profile-picture-type-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.profile-picture-filterbar {
  width: 100%;
}

.profile-picture-filterbar .profile-picture-type-tabs {
  margin-bottom: 0;
}

.profile-picture-filterbar .search-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.profile-picture-filterbar .search-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.profile-picture-control-row {
  margin-bottom: 1rem;
}

.profile-picture-search-group {
  flex: 1 1 220px;
  min-width: 0;
}

.profile-picture-modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: 1.5rem;
  align-items: start;
}

#profilePictureModal .modal-content {
  width: min(900px, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  box-sizing: border-box;
}

.profile-card-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  max-height: 500px;
  overflow-y: auto;
  padding: 1rem;
  background: var(--theme-input-bg);
  border-radius: 10px;
  box-shadow: inset 0 2px 10px var(--theme-shadow);
}

@media (max-width: 760px) {
  .profile-picture-modal-layout {
    grid-template-columns: 1fr;
  }

  .profile-picture-filterbar {
    flex-wrap: wrap;
  }
}

.profile-picture-type-tab {
  flex: 0 0 auto;
  padding: 0.6rem 1rem;
  border: 2px solid var(--theme-accent-2);
  border-radius: 15px;
  background: var(--theme-input-bg);
  color: var(--theme-control-text);
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-weight: bold;
}

.profile-picture-type-tab.active {
  background: #5dd4de;
  color: white;
}

.profile-album-selector {
  border-radius: 8px;
}

.profile-picture-type-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 1;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(91, 76, 98, 0.85);
  color: white;
  font-size: 0.55rem;
  font-weight: bold;
  line-height: 1;
  pointer-events: none;
}

.profile-card-selector:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(91, 76, 98, 0.3);
  border-color: #e88ecb;
}

.profile-card-selector.selected,
.profile-card-selector.selected:hover {
  border-color: #5dd4de;
}


/* ============================================================
   OZOZ TOKENS (Profile tab)
   ============================================================ */

.profile-collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.profile-badges-controls {
  margin-bottom: 1rem;
}

.profile-badge-card[hidden] {
  display: none;
}

.profile-collection-card {
  display: grid;
  justify-items: center;
  align-content: start;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  min-height: 188px;
  padding: 1rem 0.75rem;
  border: 1.5px solid rgba(91, 76, 98, 0.14);
  border-radius: 16px;
  background: linear-gradient(160deg, #fff9f5 0%, #fff0f6 100%);
  box-shadow: 0 6px 16px rgba(91, 76, 98, 0.08);
  font-family: 'Courier New', monospace;
}

.token-card.token-discovered {
  background: linear-gradient(160deg, #fff5fb 0%, #f5e0f5 100%);
}

.token-card.token-locked {
  background: rgba(0, 0, 0, 0.05);
}

.token-img-wrap {
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.token-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.token-img-locked {
  filter: grayscale(100%) brightness(0.35);
}

.token-name {
  font-size: 0.8rem;
  font-weight: bold;
  color: #5b4c62;
  text-align: center;
}

.profile-reward-claim-btn {
  margin-top: 4px;
  padding: 4px 10px;
  background: linear-gradient(135deg, #f9b8df 0%, #e88ecb 100%);
  border: none;
  border-radius: 10px;
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
  font-weight: bold;
  color: #5b4c62;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.profile-reward-claim-btn:hover:not(:disabled) { opacity: 0.85; transform: scale(1.04); }
.profile-reward-claim-btn:disabled { opacity: 0.5; cursor: default; }

.training-boost-text,
.token-claimed-label,
.profile-badge-claimed-label {
  color: #6f8f3f;
  font-weight: bold;
  white-space: nowrap;
}

.select-checkbox {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 30px;
  height: 30px;
  border: 3px solid #fff;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  font-weight: bold;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.select-checkbox.is-selected {
  background: #5dd4de;
}

.select-checkbox.has-count {
  font-size: 0.8rem;
}

.token-claimed-label,
.profile-badge-claimed-label {
  margin-top: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
}

/* ============================================================
   PROFILE BADGES
   ============================================================ */

.profile-subtab-panel {
  display: none;
  padding: 2rem;
  max-width: 1000px;
  margin: 0 auto;
}

.profile-subtab-description {
  color: #888;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  margin: 0 0 1.5rem;
  text-align: center;
}

.profile-badge-card {
  background: linear-gradient(160deg, #fff9f5 0%, #fff0f6 100%);
}

.profile-badge-art {
  width: 112px;
  height: 123px;
  display: grid;
  place-items: center;
}

.profile-badge-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.bounty-badge-preview {
  width: 64px;
  height: 70px;
  object-fit: contain;
  flex-shrink: 0;
}

.profile-badge-fallback {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(91, 76, 98, 0.08);
  color: #5b4c62;
  font-family: 'Press Start 2P', monospace;
  font-size: 1.2rem;
}

.profile-badge-name {
  max-width: 100%;
  color: #5b4c62;
  font-weight: bold;
  font-size: 0.86rem;
  text-align: center;
  overflow-wrap: anywhere;
}

.profile-badge-earned {
  color: #777;
  font-size: 0.74rem;
  text-align: center;
  line-height: 1.35;
}

.profile-collection-message,
.profile-collection-empty {
  grid-column: 1 / -1;
  padding: 2rem;
  border: 1.5px dashed rgba(91, 76, 98, 0.16);
  border-radius: 16px;
  background: rgba(255, 249, 245, 0.72);
  color: #5b4c62;
  text-align: center;
  font-family: 'Courier New', monospace;
}

.profile-collection-empty h3 {
  margin: 0 0 0.6rem;
  color: #5b4c62;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.82rem;
}

.profile-collection-empty p {
  margin: 0;
  color: #777;
  font-size: 0.86rem;
  font-weight: bold;
}

.profile-badges-error {
  color: #b85678;
}

/* ============================================================
   OZOZ + TOKENS — MOBILE RESPONSIVE
   ============================================================ */

/* Ozoz modal: scale down sprite area on small screens */
@media (max-width: 480px) {
  .ozoz-modal-content {
    width: 98vw;
    padding: 1rem;
    border-radius: 18px;
    max-height: 92dvh;
  }

  .ozoz-sprite-area {
    min-height: 185px;
    border-radius: 14px;
  }

  .ozoz-sprite {
    height: 140px;
    margin-top: 16px;
  }

  .ozoz-poop {
    height: 38px;
    right: 20px;
    bottom: 36px;
  }

  .ozoz-sprite-area { --ozoz-ground-h: 42px; }

  .ozoz-ground {
    height: 42px;
    padding: 0 14px;
  }

  .ozoz-bowl { height: 30px; }

  .ozoz-toys-inventory {
    gap: 0.6rem;
  }

  .ozoz-toy-item {
    padding: 0.4rem 0.55rem;
  }

  .ozoz-toy-icon { height: 36px; }

  .ozoz-action-btn {
    padding: 0.45rem 0.9rem;
    font-size: 0.78rem;
  }

  /* Tokens: 2 columns on small phones */
  .profile-collection-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .token-img-wrap {
    width: 80px;
    height: 80px;
  }

  .token-name { font-size: 0.72rem; }
}

/* Tokens: 3 columns on medium phones (landscape or larger) */
@media (min-width: 481px) and (max-width: 680px) {
  .profile-collection-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .token-img-wrap {
    width: 90px;
    height: 90px;
  }
}

/* Feed card grid: fewer columns on small screens */
@media (max-width: 480px) {
  .ozoz-feed-modal-content {
    width: 98vw;
    padding: 1rem;
    border-radius: 18px;
    max-height: 92dvh;
    overflow-y: auto;
  }

  .ozoz-feed-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    gap: 0.5rem;
    padding: 0.75rem;
    max-height: 55dvh;
  }
}

/* ── Daily Login Modal ───────────────────────────────────────────────────── */
.daily-login-modal {
  max-width: 600px;
  text-align: center;
}
.daily-login-streak-text,
.collection-artist-era-stats {
  color: var(--theme-text);
  font-size: 1rem;
}
.daily-login-streak-text {
  margin: 0.25rem 0 1rem;
}
.daily-login-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
  margin: 1rem 0;
}
.daily-login-day,
.reward-day-tile {
  background: var(--theme-input-bg);
  border: 2px solid var(--theme-border-strong);
  border-radius: 10px;
  padding: 0.5rem 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: var(--theme-control-text);
  font-weight: bold;
  position: relative;
  min-height: 80px;
  justify-content: center;
}
.daily-login-day.current,
.reward-day-tile.current {
  border-color: var(--theme-accent-3);
  background: var(--theme-input-bg);
  box-shadow: 0 0 10px color-mix(in srgb, var(--theme-accent-3) 60%, transparent);
}
.daily-login-day.claimed,
.reward-day-tile.claimed {
  opacity: 0.5;
  background: #e0e0e0;
}
.daily-login-day.future,
.reward-day-tile.future {
  opacity: 0.6;
}
.daily-login-day .day-label,
.reward-day-tile .day-label {
  font-size: 0.65rem;
  color: #888;
}
.daily-login-day .reward-icon,
.reward-day-tile .reward-icon {
  font-size: 1.4rem;
  line-height: 1;
}
.daily-login-day .reward-amount,
.reward-day-tile .reward-amount {
  font-size: 0.7rem;
  font-weight: bold;
  color: var(--theme-control-text);
}
.claimed-check,
.reward-day-tile .claimed-check {
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 0.75rem;
  color: var(--theme-control-text);
}
.shard-daily-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.shard-daily-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25));
}
.shard-daily-icon:not(:first-child) {
  margin-left: -5px;
}
.daily-login-claim-btn {
  margin-top: 0.5rem;
  font-size: 1rem;
  padding: 0.75rem 2rem;
}
.daily-login-claim-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.site-confirm-btn,
.action-btn--accent,
.user-btn,
.login-form .action-btn,
.crafting-assemble-btn,
.training-btn.training-start,
.close-pack-btn,
.daily-login-claim-btn {
  background: var(--theme-button-accent-bg) !important;
  color: var(--theme-button-accent-text) !important;
  box-shadow: 0 5px 0 rgba(91, 76, 98, 0.14), 0 10px 24px var(--theme-selected-glow) !important;
}

.site-confirm-btn:hover:not(:disabled),
.action-btn--accent:hover:not(:disabled),
.user-btn:hover:not(:disabled),
.login-form .action-btn:hover:not(:disabled),
.crafting-assemble-btn:hover:not(:disabled),
.training-btn.training-start:hover:not(:disabled),
.close-pack-btn:hover:not(:disabled),
.daily-login-claim-btn:hover:not(:disabled) {
  background: var(--theme-button-accent-hover-bg) !important;
  color: var(--theme-button-accent-text) !important;
}

.site-secondary-btn,
.discord-connect-btn.site-secondary-btn,
.minigame-menu-leaderboard-btn.site-secondary-btn,
.ozoz-abandon-btn.site-secondary-btn,
.ozoz-reset-btn.site-secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 0 !important;
  border-radius: 20px !important;
  background: linear-gradient(180deg, #5b4c62 0%, #5b4c62 100%) !important;
  color: #fff3ec !important;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  font-weight: bold;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(91, 76, 98, 0.28) !important;
}

.site-secondary-btn:hover:not(:disabled),
.discord-connect-btn.site-secondary-btn:hover:not(:disabled),
.minigame-menu-leaderboard-btn.site-secondary-btn:hover:not(:disabled),
.ozoz-abandon-btn.site-secondary-btn:hover,
.ozoz-reset-btn.site-secondary-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #c9b4e8 0%, #5b4c62 100%) !important;
  color: #fff3ec !important;
  transform: translateY(-1px);
  opacity: 1;
}

.site-secondary-btn:disabled,
.discord-connect-btn.site-secondary-btn:disabled,
.ozoz-reset-btn.site-secondary-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.site-cancel-btn,
.modal-action-btn--muted,
.alert-cancel-btn,
.profile-album-clear-slot,
.training-cancel-btn,
.book-clear-slot-btn {
  background: linear-gradient(180deg, #b7b1bb 0%, #8f8794 100%) !important;
  color: #5b4c62 !important;
  box-shadow: 0 5px 0 rgba(91, 76, 98, 0.14), 0 8px 18px rgba(91, 76, 98, 0.18) !important;
}

.site-cancel-btn:hover:not(:disabled),
.modal-action-btn--muted:hover:not(:disabled),
.alert-cancel-btn:hover:not(:disabled),
.profile-album-clear-slot:hover:not(:disabled),
.training-cancel-btn:hover:not(:disabled),
.book-clear-slot-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #c8c2cc 0%, #a59ea9 100%) !important;
  color: #5b4c62 !important;
}

.gallery-select-btn.gallery-select-main-btn,
.gallery-select-btn.gallery-select-btn--purple {
  background: linear-gradient(180deg, #5b4c62 0%, #5b4c62 100%) !important;
  color: #fff3ec !important;
}

.site-pink-btn,
.gallery-select-btn.gallery-select-btn--pink {
  background: var(--theme-button-bg) !important;
  color: var(--theme-button-accent-text) !important;
}

.site-pink-btn:hover:not(:disabled),
.gallery-select-btn.gallery-select-btn--pink:hover:not(:disabled) {
  background: var(--theme-button-hover-bg) !important;
  color: var(--theme-button-accent-text) !important;
}

.gallery-select-btn.gallery-select-btn--muted:not(.is-active) {
  background: linear-gradient(180deg, #b7b1bb 0%, #8f8794 100%) !important;
  color: #5b4c62 !important;
}

.gallery-bulk-icon-btn {
  min-width: 0;
}

.gallery-bulk-icon-btn img {
  flex: 0 0 auto;
}

.festival-mission-toggle:not(.bounty-mission-toggle),
.support-floating-btn {
  background: linear-gradient(135deg, #fff3ec 0%, #ffd98d 50%, #f79ab5 100%) !important;
  color: #5b4c62 !important;
  border-color: #5b4c62 !important;
  box-shadow: 0 4px 0 rgba(91, 76, 98, 0.22), 0 0 18px rgba(255, 217, 141, 0.5) !important;
}

.festival-mission-toggle:not(.bounty-mission-toggle):hover,
.support-floating-btn:hover {
  background: linear-gradient(135deg, #fff9f5 0%, #ffe5a8 48%, #ffa9c2 100%) !important;
}

.book-pagination-bar {
  position: static;
  margin: 1rem auto 0;
}

.book-clear-slot-btn {
  width: auto;
  margin-top: 0;
  padding: 0.5rem 1.5rem;
  font-size: 0.7rem;
}

.merge-token-btn,
.album-meta-row .merge-token-btn,
.draggable-sticker .merge-token-btn,
.draggable-sticker .sticker-merge-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 7px !important;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #5dd4de 0%, #4ebfcc 100%) !important;
  color: #fff3ec !important;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6rem !important;
  font-weight: bold;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(78, 191, 204, 0.28);
}

.album-meta-row .merge-token-btn {
  position: static;
}

.draggable-sticker .merge-token-btn,
.draggable-sticker .sticker-merge-btn {
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
}

.merge-token-btn:hover,
.album-meta-row .merge-token-btn:hover,
.draggable-sticker .merge-token-btn:hover,
.draggable-sticker .sticker-merge-btn:hover {
  background: linear-gradient(180deg, #6ddeea 0%, #5dd4de 100%) !important;
  box-shadow: 0 4px 10px rgba(78, 191, 204, 0.35);
}

.site-claim-btn,
.era-complete-btn,
.achievement-claim-btn,
.ozoz-token-claim-btn {
  padding: 0.45rem 0.85rem !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: var(--theme-button-accent-bg) !important;
  color: var(--theme-button-accent-text) !important;
  font-family: 'Press Start 2P', monospace !important;
  font-size: 0.72rem !important;
  font-weight: bold !important;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 3px 8px var(--theme-selected-glow) !important;
}

.site-claim-btn:hover:not(:disabled),
.era-complete-btn:hover:not(:disabled),
.achievement-claim-btn:hover:not(:disabled),
.ozoz-token-claim-btn:hover:not(:disabled) {
  background: var(--theme-button-accent-hover-bg) !important;
  transform: translateY(-1px);
  opacity: 1;
}

.site-claim-btn:disabled,
.era-complete-btn:disabled,
.achievement-claim-btn:disabled,
.ozoz-token-claim-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

/* ── Shard color dots (shared) ───────────────────────────────────────────── */
.shard-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid #5b4c62;
}
.shard-dot.shard-common,
.shard-common-color { background: #d8e5b3; color: #5b4c62; }
.shard-dot.shard-rare,
.shard-rare-color   { background: #a8e8ff; color: #5b4c62; }
.shard-dot.shard-super-rare,
.shard-super-rare-color { background: #c9b4e8; color: #5b4c62; }

.indicator-legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 1.25rem;
  padding: 0.65rem 0.9rem;
  font-size: 0.72rem;
  color: #5b4c62;
  font-family: 'Courier New', monospace;
  background: #fff3ec;
  border: 1px solid rgba(91, 76, 98, 0.1);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(91, 76, 98, 0.08);
}

.indicator-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.indicator-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 0;
  flex-shrink: 0;
}

.indicator-legend .piece-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ── Shard Shop Modal ────────────────────────────────────────────────────── */
/* ── Gem Shop section buttons ────────────────────────────────────────────── */
.shop-buttons-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
  text-align: center;
}
.shop-button-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.shop-section-btn {
  font-size: 0.85rem !important;
  padding: 0.9rem 1.2rem !important;
  margin-top: 0 !important;
  width: 100%;
}
.shop-section-btn--shard {
  background: linear-gradient(135deg, #d9c9f5, #c9b4e8) !important;
  color: #5b4c62 !important;
  box-shadow: 0 6px 20px rgba(180, 140, 220, 0.4), inset 0 -2px 10px rgba(0,0,0,0.1) !important;
}
.shop-section-btn--festival {
  background: linear-gradient(135deg, #ffd98d 0%, #f79ab5 48%, #5dd4de 100%) !important;
  color: #5b4c62 !important;
  box-shadow: 0 6px 20px rgba(247, 154, 181, 0.42), inset 0 -2px 10px rgba(0,0,0,0.1) !important;
}
.shop-section-desc {
  color: #5b4c62;
  font-size: 0.75rem;
  margin: 0.4rem 0 0;
}
@media (max-width: 480px) {
  .shop-buttons-row { grid-template-columns: 1fr; }
}

@media (min-width: 481px) and (max-width: 820px) {
  .shop-buttons-row { grid-template-columns: 1fr; }
}

.shard-shop-modal {
  max-width: 550px;
}
.shard-shop-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  font-size: 1.2rem;
  font-weight: bold;
  color: #5b4c62;
}
.shard-inventory-inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.shard-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.shard-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #fff3ec;
  border: 2px solid #5b4c62;
  border-radius: 12px;
  padding: 0.75rem 1rem;
}
.shard-card--common  { border-color: #d8e5b3; }
.shard-card--rare    { border-color: #a8e8ff; }
.shard-card--super-rare { border-color: #c9b4e8; }
.shard-card-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.shard-card-info { flex: 1; }
.shard-card-name { font-weight: bold; color: #5b4c62; font-size: 0.95rem; }
.shard-card-boost { color: #5b4c62; font-size: 0.8rem; }
.shard-card-cost  { color: #5b4c62; font-size: 0.85rem; font-weight: bold; margin-top: 0.15rem; }
.shard-daily-limit { font-size: 0.75rem; color: #888; margin-top: 0.2rem; }
.shard-buy-btn {
  width: auto !important;
  flex-shrink: 0;
  font-size: 0.75rem !important;
  padding: 0.4rem 0.75rem !important;
  margin-top: 0 !important;
  white-space: nowrap;
}
.shard-buy-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Shard Inventory Bar (Collections view) ──────────────────────────────── */
.shard-bar-item {
  font-weight: bold;
  color: inherit;
}

.shard-inventory-trigger {
  appearance: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.shard-inventory-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(91, 76, 98, 0.14);
}

.shard-inventory-trigger:focus-visible {
  outline: 2px solid var(--theme-border-strong);
  outline-offset: 3px;
}

.shard-inventory-modal {
  width: min(560px, calc(100vw - 2rem));
  max-width: 560px;
  padding: 2rem;
}

.shard-sell-intro {
  max-width: 34rem;
  margin: -0.6rem auto 0.65rem;
  color: var(--theme-muted-text);
  text-align: center;
  line-height: 1.6;
}

.shard-sell-balance {
  margin: 0 auto 1rem;
  color: var(--theme-text);
  font-size: 1rem;
  font-weight: bold;
  text-align: center;
}

.shard-sell-list {
  display: grid;
  gap: 0.75rem;
}

.shard-sell-card {
  display: grid;
  grid-template-columns: 42px minmax(165px, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  background: var(--theme-input-bg);
  border: 2px solid var(--theme-border);
  border-radius: 14px;
  color: var(--theme-text);
}

.shard-sell-card[data-shard-type="common"] { border-color: #d8e5b3; }
.shard-sell-card[data-shard-type="rare"] { border-color: #a8e8ff; }
.shard-sell-card[data-shard-type="super_rare"] { border-color: #c9b4e8; }

.shard-sell-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.shard-sell-info {
  display: grid;
  min-width: 0;
  gap: 0.16rem;
  line-height: 1.35;
}

.shard-sell-name {
  font-weight: bold;
  line-height: 1.3;
}

.shard-sell-owned,
.shard-sell-value,
.shard-sell-controls label {
  color: var(--theme-muted-text);
  font-size: 0.8rem;
  line-height: 1.35;
}

.shard-sell-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.shard-sell-controls label {
  flex: 0 0 auto;
  font-weight: bold;
}

.shard-sell-amount {
  width: 62px;
  min-width: 0;
  padding: 0.42rem 0.35rem;
  border: 2px solid var(--theme-border-strong);
  border-radius: 9px;
  background: var(--theme-modal-bg);
  color: var(--theme-text);
  font: inherit;
}

.shard-sell-btn {
  flex: 0 0 auto;
  width: auto !important;
  min-width: 62px !important;
  margin: 0 !important;
  padding: 0.48rem 0.7rem !important;
  font-size: 0.8rem !important;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .shard-inventory-modal {
    padding: 1.5rem;
  }

  .shard-sell-card {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 0.65rem 0.8rem;
    padding: 0.8rem;
  }

  .shard-sell-icon {
    width: 38px;
    height: 38px;
  }

  .shard-sell-controls {
    grid-column: 2;
    justify-content: flex-start;
  }
}

@media (max-width: 390px) {
  .shard-sell-controls {
    grid-column: 1 / -1;
  }
}

/* ── Shard icon cluster — right side of .era-training-section ───────────── */
.shard-cluster {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}
.shard-icon-wrapper {
  position: relative;
  cursor: pointer;
  width: 48px;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.15s ease;
  flex-shrink: 0;
}
.shard-icon-wrapper:not(.shard-icon--disabled):hover {
  transform: scale(1.15);
}
.shard-icon-wrapper.shard-icon--disabled {
  opacity: 0.3;
  filter: grayscale(1);
  cursor: not-allowed;
}
.shard-icon-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: block;
}
.shard-icon-boost {
  color: var(--theme-text);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6rem;
  font-style: italic;
  line-height: 1.25;
  white-space: nowrap;
}
.shard-icon-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  background: #e889a9;
  color: #fff3ec;
  font-size: 0.5rem;
  border-radius: 8px;
  padding: 1px 3px;
  font-weight: bold;
  line-height: 1.2;
  font-family: 'Press Start 2P', monospace;
  pointer-events: none;
}
.shard-icons-inner-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

/* ── Shard purchase toast ────────────────────────────────────────────────── */
.shard-purchase-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: #fff3ec;
  border: 2px solid #c9b4e8;
  border-radius: 14px;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 8px 24px rgba(91,76,98,0.18);
  z-index: 30000;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
  opacity: 0;
  min-width: 220px;
  max-width: 340px;
}
.shard-purchase-toast.shard-toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.shard-toast-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}
.shard-toast-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6rem;
  color: #5b4c62;
  line-height: 1.4;
}

.achievement-toast-container {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 30000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  pointer-events: none;
}

.achievement-unlock-toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(320px, calc(100vw - 2rem));
  background: #fff3ec;
  color: #5b4c62;
  border: 2px solid #e889a9;
  border-radius: 14px;
  padding: 0.8rem 1rem;
  box-shadow: 0 8px 24px rgba(91, 76, 98, 0.18);
  opacity: 0;
  transform: translateX(calc(100% + 1.5rem));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.achievement-unlock-toast.achievement-toast--visible {
  opacity: 1;
  transform: translateX(0);
}

.achievement-toast-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #e889a9;
  color: #fff3ec;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 1.2rem;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(232, 137, 169, 0.35);
}

.achievement-toast-icon img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
}

.achievement-toast-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  font-family: 'Press Start 2P', monospace;
  line-height: 1.45;
}

.achievement-toast-text strong {
  font-size: 0.6rem;
  color: #5b4c62;
}

.achievement-toast-text span {
  font-size: 0.58rem;
  color: #7a6b81;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .achievement-toast-container {
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
  }

  .achievement-unlock-toast {
    width: 100%;
  }

  .daily-login-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .daily-login-day { min-height: 70px; }
  .shard-cards { gap: 0.5rem; }
}

/* ===========================
   Crafting Tab
   =========================== */

/* Crafting Tab ─────────────────────────────────────────────── */
/* One column on mobile, two columns on desktop. Grid gap handles the spacing,
   so the per-card margin-bottom is zeroed inside the grid. */
.crafting-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 768px) {
  .crafting-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.crafting-grid .crafting-group-card {
  margin-bottom: 0;
}

.crafting-group-card {
  background: rgba(255, 249, 245, 0.9);
  border: 2px solid rgba(91, 76, 98, 0.15);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

/* 4×6 piece-reveal grid ─────────────────────────────────────── */
.crafting-piece-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(6, 1fr);
  width: 145px;
  aspect-ratio: 3.6715 / 5.159;
  border-radius: 8px;
  overflow: hidden;
  gap: 0;
  flex-shrink: 0;
  background: rgba(91, 76, 98, 0.12);
}

.crafting-piece-grid.complete {
  box-shadow: 0 0 0 2px #5dd4de, 0 4px 12px rgba(93, 212, 222, 0.3);
}

.crafting-piece-grid-cell {
  background: rgba(255, 249, 245, 0.8);
}

.crafting-piece-grid-cell.filled {
  background: linear-gradient(135deg, #ffa8c5, #f79ab5);
}

/* Image-reveal mode: unfilled cells fully opaque black; filled cells transparent */
.crafting-piece-grid.has-image {
  background: #000;
}

.crafting-piece-grid.has-image .crafting-piece-grid-cell {
  background: rgba(0, 0, 0, 0.99);
}

.crafting-piece-grid.has-image .crafting-piece-grid-cell.filled {
  background: transparent;
}

/* Info column ────────────────────────────────────────────────── */
.crafting-group-info {
  flex: 1;
  min-width: 0;
}

.crafting-group-title {
  font-weight: bold;
  color: #5b4c62;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.crafting-group-era {
  color: #9b8aa8;
  font-size: 0.8rem;
  margin-bottom: 0.6rem;
}

.crafting-progress-bar-wrap {
  margin-bottom: 0.35rem;
}

.crafting-progress-bar {
  background: linear-gradient(90deg, #f79ab5 0%, #c9b4e8 100%);
}

.crafting-progress-label {
  font-size: 0.75rem;
  color: #9b8aa8;
  margin-bottom: 0.65rem;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .crafting-group-card {
  background: var(--theme-card-bg);
  border-color: var(--theme-border);
  color: var(--theme-text);
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .crafting-group-info :where(.crafting-group-title, .crafting-group-era, .crafting-progress-label, div, span:not(.piece-dot)) {
  color: var(--theme-text) !important;
}

/* Member chips ───────────────────────────────────────────────── */
.crafting-members-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.crafting-member-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  border: 1.5px solid rgba(91, 76, 98, 0.2);
  background: #fff9f5;
  font-size: 0.7rem;
  font-family: inherit;
  color: #9b8aa8;
  cursor: pointer;
}

.crafting-member-chip:hover {
  border-color: #f79ab5;
}

.crafting-member-chip:focus-visible {
  outline: 3px solid var(--theme-focus, #5b4c62);
  outline-offset: 2px;
}

.crafting-member-chip.has-piece {
  border-color: #f79ab5;
  background: rgba(247, 154, 181, 0.1);
  color: #5b4c62;
  font-weight: bold;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .crafting-member-chip {
  background: var(--theme-surface-base) !important;
  border-color: rgba(255, 243, 236, 0.24) !important;
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .crafting-member-chip.has-piece {
  background: rgba(247, 154, 181, 0.18) !important;
  border-color: #f79ab5 !important;
  color: var(--theme-text) !important;
}

.member-piece-dots {
  display: flex;
  gap: 3px;
}

.piece-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d9d6dc;
  box-shadow: inset 0 0 0 1px #b8b2bf;
  flex-shrink: 0;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .crafting-member-chip .piece-dot:not(.filled) {
  background: #514b57;
  box-shadow: inset 0 0 0 1px #a49caa;
}

/* Dot 1 — required piece */
.piece-dot.required.filled {
  background: #f79ab5;
  box-shadow: none;
}

/* Dots 2-6 — useful extras that count toward the 5-piece pool */
.piece-dot.extra.filled {
  background: #b7ce84 !important;
  box-shadow: none;
}

/* Dots 2-6 — excess extras that go beyond what's needed */
.piece-dot.extra.excess.filled {
  background: #9b8aa8 !important;
}

/* Image-reveal grid: filled cells are transparent, showing the card image beneath;
   empty cells are a dark mask hiding the unrevealed portion */
.crafting-piece-grid.has-image .crafting-piece-grid-cell {
  background: rgba(0, 0, 0, 0.99);
}

.crafting-piece-grid.has-image .crafting-piece-grid-cell.filled {
  background: transparent;
}

/* Dot legend ─────────────────────────────────────────────────── */
.crafting-legend-item {
  color: inherit;
}

/* Auction minimum-bid legend ─────────────────────────────────── */
/* Auction filter toggles — a tidy settings-style panel with real toggle switches
   (reuses the .ozoz-toggle switch component) instead of bare checkboxes. */
.auction-filters-panel {
  max-width: 620px;
  margin: 1rem auto 0;
  display: flex;
  flex-direction: column;
  padding: 0.35rem 1rem;
  background: linear-gradient(180deg, #fff9f5 0%, #fff3ec 100%);
  border: 2px solid rgba(91, 76, 98, 0.12);
  border-radius: 15px;
  box-shadow: 0 4px 12px rgba(91, 76, 98, 0.08);
  text-align: left;
}

.auction-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.25rem;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  color: #5b4c62;
  font-size: 0.95rem;
}

.auction-filter-row + .auction-filter-row {
  border-top: 1px dashed rgba(91, 76, 98, 0.15);
}

.auction-filter-text {
  flex: 1;
  line-height: 1.3;
}

.auction-legend-label {
  font-weight: bold;
}

.auction-legend-item {
  color: inherit;
}

.auction-rarity-dot.dot-common    { background: #d8e5b3; }
.auction-rarity-dot.dot-rare      { background: #a8e8ff; }
.auction-rarity-dot.dot-epic      { background: #d9c9f5; }
.auction-rarity-dot.dot-legendary { background: #ffd98d; }
.auction-rarity-dot.dot-holo      { background: linear-gradient(135deg, #f79ab5 0%, #c9b4e8 25%, #93c9d5 50%, #b7ce84 75%, #ffd98d 100%); }

.auction-controls {
  margin-bottom: 2rem;
  text-align: center;
}

.auction-search-wrap {
  display: flex;
  flex: 0 0 auto;
  margin: 0;
}

.auction-sort-row {
  justify-content: center;
}

.auction-filterbar {
  justify-content: safe center;
  gap: 0.9rem;
}

.auction-filter-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 0 0 auto;
  color: #5b4c62;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  font-weight: bold;
  white-space: nowrap;
  text-shadow: 0 1px 1px color-mix(in srgb, var(--theme-modal-bg) 68%, transparent);
}

.auction-filter-chip .ozoz-toggle {
  transform: scale(0.86);
  transform-origin: center;
}

.auction-section {
  width: 100%;
  padding: 0.85rem;
  background: var(--theme-panel-bg);
  border: 1px solid var(--theme-border);
  border-radius: 20px;
  box-shadow: 0 6px 18px var(--theme-shadow);
  box-sizing: border-box;
}

.auction-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: 0.85rem !important;
  padding: 0.25rem 0.25rem 0.75rem !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 16px !important;
  box-shadow: none !important;
}

.auction-section-header h2 {
  margin-bottom: 0;
}

.auction-section-arrow {
  color: var(--theme-text);
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

#myAuctionsHeader.auction-section-header,
#friendsAuctionsHeader.auction-section-header {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.auction-section-content {
  padding: 0.25rem;
}

.auction-section-divider {
  width: 100%;
  height: 2px;
  margin: 0 0 2rem;
  background: repeating-linear-gradient(90deg, #e88aa9 0 8px, transparent 8px 14px);
}

/* Tournament View */
.tournament-container {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 2rem;
}

.tournament-panel {
  padding: 1.5rem;
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 20px;
  box-shadow: 0 6px 18px var(--theme-shadow);
  color: var(--theme-text);
}

#tournamentViewContent > p,
#tournamentHofContent > p {
  margin: 0;
  color: #9b8aa8 !important;
  font-weight: 700;
}

#tournamentViewContent > div:first-child {
  border-radius: 18px !important;
}

#tournamentViewContent .tournament-theme-name {
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  line-height: 1.2;
}

#tournamentViewContent .tournament-voting-grid {
  gap: 1rem !important;
}

#tournamentViewContent .tournament-vote-option {
  min-width: 0;
  padding: 1rem;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 243, 236, 0.86));
  border: 1px solid rgba(91, 76, 98, 0.1);
  box-shadow: 0 6px 16px rgba(91, 76, 98, 0.1);
}

#tournamentViewContent .tournament-vs-badge {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  justify-self: center;
  padding: 0 !important;
  border-radius: 50%;
  background: #5b4c62;
  color: #ffd98d !important;
  box-shadow: 0 4px 12px rgba(91, 76, 98, 0.2);
}

#tournamentViewContent button[id^="voteBtn"] {
  min-height: 44px;
  border-radius: 999px !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#tournamentViewContent button[id^="voteBtn"]:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 7px 18px rgba(247, 154, 181, 0.45) !important;
}

#tournamentViewContent button[id^="voteBtn"]:disabled {
  opacity: 0.65;
  cursor: wait !important;
}

#tournamentViewContent .tournament-bracket-match,
#tournamentHofContent .tournament-hof-row {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 243, 236, 0.86)) !important;
  border-color: rgba(91, 76, 98, 0.1) !important;
  box-shadow: 0 4px 14px rgba(91, 76, 98, 0.08);
}

#tournamentViewContent .tournament-img-wrap,
#tournamentHofContent .tournament-img-wrap {
  box-shadow: 0 6px 18px rgba(91, 76, 98, 0.16);
}

#tournamentHofContent .tournament-hof-row {
  border-radius: 16px !important;
}

@media (max-width: 700px) {
  .tournament-container {
    padding: 1.25rem 1rem;
  }

  .tournament-panel {
    padding: 1rem;
  }

  #tournamentViewContent .tournament-voting-grid {
    grid-template-columns: 1fr !important;
  }

  #tournamentViewContent .tournament-vs-badge {
    width: auto;
    height: auto;
    padding: 0.35rem 0.8rem !important;
    border-radius: 999px;
  }
}

/* Dark mode compatibility for legacy/generated markup.
   Keep these scoped to owning containers; shared controls inherit from tokens above. */
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .stat-item--merged,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .clock-format-btn {
  background: var(--theme-control-bg) !important;
  border-color: var(--theme-border-strong) !important;
  color: var(--theme-control-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .clock-format-btn.clock-format-active {
  background: var(--theme-control-active-bg) !important;
  color: var(--theme-control-active-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-section,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .friends-section,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .trading-section,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .auction-section,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .tournament-panel,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .group-section,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .era-section,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .friend-card,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .search-result-card,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .era-card:not(.bronze-border):not(.silver-border):not(.gold-border) {
  color: var(--theme-text);
  border-color: var(--theme-border);
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-section h2,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .friends-section h2,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .trading-section h2,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .auction-section h2,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .group-section h2,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .era-section h3,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .friend-name,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .friend-status,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-info,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-info p,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .display-setting-description,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .placeholder-text,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) :where(
  .profile-section,
  .friends-section,
  .trading-section,
  .auction-section,
  .tournament-panel,
  .group-section
) :where(h2, h3, p, label, strong, small, li),
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .era-section > h3,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .era-section .era-progress-summary,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .era-section .era-progress-summary :where(.era-progress-text, .era-progress-icon, .era-stars) {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-subtab-description,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-badge-earned,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-collection-empty p {
  color: var(--theme-muted-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-collection-card {
  background: var(--theme-panel-bg) !important;
  border-color: var(--theme-border);
  box-shadow: 0 6px 16px var(--theme-shadow);
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-badge-name,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .token-card .token-name,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-collection-message,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-collection-empty,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-collection-empty h3 {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .token-card.token-locked {
  background: rgba(255, 243, 236, 0.06) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .token-card.token-locked .token-img-locked {
  filter: grayscale(100%) brightness(1.7);
  opacity: 0.34;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .token-card.token-locked .token-name {
  color: color-mix(in srgb, var(--theme-text) 58%, transparent) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-collection-message,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-collection-empty,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .profile-badge-fallback {
  background: var(--theme-control-bg) !important;
  border-color: var(--theme-border);
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) :where(
  .gallery-filterbar .styled-select,
  .gallery-filterbar .search-input,
  .gallery-filterbar .filterbar-command-btn,
  .gallery-filterbar .custom-select-trigger,
  .gallery-filterbar .custom-select-option
) {
  color: var(--theme-control-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .gallery-filterbar .custom-select-option.selected {
  color: var(--theme-on-accent-2) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .custom-select-menu {
  scrollbar-color: rgba(255, 243, 236, 0.72) transparent;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .custom-select-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 243, 236, 0.72);
  background-clip: content-box;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .custom-select-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 243, 236, 0.9);
  background-clip: content-box;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) :where(.page-title, .gallery-header h1, .profile-container h1, .groups-container h1, .friends-container h1) {
  text-shadow: 3px 3px 0 var(--theme-heading-shadow) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) :where(.profile-section h2, .friends-section h2, .trading-section h2, .auction-section h2, .group-section h2, .era-section h3, .modal-content h2, #supportModal .support-modal-content h2, .shop-stall-hero h2) {
  text-shadow: 2px 2px 0 var(--theme-heading-shadow) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .modal-content:not(.shop-stall-modal):not(.support-modal-content),
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .custom-alert-modal,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .leaderboard-modal,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .pack-opening,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .balloon-game-modal,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .gem-catch-game-modal,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .memory-game-modal,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #minigamesModal .modal-content {
  background: var(--theme-modal-bg) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

/* Section surfaces sit directly on the themed page gradient. Keep their
   boundaries shadow-only, as on Collections, without changing card controls. */
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .view:not(#groupsView) :is(
  .profile-section,
  .friends-section,
  .trading-section,
  .auction-section,
  .tournament-panel
) {
  border: 0 !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-panel,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-status-card {
  background: linear-gradient(135deg, var(--theme-surface-deep), var(--theme-surface-base)) !important;
  border-color: var(--theme-border) !important;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.22);
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-copy,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-field,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-panel h2,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-status-card h3 {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-preview,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-empty,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-meta p {
  background: var(--theme-control-bg) !important;
  border-color: color-mix(in srgb, var(--theme-border) 62%, transparent) !important;
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-card-face,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-card-face--active,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-card-face--inactive {
  background: linear-gradient(135deg, var(--theme-surface-base), var(--theme-surface-mid)) !important;
  border-color: var(--theme-border) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-card-face h3,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-meta span,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-empty-icon {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .bounty-mission-pool {
  background: linear-gradient(135deg, var(--theme-surface-deep), var(--theme-surface-base)) !important;
  border-color: var(--theme-border) !important;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .bounty-mission-pool-title,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .bounty-mission-pool-item {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .bounty-mission-pool-item small {
  color: color-mix(in srgb, var(--theme-text) 72%, transparent) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .market-ping-empty-icon {
  background: var(--theme-surface-base) !important;
  border-color: var(--theme-border) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #packAnimationModal .modal-content {
  background: transparent !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .modal-content:not(.shop-stall-modal):not(.support-modal-content) h2,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .modal-content:not(.shop-stall-modal):not(.support-modal-content) h3,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .modal-content:not(.shop-stall-modal):not(.support-modal-content) p:not(.card-modal-rarity):not(.trade-modal-rarity),
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .modal-content:not(.shop-stall-modal):not(.support-modal-content) label,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .modal-content:not(.shop-stall-modal):not(.support-modal-content) small,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .modal-content:not(.shop-stall-modal):not(.support-modal-content) strong,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .custom-alert-modal h2,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .custom-alert-modal p,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .mode-selection > p {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .close-modal::before,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .close-modal::after,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .modal-close::before,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .modal-close::after {
  background: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .close-modal:hover::before,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .close-modal:hover::after,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .modal-close:hover::before,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .modal-close:hover::after {
  background: #f79ab5 !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .auction-card :where(
  .auction-card-title,
  .auction-card-subtitle,
  .auction-card-seller,
  .auction-bid-label,
  .auction-bid-value,
  .auction-time,
  h3,
  p,
  span,
  strong,
  div
) {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .auction-bid-panel {
  background: var(--theme-control-bg) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .tournament-vote-status {
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .uft-owner-list,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .uft-owner-list *,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .uft-detail-owner-list,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .uft-detail-owner-list *,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .uft-detail-owner-heading,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .uft-detail-owner-heading * {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .discord-join-card {
  background: var(--theme-surface-base) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .discord-join-card :where(p, li, span, strong, div) {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .discord-join-icon path {
  fill: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .display-toggle-btn.clock-format-active {
  background: var(--theme-text) !important;
  background-image: none !important;
  color: var(--theme-text-inverse) !important;
  border-color: var(--theme-text) !important;
}

/* Keep selected tabs inside the active color mode instead of retaining their
   default pink, yellow, cyan, or purple fills. */
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) :where(
  .festival-modal-tab.active,
  #supportModal .support-tab.active,
  .shop-stall-tab.active,
  .gallery-tab-btn.active,
  .lb-tab.active,
  .profile-picture-type-tab.active
) {
  background: var(--theme-selected-tab-bg) !important;
  color: var(--theme-selected-tab-text) !important;
  border-color: var(--theme-surface-light) !important;
  box-shadow: 0 4px 15px var(--theme-selected-glow-strong) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .minigame-how-to,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .minigame-back-btn,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #clawGameModal .claw-side-panel {
  background: var(--theme-control-bg) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .minigame-how-to *,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #clawGameModal .claw-side-panel * {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .leaderboard-modal,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .leaderboard-modal :where(h2, h3, p, span, strong, div, th, td) {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .lb-tab {
  background: var(--theme-control-bg) !important;
  color: var(--theme-control-text) !important;
  border-color: var(--theme-border-strong) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .lb-tab.active {
  background: var(--theme-selected-tab-bg) !important;
  color: var(--theme-selected-tab-text) !important;
  border-color: var(--theme-surface-light) !important;
  box-shadow: 0 4px 15px var(--theme-selected-glow-strong) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .lb-table tbody tr:hover,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .lb-user-entry,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .lb-table tbody tr.lb-me {
  background: var(--theme-control-bg) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #patchNotesList,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #patchNotesCompose {
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #patchNotesInput,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) textarea[id^="pn-edit-"] {
  background: var(--theme-input-bg) !important;
  color: var(--theme-control-text) !important;
  border-color: var(--theme-border-strong) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .card-detail-label,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .card-detail-title,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .card-detail-subtitle,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .card-detail-line,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .card-detail-note label,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .card-detail-note * {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .card-detail-muted {
  color: #f79ab5 !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .ssr-selection-modal,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .ssr-selection-modal :where(.ssr-selection-copy, .ssr-choice-card-member, .ssr-choice-card-era, .ssr-choice-card-number) {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) :where(
  .sort-control,
  .gallery-filterbar,
  .filterbar-control-row,
  .profile-picture-filterbar,
  .modal-control-row,
  .indicator-legend
) {
  background: var(--theme-filterbar-bg) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .guess-who-inputs .form-input {
  background: var(--theme-input-bg) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border-strong) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .guess-who-inputs .form-input:focus {
  background: var(--theme-input-bg) !important;
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .guess-who-inputs .form-input::placeholder {
  color: rgba(255, 243, 236, 0.62) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .guess-who-feedback {
  color: #fff3ec !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .search-clear-btn,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .training-boost-text {
  color: #fff3ec !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #stickerPanel,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .sticker-panel-sidebar {
  background: var(--theme-surface-base) !important;
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .sticker-panel-sidebar :where(h3, p, span, div),
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .sticker-panel-header h3,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .sticker-panel-tracker,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .sticker-panel-empty,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .sticker-set-header,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .sticker-pack-count {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #pageTitle {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #pageTitle::placeholder {
  color: rgba(255, 243, 236, 0.66) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .notification-item {
  background: color-mix(in srgb, #888 32%, var(--theme-surface-base)) !important;
  border-left-color: #888 !important;
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .notification-item.unread:hover {
  background: var(--theme-surface-mid) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .notification-item.unread {
  background: color-mix(in srgb, var(--notification-accent, #c9b4e8) 26%, var(--theme-surface-base)) !important;
  border-left-color: var(--notification-accent, #c9b4e8) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .notification-message,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .notification-time,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .notification-gems {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) :where(
  .search-input,
  .text-input,
  .modal-search-input,
  .styled-select,
  .custom-select-trigger,
  input[type="text"],
  input[type="number"],
  textarea
) {
  background: var(--theme-input-bg) !important;
  color: var(--theme-control-text) !important;
  border-color: var(--theme-border-strong) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) :where(
  .profile-section,
  .friends-section,
  .trading-section,
  .auction-section,
  .tournament-panel,
  .group-section,
  .era-section,
  .card-detail,
  .uft-detail-modal,
  .friend-card,
  .search-result-card,
  .achievement-card,
  .crafting-group-card
) {
  background: var(--theme-card-bg) !important;
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #alphabetNav {
  background: transparent !important;
  border: 0;
  box-shadow: none !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #alphabetNav .alphabet-btn {
  color: var(--theme-text) !important;
  border-color: var(--theme-border-strong) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #alphabetNav .alphabet-btn--unclaimed:not(.active) {
  background: rgba(255, 217, 141, 0.28) !important;
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #alphabetNav .alphabet-btn--training:not(.active) {
  background: rgba(216, 229, 179, 0.3) !important;
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #alphabetNav .alphabet-btn--group:not(.active) {
  background: rgba(247, 154, 181, 0.3) !important;
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #alphabetNav .alphabet-btn.active {
  background: var(--theme-control-active-bg) !important;
  color: var(--theme-control-active-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #alphabetNav .alphabet-btn--unclaimed.active {
  background: linear-gradient(135deg, #ffd98d 0%, #f8c471 100%) !important;
  color: var(--theme-surface-base) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #alphabetNav .alphabet-btn--training.active {
  background: linear-gradient(135deg, #d8e5b3 0%, #c4d39f 100%) !important;
  color: var(--theme-surface-base) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #alphabetNav .alphabet-btn--group.active {
  background: linear-gradient(135deg, #f79ab5 0%, #e8c8f5 100%) !important;
  color: var(--theme-surface-base) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #collectionStatsBody,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #collectionStatsBody * {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #collectionStatsBody > div {
  border-bottom-color: var(--theme-border) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .auction-filter-row,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .auction-filter-chip,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .indicator-legend,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .auction-legend-label,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .auction-legend-item,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .shard-bar-item,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .crafting-legend-item {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .auction-filter-row + .auction-filter-row {
  border-top-color: var(--theme-border) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .friend-card,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .search-result-card {
  background: var(--theme-input-bg) !important;
  color: var(--theme-control-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .friend-card :where(h1, h2, h3, p, label, span, strong, small, li, div),
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .search-result-card :where(h1, h2, h3, p, label, span, strong, small, li, div),
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .friend-name,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .friend-status {
  color: var(--theme-control-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .indicator-legend,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .auctions-grid .auction-card {
  color: var(--theme-text) !important;
  border-color: var(--theme-border) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .indicator-legend {
  background: var(--theme-surface-base) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .auctions-grid .auction-card {
  background: var(--theme-card-bg) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card.is-completed,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card.is-claimed {
  background: var(--theme-surface-base) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card :where(h3, p, span, strong, div),
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card.is-completed :where(h3, p, span, strong, div),
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card.is-claimed :where(h3, p, span, strong, div),
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card .achievement-card-title,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card .achievement-card-count,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card .achievement-progress-text,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card .achievement-status-text,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card .achievement-reward-text,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card.is-completed .achievement-card-title,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card.is-completed .achievement-card-count,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card.is-completed .achievement-progress-text,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card.is-completed .achievement-status-text,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card.is-completed .achievement-reward-text,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card.is-claimed .achievement-card-title,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card.is-claimed .achievement-card-count,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card.is-claimed .achievement-progress-text,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card.is-claimed .achievement-status-text,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .achievements-grid .achievement-card.is-claimed .achievement-reward-text {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .game-result {
  background: var(--theme-surface-base) !important;
  background-image: none !important;
  color: var(--theme-text) !important;
  box-shadow: 0 6px 20px var(--theme-shadow);
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .game-result :where(h3, p, strong, span, div) {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) :where(#galleryGrid, #friendTradeCardsGrid, #allFriendsTradeCardsGrid) .card-footer,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) :where(#galleryGrid, #friendTradeCardsGrid, #allFriendsTradeCardsGrid) .card-footer :where(.card-name, .card-era, span:not(.card-rarity), div:not(.card-rarity), p:not(.card-rarity)) {
  color: var(--theme-surface-base) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .era-card .era-card-name,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .era-card > div:not(.era-card-placeholder):not(.training-overlay):not(.era-card-rarity) {
  color: var(--theme-surface-base) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #tournamentViewContent .tournament-bracket-match,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #tournamentHofContent .tournament-hof-row {
  background: var(--theme-card-bg) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) :is(
  #tournamentViewContent .tournament-bracket-match:not(.is-current),
  #tournamentHofContent .tournament-hof-row
) {
  border: 0 !important;
}

.merged-card-meta { color: #777; }

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) .merged-card-meta {
  color: var(--theme-text) !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #tournamentViewContent .tournament-vote-option {
  background: linear-gradient(135deg, var(--theme-surface-deep), var(--theme-surface-base)) !important;
  border-color: var(--theme-border) !important;
  box-shadow: 0 6px 18px var(--theme-shadow);
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #tournamentViewContent h2,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #tournamentViewContent h3,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #tournamentViewContent p,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #tournamentViewContent div,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #tournamentViewContent span,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #tournamentHofContent h2,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #tournamentHofContent h3,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #tournamentHofContent p,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #tournamentHofContent div,
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"]) #tournamentHofContent span {
  color: var(--theme-text) !important;
}

/* Info icon (i) next to pieces count */
.crafting-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid #9b8aa8;
  color: #9b8aa8;
  font-size: 0.6rem;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: help;
  margin-left: 0.25rem;
  vertical-align: middle;
  user-select: none;
  flex-shrink: 0;
}

.crafting-info-icon:is(.search-help-trigger, .gallery-shortcuts-info, .shop-pack-info, .site-info-trigger) {
  margin-left: 0;
  padding: 0;
  background: transparent;
  line-height: 1;
  cursor: help;
}

.new-personal-best {
  color: var(--theme-text, #5b4c62);
  font-weight: 800;
  white-space: nowrap;
}

.crafting-info-icon:is(.search-help-trigger, .gallery-shortcuts-info, .shop-pack-info, .site-info-trigger):hover {
  color: var(--theme-text, #5b4c62);
  border-color: var(--theme-text, #5b4c62);
  background: var(--theme-input-bg, #fff);
}

.crafting-info-icon:is(.search-help-trigger, .gallery-shortcuts-info, .shop-pack-info, .site-info-trigger):focus-visible {
  outline: 2px solid var(--theme-border-strong);
  outline-offset: 2px;
}

.modal-search-help-group {
  display: flex;
  align-items: center;
  flex: 1 1 220px;
  min-width: 0;
  gap: 0.6rem;
}

.modal-search-help-group .modal-search-input {
  width: 100%;
  min-width: 0;
}

/* Assemble button ────────────────────────────────────────────── */
.crafting-assemble-btn {
  background: linear-gradient(135deg, #f79ab5 0%, #ffd98d 100%);
  color: #5b4c62;
  border: none;
  border-radius: 20px;
  padding: 0.45rem 1.2rem;
  font-weight: bold;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 5px 0 rgba(91, 76, 98, 0.14), 0 10px 24px rgba(247, 154, 181, 0.24);
  transition: all 0.2s;
}

.crafting-assemble-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #ffa8c5 0%, #ffe3a8 100%);
  box-shadow: 0 5px 0 rgba(91, 76, 98, 0.14), 0 10px 24px rgba(247, 154, 181, 0.24);
}

.crafting-assemble-btn:disabled {
  opacity: 0.42;
  box-shadow: none;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .crafting-piece-grid {
    width: 64px;
  }
}

@media (max-width: 768px) {
  .filterbar-control-row,
  .gallery-filterbar,
  .profile-picture-filterbar {
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    max-width: min(100%, 95vw);
    -webkit-overflow-scrolling: touch;
  }

  .filterbar-control-row > *,
  .gallery-filterbar > *,
  .profile-picture-filterbar > *,
  .sort-control,
  .filterbar-group {
    flex: 0 0 auto;
  }

  .profile-picture-filterbar .search-wrap,
  .profile-picture-search-group {
    flex: 0 0 220px;
    min-width: 220px;
  }

  .gallery-sort-row {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
    overflow: visible;
    width: 100%;
  }

  #galleryFilterBar,
  #bulkActions,
  #gallerySelectControls {
    width: min(100%, 95vw);
    max-width: min(100%, 95vw);
    box-sizing: border-box;
  }

  .filter-scroll-shell--gallery-selection {
    display: block;
    width: 100%;
  }

  .filter-scroll-shell--bulk,
  .filter-scroll-shell--select {
    width: min(100%, 95vw);
    max-width: 100%;
    min-width: 0;
  }

  #bulkActions {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .gallery-selection-bar {
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    gap: 0.4rem;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  #bulkActions,
  #gallerySelectControls {
    padding: 0.5rem 1.25rem;
    background: var(--theme-filterbar-bg);
    border-radius: 20px;
    box-shadow: 0 2px 10px var(--theme-shadow);
    box-sizing: border-box;
    scrollbar-width: none;
  }

  #bulkActions::-webkit-scrollbar,
  #gallerySelectControls::-webkit-scrollbar {
    display: none;
  }

  .gallery-bulk-actions-row {
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: max-content;
    min-width: 100%;
  }

  #gallerySelectControls {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    border-left: 0;
    -webkit-overflow-scrolling: touch;
  }

  #gallerySelectControls .gallery-select-btn {
    flex: 0 0 auto;
  }

  .friends-filterbar,
  .uft-filterbar {
    justify-content: center !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    width: 100%;
    max-width: 100%;
  }

  .friends-filterbar > *,
  .uft-filterbar > * {
    flex: 0 1 auto;
  }

  .friends-filterbar .filterbar-command-btn {
    white-space: nowrap;
  }

  .sticker-panel-sidebar .book-sticker-pack {
    width: auto !important;
    flex: 0 0 auto !important;
    display: block !important;
    padding: 0.2rem 0.2rem 0.35rem !important;
  }

  .sticker-panel-sidebar .lib-new-badge-sm {
    right: -6px !important;
    bottom: -6px !important;
    padding: 1px 3px !important;
    font-size: 0.45rem !important;
  }

  .sticker-panel-sidebar .sticker-count-pill {
    top: -1px !important;
    left: -1px !important;
    min-height: 14px !important;
    padding: 1px 3px !important;
    font-size: 0.4rem !important;
    line-height: 1.25 !important;
  }

  .sticker-panel-sidebar .sticker-merge-btn {
    bottom: -4px !important;
    min-height: 22px !important;
    padding: 4px 7px !important;
    font-size: 0.5rem !important;
  }
}

[data-web3-feature][hidden] {
  display: none !important;
}
/* Album room: artwork and shelf locations adapted from GrimlinLord/k-pix. */
#groupsView.album-room-view { padding-bottom: 0; }
#libraryAlbumsTab { padding-top: 0; }
.album-room-panel { position: relative; width: 100%; height: max(calc(100dvh - var(--nav-height) - var(--album-room-tabs-height, 64px)), calc(var(--album-room-header-height, 100px) + 3.5rem + 120px)); padding-top: 2rem; display: flex; flex-direction: column; align-items: center; gap: 1.5rem; color: var(--theme-text); }
.album-room-panel [hidden], .album-room-inventory-modal [hidden], .album-room-detail-modal [hidden] { display: none !important; }
.album-room-toolbar, .album-room-detail-controls { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.album-room-toolbar { position: relative; width: calc(100% - 2rem); flex-shrink: 0; z-index: 30; justify-content: space-between; pointer-events: none; }
.album-room-toolbar .album-room-summary { width: 100%; text-align: center; margin: 0; }
#headerWalletSettings [hidden], #headerWalletSettings[hidden] { display: none !important; }
#profileWalletStatus:empty { display: none; }
.album-room-caption { position: absolute; bottom: .75rem; left: 1rem; right: 1rem; z-index: 30; pointer-events: none; text-align: center; }
.album-room-summary, .album-room-status { font-size: .8rem; line-height: 1.5; margin: .25rem 0; }
.album-room-status:not(:empty) { display: inline-block; padding: .35rem .7rem; border-radius: 12px; background: var(--theme-nav-bg); }
.album-room-status:empty { display: none; }
.album-room-inventory-status:empty { display: none; }
.album-room-inventory-status:not(:empty) { margin: .5rem 0; padding: .4rem .7rem; border-radius: 10px; background: var(--theme-control-bg); color: var(--theme-text); }
.album-room-stage { position: relative; width: 100%; max-width: calc(max(120px, calc(100dvh - var(--nav-height) - var(--album-room-tabs-height, 64px) - var(--album-room-header-height, 100px) - 3.5rem)) * 1920 / 1080); aspect-ratio: 1920 / 1080; flex-shrink: 0; margin-block: auto; }
.album-room-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; user-select: none; pointer-events: none; }
.album-room-slots { position: absolute; inset: 0; }
.album-room-slot { position: absolute; }
.album-room-cubbies { position: absolute; left: 76.875%; top: 78.3333%; width: 13.125%; height: 20%; z-index: 25; padding: 0; border: 0; background: transparent; cursor: pointer; }
.album-room-cubbies:hover, .album-room-cubbies:focus-visible { outline: 2.5px solid #fff3ec; outline-offset: 2px; }
.album-room-cover { position: absolute; top: 0; height: 100%; aspect-ratio: 1; padding: 0; border: 1px solid var(--theme-border-strong); border-radius: 0; background: var(--theme-nav-bg); color: var(--theme-text); cursor: grab; overflow: hidden; touch-action: none; user-select: none; font-size: .55rem; }
.album-room-cover img, .album-room-drag-ghost img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; pointer-events: none; }
.album-room-cover--nft { border-color: #a57435; }
.album-room-cover:hover, .album-room-cover:focus-visible { z-index: 20 !important; outline: 2.5px solid #fff3ec; outline-offset: 1px; }
.album-room-drop-target { outline: 3px solid var(--theme-accent-2); outline-offset: 3px; background: color-mix(in srgb, var(--theme-accent-2) 18%, transparent); }
.album-room-drop-blocked { outline: 3px solid #c65d65; outline-offset: 3px; }
.album-room-drop-preview { position: absolute; top: 0; height: 100%; aspect-ratio: 1; z-index: 50; border: 3px dashed var(--theme-border-strong); background: color-mix(in srgb, var(--theme-accent-2) 45%, transparent); pointer-events: none; }
.album-room-drop-label { position: fixed; z-index: 10001; padding: .4rem .6rem; border: 2px solid var(--theme-border-strong); border-radius: 8px; background: var(--theme-input-bg); color: var(--theme-control-text); white-space: nowrap; font-family: 'Courier New', monospace; font-size: .8rem; font-weight: bold; pointer-events: none; }
.album-room-inventory-modal .modal-content { width: 900px; }
.album-room-detail-modal .modal-content { width: 700px; }
.album-room-inventory-modal .close-modal, .album-room-detail-modal .close-modal { background: transparent; border: 0; padding: 0; }
.album-room-inventory-header .close-modal { position: static; }
.album-room-inventory-modal .modal-title-with-close { padding-right: 0; }
.album-room-inventory-filters { flex-wrap: wrap; }
.album-room-inventory-filters .styled-select { max-width: 200px; }
.album-room-inventory-filters .album-room-search-label { display: flex; align-items: center; gap: .5rem; flex-wrap: nowrap; margin: 0; }
.album-room-inventory-filters .album-room-search { max-width: 240px; min-width: 0; margin: 0; }
.album-room-inventory-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.album-room-inventory-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.album-room-inventory-actions .action-btn { width: auto; margin: 0; }
.album-room-inventory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1rem; margin-top: 1rem; }
.album-room-inventory-entry { position: relative; min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
.album-room-inventory-entry .album-room-inventory-item { width: 100%; flex: 1; }
.album-room-inventory-entry .album-room-inventory-merge-btn { position: static; align-self: center; }
.album-room-inventory-item { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .65rem; background: #fff3ec; overflow: hidden; color: #5b4c62; font: inherit; font-size: .8rem; border: 2px solid var(--theme-border); border-radius: 12px; cursor: pointer; min-width: 0; }
.album-room-inventory-item[data-source="nft"] { background: #e9ddff; }
.album-room-inventory-item.album-room-on-shelf { border-color: var(--theme-border-strong); }
.album-room-inventory-item:hover, .album-room-inventory-item:focus-visible { outline: 2.5px solid #fff3ec; outline-offset: 2px; box-shadow: 0 0 0 4px var(--theme-border-strong); }
.album-room-settings-panel[hidden], .album-room-list-panel[hidden] { display: none; }
.album-room-settings-panel .ozoz-abandon-note { margin-top: .75rem; }
.album-room-settings-actions { justify-content: center; }
.album-room-settings-actions .display-toggle-btn:disabled { opacity: .5; cursor: default; }
.album-room-list-panel { margin: 0 0 1rem; }
.album-room-list-progress { margin: 0 0 .75rem; font-weight: bold; }
.album-room-checklist { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); max-height: 310px; }
.album-room-checklist-item { display: flex; align-items: center; gap: .75rem; }
.album-room-checklist-item span { min-width: 0; overflow-wrap: anywhere; }
.album-room-checklist-mark:disabled { opacity: 1; cursor: default; }
.album-room-inventory-cover { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1; overflow: hidden; }
.album-room-inventory-cover.album-room-inventory-stack { position: relative; isolation: isolate; overflow: visible; padding: 8px 0 0 8px; box-sizing: border-box; }
.album-room-inventory-stack::before, .album-room-inventory-stack::after { content: ''; position: absolute; inset: 0 8px 8px 0; border: 1px solid var(--theme-border-strong); background: var(--theme-input-bg); z-index: -2; }
.album-room-inventory-stack::after { inset: 4px 4px 4px 4px; z-index: -1; }
.album-room-inventory-stack img, .album-room-inventory-stack > .album-room-cover-fallback { border: 1px solid var(--theme-border-strong); box-sizing: border-box; }
.album-room-inventory-stack .album-room-copy-count { position: absolute; right: 3px; bottom: 3px; z-index: 1; margin: 0; }
.album-room-cover-fallback { display: flex; align-items: center; justify-content: center; text-align: center; width: 100%; height: 100%; padding: .5rem; box-sizing: border-box; background: var(--theme-input-bg); color: var(--theme-text); overflow-wrap: anywhere; font-size: .7rem; }
.album-room-inventory-cover img, .album-room-detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-room-inventory-name { font-weight: bold; }
.album-room-inventory-item > span { text-align: center; overflow-wrap: anywhere; }
.album-room-inventory-location { font-weight: bold; }
.album-room-detail-header { display: flex; align-items: flex-start; gap: 1.5rem; margin: 1rem 0; }
.album-room-detail-cover { width: 160px; aspect-ratio: 1; flex: none; display: flex; justify-content: center; align-items: center; }
.album-room-detail-info { flex: 1; min-width: 0; }
.album-room-detail-info h3 { font-size: .9rem; line-height: 1.7; margin-top: 0; overflow-wrap: anywhere; }
.album-room-stats { font-size: .85rem; margin: 0; }
.album-room-stats > div { display: flex; gap: .75rem; padding: .35rem 0; border-bottom: 1px solid var(--theme-border); }
.album-room-stats dt { font-weight: bold; flex: 1; }
.album-room-stats dd { margin: 0; flex: 1; overflow-wrap: anywhere; }
.album-room-detail-controls label { display: flex; align-items: center; gap: .5rem; }
.album-room-detail-link { display: inline-block; margin-top: 1rem; color: var(--theme-text); }
.album-room-detail-link + .album-room-detail-link { margin-left: 1rem; }
.wallet-nft-section { margin: 1.5rem 0; }
.wallet-nft-section[hidden] { display: none; }
.wallet-nft-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.wallet-nft-header .page-title { margin: 0; }
.wallet-nft-grid { margin-top: 0; }
.wallet-nft-card .card-placeholder, .wallet-nft-card .era-card-placeholder { position: relative; }
.wallet-nft-card .card-placeholder img, .wallet-nft-card .era-card-placeholder img { width: 100%; height: 100%; object-fit: cover; border-radius: 4.85% / 3.45%; }
.wallet-nft-badge { position: absolute; top: .4rem; right: .4rem; padding: .2rem .4rem; border-radius: .3rem; background: #5b398b; color: #fff; font-size: .7rem; font-weight: 700; }
.wallet-nft-card-footer { display: flex; flex-direction: column; gap: .2rem; text-align: center; font-size: .8rem; }
.wallet-nft-card .card-footer { display: flex; flex-direction: column; gap: .2rem; }
.wallet-nft-card a { color: var(--theme-text); text-decoration: underline; }
.album-room-drag-ghost { position: fixed; z-index: 10000; pointer-events: none; padding: 0; border: 2px solid var(--theme-border-strong); background: var(--theme-nav-bg); transform: translate(-50%, -50%); opacity: .9; }
@media (max-width: 640px) {
  .album-room-toolbar { gap: .5rem; }
  .album-room-detail-controls label { flex-wrap: wrap; }
  .album-room-detail-header { flex-direction: column; align-items: center; gap: 1rem; }
  .album-room-detail-info { width: 100%; }
  .album-room-inventory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .album-room-inventory-filters .styled-select { max-width: 100%; }
}

@media (max-width: 540px) {
  .user-stats {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    min-height: 0;
  }

  .user-stats .nav-account {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
  }
}

/* Both shortcuts and their panels use the same spacing at every screen size. */
body {
  --mission-shortcut-height: 44px;
  --mission-shortcut-gap: 8px;
  --mission-shortcut-top: calc(var(--nav-height, 80px) + 12px);
  --mission-shortcut-step: calc(var(--mission-shortcut-height) + var(--mission-shortcut-gap));
  --beginner-shortcut-offset: 0px;
  --bias-shortcut-offset: 0px;
  --festival-shortcut-offset: 0px;
  --mission-panel-top: calc(var(--mission-shortcut-top) + var(--mission-shortcut-height) + var(--beginner-shortcut-offset) + var(--bias-shortcut-offset) + var(--festival-shortcut-offset) + 10px);
}

body.beginner-bundle-visible { --beginner-shortcut-offset: var(--mission-shortcut-step); }
body.starter-bias-visible { --bias-shortcut-offset: var(--mission-shortcut-step); }
body.mission-shortcuts-stacked { --festival-shortcut-offset: var(--mission-shortcut-step); }

#bountyMissionToggle,
#festivalMissionToggle,
#starterBiasToggle {
  height: var(--mission-shortcut-height);
}

#starterBiasToggle { top: calc(var(--mission-shortcut-top) + var(--beginner-shortcut-offset)); }
#bountyMissionToggle { top: calc(var(--mission-shortcut-top) + var(--beginner-shortcut-offset) + var(--bias-shortcut-offset)); }
#festivalMissionToggle { top: calc(var(--mission-shortcut-top) + var(--beginner-shortcut-offset) + var(--bias-shortcut-offset) + var(--festival-shortcut-offset)); }

#bountyMissionPanel,
#festivalMissionPanel {
  top: var(--mission-panel-top);
  max-height: calc(100dvh - var(--mission-panel-top) - 12px - env(safe-area-inset-bottom));
}

.friends-filterbar .friends-list-search-group {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 360px;
}

.friends-list-search-group .search-wrap,
.friends-list-search-group .search-input {
  width: 100%;
  min-width: 0;
}

/* Beginner offer lives with the mission shortcuts and uses the standard modal shell. */
#beginnerBundleToggle {
  top: var(--mission-shortcut-top);
  height: var(--mission-shortcut-height);
  display: none;
}
#beginnerBundleToggle.visible { display: inline-flex; }
#beginnerBundleToggle > span:first-child { font-size: 1.4rem; line-height: 1; }
.beginner-bundle-frame {
  position: relative;
  width: min(92vw, 660px);
  max-height: min(90dvh, 900px);
}
.beginner-bundle-content {
  width: 100%;
  max-width: 100%;
  max-height: min(90dvh, 900px);
  overflow-y: auto;
  padding: 0;
  text-align: left;
  border: 3px solid var(--theme-border-strong);
  border-radius: 18px;
}
#beginnerBundleModal .beginner-bundle-content { width: 100%; max-width: 100% !important; padding: 0; }
#beginnerBundleModal .beginner-bundle-frame > .close-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  background: var(--theme-control-bg);
}
.beginner-bundle-hero {
  padding: 17px;
  border-bottom: 3px solid var(--theme-border-strong);
  background: repeating-linear-gradient(90deg, #f79ab5 0 36px, #ffd98d 36px 72px, #5dd4de 72px 108px);
}
.beginner-bundle-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 155px;
  gap: 8px;
  align-items: center;
  min-height: 180px;
  padding: 20px 46px 20px 22px;
  border: 3px solid #5b4c62;
  border-radius: 12px;
  background: var(--theme-modal-bg);
}
.beginner-bundle-kicker {
  display: inline-block;
  margin-bottom: 8px;
  font: 900 .82rem/1.35 'Courier New', monospace;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.beginner-bundle-hero h2 { margin: 0 0 6px; text-align: left; font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.1; }
.beginner-bundle-hero p { margin: 0 0 10px; line-height: 1.45; }
.beginner-bundle-deadline {
  display: inline-block;
  padding: 5px 9px;
  border: 2px solid var(--theme-border-strong);
  border-radius: 7px;
  background: var(--theme-control-bg);
  font: 800 .78rem/1.4 'Courier New', monospace;
}
.beginner-bundle-pack-art { position: relative; width: 155px; height: 160px; }
.beginner-bundle-pack-art img { position: absolute; top: 2px; width: 96px; height: 150px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 8px 4px rgba(91, 76, 98, .28)); }
.beginner-bundle-pack-art img:first-child { left: 0; transform: rotate(-12deg); }
.beginner-bundle-pack-art img:nth-child(2) { right: 0; transform: rotate(10deg); }
.beginner-bundle-pack-art span { position: absolute; right: -7px; bottom: 0; padding: 3px 9px; border: 2px solid #5b4c62; border-radius: 8px; background: #ffd98d; color: #5b4c62; font: 900 1.2rem 'Courier New', monospace; }
.beginner-bundle-body { padding: 20px 24px 24px; }
.beginner-bundle-reward-heading, .beginner-bundle-section-heading, .beginner-bundle-checkout-heading { display: flex; align-items: center; gap: 9px; }
.beginner-bundle-reward-heading { justify-content: space-between; margin-bottom: 10px; }
.beginner-bundle-reward-heading h3, .beginner-bundle-section-heading h3, .beginner-bundle-checkout-heading h3 { margin: 0; font-size: 1.1rem; }
.beginner-bundle-reward-heading > span { font: 800 .73rem 'Courier New', monospace; text-transform: uppercase; }
.beginner-bundle-rewards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.beginner-bundle-reward { display: flex; align-items: center; gap: 10px; min-height: 55px; padding: 8px 11px; border: 2px solid var(--theme-border-strong); border-radius: 10px; background: var(--theme-card-bg); box-shadow: 0 3px 0 var(--theme-shadow); }
.beginner-bundle-reward--packs { border-color: #5b4c62; background: linear-gradient(100deg, #ffe9f1, #fff0c8); color: #5b4c62; }
.beginner-bundle-reward-icon { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 8px; background: var(--theme-control-bg); font-size: 1.45rem; }
.beginner-bundle-reward strong, .beginner-bundle-reward small { display: block; line-height: 1.3; }
.beginner-bundle-reward small { margin-top: 2px; font-size: .77rem; }
.beginner-bundle-selection { margin-top: 20px; }
.beginner-bundle-section-heading > span, .beginner-bundle-checkout-heading > span { display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid var(--theme-border-strong); border-radius: 7px; background: #ffd98d; color: #5b4c62; font: 900 .8rem 'Courier New', monospace; }
.beginner-bundle-selection p { margin: 9px 0 13px; line-height: 1.45; }
.beginner-bundle-select-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.beginner-bundle-select-grid > div { min-width: 0; }
.beginner-bundle-selection label { display: block; margin-bottom: 5px; font-weight: 800; }
.beginner-bundle-selection select { width: 100%; min-height: 44px; padding: 8px 10px; border: 2px solid var(--theme-border-strong); border-radius: 8px; background: var(--theme-input-bg); color: var(--theme-text); }
.beginner-bundle-selection select:focus-visible { outline: 3px solid var(--theme-focus); outline-offset: 2px; }
.beginner-bundle-purchase { position: sticky; bottom: -24px; z-index: 2; display: grid; grid-template-columns: 1fr auto; gap: 9px 16px; align-items: center; margin: 16px -24px -24px; padding: 14px 24px 20px; border-top: 3px solid var(--theme-border-strong); background: var(--theme-modal-bg); box-shadow: 0 -5px 18px var(--theme-shadow); }
.beginner-bundle-purchase:empty, .beginner-bundle-selection:empty { display: none; }
.beginner-bundle-checkout-heading { grid-column: 1 / -1; }
.beginner-bundle-price { display: flex; flex-direction: column; gap: 1px; margin: 0; }
.beginner-bundle-price strong { font-size: 1.65rem; line-height: 1; }
.beginner-bundle-price small { font-size: .8rem; font-weight: 700; }
.beginner-bundle-payment-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.beginner-bundle-payment-row .action-btn, .beginner-bundle-purchase > .action-btn { width: auto; min-height: 42px; margin: 0; padding-inline: 16px; }
.beginner-bundle-purchase > .action-btn { justify-self: end; }
.beginner-bundle-purchase--native > p { margin: 0; }
.beginner-bundle-purchase--native > .beginner-bundle-price { justify-self: end; font-size: 1.4rem; font-weight: 900; }
.beginner-bundle-purchase--native > .action-btn { grid-column: 1 / -1; width: 100%; }
.beginner-bundle-claim { display: grid; gap: .6rem; margin-top: 18px; padding: 14px; border: 2px solid var(--theme-border); border-radius: 10px; background: var(--theme-card-bg); }

/* Keep the fill within each rounded border; nested translucent panels otherwise
   show a second, displaced gradient at their corners. */
:is(.profile-section, .friends-section, .trading-section, .auction-section,
    .tournament-panel, .group-section, .modal-content, .friend-card,
    .search-result-card, .achievement-card, .bounty-mission-pool,
    .shop-stall-card, .festival-mission-panel) {
  background-clip: padding-box;
}

/* The current matchup can land on a fractional pixel. Extend its gradient one
   pixel beyond the box so the page color cannot show along the top or left. */
html #tournamentViewContent .tournament-bracket-match.is-current {
  --tournament-match-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 243, 236, 0.86));
  position: relative;
  isolation: isolate;
  border: 0 !important;
  background: transparent !important;
}

:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"])
  #tournamentViewContent .tournament-bracket-match.is-current {
  --tournament-match-gradient: var(--theme-card-bg);
}

html #tournamentViewContent .tournament-bracket-match.is-current::before {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  background: var(--tournament-match-gradient);
  pointer-events: none;
}

/* Translucent star borders show a different-colored strip around rounded era
   cards. Stars remain in the header, so use the tournament's extended fill. */
html .era-section {
  position: relative;
  isolation: isolate;
  border: 0 !important;
  background: transparent !important;
}
html .era-section::before {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  background: var(--theme-card-bg);
  pointer-events: none;
}

/* Keep the training surface continuous at rounded, fractional-pixel edges. */
html .era-training-section {
  --training-section-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 240, 255, 0.5));
  isolation: isolate;
  background: transparent;
}
:is(html[data-theme="dark"], html[data-theme="grey"], html[data-theme^="festival-"])
  .era-training-section {
  --training-section-gradient: var(--theme-card-bg);
}
html .era-training-section::before {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  background: var(--training-section-gradient);
  pointer-events: none;
}

#authModal .login-modal {
  border-color: var(--theme-border-strong) !important;
  background-clip: padding-box;
}
#authModal .login-form .form-input,
#authModal .login-form .form-input:focus {
  background: #fff3ec !important;
  color: #5b4c62 !important;
  caret-color: #5b4c62;
  color-scheme: light;
}
#authModal .login-form .form-input::placeholder { color: #75667b !important; opacity: 1; }
#authModal .auth-terms-check,
#authModal .auth-terms-check span { color: #5b4c62 !important; }
#authModal .auth-terms-check a { color: #7c3864 !important; }

#requiredAppUpdate {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(25, 21, 31, 0.92);
}
.required-app-update-card {
  width: min(440px, 100%);
  padding: 32px;
  border: 3px solid var(--theme-border-strong);
  border-radius: 24px;
  background: var(--theme-modal-bg);
  color: var(--theme-text);
  text-align: center;
  box-shadow: 0 16px 48px var(--theme-shadow-strong);
}
.required-app-update-card .action-btn[hidden] { display: none; }
.beginner-bundle-claim .action-btn { justify-self: start; }
@media (max-width: 600px) {
  .beginner-bundle-hero { padding: 10px; }
  .beginner-bundle-hero-inner { grid-template-columns: minmax(0, 1fr) 95px; min-height: 145px; padding: 14px 40px 14px 14px; }
  .beginner-bundle-hero h2 { font-size: 1.65rem; }
  .beginner-bundle-hero p { font-size: .91rem; }
  .beginner-bundle-pack-art { width: 95px; height: 120px; }
  .beginner-bundle-pack-art img { width: 68px; height: 110px; }
  .beginner-bundle-body { padding: 15px; }
  .beginner-bundle-rewards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .beginner-bundle-reward { gap: 6px; min-height: 52px; padding: 6px; }
  .beginner-bundle-reward-icon { flex-basis: 29px; width: 29px; height: 29px; font-size: 1.15rem; }
  .beginner-bundle-reward strong { font-size: .86rem; }
  .beginner-bundle-select-grid { grid-template-columns: 1fr; gap: 9px; }
  .beginner-bundle-purchase { grid-template-columns: 1fr; bottom: -15px; margin: 14px -15px -15px; padding: 12px 15px 15px; }
  .beginner-bundle-payment-row { justify-content: stretch; }
  .beginner-bundle-payment-row .action-btn { flex: 1 1 90px; }
  .beginner-bundle-purchase > .action-btn { justify-self: stretch; }
  .beginner-bundle-purchase--native > .beginner-bundle-price { justify-self: start; }
}

.bounty-pool-btn.site-secondary-btn {
  white-space: normal;
  text-wrap: balance;
}

/* Give the desktop controls their own space before switching layouts. */
@media (min-width: 901px) and (max-width: 1300px) {
  .top-nav {
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: clamp(18px, 1.5vw, 22px);
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .nav-brand {
    min-width: 0;
    gap: 2px;
    font-size: clamp(9px, 1vw, 12px);
    white-space: nowrap;
  }

  .nav-brand .notification-btn { margin: 0; padding: 3px; }

  .nav-links {
    justify-self: stretch;
    justify-content: center;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 3px;
  }

  .nav-link {
    flex: none;
    padding: 4px 6px;
    font-size: clamp(8px, 0.9vw, 11px);
  }

  .user-stats { gap: 4px; padding-left: 0; }
  .user-stats .stat-item--merged {
    flex: none;
    padding: 4px 7px;
    gap: 3px;
    font-size: clamp(9px, 1vw, 12px);
    white-space: nowrap;
  }
  .nav-account { min-width: 0; max-width: 130px; }
  .nav-account .header-wallet-actions .action-btn { padding: 3px 5px; font-size: 9px; }
}

/* Both navigation choices switch together when the desktop row runs out of room. */
@media (max-width: 900px) {
  .top-nav[data-mobile-nav-layout="classic"] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    height: auto;
    min-height: 0;
    gap: 4px clamp(2px, 0.8vw, 10px);
    padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  }

  .top-nav[data-mobile-nav-layout="classic"] .nav-brand {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    margin: 0;
    gap: 2px;
    font-size: clamp(6.5px, 2.05vw, 12px);
    letter-spacing: 0;
    white-space: nowrap;
  }

  .top-nav[data-mobile-nav-layout="classic"] .nav-brand > span {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-nav[data-mobile-nav-layout="classic"] .nav-brand .notification-btn {
    flex: none;
    margin: 0;
    padding: 2px;
    font-size: clamp(14px, 4vw, 20px);
  }

  .top-nav[data-mobile-nav-layout="classic"] .nav-brand .notification-badge {
    top: -3px;
    right: 0;
    min-width: 14px;
    height: 14px;
    padding: 0 2px;
    border-width: 1px;
    font-size: 7px;
  }

  .top-nav[data-mobile-nav-layout="classic"] .user-stats { display: contents; }

  .top-nav[data-mobile-nav-layout="classic"] .stat-item--merged {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    margin: 0;
    padding: 4px 6px;
    gap: clamp(2px, 0.4vw, 5px);
    font-size: clamp(8px, 1.1vw, 13px);
    white-space: nowrap;
  }

  .top-nav[data-mobile-nav-layout="classic"] .nav-account {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    width: auto;
    min-width: 0;
    max-width: min(100%, 175px);
  }

  .top-nav[data-mobile-nav-layout="classic"] .header-username-btn {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 2px 3px;
    font-size: clamp(9px, 1vw, 12px);
  }

  .top-nav[data-mobile-nav-layout="classic"] .header-wallet-settings,
  .top-nav[data-mobile-nav-layout="classic"] .header-wallet-actions,
  .top-nav[data-mobile-nav-layout="classic"] .header-wallet-connect { max-width: 100%; }

  .top-nav[data-mobile-nav-layout="classic"] .header-wallet-actions .action-btn {
    width: 100%;
    max-width: 100%;
    padding: 3px 5px;
    font-size: clamp(8px, 0.9vw, 11px);
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
  }

  .top-nav[data-mobile-nav-layout="classic"] .nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    gap: 4px;
    order: initial;
  }

  .top-nav[data-mobile-nav-layout="classic"] .nav-link {
    flex: none;
    width: auto;
    min-height: 0;
    padding: 0.4rem 0.65rem;
    font-size: clamp(8px, 1.5vw, 12px);
    line-height: 1.1;
  }

  /* Collapsible remains optional in Profile settings. */
  .top-nav[data-mobile-nav-layout="collapsible"] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    height: auto;
    min-height: 0;
    gap: 3px 8px;
    padding: max(7px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 7px max(12px, env(safe-area-inset-left));
  }

  .top-nav[data-mobile-nav-layout="collapsible"] .nav-brand {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    margin: 0;
    font-size: 17px;
    text-align: left;
  }

  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-actions {
    display: flex;
    grid-column: 2;
    grid-row: 1 / 3;
    justify-self: end;
    gap: 5px;
  }

  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-actions .notification-btn {
    margin: 0;
    padding: 6px;
    color: var(--theme-text);
    font-size: 20px;
  }

  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-toggle {
    position: relative;
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--theme-border-strong);
    border-radius: 10px;
    background: var(--theme-control-bg);
    color: var(--theme-control-text);
    cursor: pointer;
  }

  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-toggle-lines,
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-toggle-lines::before,
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-toggle-lines::after {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
  }

  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-toggle-lines { position: relative; }
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-toggle-lines::before,
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-toggle-lines::after { content: ''; position: absolute; left: 0; }
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-toggle-lines::before { top: -6px; }
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-toggle-lines::after { top: 6px; }
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-toggle:focus-visible { outline: 2px solid var(--theme-text); outline-offset: 2px; }
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-toggle .notification-badge {
    top: -5px;
    right: -5px;
    min-width: 13px;
    width: 13px;
    height: 13px;
    padding: 0;
    border-width: 2px;
  }

  .top-nav[data-mobile-nav-layout="collapsible"] .user-stats {
    display: flex;
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    justify-content: flex-start;
    position: static;
    width: auto;
    min-height: 0;
    padding: 0;
  }

  .top-nav[data-mobile-nav-layout="collapsible"] .user-stats .stat-item--merged {
    margin: 0;
    padding: 5px 9px;
    gap: 5px;
    font-size: 12px;
    white-space: nowrap;
  }

  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: calc(100% + 4px);
    left: 10px;
    right: 10px;
    z-index: 1100;
    max-height: calc(100dvh - 100px - env(safe-area-inset-top));
    overflow-y: auto;
    gap: 10px;
    padding: 12px;
    border: 2px solid var(--theme-border-strong);
    border-radius: 16px;
    background: var(--theme-nav-bg), var(--theme-page-bg);
    box-shadow: 0 10px 25px var(--theme-shadow-strong);
  }

  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu:not(.is-open) { display: none; }

  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu .nav-account {
    order: 0;
    width: 100%;
    min-width: 0;
    align-items: stretch;
    position: static;
    transform: none;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--theme-border);
  }

  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu #userDisplay { align-self: stretch; }
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu .header-username-btn,
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu #loginBtn { width: 100%; text-align: left; }
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu .header-username-btn { padding: 9px 10px; font-size: 15px; }
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu .header-wallet-settings,
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu .header-wallet-actions,
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu .header-wallet-connect { width: 100%; }
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu .header-wallet-actions .action-btn {
    width: auto;
    min-height: 26px;
    padding: 4px 8px;
    font-size: 9px;
  }
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu .header-quick-settings,
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu .header-wallet-menu,
  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu .header-wallet-status:not(:empty) {
    position: static;
    width: 100%;
    max-width: none;
    max-height: none;
    text-align: left;
  }

  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu .nav-links {
    display: flex;
    flex-direction: column;
    order: 1;
    width: 100%;
    gap: 7px;
  }

  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-menu .nav-link {
    width: 100%;
    min-height: 42px;
    padding: 9px 13px;
    font-size: 14px;
    text-align: left;
  }

  .top-nav[data-mobile-nav-layout="collapsible"] .mobile-nav-trial-note {
    display: block;
    order: 2;
    color: var(--theme-text);
    font-size: 11px;
    text-align: center;
    opacity: 0.75;
  }
}

.mobile-nav-setting-help {
  margin: 0.6rem 0 0;
  color: var(--theme-muted);
  font-size: max(11px, 0.75rem);
  text-align: center;
}

@media (max-width: 900px) {
  .top-nav[data-mobile-nav-layout="collapsible"][data-mobile-nav-side="left"] .nav-brand,
  .top-nav[data-mobile-nav-layout="collapsible"][data-mobile-nav-side="left"] .user-stats {
    grid-column: 2;
    justify-self: end;
  }

  .top-nav[data-mobile-nav-layout="collapsible"][data-mobile-nav-side="left"] .mobile-nav-actions {
    grid-column: 1;
    justify-self: start;
    flex-direction: row-reverse;
  }
}

@media (max-width: 350px) {
  .top-nav[data-mobile-nav-layout="classic"] .nav-brand { font-size: 7px; }
  .top-nav[data-mobile-nav-layout="classic"] .nav-brand > span { letter-spacing: -1px; }
}

html.kpg-native-app :is(.shop-gem-pack-card, .token-paid-bundle)[data-website-mode] .shop-gem-provider-row.shop-gem-provider-row--apple {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  max-width: none;
}
html.kpg-native-app .shop-gem-provider-row--apple .shop-gem-pack-price {
  grid-column: 1;
  text-align: center;
}
html.kpg-native-app .shop-gem-provider-row--apple .apple-iap-buy {
  grid-column: 1;
  width: 100%;
}
html.kpg-native-app #supportModal .support-tier-price-row .apple-iap-buy {
  width: 100%;
  max-width: none;
}
.guest-account-notice[hidden], #profileInviteFriendsSection[hidden],
#logoutBtn[hidden], #deleteAccountBtn[hidden], #loginGuestBtn[hidden], #registerGuestBtn[hidden] {
  display: none !important;
}

.guest-account-notice p {
  color: var(--theme-text);
}
.shop-tab-panel--festival.active { display: flex; flex-direction: column; gap: 0; height: auto; min-height: 560px; overflow: visible; }
.shop-tab-panel--festival [data-festival-content] { flex: 1 1 auto; min-height: 0; overflow: visible; }
.shop-tab-panel--festival .shop-festival-grid { height: auto; }
@media (min-width: 901px) {
  .shop-stall-modal:has(.shop-tab-panel--festival.active) { max-height: calc(100dvh - 8px); }
  .shop-tab-panel--festival.active { padding: 14px 18px 20px; }
}
.shop-festival-page-nav {
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  border-top: 1px solid rgba(91, 76, 98, 0.16);
}
.shop-festival-pages { display: flex; align-items: center; gap: .75rem; }
.shop-festival-page:not(.active) { background: #5b4c62; }
@media (min-width: 901px) and (max-height: 800px) {
  .shop-tab-panel--festival.active { padding-bottom: 14px; }
  .shop-festival-grid { --shop-festival-feature-height: 134px; }
  .shop-festival-page-nav { margin-top: 7px; }
}
@media (max-width: 900px) {
  .shop-tab-panel--festival [data-festival-content] { flex: none; overflow: visible; }
  .shop-festival-page-nav { order: -1; flex-basis: 26px; margin: 0 0 8px; border-top: 0; border-bottom: 1px solid rgba(91, 76, 98, 0.16); }
}
[data-festival-content][hidden] { display: none !important; }
.shop-festival-archive { min-height: 0; overflow-y: auto; color: #5b4c62; }
.shop-festival-archive-note { margin: 0 0 8px; color: #6b5773; font-size: .78rem; font-weight: 800; }
.shop-festival-archive-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; align-content: start; padding: 2px 2px 8px; }
.shop-festival-archive-section { min-width: 0; }
.shop-festival-archive > .shop-stall-label { font-weight: 400; }
.shop-festival-archive-counter { padding: 8px; border-width: 3px; border-radius: 10px; background: linear-gradient(135deg, #fff9f5, #fff3ec); }
.shop-festival-archive-section[data-archive-festival="october-harvest"] .shop-festival-archive-counter { background: var(--festival-october-harvest-gradient); }
.shop-festival-archive-counter > .shop-festival-section-title { margin: 0 0 7px; padding-bottom: 5px; border-bottom: 2px dashed rgba(91, 76, 98, .24); font-weight: 400; }
.shop-festival-archive-section[data-archive-festival="october-harvest"] .shop-festival-section-title { color: #fff9f5; border-bottom-color: rgba(255, 249, 245, .6); text-shadow: 2px 2px 0 #24252b; }
.shop-festival-archive-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.shop-festival-archive-card { position: relative; display: flex; flex-direction: column; gap: 5px; min-width: 0; padding: 9px 8px 8px; border-width: 3px; border-radius: 10px; background: #fff9f5; box-shadow: 0 6px 0 rgba(91, 76, 98, .14); }
.shop-festival-archive-heading { min-height: 25px; padding-right: 62px; }
.shop-festival-archive-heading h4 { margin: 0; color: #5b4c62; font: 400 .82rem 'Courier New', monospace; line-height: 1.5; overflow-wrap: anywhere; }
.shop-festival-archive-price-badge { position: absolute; top: 8px; right: 8px; z-index: 1; display: inline-flex; align-items: center; justify-content: center; min-width: 56px; padding: 4px 7px; border: 2px solid rgba(91, 76, 98, .78); border-radius: 999px; background: rgba(255, 249, 245, .82); color: #5b4c62; font-family: 'Courier New', monospace; font-size: .75rem; font-weight: 900; line-height: 1; white-space: nowrap; box-shadow: 0 2px 0 rgba(91, 76, 98, .14); }
.shop-festival-archive-description { position: relative; flex: 1 1 auto; margin: 0; padding: 5px 6px 5px 16px; border-radius: 6px; background: #fff3ec; color: #6b5773; font: 400 .7rem 'Courier New', monospace; line-height: 1.25; }
.shop-festival-archive-description::before { content: '\2022'; position: absolute; top: 5px; left: 6px; color: #5b4c62; }
.shop-festival-archive-details { padding-top: 3px; border-top: 2px dashed rgba(91, 76, 98, .24); font-size: .7rem; }
.shop-festival-archive-details summary { color: #5b4c62; cursor: pointer; font-weight: 900; }
.shop-festival-archive-items { display: grid; gap: 3px; margin: 5px 0 0; padding: 0; list-style: none; font-size: .7rem; }
.shop-festival-archive-items li { min-width: 0; padding: 4px 6px 4px 16px; border-radius: 5px; background: #fff3ec; line-height: 1.3; }
.shop-festival-archive-items li::before { content: '\2022'; margin-left: -10px; padding-right: 5px; }
.shop-festival-archive-card li.owned { opacity: .65; }
.shop-festival-archive-actions.shop-gem-provider-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.shop-festival-archive-actions .shop-price-pill { min-width: 0; width: 100%; padding: 5px 6px; font-size: .8rem; }
.shop-festival-archive-actions .apple-iap-buy { grid-column: 1 / -1; }
.shop-festival-archive-actions .shop-price-pill:disabled { opacity: .62; cursor: not-allowed; }
@media (max-width: 350px) {
  .shop-festival-archive-grid { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
  .jigsaw-reference-toolbar:not([hidden]) { width: 265px; }
  .jigsaw-board {
    grid-template-columns: repeat(6, 42px);
    grid-template-rows: repeat(8, 45px);
  }
  .jigsaw-tray {
    grid-template-columns: repeat(8, 29px);
    grid-template-rows: repeat(6, var(--jigsaw-tray-piece-height, 31px));
    padding: 7.5px;
  }
}
