/* Sparks sheet, shop, "How sparks work" (render inside .sheet, outside #screen). Prefixes: .sp- .shop- .sph-
   Also the shared flame (.flame, ui/flame.js), loaded on every page. */

/* .glass (glass.css, later in the cascade) sets position:relative and beats .sheet's position:fixed.
   Keep these sheets fixed until the foundation rule is fixed. */
.sheet:has(> .sheet__body.sp) { position: fixed; }

/* ---------- the flame (everywhere) ---------- */
.flame { display: block; flex: none; overflow: visible; }
.flame-box { display: inline-flex; }

.sp { padding-bottom: 28px; }
.sp :focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

/* ---------- balance ---------- */
.sp-bal { padding: 4px 0 6px; }
.sp-bal__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sp-bal__row { display: flex; align-items: center; gap: 10px; margin: 0; }
.sp-bal__num { font-size: 60px; line-height: 1; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.sp-bal__mark { display: inline-flex; font-size: 30px; line-height: 1; color: var(--fg); }
.sp-bal__mark .cur { width: 0.74em; height: 0.86em; margin: 0; }
.sp-info { flex: none; color: var(--muted); }
@media (hover: hover) { .sp-info:hover { color: var(--fg); } }
.sp-info svg { width: 22px; height: 22px; }
.sp-rules { margin: 12px 0 0; max-width: 52ch; font-size: 14px; line-height: 1.45; color: var(--muted); text-wrap: pretty; }

/* ---------- sections ---------- */
.sp-sec { margin-top: 26px; }
.sp-sec__title { margin: 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 18px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; overflow-wrap: anywhere; }
.sp-sec__title:focus { outline: none; }
.sp-sec__title:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 4px; }

/* the fire */
.sp-firehead { display: flex; align-items: center; gap: 14px; padding: 4px 0 14px; border-bottom: 1px solid var(--line); }
.sp-firehead__flame { display: inline-flex; flex: none; }
.sp-firehead.is-lit .sp-firehead__flame .flame:not(.flame--rainbow) { filter: drop-shadow(0 4px 14px rgb(255 140 0 / .35)); }
.sp-firehead__n { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }
.sp-firehead__best { margin: 3px 0 0; font-size: var(--t-small); color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- plain rows, hairlines ---------- */
.sp-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 64px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.sp-row__main { min-width: 0; }
.sp-row__title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: 15px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; overflow-wrap: anywhere; hyphens: manual; }
.sp-row__sub { margin-top: 3px; font-size: var(--t-small); line-height: 1.35; color: var(--muted); overflow-wrap: anywhere; hyphens: manual; }
.sp-row__end { display: flex; align-items: center; justify-content: flex-end; max-width: 52vw; }
.sp-act { min-width: 64px; white-space: nowrap; }
.sp-act.btn--s { min-height: 38px; padding: 6px 15px; }
.sp-need { font-size: var(--t-small); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* freeze ahead: text on top, the stepper and the price below it on a phone */
.sp-freeze { grid-template-columns: minmax(0, 1fr); }
.sp-freeze__ctl { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.sp-stepper { display: inline-flex; align-items: center; gap: 6px; }
.sp-stepper__n { min-width: 7.5ch; text-align: center; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* the sheet is narrow on every screen, so the text always sits above the stepper (side by side it broke words) */
.sp-freeze .sp-row__title, .sp-freeze .sp-row__sub { overflow-wrap: normal; word-break: normal; hyphens: manual; }

/* ---------- shop: tiles ---------- */
.shop-sec { margin-top: 18px; scroll-margin-top: 12px; }
.sp-shop .shop-sec__title { font-size: 15px; color: var(--muted); border-bottom: 0; padding-bottom: 8px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.shop-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px;
  min-height: 128px; padding: 12px 8px 10px; border: 0; border-radius: 18px; cursor: pointer;
  background: rgb(var(--fg-rgb) / .045); box-shadow: inset 0 0 0 1px var(--line); color: var(--fg);
  font: inherit; text-align: center; -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease, background-color .15s ease;
}
@media (hover: hover) { .shop-tile:hover { background: rgb(var(--fg-rgb) / .075); } }
.shop-tile:active { transform: scale(.97); }
.shop-tile:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.shop-tile.is-chosen { box-shadow: inset 0 0 0 2px rgb(var(--cta-rgb)); background: rgb(var(--cta-rgb) / .12); }
.shop-tile__art { display: grid; place-items: center; width: 56px; height: 56px; flex: none; }
.shop-tile.is-locked .shop-tile__art { opacity: .78; }
.shop-tile__name { font-size: 13px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; overflow-wrap: break-word; hyphens: manual; max-width: 100%; }
.shop-state { display: inline-flex; align-items: center; justify-content: center; gap: 4px; margin-top: auto; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.shop-state.is-chosen { color: rgb(var(--cta-rgb)); }
.shop-state.is-chosen svg { width: 14px; height: 14px; }
.shop-lock { display: inline-flex; color: var(--muted); }
.shop-lock svg { width: 13px; height: 13px; stroke-width: 2; }
.shop-price__was { margin-right: 4px; color: var(--faint); font-weight: 500; }
.shop-empty { color: var(--muted); font-size: 14px; }

/* "All colours": a fan of the twelve */
.shop-fan { position: relative; }
.shop-fan i { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border-radius: 50%; background: var(--sw);
  transform: rotate(calc(var(--i) * 30deg)) translateY(-19px); box-shadow: 0 0 0 1px rgb(0 0 0 / .15); }
.shop-salute-ico svg, .shop-sound-ico svg { width: 30px; height: 30px; color: var(--muted); }
.shop-salute-ico[data-salute="confetti"] svg { color: #ffd23a; }
.shop-salute-ico[data-salute="sparks"] svg { color: #ff9f0a; }
.shop-salute-ico[data-salute="wave"] svg { color: rgb(var(--cta-rgb)); }

/* ring previews: the Look area styles [data-ring-style] .stone; this only sizes them */
.shop-ring { position: relative; display: grid; place-items: center; }
.shop-ring svg { display: block; max-width: 100%; height: auto; }

/* ---------- shop: one item ---------- */
.shop-detail { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.shop-detail__art { display: grid; place-items: center; min-height: 150px; width: 100%; padding: 8px 0; }
.shop-bigflame .flame:not(.flame--rainbow) { filter: drop-shadow(0 10px 26px rgb(0 0 0 / .35)); }
.shop-detail__art.shop-bigflame.is-rainbow { position: relative; min-height: 330px; padding: 0; display: grid; place-items: center; }   /* room for the whole glow (the 180 px halo + its 28 px blur reaches ~150 px from the middle): it was cut off at the top */
.shop-bigflame.is-rainbow::before { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 0deg, #ff5a5a55, #ffd23a55, #3ad27a55, #3a9bff55, #b05aff55, #ff5a5a55); filter: blur(28px); opacity: .7;
  animation: shop-spin 6s linear infinite; }
.shop-bigflame.is-rainbow .flame { position: relative; }
@keyframes shop-spin { to { transform: rotate(360deg); } }
.shop-detail__head { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.shop-detail__kind { margin: 0; font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.shop-detail__state { margin: 0; font-size: 15px; font-weight: 600; color: var(--muted); }
.shop-detail__state .shop-state { font-size: 15px; }
.shop-note { margin: 0; max-width: 40ch; font-size: var(--t-small); color: var(--muted); line-height: 1.4; }
.shop-detail__acts { display: flex; flex-direction: column; align-items: stretch; gap: 10px; width: 100%; max-width: 360px; margin-top: 4px; }
.shop-detail__acts .btn { min-height: 48px; font-size: 15px; gap: 8px; }
.shop-need { margin: 0; font-size: var(--t-small); color: var(--muted); }
.shop-need.is-ok { color: var(--fg); }
.shop-play { display: grid; place-items: center; width: 96px; height: 96px; border: 0; border-radius: 50%; cursor: pointer; color: var(--fg); background: rgb(var(--fg-rgb) / .08); }
.shop-play svg { width: 36px; height: 36px; }

/* colours */
.shop-colours { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 360px; }
.shop-swgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; justify-items: center; }
.shop-sw { position: relative; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--sw); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .18); }
.shop-sw[aria-pressed="true"] { box-shadow: 0 0 0 2px rgb(var(--bg-rgb)), 0 0 0 4px var(--fg); }
.shop-sw .shop-lock { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: rgb(0 0 0 / .55); color: #fff; }
.shop-sw .shop-lock svg { width: 11px; height: 11px; }
.shop-colours__row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.shop-any, .shop-chip { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px 0 6px; border: 0; border-radius: 99px; cursor: pointer;
  background: rgb(var(--fg-rgb) / .07); box-shadow: inset 0 0 0 1px var(--line); color: var(--fg); font: 600 14px/1.2 var(--f-sans); }
.shop-chip[aria-pressed="true"] { box-shadow: inset 0 0 0 2px rgb(var(--cta-rgb)); }
.shop-any:focus-within { outline: 2px solid var(--fg); outline-offset: 2px; }
.shop-any__ring { position: relative; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex: none;
  background: conic-gradient(#ff453a, #ffd60a, #30d158, #40c8e0, #0a84ff, #bf5af2, #ff453a); }
.shop-any__native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; cursor: pointer; }
.shop-chip__dot { width: 32px; height: 32px; border-radius: 50%; background: rgb(var(--cta-rgb)); flex: none; }

/* rainbow editor */
.shop-rainbow { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 360px; }
.shop-label { margin: 6px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.shop-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.shop-slot { position: relative; display: inline-flex; }
.shop-slot__sw { position: relative; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--sw); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .2); }
.shop-slot__sw:focus-within { outline: 2px solid var(--fg); outline-offset: 2px; }
.shop-slot__del { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: rgb(var(--bg-rgb)); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-strong); }
.shop-slot__del svg { width: 12px; height: 12px; }
.shop-slot__add { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.shop-slot__add svg { width: 18px; height: 18px; }
.shop-presets { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.shop-preset { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px 0 8px; border: 0; border-radius: 99px; cursor: pointer;
  background: rgb(var(--fg-rgb) / .07); box-shadow: inset 0 0 0 1px var(--line); color: var(--fg); font: 600 13px/1.2 var(--f-sans); }
.shop-preset[aria-pressed="true"] { box-shadow: inset 0 0 0 2px rgb(var(--cta-rgb)); }
.shop-preset__art { display: inline-flex; }

.shop-bal { margin: 0 0 6px; font-size: 22px; font-weight: 700; }

/* ---------- How sparks work ---------- */
.sph-sec { margin-top: 22px; }
.sph-sec:first-child { margin-top: 4px; }
.sph-sec__title { margin: 0 0 10px; font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }
.sph-p { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--fg); max-width: 60ch; text-wrap: pretty; }
.sph-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sph-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 16px; background: rgb(var(--fg-rgb) / .045); box-shadow: inset 0 0 0 1px var(--line); font-size: 13.5px; line-height: 1.4; color: var(--muted); }
.sph-card b { color: var(--fg); font-size: 15px; }
.sph-card__art { display: inline-flex; height: 32px; align-items: center; }
.sph-spark { font-size: 26px; color: var(--fg); }
.sph-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sph-table th, .sph-table td { padding: 10px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.35; }
.sph-table th { font-weight: 500; padding-right: 12px; }
.sph-table td { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.sph-table td .cur { vertical-align: -0.05em; }
.sph-table th { width: 55%; }
.sph-example { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: rgb(var(--cta-rgb) / .1); }
.sph-example__title { margin: 0; font-size: 13px; font-weight: 650; color: var(--muted); }
.sph-example .sph-p { margin-top: 4px; }
.sph-list { margin: 0; padding: 0 0 0 18px; font-size: 14px; line-height: 1.5; }
.sph-list li { margin: 4px 0; }
.sph-qa { border-bottom: 1px solid var(--line); }
.sph-qa summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-size: 14.5px; font-weight: 600; list-style: none; }
.sph-qa summary::-webkit-details-marker { display: none; }
.sph-qa summary::after { content: "+"; margin-left: auto; padding-left: 12px; color: var(--muted); font-size: 18px; }
.sph-qa[open] summary::after { content: "−"; }
.sph-qa p { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: var(--muted); }

@media (max-width: 360px) {
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-swgrid { grid-template-columns: repeat(4, 1fr); }
  .sph-two { grid-template-columns: 1fr; }
}
@media (min-width: 720px) {
  .sp-bal__num { font-size: 68px; }
  .sp-row__end { max-width: none; }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .shop-bigflame.is-rainbow::before { animation: none; }
  .shop-tile { transition: none; }
}

/* ---------- a purchase (ui/celebrate.js 'buy'): a soft pulse of the preview in the app colour ---------- */
.fx-bought { animation: fx-bought 1s cubic-bezier(.2, .8, .25, 1); }
@keyframes fx-bought {
  0% { transform: scale(1); filter: drop-shadow(0 0 0 rgb(var(--buy-rgb, var(--cta-rgb)) / 0)); }
  28% { transform: scale(1.07); filter: drop-shadow(0 0 22px rgb(var(--buy-rgb, var(--cta-rgb)) / .75)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0 rgb(var(--buy-rgb, var(--cta-rgb)) / 0)); }
}
/* reduced motion: no movement, only a gentle glow */
.fx-bought-calm { animation: fx-bought-calm 1.3s ease-in-out; }
@keyframes fx-bought-calm {
  0%, 100% { filter: drop-shadow(0 0 0 rgb(var(--buy-rgb, var(--cta-rgb)) / 0)); }
  45% { filter: drop-shadow(0 0 18px rgb(var(--buy-rgb, var(--cta-rgb)) / .6)); }
}
@media (prefers-reduced-motion: reduce) { .fx-bought { animation-name: fx-bought-calm; } }

/* ring shapes: the tile and the big preview take the shape's own outline (a square's corners reach a little further) */
.shop-shape svg { overflow: visible; }

/* v6 (owner): "Make your own" at the end of the ready sets leads to the colour slots */
.shop-preset__art--own { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(#ff5a5a, #ffd23a, #3ad27a, #3a9bff, #b05aff, #ff5a5a); color: #fff; }
.shop-preset__art--own svg { width: 13px; height: 13px; stroke-width: 2.6; }
.shop-slots.is-hint { animation: shop-slots-hint 0.9s ease-out; border-radius: 16px; }
@keyframes shop-slots-hint { 0% { box-shadow: 0 0 0 0 rgb(var(--accent-rgb) / 0.7); } 100% { box-shadow: 0 0 0 14px rgb(var(--accent-rgb) / 0); } }

/* v6 (owner): one short line under each shop section says what it is for */
.shop-sec__hint { margin: -6px 0 12px; font-size: 13.5px; line-height: 1.35; color: var(--muted); }
.shop-salute-art { display: grid; place-items: center; } .shop-salute-art svg { overflow: visible; filter: drop-shadow(0 0 6px rgb(255 255 255 / .18)); }

/* v6 (owner): "Your own fire" shows that any colours can be picked */
.shop-ownfire { position: relative; display: inline-grid; place-items: center; }
.shop-ownfire__wheel { position: absolute; right: -10px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%;
  background: conic-gradient(#ff5a5a, #ffd23a, #3ad27a, #3ad2d2, #3a9bff, #b05aff, #ff5a5a); box-shadow: 0 0 0 2px var(--surface, #1c1d21); }
.shop-tile__sub { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-top: -2px; }
.shop-rainbow__lead { margin: 4px 0 2px; font-size: 18px; font-weight: 700; text-align: center; }
.shop-rainbow__how { margin: 0 0 10px; text-align: center; }

/* accessories (2026-11-22): the light of an accessory reaches past the ring, so nothing around it clips it */
.acc-box { overflow: visible; }
.acc-box > canvas { pointer-events: none; }
.shop-acc-art, .shop-acc-big { overflow: visible; display: flex; align-items: center; justify-content: center; }
.shop-tile:has(.shop-acc-art) { overflow: visible; }
