/* Shop background and village-style category navigation, beta 2026.10.24.16. */
.shop-page {
  --shop-shell-width: var(--game-shell-width, 430px);
  position: relative;
  isolation: isolate;
  display: flex;
  justify-content: center;
  width: 100%;
  height: var(--cf-viewport-height, 100dvh);
  min-height: var(--cf-viewport-height, 100dvh);
  overflow: hidden;
  background-color: #050907 !important;
  background-image: none !important;
}

.shop-page::before {
  display: none !important;
}

.shop-frame {
  box-sizing: border-box;
  position: relative;
  isolation: isolate;
  width: min(100%, var(--shop-shell-width)) !important;
  max-width: var(--shop-shell-width) !important;
  height: 100% !important;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid rgba(255, 222, 151, 0.18);
  border-left: 1px solid rgba(255, 222, 151, 0.18);
  background-color: #102019 !important;
  background-image:
    linear-gradient(180deg, rgba(4, 14, 12, 0.42) 0%, rgba(5, 16, 14, 0.12) 31%, rgba(4, 12, 10, 0.5) 100%),
    radial-gradient(circle at 50% 8%, rgba(255, 225, 157, 0.11), transparent 42%),
    url("/assets/shop-background-v20261024-1.webp") !important;
  background-position: center top !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
  background-attachment: scroll !important;
  box-shadow: 0 0 34px rgba(0, 0, 0, 0.76);
}

@media (orientation: landscape) {
  .shop-frame {
    width: min(100%, var(--shop-shell-width), 56.25vh) !important;
    max-width: min(100vw, var(--shop-shell-width), 56.25vh) !important;
    width: min(100%, var(--shop-shell-width), 56.25dvh) !important;
    max-width: min(100vw, var(--shop-shell-width), 56.25dvh) !important;
  }
}

.shop-frame > .compact-player-panel,
.shop-frame > .shop-content {
  position: relative;
  z-index: 1;
}

.shop-content {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(var(--cf-viewport-height, 100dvh) - 96px) !important;
  min-height: 0;
  padding: clamp(6px, 1.5vh, 12px) 12px calc(12px + var(--cf-safe-bottom, 0px)) !important;
  overflow: hidden !important;
}

.shop-top {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 76px minmax(0, 1fr) 76px;
  align-items: center;
  gap: 6px;
  margin: 2px 0 8px;
}

.shop-top::after {
  content: "";
  width: 76px;
}

.shop-top h2 {
  min-width: 0;
  margin: 0;
  color: #fff0bf;
  font-size: clamp(20px, 5.4vw, 25px);
  line-height: 1.05;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.94);
}

.shop-back {
  box-sizing: border-box;
  justify-self: start;
  width: 76px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 224, 153, 0.44);
  border-radius: 11px;
  color: #fff4d2;
  background: linear-gradient(180deg, rgba(66, 105, 75, 0.97), rgba(18, 49, 42, 0.98));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.16), 0 3px rgba(0, 0, 0, 0.4);
}

.shop-categories {
  box-sizing: border-box;
  display: grid !important;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr) !important;
  align-content: start;
  gap: 7px !important;
  width: 100%;
  height: auto !important;
  max-height: none !important;
  min-height: 0;
  padding: 8px !important;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(255, 220, 139, 0.42);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(7, 30, 27, 0.66), rgba(13, 35, 29, 0.57));
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.48), 0 3px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(1.5px);
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.shop-categories::-webkit-scrollbar {
  display: none;
}

.shop-categories::before {
  content: none !important;
  display: none !important;
}

.shop-category {
  box-sizing: border-box;
  position: relative;
  display: grid !important;
  grid-template-columns: 56px minmax(0, 1fr) 18px;
  align-items: center;
  justify-content: stretch;
  gap: 9px !important;
  width: 100%;
  min-height: 66px !important;
  padding: 6px 9px !important;
  border: 1px solid rgba(255, 223, 158, 0.26) !important;
  border-radius: 15px !important;
  color: #fff0bf !important;
  background:
    radial-gradient(circle at 8% 10%, rgba(255, 231, 168, 0.13), transparent 36%),
    linear-gradient(140deg, rgba(37, 82, 66, 0.98), rgba(9, 34, 35, 0.98)) !important;
  font-size: 14px !important;
  font-weight: 950 !important;
  line-height: 1.15;
  text-align: left !important;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.9);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.13), 0 2px rgba(0, 0, 0, 0.34) !important;
  transition: transform 120ms ease, border-color 120ms ease, filter 120ms ease;
}

.shop-category::after {
  content: "›";
  justify-self: end;
  color: #ffe19a;
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.86);
}

.shop-category:hover {
  transform: none;
  border-color: rgba(255, 224, 153, 0.62) !important;
  filter: brightness(1.08);
}

.shop-category:focus-visible {
  outline: 2px solid #ffe7a2;
  outline-offset: 2px;
}

.shop-category:active {
  transform: translateY(1px);
}

.shop-category > span:last-of-type {
  min-width: 0;
  max-width: 100%;
  line-height: 1.15;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.shop-category-icon {
  box-sizing: border-box;
  display: block !important;
  flex: 0 0 56px !important;
  width: 56px !important;
  height: 56px !important;
  overflow: visible;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 15px !important;
  background-color: transparent !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
  box-shadow: none !important;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.56));
}

.shop-category-icon img {
  display: none !important;
}

.shop-category:nth-child(1) .shop-category-icon { background-image: url("/assets/shop-category-weapon-v20261024-1.webp") !important; }
.shop-category:nth-child(2) .shop-category-icon { background-image: url("/assets/shop-category-armor-v20261024-1.webp") !important; }
.shop-category:nth-child(3) .shop-category-icon { background-image: url("/assets/shop-category-helmet-v20261024-1.webp") !important; }
.shop-category:nth-child(4) .shop-category-icon { background-image: url("/assets/shop-category-bracers-v20261024-1.webp") !important; }
.shop-category:nth-child(5) .shop-category-icon { background-image: url("/assets/shop-category-pants-v20261024-1.webp") !important; }
.shop-category:nth-child(6) .shop-category-icon { background-image: url("/assets/shop-category-boots-v20261024-1.webp") !important; }
.shop-category:nth-child(7) .shop-category-icon { background-image: url("/assets/shop-category-machinery-v20261024-1.webp") !important; }
.shop-category:nth-child(8) .shop-category-icon { background-image: url("/assets/shop-category-potion-v20261024-1.webp") !important; }
.shop-category:nth-child(9) .shop-category-icon { background-image: url("/assets/shop-category-scroll-v20261024-1.webp") !important; }
.shop-category:nth-child(10) .shop-category-icon { background-image: url("/assets/shop-category-gift-v20261024-1.webp") !important; }
.shop-category:nth-child(11) .shop-category-icon { background-image: url("/assets/shop-category-curse-v20261024-1.webp") !important; }
.shop-category:nth-child(12) .shop-category-icon { background-image: url("/assets/shop-category-ring-v20261024-1.webp") !important; }
.shop-category:nth-child(13) .shop-category-icon { background-image: url("/assets/shop-category-collar-v20261024-1.webp") !important; }

/* Keep the selected-category item list inside the same shell and visual language. */
.shop-scroll-view {
  box-sizing: border-box;
  flex: 1 1 auto;
  height: auto !important;
  min-height: 0;
  border-color: rgba(255, 220, 139, 0.42);
  background: linear-gradient(180deg, rgba(7, 30, 27, 0.7), rgba(13, 35, 29, 0.62));
  backdrop-filter: blur(1.5px);
}

@media (max-width: 360px) {
  .shop-content {
    padding-right: 8px !important;
    padding-left: 8px !important;
  }

  .shop-top {
    grid-template-columns: 70px minmax(0, 1fr) 70px;
    gap: 4px;
  }

  .shop-top::after,
  .shop-back {
    width: 70px;
  }

  .shop-category {
    grid-template-columns: 50px minmax(0, 1fr) 16px;
    gap: 7px !important;
    min-height: 60px !important;
    padding-right: 7px !important;
    padding-left: 7px !important;
  }

  .shop-category-icon {
    width: 50px !important;
    height: 50px !important;
    flex-basis: 50px !important;
  }
}

@media (max-height: 640px) {
  .shop-content {
    padding-top: 4px !important;
    padding-bottom: calc(8px + var(--cf-safe-bottom, 0px)) !important;
  }

  .shop-top {
    margin-top: 0;
    margin-bottom: 5px;
  }

  .shop-categories {
    gap: 5px !important;
    padding: 6px !important;
  }

  .shop-category {
    grid-template-columns: 48px minmax(0, 1fr) 16px;
    min-height: 58px !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
  }

  .shop-category-icon {
    width: 48px !important;
    height: 48px !important;
    flex-basis: 48px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shop-category {
    transition: none;
  }
}
