/* Collector balls: header button, collection sheet, unlock card */
:root { --soft: color-mix(in srgb, var(--ink) 60%, var(--paper)); }
body { transition: background-color .4s, color .4s; }

.cb-actions { display: flex; gap: 8px; align-items: center; }
.cb-actions .pill { white-space: nowrap; }
.cb-open {
  position: relative; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--ink); cursor: pointer;
}
.cb-open:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.cb-mini { display: block; width: 44px; height: 44px; }
.cb-count {
  position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%);
  padding: 2px 6px; border: 2px solid var(--ink); border-radius: 99px; background: var(--paper);
  font: 700 12px/1 Inter, system-ui, sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cb-dot { position: absolute; top: -2px; right: -2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 3px solid var(--paper); }
.cb-dot[hidden] { display: none; }

dialog.cb-sheet, dialog.cb-unlock {
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  padding: 0;
  font: 16px/1.4 Inter, system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
}
dialog::backdrop { background: color-mix(in srgb, var(--ink) 45%, transparent); }
.cb-sheet h2, .cb-unlock h2 { margin: 0; font: 900 28px/1.05 Archivo, "Arial Black", sans-serif; letter-spacing: -0.02em; }
.cb-kicker { font: 700 14px/1 "Barlow Condensed", "Arial Narrow", sans-serif; letter-spacing: .12em; text-transform: uppercase; }

/* Sheet */
dialog.cb-sheet {
  width: min(640px, 100vw); max-width: 100vw; height: min(88dvh, 900px); max-height: 100dvh;
  margin: auto auto 0; border-radius: 22px 22px 0 0; border-bottom: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (min-width: 700px) { dialog.cb-sheet { margin: auto; border-radius: 22px; border-bottom: 2px solid var(--ink); } }
dialog.cb-sheet[open] { animation: cb-up .32s cubic-bezier(.2,.8,.2,1); }
@keyframes cb-up { from { transform: translateY(40%); opacity: 0; } }
.cb-head {
  position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 20px 20px 14px; background: var(--paper);
}
.cb-sub { margin: 4px 0 0; color: var(--soft); font-size: 15px; }
.cb-next { display: grid; gap: 4px; margin: 0 20px 16px; padding: 14px 16px; border: 2px dashed var(--ink); border-radius: 14px; }
.cb-next[hidden] { display: none; }
.cb-next strong { font: 900 20px/1.1 Archivo, sans-serif; }
.cb-next > span:not(.cb-kicker):not(.cb-bar) { color: var(--soft); font-size: 15px; }
.cb-bar { display: block; height: 8px; margin-top: 6px; border: 2px solid currentColor; border-radius: 99px; overflow: hidden; }
.cb-bar > span { display: block; height: 100%; background: currentColor; }

.cb-grid { list-style: none; margin: 0; padding: 0 20px 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.cb-tile {
  --t-ink: var(--ink); --t-paper: var(--paper);
  position: relative; width: 100%; height: 100%; min-height: 44px; display: grid; justify-items: center; align-content: start; gap: 2px;
  padding: 12px 10px 14px; border: 2px solid var(--t-ink); border-radius: 16px;
  background: var(--t-paper); color: var(--t-ink); font: inherit; text-align: center; cursor: pointer;
  transition: transform .15s;
}
.cb-tile:not(:disabled):active { transform: scale(.97); }
.cb-tile:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.cb-tile:disabled { cursor: default; border-style: dashed; border-color: var(--soft); color: var(--soft); }
.cb-tile[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--t-paper), 0 0 0 6px var(--t-ink); }
.cb-tile img { width: 100%; max-width: 120px; height: auto; aspect-ratio: 1; border-radius: 50%; }
.cb-tile strong { font: 900 17px/1.1 Archivo, sans-serif; }
.cb-num { font: 700 13px/1 "Barlow Condensed", sans-serif; letter-spacing: .1em; margin-top: 6px; opacity: .8; }
.cb-state { font-size: 13px; line-height: 1.3; width: 100%; }
.cb-new { position: absolute; top: 8px; right: 8px; padding: 3px 7px; border-radius: 99px; background: var(--t-ink); color: var(--t-paper); font: 700 12px/1 Inter, sans-serif; }

/* Unlock card */
dialog.cb-unlock {
  --t-ink: var(--ink); --t-paper: var(--paper);
  width: min(360px, calc(100vw - 32px)); margin: auto; border-radius: 24px; padding: 22px 22px 20px;
  background: var(--t-paper); color: var(--t-ink); border-color: var(--t-ink); text-align: center;
  overflow: hidden;
}
.cb-u-stage { position: relative; display: grid; place-items: center; height: 240px; margin: 6px 0 4px; }
.cb-u-ball { position: relative; width: 190px; height: 190px; border-radius: 50%; }
/* printed sunburst: conic rays, masked by a dot screen */
.cb-burst {
  position: absolute; width: 300px; height: 300px; border-radius: 50%;
  background: repeating-conic-gradient(var(--t-ink) 0 9deg, transparent 9deg 22.5deg);
  -webkit-mask: radial-gradient(circle, #000 1.6px, transparent 2.2px) 0 0 / 7px 7px, radial-gradient(closest-side, #000 55%, transparent);
  -webkit-mask-composite: source-in; mask-composite: intersect;
  mask: radial-gradient(circle, #000 1.6px, transparent 2.2px) 0 0 / 7px 7px, radial-gradient(closest-side, #000 55%, transparent);
  opacity: .55;
}
.cb-u-why { margin: 6px 0 18px; color: color-mix(in srgb, var(--t-ink) 70%, var(--t-paper)); }
.cb-u-actions { display: flex; gap: 10px; justify-content: center; }
.cb-u-actions .pill { flex: 1; border-color: var(--t-ink); background: var(--t-paper); color: var(--t-ink); }
.cb-u-actions .pill.solid { background: var(--t-ink); color: var(--t-paper); }

dialog.cb-unlock.play[open] { animation: cb-pop-card .35s cubic-bezier(.2,.9,.3,1.3); }
.cb-unlock.play .cb-u-ball { animation: cb-pop 1s cubic-bezier(.2,.9,.25,1.25) both .1s; }
.cb-unlock.play .cb-burst { animation: cb-spin 9s linear infinite, cb-fade .6s ease both .25s; }
@keyframes cb-pop-card { from { transform: scale(.85); opacity: 0; } }
@keyframes cb-pop { 0% { transform: scale(.2) rotate(-200deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
@keyframes cb-spin { to { transform: rotate(360deg); } }
@keyframes cb-fade { from { opacity: 0; transform: scale(.6); } }

@media (prefers-reduced-motion: reduce) {
  dialog[open], .cb-unlock.play .cb-u-ball, .cb-unlock.play .cb-burst { animation: none !important; }
  body { transition: none; }
}
