/* Shop sheet and start button (cosmetics). Mobile first; the wide and short-landscape layout is at the bottom.
   Colours come from the style.css tokens; star yellow is the literal #F5B400. Selectors start with .shop-, #shop, #btnShop or #start. */

#start .buttons > #btnShop { min-height: 44px; white-space: nowrap; }
#btnShop.shop-can { border-color: #F5B400; box-shadow: 0 0 0 2px color-mix(in srgb, #F5B400 35%, transparent); }

#shopSheet { padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); overflow: hidden; }
#shopSheet .screen-inner { width: min(100%, 560px); height: 100%; margin: 0; padding-bottom: 0; }
.shop-card { position: relative; height: 100%; display: flex; flex-direction: column; gap: 5px; padding: 8px 10px; overflow: hidden; text-align: left; }

.shop-head { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.shop-card .shop-title { margin: 0; flex: 1 1 auto; font-size: 17px; outline: none; }
.shop-balance { display: flex; align-items: center; gap: 5px; min-height: 28px; padding: 0 10px; border-radius: 999px; font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--text); background: color-mix(in srgb, #F5B400 22%, var(--surface)); border: 1px solid color-mix(in srgb, #F5B400 55%, var(--line)); }
.shop-card .shop-close { min-height: 44px; min-width: 44px; padding: 0 14px; font-size: 14px; }
.shop-ico { width: 16px; height: 16px; flex: 0 0 auto; }
.shop-star polygon { fill: #F5B400; }

.shop-main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.shop-side, .shop-list { display: contents; }
.shop-stage-wrap { order: 1; position: relative; flex: 0 0 auto; border-radius: 16px; overflow: hidden; background: var(--bg2); }
.shop-stage { display: block; width: 100%; height: auto; aspect-ratio: 720 / 520; }
.shop-stage-tag { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.shop-tabs { order: 2; flex: 0 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.shop-tab { min-height: 44px; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 800; font-size: 13px; cursor: pointer; }
.shop-tab.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.shop-tab-count { font-size: 12px; font-weight: 700; opacity: 0.8; }
.shop-tab.on .shop-tab-count { opacity: 1; }
.shop-scroll { order: 3; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px; }
/* the purchase toast floats above the action bar (it never takes height from the grid) and hides by itself after a few seconds */
.shop-toast { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 3; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 1px solid var(--accent); box-shadow: 0 6px 18px var(--shadow); }
.shop-toast[hidden] { display: none; }
.shop-msg { margin: 0; flex: 1 1 auto; font-size: 13px; font-weight: 700; color: var(--text); }
.shop-toast-row { display: flex; gap: 6px; flex: 0 0 auto; }
.shop-toast-row .btn { min-height: 44px; padding: 0 14px; }
.shop-bar { order: 5; position: relative; flex: 0 0 auto; display: flex; align-items: center; gap: 10px; min-height: 52px; padding-top: 5px; border-top: 1px solid var(--line); }
.shop-bar-text { flex: 1 1 0; min-width: 0; }
.shop-name { margin: 0; font-size: 14px; }
.shop-desc { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.25; min-height: 2.5em; }
.shop-state { margin: 0; font-size: 12px; font-weight: 800; color: var(--text); }
.shop-actions { flex: 0 0 46%; min-height: 44px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.shop-actions .btn { width: 100%; min-height: 44px; padding: 0 10px; font-size: 15px; white-space: nowrap; }

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.shop-item { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 6px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface2); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: transform 120ms ease-out, box-shadow 120ms ease-out; }
.shop-item.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.shop-item.is-eq { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.shop-thumb { display: block; width: 100%; height: auto; aspect-ratio: 13 / 9; border-radius: 9px; background: var(--bg2); }
.shop-item-name { font-size: 13px; font-weight: 800; line-height: 1.15; min-height: 2.3em; }
.shop-item-col { margin-top: -4px; font-size: 12px; font-weight: 700; line-height: 1.2; color: var(--muted); min-height: 1.2em; }
.shop-chip { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; min-height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 900; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.shop-chip .shop-ico { width: 12px; height: 12px; }
.shop-chip-eq { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.shop-chip-buy { background: color-mix(in srgb, #F5B400 28%, var(--surface)); border-color: #F5B400; }
.shop-chip-lock { color: var(--muted); }
.shop-new { position: absolute; top: 10px; left: 10px; padding: 1px 6px; border-radius: 999px; font-size: 12px; font-weight: 900; letter-spacing: 0.02em; background: #F5B400; color: #1A1530; }
.shop-need-bar { display: block; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.shop-need-fill { display: block; height: 100%; background: #F5B400; }

.shop-empty { margin: 0 0 8px; padding: 8px 10px; border-radius: 12px; border: 1px dashed var(--line); text-align: center; font-size: 14px; }
.shop-empty p { margin: 0; }
.shop-empty[hidden] { display: none; }
.shop-earn { margin: 12px 0 4px; display: flex; flex-direction: column; gap: 6px; }
.shop-earn-text { margin: 0; font-size: 13px; font-weight: 800; }
.shop-earn-track { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.shop-earn-fill { height: 100%; background: #F5B400; }
.shop-card .shop-voyage { width: 100%; min-height: 44px; }
.shop-hint { margin: 0 0 8px; color: var(--muted); font-weight: 700; }
.shop-note { margin: 0; color: var(--muted); }

.shop-confirm { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; padding: 16px; background: color-mix(in srgb, var(--bg2) 78%, transparent); border-radius: inherit; }
.shop-confirm[hidden] { display: none; }
.shop-confirm-box { width: min(100%, 320px); display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 18px; border: 1px solid var(--accent); background: var(--surface); box-shadow: 0 14px 40px var(--shadow); text-align: center; }
.shop-confirm-thumb { display: block; width: 156px; height: 108px; margin: 0 auto; border-radius: 12px; }
.shop-confirm-text { margin: 0; }
.shop-confirm-row { display: flex; flex-direction: column; gap: 8px; }
.shop-confirm-row .btn { width: 100%; min-height: 44px; }

.shop-tab:focus-visible, .shop-item:focus-visible, .shop-card button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

@keyframes shop-pop { 0% { transform: scale(1); } 35% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes shop-bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
.shop-pop { animation: shop-pop 420ms ease-out; }
.shop-bump { animation: shop-bump 420ms ease-out; }
.shop-calm .shop-pop, .shop-calm .shop-bump { animation: none; }
.shop-calm .shop-item { transition: none; }

/* premium: tab, locked previews, bundles, star packs, restore and the weekly prize card */
.shop-tabs.shop-tabs-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
.shop-tabs-6 .shop-tab { font-size: 12px; padding: 4px 0; }
.shop-tabs-6 .shop-tab-count { font-size: 12px; }
.shop-item.is-prem { border-color: color-mix(in srgb, #F5B400 55%, var(--line)); }
.shop-item.is-prem.on { border-color: var(--accent); }
.shop-prem-badge { position: absolute; top: 10px; right: 10px; padding: 1px 6px; border-radius: 999px; font-size: 12px; font-weight: 900; letter-spacing: 0.02em; background: linear-gradient(135deg, #FFD966, #F5B400); color: #1A1530; }
.shop-sec { grid-column: 1 / -1; margin: 10px 0 0; font-size: 13px; font-weight: 900; letter-spacing: 0.02em; color: var(--muted); }
.shop-sec:first-child { margin-top: 0; }
.shop-prod { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface2); }
.shop-prod-text { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shop-prod-name { font-size: 14px; font-weight: 800; }
.shop-prod-desc { color: var(--muted); }
.shop-prod .btn { flex: 0 0 auto; min-width: 112px; min-height: 44px; padding: 0 12px; white-space: nowrap; }
.shop-prod .btn:disabled, .shop-actions .btn:disabled { opacity: 0.6; cursor: default; }
.shop-premium { margin: 12px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.shop-premium[hidden], .shop-prizes[hidden] { display: none; }
.shop-card .shop-restore { width: 100%; min-height: 44px; }
.shop-prizes { display: flex; flex-direction: column; gap: 6px; margin: 0 0 8px; }
.shop-prize { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; border: 2px solid #F5B400; background: color-mix(in srgb, #F5B400 16%, var(--surface)); }
.shop-prize-text { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shop-prize .btn { flex: 0 0 auto; min-height: 44px; padding: 0 12px; white-space: nowrap; }

/* long localized prices and "Price unavailable" wrap instead of overflowing the phone width */
.shop-card .shop-actions .btn { white-space: normal; overflow-wrap: anywhere; line-height: 1.15; padding: 6px 10px; font-size: 16px; }
.shop-card .shop-prod .btn { white-space: normal; overflow-wrap: anywhere; line-height: 1.15; padding: 6px 10px; font-size: 14px; max-width: 48%; min-width: 96px; }
.shop-card .shop-prize .btn { white-space: normal; line-height: 1.15; max-width: 40%; }
.shop-prize-text .small { overflow-wrap: anywhere; }
.shop-tabs-6 .shop-tab-name { max-width: 100%; overflow: hidden; text-overflow: clip; }

/* wide (tablet, desktop) and short landscape phones: stage and action bar on the left, tabs and grid on the right */
@media (min-width: 760px), (orientation: landscape) and (max-height: 520px) and (min-width: 560px) {
  #shopSheet .screen-inner { width: min(100%, 940px); }
  .shop-main { flex-direction: row; gap: 12px; }
  .shop-side { display: flex; flex-direction: column; gap: 8px; flex: 0 0 42%; min-width: 0; min-height: 0; }
  .shop-list { display: flex; flex-direction: column; gap: 8px; flex: 1 1 0; min-width: 0; min-height: 0; }
  /* tablets in landscape: the jar fills the stage (centre square of the canvas, cropped at the sides) */
  .shop-stage-wrap { flex: 0 1 auto; min-height: 0; aspect-ratio: 1 / 1; max-height: 100%; }
  .shop-stage { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; object-position: center; }
  .shop-bar { flex-direction: column; align-items: stretch; }
  .shop-actions { flex: 0 0 auto; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .shop-card { padding: 8px; gap: 6px; }
  .shop-card .shop-title { font-size: 18px; }
  .shop-stage-wrap { max-height: 46vh; }
  .shop-stage { width: auto; height: 46vh; max-width: 100%; margin: 0 auto; }
  .shop-desc { display: none; }
  .shop-actions { flex-direction: row; }
  .shop-bar { margin-top: auto; }
}
.shop-stars-line { margin: 2px 0 6px; font-weight: 800; color: var(--gold); }

/* Ismo69-only looks (src/shop-preview.js): extra tabs wrap into two rows, flair cards and the flair demo row are HTML */
.shop-tabs.shop-tabs-wide { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
.shop-tabs-wide .shop-tab { font-size: 12px; padding: 4px 0; }
.shop-tabs-wide .shop-tab-count { font-size: 12px; }
.shop-test-badge { background: linear-gradient(135deg, #9BE7FF, #5BB8F0); }
.shop-super-badge { background: linear-gradient(135deg, #FF9BD2, #B66CFF); color: #fff; }
.shop-flair-thumb { display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 15px; font-weight: 800; color: var(--text); background: var(--bg2); }
.shop-flair-demo { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 30px 14px 10px; background: var(--bg2); font-size: 15px; font-weight: 800; color: var(--text); }
.shop-flair-row { display: flex; align-items: center; gap: 10px; min-height: 28px; padding: 3px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.shop-flair-me { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.shop-flair-demo[hidden] { display: none; }
.shop-flair-rank { width: 22px; text-align: center; color: var(--muted); }
.shop-flair-name { flex: 1; min-width: 0; }
.shop-flair-score { color: var(--muted); font-variant-numeric: tabular-nums; }
.shop-tabs.shop-tabs-wide { display: flex; overflow-x: auto; gap: 4px; padding-bottom: 2px; scrollbar-width: thin; }
.shop-tabs-wide .shop-tab { flex: 0 0 auto; min-width: 74px; padding: 4px 8px; }

/* sound sets: compact cards (no tall picture), the purpose is on the card */
.shop-item-sound { gap: 2px; padding: 5px 6px; }
.shop-item-sound .shop-thumb { aspect-ratio: 13 / 3.4; }
.shop-item-sound .shop-item-name { min-height: 0; font-size: 12px; }
.shop-item-sound .shop-item-col { margin-top: 0; min-height: 0; font-size: 12px; }
.shop-item-sound .shop-chip { min-height: 18px; font-size: 12px; }
/* prize card after Claim prize */
.shop-prize-card { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(8, 6, 20, 0.74); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.shop-prize-card[hidden] { display: none; }
.shop-prize-box { width: min(100%, 300px); display: grid; gap: 8px; justify-items: center; text-align: center; padding: 16px; border-radius: 20px; background: var(--surface); border: 2px solid #F5B400; box-shadow: 0 0 0 4px color-mix(in srgb, #F5B400 28%, transparent), 0 18px 40px rgba(0, 0, 0, 0.5); }
.shop-prize-head { font-size: 20px; color: var(--gold); } /* #F5B400 on the white prize card was 1.8:1 */
.shop-prize-thumb { width: 78%; }
.shop-prize-name { font-size: 18px; }
.shop-prize-stars { font-size: 26px; color: var(--gold); }
.shop-prize-box .btn { width: 100%; min-height: 44px; margin-top: 4px; }
.shop-stage-tag { z-index: 2; }
.shop-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
