:root {
  --ink: #1d2233;
  --ink-2: #4a5068;
  --ink-3: #8a8fa3;
  --cream: #fbf4e6;
  --paper: #fffdf8;
  --line: #eadfc9;
  --yellow: #ffcd1f;
  --yellow-d: #d9a400;
  --red: #e5392b;
  --red-d: #b3261b;
  --blue: #1f7ae0;
  --blue-d: #1459a8;
  --green: #2f9e55;
  --green-d: #1f7a3e;
  --callout: #dcecf8;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(60, 40, 10, 0.14), 0 2px 6px rgba(60, 40, 10, 0.08);
  --font: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --body: 'Nunito', system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--body);
  color: var(--ink);
  background: var(--cream);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
#labels { position: fixed; inset: 0; pointer-events: none; }

/* ---------- Brand bits ---------- */
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font); font-weight: 700; font-size: 26px; letter-spacing: -0.02em; }
.logo-brick {
  position: relative; display: inline-block; width: 34px; height: 24px; margin-top: 7px;
  background: var(--yellow); border-radius: 6px; box-shadow: inset 0 -4px 0 var(--yellow-d);
}
.logo-brick::before, .logo-brick::after {
  content: ''; position: absolute; top: -7px; width: 11px; height: 8px; border-radius: 4px 4px 1px 1px;
  background: var(--yellow); box-shadow: inset 0 -2px 0 var(--yellow-d);
}
.logo-brick::before { left: 4px; }
.logo-brick::after { right: 4px; }
.logo-brick.big { transform: scale(2.2); }

.coin {
  display: inline-block; width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3b0 0 18%, #ffd43b 19% 60%, #e0a800 61%);
  box-shadow: inset 0 0 0 2px #c98f00;
}
.coins { display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); font-family: var(--font); font-size: 18px; }
.coins b { font-weight: 600; min-width: 2ch; }
.coins.small { padding: 6px 12px 6px 8px; font-size: 16px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); }
.coins.bump { animation: bump 0.5s ease; }
@keyframes bump { 30% { transform: scale(1.18); } }

/* ---------- Buttons ---------- */
.btn {
  --bg: #fff; --edge: #d8cfbd; --fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border: 0; border-radius: 14px;
  background: var(--bg); color: var(--fg); box-shadow: 0 4px 0 var(--edge);
  font-family: var(--font); font-weight: 600; font-size: 16px; text-decoration: none; cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s;
  user-select: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.04); }
.btn:active, .btn.pressed { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.btn:disabled { cursor: not-allowed; filter: grayscale(0.6); opacity: 0.6; transform: none; }
.btn.primary { --bg: var(--yellow); --edge: var(--yellow-d); }
.btn.go { --bg: var(--green); --edge: var(--green-d); --fg: #fff; }
.btn.blue { --bg: var(--blue); --edge: var(--blue-d); --fg: #fff; }
.btn.danger { --bg: var(--red); --edge: var(--red-d); --fg: #fff; }
.btn.ghost { --bg: rgba(255, 255, 255, 0.85); --edge: rgba(0, 0, 0, 0.12); }
.btn.round { width: 42px; padding: 0; border-radius: 50%; }
.btn.on { --bg: var(--ink); --edge: #000; --fg: #fff; }
.btn.icon-left { padding-left: 12px; }
.btn small { font-weight: 500; opacity: 0.75; }

/* ---------- Catalog ---------- */
.screen { position: fixed; inset: 0; overflow-y: auto; background: var(--cream); z-index: 5; }
.shop-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 24px;
  padding: 16px max(16px, calc((100vw - 1200px) / 2)); background: rgba(251, 244, 230, 0.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: 6px; margin-right: auto; }
.tabs a { padding: 8px 14px; border-radius: 12px; color: var(--ink-2); text-decoration: none; font-family: var(--font); font-weight: 500; font-size: 17px; }
.tabs a:hover { background: rgba(0, 0, 0, 0.05); }
.tabs a.on { background: var(--ink); color: #fff; }
.shop-body { max-width: 1200px; margin: 0 auto; padding: 28px 16px 80px; }
.hero { padding: 14px 0 26px; }
.hero h1 { margin: 0 0 8px; font-family: var(--font); font-weight: 600; font-size: clamp(28px, 4vw, 44px); letter-spacing: -0.02em; line-height: 1.08; }
.hero p { margin: 0; max-width: 640px; color: var(--ink-2); font-size: 17px; line-height: 1.5; }
.section-title { margin: 48px 0 4px; font-family: var(--font); font-weight: 600; font-size: 26px; }
.section-title.first { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.section-sub { margin: 0 0 18px; color: var(--ink-2); }
.new-chip { padding: 3px 10px; border-radius: 8px; background: var(--red); color: #fff; font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; transform: rotate(-3deg); }
.box-art .band .new { padding: 2px 8px; border-radius: 6px; background: var(--red); color: #fff; text-shadow: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }

.set-card {
  position: relative; display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden;
  background: #fff; box-shadow: var(--shadow); transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.set-card:hover { transform: translateY(-4px) rotate(-0.4deg); box-shadow: 0 18px 40px rgba(60, 40, 10, 0.2); }
.box-art { position: relative; aspect-ratio: 4 / 3; background: var(--box, #888); overflow: hidden; }
.box-art::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 70% 20%, rgba(255, 255, 255, 0.45), transparent 60%), linear-gradient(160deg, transparent 50%, rgba(0, 0, 0, 0.25));
}
.box-art img { position: absolute; inset: 6% 4% 0; width: 92%; height: 94%; object-fit: contain; filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.3)); }
.box-art .band { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: #fff; font-family: var(--font); font-weight: 600; font-size: 13px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.box-art .band .mini { transform: scale(0.62); transform-origin: left center; margin-right: -12px; }
.box-art .band .age { margin-left: auto; padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.92); color: var(--ink); text-shadow: none; }
.box-art .pcs { position: absolute; right: 10px; bottom: 10px; padding: 3px 9px; border-radius: 8px; background: rgba(0, 0, 0, 0.45); color: #fff; font-family: var(--font); font-size: 13px; }
.box-art .ribbon { position: absolute; left: 10px; bottom: 10px; padding: 4px 10px; border-radius: 8px; background: #fff; color: var(--green-d); font-family: var(--font); font-weight: 600; font-size: 13px; }
.box-art .shimmer { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%); background-size: 250% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.set-info { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; flex: 1; }
.set-info h3 { margin: 0; font-family: var(--font); font-weight: 600; font-size: 21px; }
.set-info p { margin: 0 0 10px; color: var(--ink-2); font-size: 14.5px; line-height: 1.4; flex: 1; }
.set-actions { display: flex; gap: 8px; align-items: center; }
.set-actions .btn { flex: 1; }
.set-actions .btn.round { flex: 0 0 42px; }
.set-actions .note { font-size: 13px; color: var(--ink-3); }
.meter { height: 8px; border-radius: 99px; background: #eee6d6; overflow: hidden; margin-bottom: 10px; }
.meter i { display: block; height: 100%; background: var(--green); border-radius: 99px; }

/* ---------- Top bar on 3D screens ---------- */
.bar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 4; display: flex; align-items: center; gap: 16px;
  padding: 12px 16px; pointer-events: none;
}
.bar > * { pointer-events: auto; }
.bar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.bar-title { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.bar-title small { color: var(--ink-2); font-weight: 700; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.bar-title b { font-family: var(--font); font-weight: 600; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-mid { flex: 1; display: flex; justify-content: center; gap: 8px; }
.bar-right { display: flex; align-items: center; gap: 8px; }
.progress { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.88); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); font-family: var(--font); font-size: 15px; }
.progress .meter { width: 160px; margin: 0; }

/* ---------- Instruction booklet ---------- */
.booklet {
  position: fixed; left: 16px; top: 74px; bottom: 150px; z-index: 3; width: 360px; max-height: 620px;
  display: flex; flex-direction: column; perspective: 1400px;
}
.page {
  position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 16px 18px 12px;
  border-radius: 6px 16px 16px 6px; background: var(--paper);
  box-shadow: var(--shadow), inset 10px 0 14px -10px rgba(0, 0, 0, 0.18);
  transform-origin: left center; overflow: hidden;
}
.page::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(0, 0, 0, 0.05), transparent 8%); }
.page.flip-next { animation: flipNext 0.45s cubic-bezier(0.3, 0.7, 0.3, 1); }
.page.flip-prev { animation: flipPrev 0.45s cubic-bezier(0.3, 0.7, 0.3, 1); }
@keyframes flipNext { from { transform: rotateY(-70deg); opacity: 0.3; } to { transform: none; opacity: 1; } }
@keyframes flipPrev { from { transform: rotateY(40deg); opacity: 0.3; } to { transform: none; opacity: 1; } }
.page-head { display: flex; align-items: flex-start; gap: 12px; }
.step-no { font-family: var(--font); font-weight: 700; font-size: 54px; line-height: 0.9; letter-spacing: -0.03em; }
.step-of { margin-top: 6px; color: var(--ink-3); font-weight: 700; font-size: 13px; }
.callout {
  margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 6px; max-width: 70%;
  padding: 6px 8px; border: 2px solid #b9d6ec; border-radius: 12px; background: var(--callout);
}
.callout figure { margin: 0; display: flex; flex-direction: column; align-items: center; }
.callout img { width: 48px; height: 48px; object-fit: contain; }
.callout img, .piece img { filter: drop-shadow(0 1px 1px rgba(20, 24, 40, 0.35)) drop-shadow(0 0 0.5px rgba(20, 24, 40, 0.45)); }
.callout figcaption { margin-top: -4px; font-family: var(--font); font-weight: 600; font-size: 13px; }
.page-art { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.page-art img { max-width: 100%; max-height: 100%; object-fit: contain; }
.page-art .placeholder { width: 70%; aspect-ratio: 4 / 3; border-radius: 14px; background: linear-gradient(100deg, #f1eadb 30%, #f9f4ea 50%, #f1eadb 70%); background-size: 250% 100%; animation: shimmer 1.2s linear infinite; }
.page-foot { display: flex; align-items: center; justify-content: space-between; color: var(--ink-3); font-size: 12px; font-weight: 700; }
.here { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: #fff3c4; color: #8a6500; font-weight: 800; font-size: 12px; }
.here::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--yellow-d); animation: blink 1.2s ease infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.page-cover { justify-content: center; text-align: center; gap: 10px; }
.page-cover .cover-art { border-radius: 12px; overflow: hidden; }
.page-cover h2 { margin: 6px 0 0; font-family: var(--font); font-weight: 600; font-size: 26px; }
.page-cover p { margin: 0; color: var(--ink-2); }
.page-done h2 { color: var(--green-d); }
.pager { display: flex; align-items: center; gap: 8px; padding-top: 10px; }
.pager .btn { min-height: 38px; }
.pager .grow { flex: 1; }
.booklet.collapsed { bottom: auto; width: auto; }
.booklet.collapsed .page { display: none; }
.booklet-toggle { display: none; }

/* ---------- Parts tray ---------- */
.tray {
  position: fixed; left: 392px; right: 16px; bottom: 16px; z-index: 3; display: flex; gap: 10px; align-items: stretch;
  padding: 12px; border-radius: var(--radius); background: rgba(255, 253, 248, 0.94); box-shadow: var(--shadow);
  overflow-x: auto; scrollbar-width: thin;
}
.tray-label { display: flex; flex-direction: column; justify-content: center; min-width: 76px; color: var(--ink-2); font-size: 12px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; line-height: 1.3; }
.tray-label b { color: var(--ink); font-family: var(--font); font-size: 22px; letter-spacing: 0; }
.tray-done { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.piece {
  position: relative; flex: 0 0 auto; width: 88px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 4px 4px 6px; border: 2px solid transparent; border-radius: 14px; background: #f4efe4; cursor: pointer;
  transition: transform 0.12s ease, background 0.15s, opacity 0.2s;
}
.piece img { width: 64px; height: 64px; object-fit: contain; pointer-events: none; }
.piece span { font-family: var(--font); font-weight: 600; font-size: 14px; }
.piece:hover { transform: translateY(-3px); }
.piece.later { opacity: 0.62; filter: saturate(0.6); }
.piece.now { background: #fff6d1; border-color: #f5d252; }
.piece.now::after { content: attr(data-need); position: absolute; top: -8px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--red); color: #fff; font-family: var(--font); font-weight: 600; font-size: 13px; line-height: 22px; text-align: center; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); }
.piece.held { background: var(--ink); border-color: var(--ink); color: #fff; transform: translateY(-4px); }
.piece.pop { animation: pop 0.35s ease; }
@keyframes pop { 40% { transform: scale(0.86); } }

/* ---------- Free build palette ---------- */
.palette {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 3; display: flex; flex-direction: column; gap: 10px;
  padding: 12px; border-radius: var(--radius); background: rgba(255, 253, 248, 0.95); box-shadow: var(--shadow);
  max-width: 1100px; margin: 0 auto;
}
.palette-row { display: flex; gap: 8px; align-items: center; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.cat { padding: 6px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-family: var(--font); font-weight: 500; font-size: 15px; cursor: pointer; }
.cat.on { background: var(--ink); color: #fff; }
.swatch { flex: 0 0 auto; width: 30px; height: 30px; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }
.palette .piece { width: 76px; }
.palette .piece img { width: 54px; height: 54px; }
.palette .piece span { font-size: 12px; font-weight: 500; }
.palette .sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }

/* ---------- Town ---------- */
.town-empty { position: fixed; left: 50%; top: 50%; z-index: 3; transform: translate(-50%, -50%); padding: 28px 32px; border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); text-align: center; max-width: 380px; }
.town-empty h2 { margin: 0 0 6px; font-family: var(--font); font-weight: 600; }
.town-empty p { margin: 0 0 18px; color: var(--ink-2); }
.lot-label {
  position: absolute; transform: translate(-50%, -100%); padding: 6px 12px; border-radius: 12px; background: rgba(255, 253, 248, 0.95);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15); font-family: var(--font); font-weight: 600; font-size: 14px; white-space: nowrap; pointer-events: auto; cursor: pointer;
}
.lot-label small { display: block; color: var(--ink-3); font-family: var(--body); font-weight: 700; font-size: 11px; }
.lot-label::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: rgba(255, 253, 248, 0.95); }

/* ---------- Hints, toasts, modals ---------- */
.hint { position: fixed; left: 50%; bottom: var(--dock, 150px); z-index: 3; transform: translateX(-50%); padding: 7px 14px; border-radius: 999px; background: rgba(29, 34, 51, 0.78); color: #fff; font-size: 13px; font-weight: 700; pointer-events: none; opacity: 0; transition: opacity 0.3s; white-space: nowrap; }
.hint.show { opacity: 1; }
.hint kbd { padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, 0.2); font-family: inherit; }
.toast {
  position: fixed; left: 50%; top: 84px; z-index: 20; transform: translate(-50%, -20px); padding: 12px 20px; border-radius: 14px;
  background: var(--ink); color: #fff; font-family: var(--font); font-weight: 500; font-size: 16px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { background: var(--red); }
.toast.good { background: var(--green); }
.modal-wrap { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(29, 34, 51, 0.35); backdrop-filter: blur(4px); animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(440px, 100%); padding: 26px; border-radius: 22px; background: var(--paper); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); text-align: center; animation: rise 0.4s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes rise { from { transform: translateY(30px) scale(0.94); opacity: 0; } }
.modal h2 { margin: 0 0 6px; font-family: var(--font); font-weight: 600; font-size: 28px; }
.modal p { margin: 0 0 16px; color: var(--ink-2); line-height: 1.45; }
.modal img { width: 100%; border-radius: 14px; background: var(--box, #eee); margin-bottom: 14px; }
.modal .reward { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 8px 16px; border-radius: 999px; background: #fff3c4; font-family: var(--font); font-weight: 600; font-size: 22px; }
.modal .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.modal input { width: 100%; margin-bottom: 16px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font: 600 18px var(--font); color: var(--ink); outline: none; }
.modal input:focus { border-color: var(--yellow-d); }
#confetti { position: fixed; inset: 0; z-index: 25; width: 100%; height: 100%; pointer-events: none; }

.loader { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 34px; background: var(--cream); transition: opacity 0.5s; }
.loader .logo-brick { animation: hop 0.9s ease-in-out infinite; }
@keyframes hop { 50% { transform: scale(2.2) translateY(-6px); } }
.loader p { margin: 0; color: var(--ink-2); font-family: var(--font); font-size: 18px; }
.loader.gone { opacity: 0; pointer-events: none; }
.loader.error p { max-width: 420px; text-align: center; color: var(--red-d); }

/* ---------- Small screens ---------- */
@media (max-width: 820px) {
  .shop-head { gap: 12px; flex-wrap: wrap; }
  .logo { font-size: 22px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .bar { padding: 10px; gap: 8px; }
  .bar-left .btn span { display: none; }
  .bar-title b { font-size: 17px; }
  .bar-mid { display: none; }
  .bar .coins, #bar-tools [aria-label="Reset camera"] { display: none; }
  .bar-title small { display: none; }
  .booklet { left: 10px; right: 10px; top: 64px; bottom: auto; width: auto; height: 46vh; max-height: none; }
  .booklet.collapsed { right: auto; height: auto; }
  .booklet-toggle { display: inline-flex; }
  .callout img { width: 38px; height: 38px; }
  .step-no { font-size: 40px; }
  .tray { left: 10px; right: 10px; bottom: 10px; padding: 8px; }
  .tray-label { display: none; }
  .piece { width: 72px; }
  .piece img { width: 50px; height: 50px; }
  .palette { left: 10px; right: 10px; bottom: 10px; }
  .hint { display: none; }
}

/* ---------- Tray toggle ---------- */
.tray-toggle {
  flex: 0 0 auto; align-self: center; margin-left: auto; padding: 8px 14px; border: 2px dashed #d8cfbd; border-radius: 12px;
  background: transparent; color: var(--ink-2); font-family: var(--font); font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.tray-toggle:hover { border-color: var(--ink-3); color: var(--ink); }

/* ---------- Booklet: pieces from underneath, tips ---------- */
.callout figure.under { position: relative; }
.callout figure.under::before {
  content: '↑'; position: absolute; top: -4px; left: -4px; width: 18px; height: 18px; border-radius: 50%;
  background: #e8491d; color: #fff; font: 700 12px/18px var(--font); text-align: center; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.page-note { margin: 0 0 6px; padding: 6px 10px; border-radius: 10px; background: #fdeee6; color: #a3330f; font-size: 13px; font-weight: 700; }
.cover-tip { margin: 6px 8px 0; font-size: 13px; color: var(--ink-3); }

/* ---------- Catalog: Featured set, deals, stars ---------- */
.featured {
  display: grid; grid-template-columns: minmax(200px, 360px) 1fr; align-items: center; gap: 24px; margin: 0 0 30px; padding: 18px;
  border-radius: 22px; background: linear-gradient(135deg, #fff6d6, #ffe7a3); box-shadow: var(--shadow); border: 2px solid #f5d252;
}
.featured-art { position: relative; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; background: radial-gradient(120% 90% at 70% 20%, rgba(255, 255, 255, 0.45), transparent 60%), var(--box); }
.featured-art img { position: absolute; inset: 4%; width: 92%; height: 92%; object-fit: contain; filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.3)); }
.featured-text small { color: #9a6c00; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.featured-text h2 { margin: 2px 0 6px; font-family: var(--font); font-weight: 600; font-size: 34px; }
.featured-text p { margin: 0 0 14px; color: var(--ink-2); font-size: 16px; }
.featured-text .set-actions { max-width: 360px; }
.box-art .band .hot { padding: 2px 8px; border-radius: 6px; background: var(--yellow); color: var(--ink); text-shadow: none; }
.btn s { font-weight: 500; opacity: 0.55; margin-left: 2px; }
.modal .expert { margin: -6px 0 16px; color: #9a6c00; font-weight: 800; }

/* ---------- Town street signs ---------- */
.street-sign {
  position: absolute; transform: translate(-100%, -50%); padding: 5px 12px; border-radius: 8px; background: #1f7a3e; color: #fff;
  border: 2px solid #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25); font-family: var(--font); font-weight: 600; font-size: 14px; white-space: nowrap;
}

@media (max-width: 820px) {
  .featured { grid-template-columns: 1fr; gap: 12px; }
  .featured-text h2 { font-size: 26px; }
  .tray-toggle { padding: 6px 10px; font-size: 12px; }
}

/* ---------- Shared bits for page screens ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.big { min-height: 50px; padding: 0 26px; font-size: 18px; }
.muted { color: var(--ink-3); }

/* ---------- Catalog: create strip ---------- */
.create-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin: 44px 0 0; }
.create-card {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none; transition: transform 0.2s ease;
}
.create-card:hover { transform: translateY(-3px); }
.create-card.photo { background: linear-gradient(120deg, #fff6d6, #ffe0ec); }
.create-icon { display: grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 16px; background: rgba(255, 255, 255, 0.8); font-size: 26px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05); }
.create-card b { display: block; font-family: var(--font); font-weight: 600; font-size: 19px; }
.create-card small { display: block; margin-top: 2px; color: var(--ink-2); font-size: 14px; }

/* ---------- Photo mosaic ---------- */
.photo-body { max-width: 1200px; margin: 0 auto; padding: 28px 16px 80px; }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.photo-card { display: flex; flex-direction: column; gap: 16px; padding: 22px; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.photo-card h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-family: var(--font); font-weight: 600; font-size: 22px; }
.photo-card .num { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--yellow); font-size: 16px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 150px; padding: 20px;
  border: 2px dashed #d8cfbd; border-radius: 16px; background: #fbf7ef; text-align: center; cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.over { border-color: var(--yellow-d); background: #fff6d6; }
.dropzone b { font-family: var(--font); font-weight: 600; font-size: 18px; }
.dropzone small { max-width: 360px; color: var(--ink-2); }
.sample-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sample-row .or { color: var(--ink-3); font-size: 14px; }
.source-wrap { display: flex; flex-direction: column; gap: 10px; }
.photo-source { width: 100%; aspect-ratio: 1; border-radius: 14px; cursor: grab; touch-action: none; background: #efe6d4; }
.photo-source:active { cursor: grabbing; }
.zoom-row { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--ink-2); }
.zoom-row input { flex: 1; accent-color: var(--yellow-d); }
.hint-line { margin: 0; color: var(--ink-3); font-size: 13px; }
.mosaic-wrap { position: relative; }
.photo-mosaic { display: block; width: 100%; aspect-ratio: 1; border-radius: 14px; background: #1c1d22; }
.mosaic-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: rgba(255, 255, 255, 0.55); font-family: var(--font); font-size: 18px; }
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip-row > span { width: 72px; color: var(--ink-2); font-size: 14px; font-weight: 800; }
.chip { padding: 7px 14px; border: 2px solid #eadfc9; border-radius: 999px; background: #fff; font-family: var(--font); font-weight: 500; font-size: 14px; cursor: pointer; }
.chip.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.photo-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; padding: 12px 16px; border-radius: 14px; background: #f7f1e5; }
.photo-stats b { display: block; font-family: var(--font); font-weight: 600; font-size: 26px; line-height: 1; }
.photo-stats small { color: var(--ink-2); font-size: 13px; font-weight: 700; }
.photo-stats .swatches { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; max-width: 220px; }
.photo-stats .swatches i { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.create-row { display: flex; gap: 10px; }
.create-row input { flex: 1; min-width: 0; padding: 0 14px; border: 2px solid var(--line); border-radius: 12px; font: 600 16px var(--font); color: var(--ink); outline: none; }
.create-row input:focus { border-color: var(--yellow-d); }
@media (max-width: 860px) {
  .photo-grid { grid-template-columns: 1fr; }
  .create-row { flex-direction: column; }
  .create-row input { min-height: 48px; }
}

/* ---------- Photo mode + share ---------- */
.modal.wide { width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.postcard { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: center; text-align: left; margin-top: 10px; }
.postcard-preview { aspect-ratio: 1080 / 1350; border-radius: 16px; overflow: hidden; background: #efe9de; transition: opacity 0.2s; }
.postcard-preview.busy { opacity: 0.55; }
.postcard-preview img { display: block; width: 100%; height: 100%; margin: 0; border-radius: 0; object-fit: cover; }
.postcard-side { display: grid; gap: 18px; }
.postcard-controls { display: grid; gap: 14px; }
.postcard-controls .chip-row > span { width: 100%; }
.postcard-side .row { justify-content: flex-start; }
.btn[aria-disabled='true'] { opacity: 0.5; pointer-events: none; }
.modal input[readonly] { font: 500 14px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-2); text-overflow: ellipsis; }
@media (max-width: 700px) {
  .postcard { grid-template-columns: 1fr; }
  .postcard-preview { width: min(100%, 320px); justify-self: center; }
}

/* ---------- Challenges ---------- */
.daily-card {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: center; padding: 22px;
  border-radius: var(--radius); background: linear-gradient(120deg, #fff6d6, #ffe7c7); box-shadow: var(--shadow);
}
.daily-card .ch-art { aspect-ratio: 4 / 3; }
.daily-text small { color: #9a6c00; font-weight: 800; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.daily-text h2 { margin: 6px 0 8px; font-family: var(--font); font-weight: 600; font-size: clamp(28px, 3.4vw, 40px); line-height: 1.05; }
.daily-text p { margin: 0 0 18px; color: var(--ink-2); line-height: 1.5; }
.daily-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.daily-stats .stat { display: grid; padding: 10px 16px; border-radius: 14px; background: rgba(255, 255, 255, 0.7); color: var(--ink-2); font-size: 13px; font-weight: 700; }
.daily-stats .stat b { color: var(--ink); font-family: var(--font); font-weight: 600; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ch-art { display: grid; place-items: center; border-radius: 14px; background: radial-gradient(circle at 60% 35%, color-mix(in srgb, var(--box) 55%, #fff), var(--box)); overflow: hidden; }
.ch-art img { width: 100%; height: 100%; object-fit: contain; }
.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ch-card { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; padding: 12px; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.ch-card .ch-art { aspect-ratio: 1; }
.ch-info { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.ch-info h3 { margin: 0; font-family: var(--font); font-weight: 600; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ch-info p { margin: 0; color: var(--ink-2); font-size: 13px; }
.ch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ch-row .best { color: var(--ink-2); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ch-info .btn { margin-top: auto; }
.ch-more { margin-top: 26px; color: var(--ink-2); }
.medal { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-weight: 800; font-size: 12px; white-space: nowrap; }
.medal.gold { background: #ffe08a; color: #7a5200; }
.medal.silver { background: #e3e7ec; color: #46505c; }
.medal.bronze { background: #f3c9a5; color: #7a3e12; }
.medal.none { background: #f1ece2; color: var(--ink-2); }
.medal.big { margin-bottom: 10px; padding: 8px 22px; font-family: var(--font); font-weight: 600; font-size: 22px; }
.modal .par { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.timer {
  padding: 8px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-family: var(--font); font-weight: 600; font-size: 18px;
  font-variant-numeric: tabular-nums; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.ref-card {
  position: fixed; left: 16px; top: 72px; z-index: 4; width: 210px; padding: 8px 8px 6px; border: 0; border-radius: 16px; background: #fff;
  box-shadow: var(--shadow); cursor: zoom-in; transition: width 0.25s ease;
}
.ref-card.big { width: min(460px, calc(100vw - 32px)); cursor: zoom-out; }
.ref-card img { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 10px; background: #f1ece2; object-fit: contain; }
.ref-card small { display: block; padding-top: 4px; color: var(--ink-2); font-weight: 800; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.palette-row.stock .piece { padding-top: 8px; }
.palette-row.stock .count { font-family: var(--font); font-weight: 600; font-size: 14px; }
.palette-row.stock .piece.empty { opacity: 0.35; cursor: default; transform: none; }
@media (max-width: 860px) {
  .daily-card { grid-template-columns: 1fr; }
  .ref-card { width: 130px; top: 110px; }
}
.palette-label { padding: 0 6px; color: var(--ink-2); font-weight: 800; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.daily-text .set-actions { max-width: 300px; }
.daynight .chip-row > span:empty { display: none; }
.daynight .chip { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); border-color: transparent; }
.daynight .chip.on { border-color: var(--ink); }

/* ---------- Seasonal shelf ---------- */
.season-shelf { margin: 40px 0 48px; padding: 22px 22px 26px; border-radius: var(--radius); }
.season-shelf.halloween { background: linear-gradient(135deg, #2b1840, #4a2266 60%, #6b2f7a); color: #fff; }
.season-shelf.christmas { background: linear-gradient(135deg, #0f3d26, #1f6b3a 60%, #8a1c14); color: #fff; }
.season-shelf .section-title { margin-top: 0; display: flex; align-items: center; gap: 10px; }
.season-shelf .section-sub { color: rgba(255, 255, 255, 0.8); }
.season-chip { padding: 3px 10px; border-radius: 999px; background: #ff8a1f; color: #1d2233; font-size: 14px; }
.christmas .season-chip { background: #f5c451; }
.set-card .band .new.season.halloween { background: #6b2f7a; }
.set-card .band .new.season.christmas { background: #1f6b3a; }
.season-shelf .set-card { color: var(--ink); }

/* ---------- Set packs (iPhone app) ---------- */
#packs:not(:empty) { margin: 36px 0 44px; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.pack-card { display: grid; gap: 14px; padding: 16px; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.pack-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pack-thumbs img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 10px; background: var(--box); }
.pack-info h3 { margin: 0 0 4px; font-family: var(--font); font-weight: 600; font-size: 20px; }
.pack-info p { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.pack-owned { color: var(--green-d); font-weight: 800; }
.link-btn { margin-top: 12px; padding: 0; border: 0; background: none; color: var(--ink-2); font: 700 14px var(--body); text-decoration: underline; cursor: pointer; }
/* Tabs stay on one line and scroll sideways on phones. */
.tabs a { white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 820px) {
  .tabs { scrollbar-width: none; margin-right: 0; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { padding: 7px 12px; font-size: 16px; }
}
@media (max-width: 820px) {
  .bar-mid:has(.timer) { display: flex; }
  .bar-mid:has(.timer) .progress { display: none; }
}
