
/* ── Buttons ── */
.cgal-btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 11px; font: inherit; font-size: 0.86rem; font-weight: 650; cursor: pointer;
  color: var(--text, #e7e9ee); background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.14)); text-decoration: none;
  transition: background 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.cgal-btn:hover { background: rgba(255, 255, 255, 0.12); }
.cgal-btn:disabled { opacity: 0.4; cursor: default; }
.cgal-btn.primary { color: var(--on-accent); background: var(--accent); border-color: transparent; font-weight: 700; box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.28); }
.cgal-btn.primary:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.42); }
/* Settled "already installed" state — a non-interactive chip, not a button, so it
   reads as done and can't re-trigger an import. Wins over .primary
   colours by coming later at equal specificity. */
.cgal-btn.cgal-installed {
  cursor: default; font-weight: 700; box-shadow: none; filter: none;
  color: var(--success, #45d483);
  background: rgba(69, 212, 131, 0.14);
  border-color: rgba(69, 212, 131, 0.4);
}
.cgal-btn.cgal-installed:hover { background: rgba(69, 212, 131, 0.14); filter: none; }
.cgal-limited-buttons { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); gap: 8px; }
.cgal-limited-buttons .cgal-ic { width: 16px; height: 16px; }
.cgal-claim { color: #110b27; border-color: transparent; background: #a99cff; box-shadow: 0 5px 18px rgba(139, 123, 255, 0.3); white-space: nowrap; }
.cgal-claim:hover { background: #bcb2ff; box-shadow: 0 7px 24px rgba(139, 123, 255, 0.42); }
.cgal-discord { color: #fff; border-color: rgba(255, 255, 255, 0.16); background: #5865f2; box-shadow: 0 5px 18px rgba(88, 101, 242, 0.25); white-space: nowrap; }
.cgal-discord:hover { background: #6975f5; box-shadow: 0 7px 24px rgba(88, 101, 242, 0.38); }
/* "I have a code" — deliberately the quiet one of the row: it matters only to
   the few who already claimed, and must not compete with the claim button. */
.cgal-havecode { color: var(--text-muted, #a7adbb); border-color: var(--glass-border, rgba(255, 255, 255, 0.14)); background: transparent; white-space: nowrap; }
.cgal-havecode:hover { color: var(--text, #e7e9ee); background: rgba(255, 255, 255, 0.08); }
.cgal-needs { font-size: 0.72rem; color: var(--text-dim, #8b91a1); }
.cgal-soldout { flex: 1; text-align: center; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #ff5a63; padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(255, 90, 99, 0.42); background: rgba(255, 90, 99, 0.1); }

/* ── Load-more, status, skeleton ── */
.cgal-loadmore { display: flex; justify-content: center; margin: 24px 0 6px; }
.cgal-loadmore-btn { padding: 11px 30px; }
.cgal-status { padding: 44px 6px; text-align: center; font-size: 0.9rem; color: var(--text-dim, #8b91a1); }
.cgal-stale { padding: 12px 6px 0; }
.cgal-skel { pointer-events: none; }
.cgal-skel:hover { transform: none; box-shadow: none; border-color: var(--glass-border, rgba(255, 255, 255, 0.1)); }
.cgal-skel-media { aspect-ratio: 16 / 10; }.cgal-skel-media,
.cgal-skel-line { position: relative; overflow: hidden; }.cgal-skel-media::after,
.cgal-skel-line::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 400%; pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.09) 37%, rgba(255, 255, 255, 0.04) 63%);
  animation: cgal-shimmer 1.4s ease infinite;
  will-change: transform;
}
.cgal-skel-line { height: 12px; border-radius: 6px; margin: 4px 0; }
.cgal-skel-line.w70 { width: 70%; }
.cgal-skel-line.w40 { width: 40%; }
@keyframes cgal-shimmer { from { transform: translateX(-75%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) {.cgal-skel-media,
.cgal-skel-line { animation: none; }
}

/* ── Detail view: stacked overlay over the store grid ── */
.cgal-detail-scrim {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center; padding: 3vh 2.4vw;
  background: rgba(4, 6, 9, 0.62); backdrop-filter: blur(7px);
  animation: cgal-fade 0.18s ease;
}
@keyframes cgal-fade { from { opacity: 0; } to { opacity: 1; } }
/* Gallery */
.cgal-gal { display: flex; flex-direction: column; gap: 10px; min-width: 0; position: sticky; top: 0; }
.cgal-gal-stage {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 14px;
  background: rgba(0, 0, 0, 0.42); border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}
.cgal-gal-track { display: flex; height: 100%; transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
.cgal-gal-slide { flex: 0 0 100%; height: 100%; }
/* contain, not cover: a widget shot is a picture to read whole (River's title ran off both sides
   at 16:10); the stage's dark ground fills the difference. */
.cgal-gal-slide img { width: 100%; height: 100%; object-fit: contain; display: block; cursor: zoom-in; }
.cgal-gal-frame { width: 100%; height: 100%; border: 0; display: block; }
.cgal-gal-stage > canvas { width: 100%; height: 100%; display: block; }
.cgal-gal-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  color: #fff; background: rgba(8, 10, 14, 0.6); border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px); transition: background 0.15s ease;
}
.cgal-gal-arrow:hover { background: rgba(8, 10, 14, 0.85); }
.cgal-gal-arrow svg { width: 18px; height: 18px; }
.cgal-gal-prev { left: 10px; }
.cgal-gal-next { right: 10px; }
.cgal-gal-next svg { transform: rotate(180deg); }
.cgal-gal-zoom {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; cursor: pointer;
  color: #fff; background: rgba(8, 10, 14, 0.6); border: 1px solid rgba(255, 255, 255, 0.18); backdrop-filter: blur(6px);
}
.cgal-gal-zoom:hover { background: rgba(8, 10, 14, 0.85); }
.cgal-gal-zoom svg { width: 17px; height: 17px; }
.cgal-gal-count {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 3;
  font-size: 0.72rem; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums;
  padding: 3px 10px; border-radius: 999px; background: rgba(8, 10, 14, 0.6); backdrop-filter: blur(6px);
}
.cgal-gal-thumbs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.cgal-gal-thumbs::-webkit-scrollbar { display: none; }
.cgal-gal-thumb {
  flex: 0 0 66px; height: 42px; padding: 0; overflow: hidden; cursor: pointer;
  border-radius: 8px; background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
  opacity: 0.6; transition: opacity 0.15s ease, border-color 0.15s ease;
}
.cgal-gal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cgal-gal-thumb:hover { opacity: 0.85; }
.cgal-gal-thumb.on { opacity: 1; border-color: rgba(var(--accent-rgb), 0.7); }
/* "What's new in v1.2.0" + the publisher's own line. */
.cgal-detail-changelog {
  display: flex; flex-direction: column; gap: 3px;
  margin-top: 10px; padding: 9px 12px; border-radius: 10px;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
}
.cgal-changelog-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--accent, #35e08e);
}
.cgal-changelog-text { font-size: 0.82rem; line-height: 1.45; color: var(--text, #e7e9ee); overflow-wrap: anywhere; }
.cgal-detail-desc { margin: 0; font-size: 0.92rem; line-height: 1.6; color: var(--text-soft, #c3c8d2); overflow-wrap: anywhere; }
/* Rich descriptions (shared/src/rich-text.js): paragraphs, lists, bold. */
.cgal-detail-desc p, .cgal-detail-desc ul, .cgal-detail-desc ol { margin: 0 0 0.6em; }
.cgal-detail-desc > :last-child { margin-bottom: 0; }
.cgal-detail-desc ul, .cgal-detail-desc ol { padding-left: 1.25em; }
.cgal-detail-desc li + li { margin-top: 0.25em; }
.cgal-detail-desc strong { color: var(--text, #e7e9ee); font-weight: 650; }
.cgal-detail-desc code { font-size: 0.86em; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, currentColor 12%, transparent); }
.cgal-detail-cta { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.cgal-detail-cta .cgal-btn { width: 100%; }

/* Fullscreen zoom */
.cgal-zoom {
  position: fixed; inset: 0; z-index: 4000; display: flex; align-items: center; justify-content: center; padding: 4vmin;
  background: rgba(2, 4, 7, 0.9); backdrop-filter: blur(8px); animation: cgal-fade 0.16s ease;
}
.cgal-zoom-img { max-width: min(1200px, 94vw); max-height: 88vh; border-radius: 12px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7); }
.cgal-zoom-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  color: #fff; background: rgba(12, 16, 22, 0.72); border: 1px solid rgba(255, 255, 255, 0.2);
}
.cgal-zoom-arrow:hover { background: rgba(12, 16, 22, 0.95); }
.cgal-zoom-arrow svg { width: 22px; height: 22px; }
.cgal-zoom-prev { left: 3vmin; }
.cgal-zoom-next { right: 3vmin; }
.cgal-zoom-next svg { transform: rotate(180deg); }
.cgal-zoom.single .cgal-zoom-arrow { display: none; }
.cgal-zoom-x {
  position: absolute; top: 3vmin; right: 3vmin; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  color: #fff; background: rgba(12, 16, 22, 0.72); border: 1px solid rgba(255, 255, 255, 0.2);
}
.cgal-zoom-x:hover { background: rgba(12, 16, 22, 0.95); }
.cgal-zoom-x svg { width: 18px; height: 18px; }

@media (max-width: 720px) {
  .cgal-gal { position: static; }
}
@media (prefers-reduced-motion: reduce) {.cgal-detail-scrim,
.cgal-zoom { animation: none; }
  .cgal-gal-track { transition: none; }
}

/* ── Import preview: theme colour swatches + animated-background mini-preview. ── */
.preset-theme-swatches { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 0 0 12px; }
/* Distinct class from the round `.preset-swatch` accent dot on quick-preset
   buttons (above) — this is a dot+label row; sharing the name inherited that
   fixed 22px circle and collapsed the labels on top of each other. */
.preset-theme-sw { display: inline-flex; align-items: center; gap: 7px; font-size: 0.8rem; color: var(--muted-text, #aeb3bd); }
.preset-swatch-dot {
  width: 18px; height: 18px; border-radius: 6px; flex: none;
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.18));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.preset-swatch-label { color: var(--text, #e7e9ee); }
.preset-bg-preview {
  width: 100%; height: 140px; margin: 0 0 12px; border: 0; border-radius: 12px;
  background: #05070d; box-shadow: inset 0 0 0 1px var(--glass-border, rgba(255, 255, 255, 0.12));
  pointer-events: none;
}

/* ── Icon packs: the builder's added-icons list and the import thumbnail grid. ── */
.preset-iconpack-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.preset-iconpack-item { display: inline-flex; align-items: center; gap: 6px; }
.preset-iconpack-item img { width: 18px; height: 18px; object-fit: contain; flex: none; }
.preset-iconpack-del {
  flex: none; width: 18px; height: 18px; padding: 0; font-size: 13px; line-height: 1;
  color: var(--muted-text, #aeb3bd); background: transparent; border: 0; border-radius: 6px; cursor: pointer;
}
.preset-iconpack-del:hover { color: var(--danger, #ff6b6b); background: rgba(255, 255, 255, 0.06); }
.preset-iconpack-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.preset-iconpack-thumb {
  width: 28px; height: 28px; object-fit: contain; flex: none; padding: 5px; box-sizing: content-box;
  background: rgba(255, 255, 255, 0.05); border-radius: 9px;
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
}

/* ── Code-locked theme sharing: the "protect" panel, the generated codes list,
   and the unlock field on import. ──────────────────────────────────────── */
.preset-lock-toggle.is-open { color: var(--accent, #35e08e); border-color: rgba(var(--accent-rgb, 53, 224, 142), 0.35); }
.preset-lock-form { margin-top: 12px; }
.preset-lock-count { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 0.85rem; color: var(--text, #e7e9ee); margin-bottom: 4px; }
.preset-lock-count-input {
  flex: none; width: 76px; box-sizing: border-box; text-align: center;
  padding: 7px 9px; font: inherit; font-size: 0.85rem;
  color: var(--text, #e7e9ee); background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12)); border-radius: 9px;
}
.preset-locked-chip { color: var(--warn, #ffb454); }
.preset-lock-codes-head { margin: 14px 0 8px; font-weight: 700; color: var(--text, #e7e9ee); }
.preset-lock-codes { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.preset-lock-code-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 6px 10px; border-radius: 9px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}
.preset-lock-code-idx { flex: none; width: 1.6em; text-align: right; font-size: 0.78rem; color: var(--text-dim, #8b91a1); }
.preset-lock-code-val { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, monospace; font-size: 0.88rem; letter-spacing: 0.04em; color: var(--text, #e7e9ee); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-lock-code-copy { flex: none; padding: 5px 11px; font-size: 0.78rem; }
.preset-lock-note { margin-top: 12px; font-size: 0.8rem; color: var(--warn, #ffb454); }
.preset-unlock-wrap { margin-top: 10px; }
.preset-unlock-label { display: flex; flex-direction: column; gap: 5px; font-size: 0.85rem; color: var(--text, #e7e9ee); }
.preset-unlock-field {
  width: 100%; box-sizing: border-box;
  padding: 9px 11px; font: inherit; font-size: 0.9rem; font-family: ui-monospace, monospace; letter-spacing: 0.04em;
  color: var(--text, #e7e9ee); background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12)); border-radius: 10px;
}
.preset-unlock-field:focus { outline: none; border-color: rgba(var(--accent-rgb, 53, 224, 142), 0.5); }
.preset-unlock-field.need { border-color: rgba(var(--danger-rgb), 0.7); background: var(--danger-bg); }
.preset-unlock-label + .preset-check-list { margin-top: 12px; }
.preset-unlock-note { margin-top: 7px; font-size: 0.76rem; line-height: 1.45; color: var(--text-dim, rgba(231, 233, 238, 0.55)); }
/* "Your code is already saved here" + its reset. Wraps on a phone rather than
   squeezing the button, which is also the smallest touch target in the modal. */
.preset-unlock-saved {
  margin-top: 7px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 0.76rem; line-height: 1.45; color: var(--text-dim, rgba(231, 233, 238, 0.55));
}
.preset-unlock-saved > span { flex: 1 1 12ch; }
/* Both rows and the label set a display, which would beat the hidden attribute. */
.preset-unlock-saved[hidden], .preset-unlock-label[hidden] { display: none; }
.preset-unlock-forget { flex: none; padding: 6px 12px; font-size: 0.76rem; }
/* "Buy Sparks" shows only after a buy fell short; .settings-btn sets a display. */
.preset-unlock-forget[hidden] { display: none; }
/* "Buy Sparks" is a link styled as a button: no link underline. */
a.preset-unlock-forget { text-decoration: none; }

/* The pass trial's end card (js/store-supporters/trial-pass-ui.js): the Store pictures of what
   was used, one full-width way to keep it, then the code and "not now" as plain
   text links. The pictures carry the card, so nothing else is decorated. */
.trial-end-gets { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 2px 0 12px; padding: 0; list-style: none; }
.trial-end-gets li { display: grid; gap: 4px; min-width: 0; }
.trial-end-pic {
  display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}
.trial-end-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.trial-end-pic.is-glyph { color: var(--text-dim, #8b91a1); }
.trial-end-pic.is-glyph svg { width: 22px; height: 22px; }
.trial-end-name { font-size: 0.8rem; line-height: 1.3; color: var(--text, #e7e9ee); overflow-wrap: anywhere; }
.trial-end-price { margin-top: 12px; font-size: 0.82rem; }
.trial-end-code { margin-right: auto; }
.trial-welcome-row { font-size: 0.86rem; color: var(--text, #e7e9ee); }

/* "moved to Create and share" pointer (shown under Appearance) */
