/* PS99 Gems market. Page-owned styles on the shared BloxyShop shell.
   Data, quantities and prices are supplied by gems-market.js. */

.gm-page { position: relative; isolation: isolate; min-width: 0; padding-bottom: 36px; }
.gm-page::before { content: ''; position: absolute; z-index: -1; inset: -80px 0 auto; height: 440px; pointer-events: none; background: radial-gradient(ellipse at 35% 0, rgba(139, 92, 246, .1), transparent 65%); }
.gm-wrap { max-width: 1280px; min-width: 0; }
.gm-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.gm-heading { display: flex; align-items: center; gap: 14px; min-width: 0; }
.gm-heading-art { flex: none; width: 56px; height: 56px; object-fit: contain; }
.gm-heading-copy { min-width: 0; }
.gm-head .page-title { margin: 0; font-size: clamp(28px, 4vw, 46px); line-height: 1.12; letter-spacing: -.025em; text-wrap: balance; }
.gm-head .page-sub { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.gm-market-nav { display: flex; flex: none; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-1); }
.gm-market-nav a { display: inline-flex; align-items: center; justify-content: center; min-width: 68px; min-height: 40px; padding: 8px 16px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 600; }
.gm-market-nav a:hover { background: var(--surface-2); color: var(--foreground); }
.gm-market-nav a.on, .gm-market-nav a[aria-current="page"] { color: var(--foreground); background: var(--accent-soft); }

.gm-account { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; padding: 18px 20px; border-radius: 18px; background: var(--surface-1); }
.gm-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); flex: 1 1 auto; gap: 24px; min-width: 0; margin: 0; }
.gm-metric { min-width: 0; }
.gm-metric dt { margin: 0 0 7px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.gm-metric dd { margin: 0; color: var(--foreground); font-size: clamp(17px, 1.8vw, 23px); font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.gm-account-actions, .gm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gm-account-actions { flex: 0 0 auto; }
.gm-account-actions .btn { min-height: 42px; padding-inline: 14px; font-size: 13px; }

.gm-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 0 0 18px; }
.gm-tabs a { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.gm-tabs a:first-child { margin-left: -14px; }
.gm-tabs a:hover { color: var(--foreground); background: rgba(255, 255, 255, .035); }
.gm-tabs a.on, .gm-tabs a[aria-current="page"] { color: var(--foreground); }
.gm-tabs a.on::after, .gm-tabs a[aria-current="page"]::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 3px; border-radius: 3px; background: var(--accent); }
.gm-fee-promotion { margin: 0 0 18px; padding: 12px 16px; border-radius: 12px; background: rgba(139, 92, 246, .09); color: var(--foreground); font-size: 13px; line-height: 1.5; }
.gm-fee-promotion strong { color: #c4acff; }
.gm-fee-promotion small { display: block; margin-top: 3px; color: var(--muted); font-size: 11.5px; }
.gm-fee-promotion time { font-weight: 600; }
.gm-content { min-width: 0; min-height: 220px; }

.gm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 16px; align-items: start; }
.gm-card { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 18px; border-radius: 18px; background: var(--surface-1); box-shadow: var(--shadow-card); }
.gm-card-art { display: grid; place-items: center; min-width: 0; min-height: 140px; margin: 0; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.gm-card-art img { display: block; width: 104px; height: 104px; max-width: 100%; object-fit: contain; }
.gm-card h2, .gm-card h3, .gm-card-title { margin: 0; color: var(--foreground); font-size: 21px; line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
.gm-card p { margin: 0; }
.gm-card-copy { display: grid; gap: 6px; min-width: 0; }
.gm-price { color: var(--foreground); font-size: 23px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.gm-price small { font-size: 12px; font-weight: 400; color: var(--muted); }
.gm-stock, .gm-muted { color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.gm-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: auto; }
.gm-card > .btn, .gm-card .gm-form > .btn { width: 100%; }

.gm-form { display: grid; gap: 16px; min-width: 0; width: 100%; }
.gm-content > .gm-form { max-width: 720px; padding: 22px; border-radius: 18px; background: var(--surface-1); box-shadow: var(--shadow-card); }
.gm-form h2 { margin: 0; font-size: 20px; line-height: 1.3; }
.gm-form p { margin: 0; }
.gm-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.gm-field > label, label.gm-field > span:first-child { color: var(--foreground); font-size: 13px; font-weight: 600; }
.gm-field > small { color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.gm-field input, .gm-field select, .gm-field textarea { display: block; width: 100%; min-width: 0; max-width: 100%; border: 0; border-radius: 11px; padding: 11px 13px; background: var(--surface-2); color: var(--foreground); font: inherit; font-size: 15px; line-height: 1.4; }
.gm-field input::placeholder, .gm-field textarea::placeholder { color: var(--muted); }
.gm-field textarea { resize: vertical; min-height: 88px; }
.gm-field .csel-trigger { width: 100%; min-height: 44px; border-radius: 11px; background: var(--surface-2); }
.gm-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 14px; min-width: 0; }
.gm-summary { display: grid; gap: 10px; min-width: 0; padding: 16px; border-radius: 12px; background: var(--surface-2); font-size: 13px; line-height: 1.5; }
.gm-summary > div, .gm-summary > p { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0; min-width: 0; }
.gm-summary span { color: var(--muted); }
.gm-summary b, .gm-summary strong { color: var(--foreground); text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.gm-summary .gm-total { color: var(--accent-hover); font-size: 19px; font-weight: 700; }
.gm-error { margin: 0; color: #ff9498; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.gm-error:empty { display: none; }
.gm-pending { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; padding: 16px; border: 1px solid var(--accent-soft); border-radius: 12px; background: var(--surface-1); }
.gm-pending p { margin: 0; color: var(--muted); font-size: 13px; }
.gm-history-title { margin: 26px 0 12px; font-size: 19px; }
.gm-buy-dialog { display: grid; gap: 14px; }
.gm-buy-dialog h2, .gm-buy-dialog p { margin: 0; }
.gm-buy-dialog :where(button, input) { min-height: 44px; }
.gm-buy-dialog .gm-field input { font-size: 16px; }
.gm-buy-dialog .modal-close { min-width: 44px; }

.gm-list { display: grid; gap: 10px; }
.gm-listing { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; min-width: 0; padding: 16px; border-radius: 15px; background: var(--surface-1); }
.gm-listing .gm-card-art { flex: none; width: 56px; height: 56px; min-height: 0; padding: 8px; border-radius: 10px; }
.gm-listing .gm-card-art img { width: 40px; height: 40px; }
.gm-listing-main { flex: 1 1 180px; min-width: 0; }
.gm-listing h2, .gm-listing h3 { margin: 0 0 5px; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.gm-listing p { margin: 0; }
.gm-listing .gm-price { font-size: 18px; }
.gm-listing-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.gm-listing .gm-field { flex: 1 1 140px; }

.gm-empty, .gm-loading { display: grid; place-items: center; align-content: center; gap: 10px; min-width: 0; min-height: 220px; margin: 0; padding: 28px 20px; border-radius: 18px; background: var(--surface-1); color: var(--muted); text-align: center; font-size: 14px; line-height: 1.6; }
.gm-empty h2, .gm-empty h3 { margin: 0; color: var(--foreground); font-size: 20px; line-height: 1.3; }
.gm-empty p { max-width: 460px; margin: 0; }
.gm-empty > img, .gm-loading > img { width: 56px; height: 56px; object-fit: contain; }
.gm-grid > .gm-empty, .gm-grid > .gm-loading { grid-column: 1 / -1; }
.gm-page :where(button, input, select, .btn) { min-height: 40px; }
.gm-page :where(button, a, input, select, textarea):focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 3px; }
.gm-page button:disabled { cursor: default; }

@media (max-width: 1000px) {
  .gm-account { flex-direction: column; align-items: stretch; }
  .gm-account-actions { justify-content: flex-end; }
}
@media (max-width: 600px) {
  .gm-head { align-items: flex-start; flex-direction: column; gap: 16px; margin-bottom: 18px; }
  .gm-heading { gap: 10px; }
  .gm-heading-art { width: 44px; height: 44px; }
  .gm-head .page-title { font-size: clamp(27px, 7.5vw, 36px); }
  .gm-head .page-sub { font-size: 12.5px; }
  .gm-market-nav { align-self: flex-start; }
  .gm-account { padding: 16px; gap: 16px; border-radius: 15px; }
  .gm-metrics { gap: 12px; }
  .gm-metric dt { font-size: 11px; }
  .gm-account-actions { justify-content: stretch; }
  .gm-account-actions .btn { flex: 1 1 110px; min-width: 0; padding-inline: 10px; }
  .gm-grid { gap: 12px; }
  .gm-content > .gm-form { padding: 18px; }
  .gm-field input, .gm-field select, .gm-field textarea { font-size: 16px; }
  .gm-listing { gap: 12px; }
  .gm-listing-actions { width: 100%; }
  .gm-listing-actions .btn { flex: 1 1 110px; }
}
@media (max-width: 380px) {
  .gm-heading-art { width: 38px; height: 38px; }
  .gm-metrics { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .gm-metric { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  .gm-metric dt { flex: 0 0 auto; margin: 0; font-size: 12px; }
  .gm-metric dd { text-align: right; font-size: 17px; }
  .gm-tabs { gap: 0; }
  .gm-tabs a { padding-inline: 12px; font-size: 13px; }
  .gm-tabs a:first-child { margin-left: -12px; }
  .gm-tabs a.on::after, .gm-tabs a[aria-current="page"]::after { left: 12px; right: 12px; }
  .gm-row { grid-template-columns: minmax(0, 1fr); }
  .gm-card { padding: 16px; }
}
