/* Shop and inventory share content-sized cards; unused grid tracks stay empty. */
body.economy-page .shop-sections {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 36px;
}
body.economy-page .shop-section {
  min-width: 0;
}
body.economy-page .shop-section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
  margin-bottom: 18px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--ui-line);
}
body.economy-page .shop-section-heading h2 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.4;
  color: var(--ui-text) !important;
}
body.economy-page .shop-section-heading p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--ui-muted) !important;
}
body.economy-page.theme-dark .economy-inventory-link img {
  filter: brightness(0) invert(0.93);
}
.economy-page .shop-grid,
.economy-page .inventory-list {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  align-items: stretch;
  gap: 18px;
}

.economy-page .shop-item-card,
.economy-page .inventory-item-row {
  grid-template-rows: 128px 1fr auto;
  aspect-ratio: auto;
  min-width: 0;
  padding: 16px;
  gap: 16px;
  border-radius: 18px;
}

body.economy-page .shop-item-image,
body.economy-page .inventory-item-image,
body.economy-page .shop-inspect-image {
  display: grid;
  place-items: center;
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  background: var(--ui-surface-soft) !important;
}

body.economy-page .shop-item-image img,
body.economy-page .inventory-item-image img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

/* Only legacy monochrome artwork needs inversion. Keep colored SVGs intact. */
body.economy-page .shop-item-image img,
body.economy-page .inventory-item-image img,
body.economy-page .shop-inspect-image img {
  filter: none !important;
}
body.economy-page.theme-dark
  :is(.shop-item-image, .inventory-item-image, .shop-inspect-image)
  img:is([src$='/battery.svg'], [src$='/fishbone.svg']) {
  filter: brightness(0) invert(0.93) !important;
}

body.economy-page .asset-quantity-badge {
  top: 24px;
  right: 24px;
  width: auto;
  height: auto;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  background: var(--ui-surface) !important;
  color: var(--ui-muted) !important;
  font-size: 0.75rem;
  line-height: 1.4;
}

.economy-page .shop-item-copy,
.economy-page .inventory-item-copy {
  align-content: start;
  gap: 8px;
}

body.economy-page .shop-item-copy h2,
body.economy-page .inventory-item-copy h2 {
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 1.12rem;
  line-height: 1.5;
  color: var(--ui-text);
}

body.economy-page .shop-item-copy p,
body.economy-page .inventory-item-copy p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 3;
}

body.economy-page .shop-item-price,
body.economy-page #shop-inspect-price {
  color: var(--ui-accent);
  font-size: 1rem;
  line-height: 1.6;
}

.economy-page .inventory-item-actions {
  grid-template-columns: 1fr;
}

body.economy-page:not(.auth-page-body) .electromagnetic-button {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--ui-line-strong);
  border-radius: 10px;
  background: var(--ui-accent-soft) !important;
  color: var(--ui-text) !important;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: normal;
}

body.economy-page .electromagnetic-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

body.economy-page .electromagnetic-button:focus-visible,
body.economy-page .fortune-close:focus-visible,
body.economy-page .inventory-gift-input:focus-visible {
  outline: 3px solid var(--ui-focus);
  outline-offset: 3px;
}

body.economy-page .shop-inspect-modal {
  display: grid;
  place-items: center;
  padding: 16px;
  overscroll-behavior: contain;
}

body.economy-page .shop-inspect-panel {
  width: min(760px, 100%);
  margin: 0;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 56px 24px 24px;
  border: 1px solid var(--ui-line-strong);
  background: var(--ui-surface) !important;
  color: var(--ui-text);
}

body.economy-page .shop-inspect-panel .fortune-close {
  position: sticky;
  top: 0;
  right: auto;
  z-index: 5;
  display: block;
  width: 44px;
  height: 44px;
  margin: -44px -12px 0 auto;
  border-radius: 50%;
  background: var(--ui-surface);
  color: var(--ui-text);
}

.economy-page .shop-inspect-layout {
  grid-template-columns: minmax(140px, 0.7fr) minmax(0, 1.3fr);
  align-items: start;
  gap: 24px;
}

body.economy-page .shop-inspect-image {
  min-height: 180px;
}

.economy-page .shop-inspect-copy {
  min-width: 0;
}

.economy-page .shop-purchase-progress {
  padding: 8px 10px;
  border: 1px solid var(--ui-line-strong);
  border-radius: 10px;
  background: var(--ui-input);
  color: var(--ui-text);
  font-size: 0.9rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

body.economy-page .shop-inspect-copy h2 {
  color: var(--ui-text);
  font-size: 1.65rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

body.economy-page .shop-inspect-copy p {
  color: var(--ui-muted);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.economy-page #shop-inspect-desc {
  white-space: pre-line;
}

.economy-page .shop-inspect-actions {
  grid-column: 1 / -1;
  grid-template-columns: 1fr;
}

.economy-page #shop-inspect-message {
  grid-column: 1 / -1;
  margin: 0;
}

.economy-page #shop-inspect-message:empty {
  display: none;
}

.economy-page .economy-activation-button > span {
  display: grid;
  gap: 2px;
}

.economy-page .economy-activation-button small {
  font-size: 0.8rem;
}

body.economy-page.theme-light .economy-activation-button img {
  filter: brightness(0) saturate(100%);
}

body.economy-page .inventory-gift-input {
  min-height: 44px;
  border-color: var(--ui-line-strong) !important;
  background: var(--ui-input) !important;
  color: var(--ui-text) !important;
}

body.economy-page .inventory-gift-input::placeholder {
  color: var(--ui-muted) !important;
}

@media (max-width: 600px) {
  .economy-page .shop-grid,
  .economy-page .inventory-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .economy-page .shop-item-card,
  .economy-page .inventory-item-row {
    grid-template-rows: 108px 1fr auto;
    padding: 12px;
    gap: 12px;
  }

  body.economy-page .asset-quantity-badge {
    top: 18px;
    right: 18px;
  }

  .economy-page .shop-inspect-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  body.economy-page .shop-inspect-image {
    min-height: 100px;
  }
}

@media (max-width: 359px) {
  .economy-page .shop-grid,
  .economy-page .inventory-list {
    grid-template-columns: 1fr;
  }
}
.laser-controls {
  width: 100%;
  padding: 18px;
  border-radius: 16px;
  background: var(--panel-soft, #eef5f5);
  color: var(--text, #12343b);
}
.laser-controls > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.laser-controls p {
  font-size: 0.95rem;
  line-height: 1.65;
}
.shop-trade-rules {
  flex-basis: 100%;
  font-size: 0.9rem;
  line-height: 1.7;
}
.shop-trade-rules summary {
  cursor: pointer;
}
.shop-trade-rules p {
  white-space: pre-line;
}
body.theme-dark .laser-controls {
  background: #19343b;
  color: #dfedef;
}
/* Product gallery: consistent readable surfaces, semantic art and calm spacing. */
body.economy-page .shop-item-card {
  --product-tint: #e8f2f1;
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-line);
  box-shadow: 0 8px 24px rgb(24 58 65 / 5%);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
body.economy-page .shop-item-card:hover {
  border-color: var(--ui-accent);
  box-shadow: 0 10px 28px rgb(24 58 65 / 12%);
}
body.economy-page .shop-item-card[data-product-class='scholar_relic'] {
  --product-tint: #f5ead9;
}
body.economy-page .shop-item-card[data-product-class='profile_card'],
body.economy-page .shop-item-card[data-product-class='nameplate'] {
  --product-tint: #eee8f6;
}
body.economy-page .shop-item-card[data-product-class='pet'],
body.economy-page .shop-item-card[data-product-class='pet_food'] {
  --product-tint: #e5efdc;
}
body.economy-page.theme-dark .shop-item-card {
  --product-tint: #19343d;
}
body.economy-page.theme-dark .shop-item-card[data-product-class='scholar_relic'] {
  --product-tint: #393226;
}
body.economy-page.theme-dark .shop-item-card[data-product-class='profile_card'],
body.economy-page.theme-dark .shop-item-card[data-product-class='nameplate'] {
  --product-tint: #302c43;
}
body.economy-page.theme-dark .shop-item-card[data-product-class='pet'],
body.economy-page.theme-dark .shop-item-card[data-product-class='pet_food'] {
  --product-tint: #26392d;
}
body.economy-page .shop-item-card .shop-item-image {
  background: var(--product-tint) !important;
}
body.economy-page .shop-item-card .shop-item-image img {
  width: 92px;
  height: 92px;
}
body.economy-page .shop-category {
  font-size: 0.78rem;
  color: var(--ui-muted);
  letter-spacing: 0.04em;
}
body.economy-page .shop-item-price {
  color: var(--ui-text);
  font-variant-numeric: tabular-nums;
}
body.economy-page .shop-inspect-panel {
  background: var(--ui-surface) !important;
  color: var(--ui-text) !important;
}
body.economy-page .shop-trade-rules {
  padding: 12px 16px;
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  background: var(--ui-surface-soft);
  color: var(--ui-text);
}
body.economy-page .shop-trade-rules p {
  color: var(--ui-text) !important;
  font-size: 0.9rem;
  line-height: 1.75;
}
body.economy-page #shop-inspect-desc {
  color: var(--ui-muted) !important;
  line-height: 1.85;
  white-space: pre-line;
}
@media (prefers-reduced-motion: reduce) {
  body.economy-page .shop-item-card {
    transition: none;
  }
}
