
:root {
  color-scheme: light;
  --bg: #fff;
  --card: #fff;
  --line: #dfe3e8;
  --text: #1f2937;
  --muted: #667085;
  --accent: #2563eb;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  position: relative;
  min-height: 100vh;
  background: #fff;
}

body::before {
  content: "";
  position: fixed;
  inset: -20px;

  background:
    linear-gradient(
      rgba(0, 0, 0, 0.10),
      rgba(0, 0, 0, 0.10)
    ),
    url("../images/city.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  filter: blur(5px);

  z-index: -1;
}

.home-button {
    display: inline-block;
    margin-bottom: 15px;
	margin-right: 5px;
    padding: 10px 14px;

    color: #374151;
    background: #ffffff;

    border: 1px solid #d9dde3;
    border-radius: 8px;

    font-size: 14px;
    font-weight: 600;
    text-decoration: none;

    transition: background 0.15s ease, border-color 0.15s ease;
}

.home-button[hidden] {
    display: none;
}

.home-button:hover {
    background: #f3f4f6;
    border-color: #c5cad1;
}

.catalog-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px;
}

.catalog-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.catalog-header h1 {
  margin: 0 0 5px;
  font-size: 28px;
}

.catalog-header p {
  margin: 0;
  color: #000;
}

.controls {
  display: grid;
  /* 4-control catalogs such as Makeup: search + year + sort + page size */
  grid-template-columns: minmax(280px, 1fr) 145px 180px 130px;
  gap: 10px;
  margin-bottom: 12px;
  align-items: center;
}

/* 5-control catalogs: search + category + year + sort + page size */
.controls:has(> :nth-child(5)) {
  grid-template-columns: minmax(280px, 1fr) 145px 145px 180px 130px;
}

/* 6-control catalogs add the currency filter. */
.controls:has(> :nth-child(6)) {
  grid-template-columns: minmax(280px, 1fr) 135px 135px 135px 180px 130px;
}

.controls input,
.controls select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  font: inherit;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  color: #000;
  font-size: 14px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.item-card {
  overflow: hidden;
  background: var(--card);
  border: 2px solid #C2C2C2;
  border-radius: var(--radius);
  min-width: 0;
}

.preview-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #F0F0F0;
  cursor: pointer;
}

.preview-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.preview-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.preview-state.error {
  color: #b42318;
  background: rgba(255,255,255,.82);
}

.item-info {
  padding: 12px;
  background: #fff;
}

.item-name {
  margin: 0 0 9px;
  min-height: 2.45em;
  line-height: 1.22;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.meta {
  display: grid;
  gap: 5px;
  font-size: 13px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.meta-label { color: var(--muted); }

.meta-value {
  text-align: right;
  overflow-wrap: anywhere;
}

.item-id {
  margin-top: 0px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

/* Used by Clothing, Accessories, Makeup, Lucky Box/Wheel, etc. */
.item-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 0px;
  color: var(--muted);
  font-size: 11px;
}

.item-category {
  font-weight: 600;
}

/* When the ID is inside .item-footer, the footer supplies the spacing. */
.item-footer .item-id {
  margin-top: 0;
  text-align: right;
}

.catalog-loader {
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  text-align: center;
  font-size: 16px;
  color: var(--muted);
}

.catalog-loader[hidden] {
  display: none;
}

.catalog-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(0, 0, 0, 0.15);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: catalog-spin 0.8s linear infinite;
}

@keyframes catalog-spin {
  to { transform: rotate(360deg); }
}

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: #000;
  font-size: 14px;
}

.page-jump input {
  width: 70px;
  padding: 8px 9px;
  box-sizing: border-box;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 22px 0 4px;
}

.pagination button {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}

.pagination button:disabled {
  opacity: .45;
  cursor: default;
}

.page-number {
  min-width: 120px;
  text-align: center;
  color: #000;
}

@media (max-width: 760px) {
  .catalog-shell { padding: 14px; }
  .catalog-header { display: block; }
  .controls {
    /* 4-control catalogs such as Makeup */
    grid-template-columns: minmax(240px, 1fr) 135px 160px 120px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .controls:has(> :nth-child(5)) {
    grid-template-columns: minmax(240px, 1fr) 135px 135px 160px 120px;
  }

  .controls:has(> :nth-child(6)) {
    grid-template-columns: minmax(240px, 1fr) 125px 125px 125px 150px 110px;
  }
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .item-info { padding: 9px; }
  .item-name { font-size: 14px; }
  .pagination { flex-wrap: wrap; }
}


@media (max-width: 460px) {
  .catalog-grid { grid-template-columns: 1fr 1fr; }
}

body.lightbox-open {
  overflow: hidden;
  padding-right: var(--lightbox-scrollbar-width, 0px);
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .72);
}

.lightbox-panel {
  width: fit-content;
  max-width: min(1080px, 96vw);
  max-height: 94vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .32);
}

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.lightbox-header > div {
  min-width: 0;
  flex: 1 1 auto;
}

.lightbox-header h2 {
  min-width: 0;
  margin: 0 0 3px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.lightbox-id {
  color: var(--muted);
  font-size: 12px;
}

.lightbox-close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-stage {
  position: relative;
  width: fit-content;
  height: fit-content;
  max-width: 100%;
  max-height: calc(94vh - 70px);
  min-height: 0;
  flex: 0 1 auto;
  margin: 0;
  overflow: hidden;
  background: #e5e7eb;
}

.lightbox-stage canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0 auto;
}

.lightbox-state[hidden] {
  display: none;
}

.lightbox-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, .7);
  pointer-events: none;
}

@media (max-width: 760px) {
  .lightbox { padding: 10px; }
  .lightbox-header { padding: 10px 12px; }
  .lightbox-stage { max-height: calc(94vh - 64px); }
}

/* Extra-small pagination refinement used by the other catalog layouts. */
@media (max-width: 520px) {
  .pagination {
    flex-wrap: wrap;
  }

  .page-number {
    min-width: 100px;
  }
}

/* =========================================================
   SHOP AVAILABILITY ICONS + HOVER POPUP
   ========================================================= */

.item-card {
  position: relative;
}

.shop-icons {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: calc(100% - 16px);
}

.shop-icon-wrap {
  position: relative;
  flex: 0 0 auto;
}

.shop-icon {
  width: 30px;
  height: 30px;
  display: block;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  cursor: help;
}

.shop-popup {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 30;
  width: max-content;
  min-width: 175px;
  max-width: 240px;
  padding: 9px 11px;
  border: 1px solid rgba(31, 41, 55, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.20);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-3px);
  transition:
    opacity 0.12s ease,
    transform 0.12s ease,
    visibility 0.12s ease;
}

.shop-popup::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 10px;
  width: 9px;
  height: 9px;
  background: rgba(255, 255, 255, 0.98);
  border-left: 1px solid rgba(31, 41, 55, 0.16);
  border-top: 1px solid rgba(31, 41, 55, 0.16);
  transform: rotate(45deg);
}

.shop-icon-wrap.is-open .shop-popup {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (hover: hover) {
  .shop-icon-wrap:hover .shop-popup,
  .shop-icon-wrap:focus-within .shop-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

.shop-popup-title {
  position: relative;
  z-index: 1;
  font-weight: 700;
}

.shop-popup-position {
  position: relative;
  z-index: 1;
  margin-top: 3px;
  color: var(--muted);
}

.shop-popup.synthesis-popup {
  min-width: 145px;
  max-width: 220px;
  pointer-events: auto;
}

.synthesis-material-list {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 6px;
  row-gap: 4px;
  margin-top: 6px;
}

.synthesis-material-row {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 5px 2px 2px;
  border-radius: 6px;
  background: #e2e5e9;
  white-space: nowrap;
}

.synthesis-material-preview {
  display: block;
  width: var(--synthesis-icon-size, 30px);
  height: var(--synthesis-icon-size, 30px);
  flex: 0 0 var(--synthesis-icon-size, 30px);
  object-fit: contain;
  border-radius: 5px;
  background: transparent;
}

.synthesis-material-amount {
  color: #000;
  font-weight: 700;
  font-size: 13px;
}

@media (max-width: 760px) {
  .shop-icons {
    top: 6px;
    right: 6px;
    gap: 3px;
  }

  .shop-icon {
    width: 26px;
    height: 26px;
  }

  .shop-popup {
    min-width: 160px;
    max-width: 210px;
    font-size: 11px;
  }

  .shop-popup.synthesis-popup {
    min-width: 135px;
    max-width: min(220px, calc(100vw - 24px));
  }
}

/* =========================================================
   WISHLIST
   ========================================================= */

.wishlist-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 12;
  width: 30px;
  height: 30px;
  padding: 4px;
  border: 0;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

/* Keep the white button box static. Only the heart image is interactive. */
.wishlist-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  opacity: 0.4;
  transform: scale(1);
  transition: opacity 0.12s ease, transform 0.12s ease, filter 0.12s ease;
}

.wishlist-button:focus-visible img {
  opacity: 1;
  filter: grayscale(0);
  transform: scale(1);
}

.wishlist-button.is-wishlisted img {
  opacity: 1;
  filter: grayscale(0);
}

/* Hover is persistent after taps on some touch browsers, so reserve it for mice. */
@media (hover: hover) {
  .wishlist-button:hover img {
    opacity: 1;
    filter: grayscale(0);
    transform: scale(1);
  }

  /* On the Wishlist page, fading the filled heart on hover signals removal. */
  .wishlist-shell .wishlist-button.is-wishlisted:hover img {
    opacity: 1;
    filter: grayscale(1);
  }
}

@media (hover: none) {
  .wishlist-button:active img {
    opacity: 0.4;
    transform: scale(0.92);
  }
}

.wishlist-shell .wishlist-button.is-wishlisted:focus-visible img {
  opacity: 0.4;
  filter: grayscale(0);
}

/* Stack shop icons vertically directly under the heart. */
.shop-icons {
  top: 46px;
  right: 8px;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 4px;
  max-width: none;
}

.wishlist-summary {
  margin-bottom: 16px;
}

.wishlist-empty {
  margin: 36px auto;
  max-width: 520px;
  padding: 34px 24px;
  text-align: center;
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid #C2C2C2;
  border-radius: var(--radius);
}

.wishlist-empty img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  opacity: 1;
}

.wishlist-empty h2 {
  margin: 12px 0 6px;
}

.wishlist-empty p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  .wishlist-button {
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
  }

  .shop-icons {
    top: 38px;
    right: 6px;
    gap: 3px;
    max-width: none;
  }
}

/* =========================================================
   WISHLIST CONTROLS + SHARING
   ========================================================= */

.wishlist-toolbar {
  display: block;
  margin-bottom: 16px;
}

.wishlist-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.wishlist-actions-row > .wishlist-controls-row {
  flex: 1 1 auto;
  min-width: 0;
}

.wishlist-page-image-button {
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.wishlist-page-image-button:hover:not(:disabled) {
  background: #f3f4f6;
}

.wishlist-page-image-button:disabled {
  opacity: .5;
  cursor: default;
}

.wishlist-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  flex-wrap: nowrap;
}

.wishlist-controls-row[hidden] {
  display: none;
}

.wishlist-controls-row button,
.wishlist-share-result button {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.wishlist-controls-row button:hover,
.wishlist-share-result button:hover {
  background: #f3f4f6;
}

.wishlist-controls-row button:disabled {
  opacity: .5;
  cursor: default;
}

.wishlist-share-result {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  margin: 0;
  flex: 0 0 auto;
}

.wishlist-share-result[hidden] {
  display: none;
}

.wishlist-share-expiry {
  color: #000;
  font-size: 12px;
  white-space: nowrap;
}

.wishlist-share-expiry[hidden] {
  display: none;
}

.wishlist-share-result input {
  width: min(360px, 42vw);
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.shared-wishlist-mode .wishlist-button {
  display: none;
}

@media (max-width: 760px) {
  .wishlist-actions-row {
    align-items: flex-start;
  }

  .wishlist-controls-row {
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .wishlist-share-result {
    flex: 0 0 auto;
  }

  .wishlist-share-result input {
    width: 300px;
    min-width: 220px;
  }
}

/* Compact item cost and release date into one row beneath the item name. */
.item-name {
  min-height: 0;
  padding-bottom: 8px;
  margin-bottom: 0;
}

.item-info {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.item-info .meta {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid #e1e4e8;
}

.item-card {
  display: flex;
  flex-direction: column;
}

.item-card .preview-wrap {
  flex: 0 0 auto;
}

.item-info .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
}

.item-info .meta-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  min-width: 0;
}

.item-info .meta-row:first-child {
  padding-left: 7px;
}

.item-info .meta-row:nth-child(2) {
  margin-left: auto;
  white-space: nowrap;
}

.item-info .meta-label {
  display: none;
}

.item-info .meta-value.cost {
  text-align: left;
  overflow-wrap: normal;
}

.item-info .currency-icon {
  display: block;
  width: 20px;
  height: 20px;
  max-height: 20px;
  flex: 0 0 20px;
  object-fit: contain;
}

.wishlist-shell .item-info {
  padding-bottom: 2px;
}
