/* /shop storefront — single-currency (caps) store. Tokens are theme-scoped by
   [data-server] in site.css. The shop derives its own accent so we can keep Chill's
   cyan while toning Heat's red right down to a calm warm amber (caps is the currency,
   so the store reads gold/amber, not red). No emoji, no arrow glyphs in copy. */

main.shop {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
  /* Shop accent: Chill keeps cyan; price is always the caps gold. */
  --shop-accent: var(--sky);
  --shop-accent-soft: color-mix(in srgb, var(--shop-accent) 12%, transparent);
  --shop-caps: #ffcc4d;
}
/* Heat: replace the ember-red accent with a calm warm amber so the store is gold, not red. */
[data-server="heat"] main.shop { --shop-accent: #e6a35c; }

.shop .loading { color: var(--muted); padding: 2.5rem; text-align: center; }

.shop-head { margin: 0 0 0.3rem; }
.shop-head h1 { margin: 0; font-size: 1.6rem; font-weight: 700; color: var(--shop-caps); }
.shop-sub { color: var(--muted); font-size: 0.92rem; margin: 0.25rem 0 1.3rem; line-height: 1.5; }

/* Server-bound ownership footnote (defines the "Own forever*" asterisk). */
.shop-foot {
  color: var(--muted); font-size: 0.78rem; line-height: 1.5;
  margin: 1.3rem 0 0; padding-top: 0.85rem; border-top: 1px solid var(--border);
}
.sk-kit-foot { color: var(--muted); font-size: 0.76rem; line-height: 1.45; margin: 0.6rem 0 0; }

.shop-empty {
  background: var(--panel); border: 1px dashed var(--border);
  border-radius: 14px; padding: 2.25rem 1.5rem; text-align: center;
  color: var(--muted); font-size: 0.95rem; line-height: 1.6;
}
.shop-error { color: var(--err); }

/* ===== Wallet bar ===== */
.shop-wallet {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  background: var(--panel-inset); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.85rem 1.1rem; margin: 0 0 1.5rem;
}
.shop-wallet-bal { display: flex; align-items: center; gap: 0.6rem; }
.shop-wallet-coin { display: block; flex-shrink: 0; }
.shop-wallet-label { color: var(--muted); font-size: 0.8rem; }
.shop-wallet-amt { color: var(--shop-caps); font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* /garage cross-sell strip, snugged under the wallet bar */
.shop-garage-ad {
  display: flex; align-items: center; gap: 0.85rem;
  background: var(--shop-accent-soft); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.7rem 1.1rem; margin: -0.75rem 0 1.5rem;
  font-size: 0.85rem;
}
.shop-garage-icon { flex-shrink: 0; }
.shop-garage-copy { display: flex; flex-direction: column; gap: 0.15rem; }
.shop-garage-copy strong { color: var(--shop-accent); font-size: 0.8rem; letter-spacing: 0.02em; }
.shop-garage-copy span { color: var(--muted); }
.shop-garage-cmd { color: var(--shop-caps); font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.shop-wallet-earn { color: var(--muted); font-size: 0.82rem; }
.shop-wallet-out .shop-wallet-msg { color: var(--muted); font-size: 0.88rem; }

/* ===== Sections + list ===== */
.shop-section { margin: 0 0 1.6rem; }
.shop-section-title {
  margin: 0 0 0.55rem; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.shop-list {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: var(--panel);
}

/* ===== Featured weekly drop (hero) ===== */
.shop-featured { margin: 0 0 1.1rem; }
/* Admin preview banner — makes it unmistakable this is not the live state. */
.shop-hero-preview {
  font-size: 0.8rem; color: #f0b64d; line-height: 1.5;
  border: 1px solid #6b5320; background: #241d0c; border-radius: 9px;
  padding: 0.5rem 0.75rem; margin: 0 0 0.6rem;
}
.shop-hero-preview a { color: var(--shop-accent); }
.shop-hero {
  display: flex; gap: 1rem; align-items: flex-start;
  border: 2px solid var(--shop-accent); border-radius: 12px;
  background: var(--panel); padding: 1.05rem;
}
.shop-hero-art { flex-shrink: 0; display: flex; gap: 0.3rem; }
.shop-hero-art .shop-item { width: 64px; height: 64px; border-radius: 10px; }
.shop-hero-art .shop-item-icon { width: 52px; height: 52px; }
.shop-hero-main { flex: 1; min-width: 0; }
.shop-hero-tags { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0 0 0.35rem; }
.shop-hero-drop {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--shop-accent); border: 1px solid var(--shop-accent);
  background: var(--shop-accent-soft); border-radius: 999px; padding: 0.14rem 0.55rem;
}
/* Amber urgency pill for the vault countdown — independent of the (cyan/amber) accent. */
.shop-hero-countdown {
  font-size: 0.72rem; font-weight: 600; color: #f0b64d;
  border: 1px solid #6b5320; background: #241d0c; border-radius: 999px; padding: 0.14rem 0.55rem;
}
.shop-hero-name { font-size: 1.28rem; font-weight: 700; color: var(--text); line-height: 1.2; width: fit-content; }
.shop-hero-sub { font-size: 0.83rem; color: var(--muted); line-height: 1.5; margin: 0.3rem 0 0; }
/* The scarcity promise — always shown, the demand driver. Accent callout so it reads as the point. */
.shop-hero-promise {
  margin: 0.5rem 0 0; padding: 0.35rem 0 0.35rem 0.65rem;
  border-left: 2px solid var(--shop-accent); border-radius: 0;
  font-size: 0.82rem; line-height: 1.45; font-weight: 600; color: var(--text);
}
.shop-hero-buy { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 0.9rem 0 0; }
.shop-hero-price { color: var(--shop-caps); font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
/* The hero CTA is the primary action on the page — upsize the reused row button + fill the accent. */
.shop-hero-action .shop-btn-sm { padding: 0.6rem 1.25rem; font-size: 0.95rem; }
.shop-hero-action .shop-btn-accent:not([disabled]) {
  background: var(--shop-accent); color: var(--bg); border-color: var(--shop-accent); font-weight: 700;
}
.shop-hero-action .shop-btn-accent:not([disabled]):hover { background: var(--shop-accent); opacity: 0.88; }
.shop-hero-status { text-align: left; }

/* Collection strip — the FOMO hook linking to the full drop roster. */
.shop-collection-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--panel-inset); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.7rem 0.95rem; margin: 0 0 1.6rem; text-decoration: none;
}
.shop-collection-strip:hover { border-color: var(--shop-accent); }
.shop-collection-info { display: flex; flex-direction: column; }
.shop-collection-title { color: var(--text); font-size: 0.9rem; font-weight: 600; }
.shop-collection-sub { color: var(--muted); font-size: 0.78rem; }
.shop-collection-link { color: var(--shop-accent); font-size: 0.83rem; font-weight: 600; white-space: nowrap; }

@media (max-width: 560px) {
  .shop-hero-art .shop-item:nth-child(n+3) { display: none; }
}

/* ===== Row ===== */
.shop-row {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
}
.shop-row:last-child { border-bottom: none; }

.shop-row-icons { display: flex; gap: 0.3rem; flex-shrink: 0; }
.shop-item {
  position: relative; width: 40px; height: 40px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 7px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.shop-item-icon { width: 34px; height: 34px; object-fit: contain; display: block; }
.shop-item .qty {
  position: absolute; right: -4px; bottom: -5px;
  background: var(--panel-inset); border: 1px solid var(--border-bright); border-radius: 6px;
  color: var(--text); font-size: 0.6rem; font-weight: 700; padding: 0 0.25rem;
  font-variant-numeric: tabular-nums;
}
.shop-item-more { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.shop-item-chip {
  display: inline-flex; align-items: center;
  background: var(--panel-inset); border: 1px solid var(--border);
  border-radius: 7px; padding: 0 0.5rem; min-height: 40px;
  color: var(--text); font-size: 0.74rem; line-height: 1.3;
}
.shop-item-skip { border-color: var(--border-bright); }
.shop-skip-icon { width: 30px; height: 30px; object-fit: contain; opacity: 0.92; display: block; }

.shop-row-main { flex: 1; min-width: 0; }
.shop-row-name { color: var(--text); font-size: 0.98rem; font-weight: 600; }
.shop-row-sub { color: var(--muted); font-size: 0.8rem; line-height: 1.45; margin-top: 0.1rem; }
.shop-row-status { font-size: 0.78rem; min-height: 0; margin-top: 0.2rem; color: var(--muted); }
.shop-row-status.ok { color: #57d364; }
.shop-row-status.err { color: var(--err); }
.shop-row-status:empty { display: none; }

/* Clickable kit (icon art + name) opens the details modal — no inline link, so nothing wraps. */
.shop-row-icons-clickable { cursor: pointer; border-radius: 8px; }
.shop-row-icons-clickable:focus-visible { outline: 2px solid var(--shop-accent); outline-offset: 2px; }
.shop-row-name-link { cursor: pointer; width: fit-content; }
.shop-row-name-link:hover { color: var(--shop-accent); }

.shop-row-price {
  flex-shrink: 0; color: var(--shop-caps); font-size: 0.95rem; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right;
  min-width: 5.5rem;
}
.shop-row-action { flex-shrink: 0; }

/* ===== Buttons ===== */
.shop-btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: 9px; padding: 0.55rem 1rem;
  background: transparent; border: 1px solid var(--shop-accent); color: var(--shop-accent);
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  text-decoration: none; display: inline-block; text-align: center; white-space: nowrap;
}
.shop-btn:hover { background: var(--shop-accent-soft); }
.shop-btn:active { opacity: 0.85; }
.shop-btn-sm { padding: 0.5rem 0.9rem; font-size: 0.86rem; }
.shop-btn[disabled] {
  cursor: not-allowed; color: var(--muted); border-style: dashed;
  border-color: var(--border-bright); background: transparent;
}
.shop-btn[disabled]:hover { background: transparent; }
.shop-btn-accent { /* primary call to action, same accent treatment */ }

/* Caps coin inside a PAID action (Redeem / Own forever) so spending caps is obvious, vs the
   free green Claim which carries no coin. */
.shop-btn-caps { width: 15px; height: 15px; vertical-align: -3px; margin-right: 5px; }

/* Free "Claim" for an owned kit — green, distinct from the accent paid buttons. */
.shop-claim, .shop-claim:hover { background: #2ea043; border-color: #2ea043; color: #fff; }
.shop-claim:hover { opacity: 0.9; }

/* ===== Buy-caps ladder dialog (shares .sk-dlg chrome with the payment modal) ===== */
.sk-context {
  background: var(--panel-inset); border: 1px solid var(--border-bright);
  border-radius: 9px; padding: 0.7rem 0.9rem; margin: 0 0 0.9rem;
  color: var(--text); font-size: 0.86rem; line-height: 1.5;
}
.sk-context-plain { color: var(--muted); }
.sk-bundles { display: flex; flex-direction: column; gap: 0.5rem; }
.sk-bundle {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "caps price" "rate price";
  align-items: center; gap: 0.1rem 0.75rem;
  width: 100%; text-align: left; cursor: pointer;
  background: var(--panel-inset); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.7rem 0.9rem; font: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.sk-bundle:hover { border-color: var(--shop-accent); }
.sk-bundle-pick { border-color: var(--shop-accent); background: var(--shop-accent-soft); }
.sk-bundle-caps {
  grid-area: caps; color: var(--shop-caps); font-size: 1rem; font-weight: 700;
  font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 0.5rem;
}
.sk-bundle-rate { grid-area: rate; color: var(--muted); font-size: 0.74rem; }
.sk-bundle-price {
  grid-area: price; color: var(--text); font-size: 1rem; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.sk-tag {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  border-radius: 999px; padding: 0.12rem 0.5rem;
}
.sk-tag-best { color: #6ee7a8; border: 1px solid rgba(63,185,80,0.5); background: rgba(63,185,80,0.12); }
.sk-tag-pick { color: var(--shop-accent); border: 1px solid var(--shop-accent); background: var(--shop-accent-soft); }
.sk-fineprint { color: var(--muted); font-size: 0.76rem; line-height: 1.5; margin: 0.9rem 0 0; }

/* ===== Payment modal (.sk-* shared with the caps dialog) ===== */
/* Dialogs render in the top layer as siblings of <main.shop>, so they don't inherit its
   --shop-accent / --shop-caps. Re-declare them here (server-scoped via the <html> data-server)
   or every accent inside a dialog silently resolves to empty and buttons render un-styled. */
.sk-dlg {
  --shop-accent: var(--sky);
  --shop-accent-soft: color-mix(in srgb, var(--shop-accent) 12%, transparent);
  --shop-caps: #ffcc4d;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 0; max-width: 440px; width: 92%;
}
[data-server="heat"] .sk-dlg { --shop-accent: #e6a35c; }
.sk-dlg::backdrop { background: rgba(0,0,0,0.55); }
.sk-body { padding: 1.5rem 1.5rem 1.25rem; }

.sk-header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem;
  margin: 0 0 0.9rem;
}
.sk-headline {
  margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--shop-accent);
  flex: 1; min-width: 0; word-break: break-word;
}
.sk-expires { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sk-expires strong { color: var(--text); font-weight: 600; }

.sk-loading { color: var(--muted); text-align: center; font-size: 0.9rem; padding: 2.5rem 0; }

.sk-qr { background: #fff; padding: 0.6rem; border-radius: 10px; margin: 0 auto 0.6rem; max-width: 220px; line-height: 0; }
.sk-qr svg { width: 100%; height: auto; display: block; }
.sk-scan-hint { text-align: center; color: var(--muted); font-size: 0.8rem; margin: 0 0 0.7rem; }

.sk-meta-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.45rem 0.75rem; border-radius: 8px;
  background: var(--panel-inset); border: 1px solid var(--border);
  margin: 0.3rem 0; font-size: 0.9rem;
}
.sk-meta-row .lbl { color: var(--muted); font-size: 0.78rem; }
.sk-meta-row .val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.sk-amount-val { color: var(--shop-accent); font-size: 1rem; }

.sk-wait-hint { text-align: center; color: var(--muted); font-size: 0.82rem; line-height: 1.45; margin: 0.6rem 0 0.4rem; }
.sk-result { min-height: 1.2em; margin: 0.4rem 0 0.9rem; color: var(--muted); font-size: 0.9rem; }

/* Foreign-payer (Wise / AlipayHK) fold-out inside the pay modal */
.sk-intl { margin: 0.7rem 0 0.2rem; border-top: 1px solid var(--border); padding-top: 0.55rem; }
.sk-intl > summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; user-select: none; }
.sk-intl[open] > summary { color: var(--text); }
.sk-intl-steps { margin: 0.5rem 0 0.3rem; padding-left: 1.2rem; color: var(--text); font-size: 0.84rem; line-height: 1.5; }
.sk-intl-steps li { margin-bottom: 0.45rem; }
.sk-intl-num { font-variant-numeric: tabular-nums; }
.sk-intl-fine { color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.sk-copy {
  margin-left: 0.35rem; padding: 0.1rem 0.5rem; font-size: 0.72rem; border-radius: 6px;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  cursor: pointer; font-family: inherit;
}
.sk-copy:hover { color: var(--text); border-color: var(--muted); }

/* Payment-confirmed state. */
#skPay.sk-paid .sk-qr,
#skPay.sk-paid .sk-scan-hint,
#skPay.sk-paid .sk-meta-row,
#skPay.sk-paid .sk-intl,
#skPay.sk-paid .sk-wait-hint { display: none; }
#skPay.sk-paid .sk-result {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  text-align: center; margin: 1.5rem 0 1.25rem;
}
.sk-paid-badge { display: inline-flex; align-items: center; gap: 0.4rem; color: #34d399; font-weight: 700; font-size: 1.05rem; }
.sk-paid-badge svg { width: 1rem; height: 1rem; flex: none; }
.sk-paid-detail { color: var(--muted); font-size: 0.85rem; line-height: 1.45; max-width: 30ch; }

.sk-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }
.sk-actions[hidden] { display: none; }
.sk-btn { padding: 0.5rem 1rem; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 0.92rem; font-family: inherit; }
.sk-btn-secondary { background: var(--panel-inset); border: 1px solid var(--border); color: var(--text); }

/* ===== Kit details modal ===== */
.sk-kit-desc { color: var(--muted); font-size: 0.86rem; line-height: 1.5; margin: 0 0 0.9rem; }
.sk-kit-items {
  display: flex; flex-direction: column; gap: 0.35rem;
  max-height: 50vh; overflow-y: auto; margin: 0 0 0.8rem;
}
.sk-kit-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.35rem 0.5rem; border-radius: 8px; background: var(--panel-inset);
  border: 1px solid var(--border);
}
.sk-kit-item-name { flex: 1; min-width: 0; color: var(--text); font-size: 0.88rem; }
.sk-kit-item-amt {
  color: var(--muted); font-size: 0.82rem; font-weight: 600;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.sk-kit-meta { color: var(--muted); font-size: 0.78rem; line-height: 1.45; margin: 0 0 0.9rem; }

/* Buy options (single claim / own forever) inside the details modal. */
.sk-kit-options {
  display: flex; flex-direction: column; gap: 0.5rem;
  padding-top: 0.7rem; border-top: 1px solid var(--border);
}
.sk-kit-opt {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--panel-inset); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.6rem 0.8rem;
}
.sk-kit-opt-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.sk-kit-opt-title { color: var(--text); font-size: 0.9rem; font-weight: 600; }
.sk-kit-opt-desc { color: var(--muted); font-size: 0.76rem; line-height: 1.4; }
.sk-kit-opt-price {
  color: var(--shop-caps); font-size: 0.95rem; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.sk-kit-opt-action { flex-shrink: 0; }
/* The buy options are the primary CTA in this modal, so give them a filled accent so they
   clearly read as buttons (the transparent-outline treatment looked like plain text). Disabled
   states (Owned / not-enough) keep the muted look from .shop-btn[disabled]. */
.sk-kit-opt-action .shop-btn:not([disabled]) {
  background: var(--shop-accent); color: var(--bg); border-color: var(--shop-accent); font-weight: 700;
}
.sk-kit-opt-action .shop-btn:not([disabled]):hover { background: var(--shop-accent); opacity: 0.88; }
/* Free Claim stays green even inside the modal (override the accent fill above). */
.sk-kit-opt-action .shop-claim:not([disabled]),
.sk-kit-opt-action .shop-claim:not([disabled]):hover { background: #2ea043; border-color: #2ea043; color: #fff; }
.sk-kit-opt-free { color: #3fb950; font-size: 0.95rem; font-weight: 700; }
.sk-modal-status { font-size: 0.82rem; margin-top: 0.6rem; min-height: 0; color: var(--muted); text-align: right; }
.sk-modal-status.ok { color: #57d364; }
.sk-modal-status.err { color: var(--err); }
.sk-modal-status:empty { display: none; }

/* Kit details modal: cap to the viewport and make the item list the ONLY scroller (header, buy
   options + Close stay pinned), so a short screen never stacks an outer dialog scrollbar on the
   inner one. Nested flex because the scrollable list sits inside a [data-kit-body] wrapper.
   IMPORTANT: the flex + overflow live on .sk-body (an inner wrapper), NOT on the <dialog> element.
   display/overflow on the dialog itself leaves a "ghost" painted after close() until the next
   repaint (top-layer paint-invalidation bug) — the dialog stays plain display:block. */
#shopKitDialog .sk-body { display: flex; flex-direction: column; max-height: calc(100dvh - 3rem); min-height: 0; overflow: hidden; }
#shopKitDialog .sk-body > .sk-header,
#shopKitDialog .sk-body > .sk-actions { flex: 0 0 auto; }
#shopKitDialog .sk-body > [data-kit-body] { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
#shopKitDialog [data-kit-body] > :not(.sk-kit-items) { flex: 0 0 auto; }
#shopKitDialog [data-kit-body] > .sk-kit-items { flex: 1 1 auto; min-height: 0; max-height: none; }

/* Small-screen polish: keep rows readable, let price/action wrap under the name. */
@media (max-width: 560px) {
  .shop-row { flex-wrap: wrap; }
  .shop-row-price { order: 3; min-width: 0; text-align: left; }
  .shop-row-action { order: 4; margin-left: auto; }
}
