/* Binder: layout, components and motion. Tokens live in theme.css. */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

/* The explicit Animations control. Never inferred from the operating system. */
.motion-off *, .motion-off *::before, .motion-off *::after { animation: none !important; transition: none !important; }
/* Re-renders (switching boosters) must not replay flips. */
.is-instant, .is-instant *, .is-instant *::before, .is-instant *::after { transition: none !important; }

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-m);
  line-height: var(--leading);
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body { margin: 0; min-height: 100vh; background: var(--paper); }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip-link {
  position: absolute;
  z-index: 80;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-button);
  background: var(--highlighter);
  color: var(--ink);
  font-weight: 700;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }
.cover :focus-visible { outline-color: var(--focus-on-cobalt); }

/* ---------- Frame ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- Binder cover (sidebar) ---------- */

.cover {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px 20px;
  color: var(--on-cobalt);
  /* A hinge crease near the spine: the only texture on the cover. */
  background:
    linear-gradient(90deg, transparent calc(100% - 13px), rgba(8, 20, 70, .32) calc(100% - 13px) calc(100% - 12px), rgba(255, 255, 255, .08) calc(100% - 12px) calc(100% - 11px), transparent calc(100% - 11px)),
    var(--cobalt);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .3) transparent;
}

.cover-top { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.wordmark { padding: 0 10px; }
.wordmark { font-size: 26px; font-weight: 800; letter-spacing: -.035em; line-height: 1; }

.toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 9px 4px 7px;
  border: 1px solid var(--cobalt-line);
  border-radius: 999px;
  background: transparent;
  color: var(--on-cobalt-muted);
  font-size: var(--text-xs);
  cursor: pointer;
}
.toggle:hover { border-color: rgba(255, 255, 255, .55); color: var(--on-cobalt); }
.toggle[aria-pressed="true"] { color: var(--on-cobalt); border-color: rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .08); }
.toggle-icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.toggle-icon .fill { fill: currentColor; stroke: none; }
.toggle[aria-pressed="true"] .when-off, .toggle[aria-pressed="false"] .when-on { display: none; }

.menu-button, .sheet-close { display: none; }

.section-nav { display: grid; gap: 1px; }
.section-nav a, .section-nav button {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--on-cobalt-muted);
  font-size: 14.5px;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.section-nav a:hover, .section-nav button:hover { background: var(--on-cobalt-hover); color: var(--on-cobalt); }
.section-nav [aria-current="page"] { background: var(--on-cobalt-current); color: var(--on-cobalt); font-weight: 700; box-shadow: inset 3px 0 0 var(--on-cobalt); }

.nav-foot { margin-top: 10px; padding: 10px 10px 0; border-top: 1px solid var(--cobalt-line); }
.variants-link { color: var(--on-cobalt-muted); font-size: var(--text-s); text-underline-offset: 3px; }
.variants-link:hover { color: var(--on-cobalt); }

.boosters h2 { margin: 0 10px 8px; color: var(--on-cobalt-muted); font-size: var(--text-s); font-weight: 700; }
.booster-list { display: grid; gap: 4px; }
.booster {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  grid-template-areas: "swatch name name" "swatch number status";
  column-gap: 11px;
  row-gap: 1px;
  align-items: baseline;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--on-cobalt);
  text-align: left;
  cursor: pointer;
}
.booster:hover { background: var(--on-cobalt-hover); }
.booster[aria-current="true"] { background: var(--sheet); color: var(--ink); }
.booster[aria-disabled="true"] { cursor: progress; }
.swatch {
  grid-area: swatch;
  align-self: center;
  width: 22px;
  height: 30px;
  border-radius: 1px;
  background:
    linear-gradient(color-mix(in srgb, var(--pack) 70%, #16213d) 0 3px, transparent 3px calc(100% - 3px), color-mix(in srgb, var(--pack) 70%, #16213d) calc(100% - 3px)),
    linear-gradient(transparent 58%, rgba(255, 255, 255, .85) 58% 76%, transparent 76%) 3px 0 / calc(100% - 6px) 100% no-repeat,
    var(--pack);
}
.booster[data-phase="open"] .swatch, .booster[data-phase="done"] .swatch {
  clip-path: polygon(0 16%, 18% 7%, 36% 16%, 54% 5%, 72% 15%, 100% 6%, 100% 100%, 0 100%);
}
.booster[data-phase="done"] .swatch { opacity: .55; }
.booster-name { grid-area: name; overflow: hidden; font-size: 14px; font-weight: 700; line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; }
.booster-number { grid-area: number; color: var(--on-cobalt-muted); font-size: var(--text-xs); }
.booster-status { grid-area: status; color: var(--on-cobalt-muted); font-size: var(--text-xs); text-align: right; white-space: nowrap; }
.booster[data-phase="open"] .booster-status { color: var(--on-cobalt); font-weight: 700; }
.booster[aria-current="true"] .booster-number, .booster[aria-current="true"] .booster-status { color: var(--ink-muted); }
.booster[aria-current="true"][data-phase="open"] .booster-status { color: var(--cobalt); }

.open-all {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1.5px solid rgba(255, 255, 255, .75);
  border-radius: var(--radius-button);
  background: transparent;
  color: var(--on-cobalt);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}
.open-all:hover { background: var(--on-cobalt-hover); }
.open-all[aria-disabled="true"] { border-color: var(--cobalt-line); color: var(--on-cobalt-muted); cursor: default; }
.open-all[aria-disabled="true"]:hover { background: transparent; }
.is-batch .open-all { cursor: progress; }

/* ---------- Desk ---------- */

.desk { min-width: 0; max-width: 1240px; padding: 28px clamp(20px, 3.2vw, 48px) 48px; }

/* ---------- Opening strip ---------- */

.strip-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 16px; }
.strip-head h1 { font-size: var(--text-xxl); font-weight: 700; letter-spacing: -.025em; line-height: 1.1; }
.pack-no { color: var(--ink-muted); font-size: var(--text-m); }
.gift {
  margin-left: auto;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--ink-muted);
  font-size: var(--text-s);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.gift:hover { color: var(--ink); }

.strip-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px 36px; }
.strip-cards { display: flex; align-items: flex-start; gap: 26px; }
.slots { display: flex; gap: 12px; }
.slot-cell { width: var(--card-w); }
.strip-side { flex: 1 1 250px; min-width: 0; max-width: 430px; padding-top: 2px; }
.status { min-height: 4.4em; font-size: var(--text-m); line-height: 1.45; }
.status strong { font-weight: 700; }
.actions { margin-top: 14px; }
.action-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.dock-progress { display: none; }

.button {
  min-height: 40px;
  padding: 8px 16px;
  border: 1.5px solid var(--cobalt);
  border-radius: var(--radius-button);
  background: var(--sheet);
  color: var(--cobalt);
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.button:hover { background: var(--button-hover); }
.button.is-primary { background: var(--cobalt); color: var(--on-cobalt); }
.button.is-primary:hover { background: var(--cobalt-deep); }
.button:active { transform: translateY(1px); }
.button[aria-disabled="true"] { opacity: .5; cursor: default; }
.button[aria-disabled="true"]:active { transform: none; }

/* The pack */
.pack {
  position: relative;
  flex: none;
  width: var(--card-w);
  aspect-ratio: 5 / 7;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  container-type: inline-size;
  transition: transform 160ms ease-out;
}
.strip[data-phase="sealed"] .pack:hover { transform: translateY(-3px); }
.strip[data-phase="sealed"] .pack:active { transform: translateY(0); }
.strip:not([data-phase="sealed"]) .pack { cursor: default; }
.pack-body {
  position: absolute;
  inset: 8% 0 5.5%;
  display: flex;
  flex-direction: column;
  padding: 17cqi 9cqi 9cqi;
  background: var(--pack);
  color: #fff;
  box-shadow: var(--shadow-card);
  text-align: left;
  transition: opacity 300ms ease-out, filter 300ms ease-out;
}
.pack-crimp {
  position: absolute;
  left: 0;
  right: 0;
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--pack) 70%, #16213d) 0 2px, var(--pack) 2px 5px);
}
.pack-crimp-top { top: 0; height: 8.5%; border-radius: 2px 2px 0 0; }
.pack-crimp-bottom { bottom: 0; height: 6%; border-radius: 0 0 2px 2px; }
.pack-perf { position: absolute; top: 5cqi; left: 5cqi; right: 5cqi; border-top: 2px dashed rgba(255, 255, 255, .8); }
.pack-hint { position: absolute; top: 7.5cqi; right: 6cqi; color: rgba(255, 255, 255, .92); font-size: 7.6cqi; font-weight: 700; }
.pack-brand { font-size: 12cqi; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.pack-label { display: flex; flex-direction: column; gap: 2cqi; margin-top: auto; padding: 7cqi 7cqi 6cqi; border-radius: 2px; background: #fff; color: var(--ink); }
.pack-name { font-size: 10.5cqi; font-weight: 700; line-height: 1.12; }
.pack-number { color: var(--ink-muted); font-size: 8.5cqi; }
@container (max-width: 110px) {
  .pack-hint { display: none; }
  .pack-name { font-size: max(9px, 11cqi); }
  .pack-number { font-size: max(8px, 9cqi); }
  .pack-brand { font-size: max(9px, 12cqi); }
}

/* Opened pack: torn top, spent colour. */
.strip:not([data-phase="sealed"]):not(.is-tearing) .pack-crimp-top { visibility: hidden; }
.strip:not([data-phase="sealed"]):not(.is-tearing) .pack-perf,
.strip:not([data-phase="sealed"]):not(.is-tearing) .pack-hint { visibility: hidden; }
.strip:not([data-phase="sealed"]):not(.is-tearing) .pack-body {
  clip-path: polygon(0 3%, 8% 0, 16% 2.6%, 25% .4%, 33% 3.2%, 41% .8%, 50% 3%, 58% 0, 67% 2.8%, 75% .6%, 83% 3.2%, 92% .4%, 100% 2.6%, 100% 100%, 0 100%);
  opacity: .5;
  filter: saturate(.7);
}
.is-tearing .pack-crimp-top { transform-origin: 100% 100%; animation: tear-off var(--tear-ms, 420ms) cubic-bezier(.35, .1, .5, 1) forwards; }
.is-tearing .pack-body { animation: tug var(--tear-ms, 420ms) ease-out; }
.is-tearing .slot-card { visibility: hidden; }
@keyframes tear-off {
  0% { transform: none; }
  30% { transform: translate(1px, -2px) rotate(2deg); }
  100% { transform: translate(30%, -150%) rotate(16deg); opacity: 0; }
}
@keyframes tug {
  0%, 100% { transform: none; }
  25% { transform: translateY(-2px) rotate(-.6deg); }
  45% { transform: translateY(1px) rotate(.4deg); }
}

/* Slots */
.slot {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 5 / 7;
  padding: 0;
  border: 0;
  border-radius: var(--radius-card);
  background: none;
  cursor: pointer;
}
.slot::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px dashed var(--grid-strong);
  border-radius: inherit;
}
.slot:not([data-state="empty"])::before { display: none; }
.slot[data-state="empty"] { cursor: default; }
.slot[aria-disabled="true"] { cursor: progress; }
.slot-card { position: absolute; inset: 0; perspective: 700px; container-type: inline-size; transition: transform 160ms ease-out; }
.slot[data-state="back"]:hover .slot-card { transform: translateY(-3px); }
.slot[data-state="empty"] .flip { visibility: hidden; }
.flip {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform var(--flip-ms, 360ms) cubic-bezier(.3, .7, .3, 1) var(--charge, 0ms);
}
.slot.is-revealed .flip { transform: rotateY(180deg); }
.back, .face { position: absolute; inset: 0; border-radius: var(--radius-card); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face { transform: rotateY(180deg); }
.face > .card { height: 100%; }
.back {
  border: max(3px, 3.4cqi) solid var(--card-stock);
  background-color: var(--cobalt);
  background-image:
    linear-gradient(rgba(255, 255, 255, .14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .14) 1px, transparent 1px);
  background-size: 9px 9px;
  background-position: -1px -1px;
  box-shadow: var(--shadow-card);
}
.back-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 36cqi;
  height: 36cqi;
  padding-bottom: 2cqi;
  border-radius: 50%;
  background: #fff;
  color: var(--cobalt);
  font-size: 24cqi;
  font-weight: 800;
  line-height: 1;
  transform: translate(-50%, -50%);
}
/* Rare and Legendary cards show their colour at the edge before they turn. */
.slot.is-charging .back { animation: charge var(--charge, 300ms) ease-in forwards; }
.slot.is-charging[data-rank="2"] .slot-card { animation: shiver 90ms linear infinite; }
@keyframes charge {
  from { box-shadow: 0 0 0 0 var(--rarity); }
  to { box-shadow: 0 0 0 5px var(--rarity), 0 0 18px 4px var(--rarity); }
}
@keyframes shiver {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-1px) rotate(-.4deg); }
  75% { transform: translateX(1px) rotate(.4deg); }
}

.slot-tag { display: block; min-height: 22px; margin-top: 7px; font-size: var(--text-s); font-weight: 700; line-height: 1.3; }
.slot-tag.is-duplicate { color: var(--pen); }
.slot-cell:has(.is-charging) .slot-tag { visibility: hidden; }
.hl, .recent-tag.is-new {
  padding: 0 .35em .05em;
  background:
    repeating-linear-gradient(180deg, transparent 0 3px, rgba(255, 255, 255, .25) 3px 4px),
    var(--highlighter);
  border-radius: 2px 5px 3px 6px;
  color: var(--ink);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---------- Card face ---------- */

.card-holder { container-type: inline-size; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3.4cqi;
  height: 100%;
  padding: 5cqi 5cqi 4.4cqi;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--card-stock);
  box-shadow: var(--shadow-card);
  color: var(--ink);
  font-size: 7.4cqi;
  line-height: 1.2;
  text-align: left;
}
.card-art { display: block; flex: 1 1 auto; min-height: 0; padding: 1.8cqi; border-radius: 2px; background: var(--rarity); }
.card-art img { width: 100%; height: 100%; border-radius: 1px; background: var(--card-stock); }
.card-name { display: -webkit-box; overflow: hidden; font-size: 1.16em; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-meta { display: flex; justify-content: space-between; gap: 4px; color: var(--ink-muted); font-size: .86em; }
@container (max-width: 110px) {
  .card { gap: 4cqi; padding: 5cqi; }
  .card-name { font-size: max(9px, 10cqi); -webkit-line-clamp: 2; }
  .card-meta { display: none; }
}

.flyer { position: fixed; z-index: 60; margin: 0; border-radius: var(--radius-card); pointer-events: none; transform-origin: 0 0; will-change: transform; }
.flyer .card { height: 100%; }

/* ---------- Binder sheet ---------- */

.binder {
  position: relative;
  margin-top: 30px;
  padding: 24px 30px 30px 76px;
  border-radius: var(--radius-sheet);
  background:
    linear-gradient(90deg, var(--sheet) 0 56px, var(--grid-strong) 56px 57px, transparent 57px),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 -1px / var(--grid-step) var(--grid-step),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) -1px 0 / var(--grid-step) var(--grid-step),
    var(--sheet);
  box-shadow: var(--shadow-sheet);
}
.rings { position: absolute; top: 0; bottom: 0; left: 18px; display: flex; flex-direction: column; justify-content: space-evenly; }
.rings span { display: block; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); box-shadow: inset 1px 2px 3px rgba(22, 33, 61, .32), 0 0 0 1px rgba(22, 33, 61, .07); }

.binder-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 232px);
  grid-template-areas: "head recent" "pockets recent";
  gap: 18px 32px;
  align-items: start;
}
.binder-head { grid-area: head; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; }
.binder-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -.015em; }
.progress-label { color: var(--ink); font-size: var(--text-m); }
.progress-label strong { font-weight: 700; }
.note { order: 2; margin-left: auto; color: var(--ink-muted); font-size: var(--text-s); }
.bar { position: relative; display: block; height: 4px; overflow: hidden; border-radius: 2px; background: var(--grid); }
.bar-large { order: 3; flex-basis: 100%; height: 5px; background: var(--bar-track); box-shadow: inset 0 0 0 1px var(--grid-strong); }
.bar-fill { position: absolute; inset: 0 auto 0 0; width: 0; min-width: 0; background: var(--cobalt); transition: width 400ms ease-out; }

.pockets { grid-area: pockets; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 18px; }
.pocket { min-width: 0; padding-top: 17px; }
.sleeve {
  position: relative;
  aspect-ratio: 5 / 7;
  border: 1px solid var(--pvc-edge);
  border-radius: var(--radius-sleeve);
  background: var(--pvc);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7), 0 1px 0 rgba(22, 33, 61, .05);
  container-type: inline-size;
}
/* The pocket opening near the top edge. */
.sleeve::before {
  content: "";
  position: absolute;
  z-index: 4;
  top: 4%;
  left: 3%;
  right: 3%;
  height: 1px;
  background: var(--pocket-slit);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .95);
  pointer-events: none;
}
/* PVC gloss: a material highlight, not decoration. */
.sleeve::after {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(118deg, transparent 0 27%, var(--pvc-gloss) 33%, transparent 39%, transparent 43%, rgba(255, 255, 255, .38) 45%, transparent 48%);
  pointer-events: none;
}
.pocket-card { position: absolute; inset: 7% 5.5% 4.5%; }
.pocket[data-state="empty"] .pocket-card { visibility: hidden; }
.pocket-card .card { box-shadow: 0 1px 1px rgba(22, 33, 61, .18); }

.pocket-empty {
  position: absolute;
  inset: 7% 5.5% 4.5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4cqi;
  border: 1px dashed var(--grid-strong);
  border-radius: var(--radius-card);
  color: var(--ink-faint);
}
.pocket-serial { position: absolute; top: 6cqi; left: 7cqi; color: var(--ink-muted); font-size: max(12px, 11cqi); font-weight: 700; }
.silhouette { width: 40cqi; fill: var(--grid-strong); }
.pocket-hint { font-size: max(11px, 8.4cqi); }

.pocket-tab {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 8%;
  padding: 1px 7px 1px;
  border-radius: 3px 3px 0 0;
  background: var(--rarity);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 15px;
  transform: translateY(-100%);
}

/* The highlighter stamp: hand-applied, slightly crooked, multiplied onto the sleeve. */
.stamp {
  position: absolute;
  z-index: 6;
  top: 49%;
  left: -4%;
  padding: .06em .5em .14em .42em;
  border-radius: 3px 11px 4px 9px / 10px 4px 11px 3px;
  background:
    repeating-linear-gradient(178deg, transparent 0 3px, rgba(255, 255, 255, .24) 3px 4px),
    linear-gradient(90deg, var(--highlighter-deep) 0 7%, transparent 7% 91%, var(--highlighter-deep) 91%),
    var(--highlighter);
  color: var(--ink);
  font-size: max(14px, 13cqi);
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.15;
  transform: rotate(-7deg);
  mix-blend-mode: multiply;
}
.pocket.is-stamping .stamp { animation: swipe 380ms cubic-bezier(.55, 0, .25, 1) 80ms backwards; }
@keyframes swipe {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

/* Red pen: the duplicate count. */
.pen {
  position: absolute;
  z-index: 6;
  top: -7%;
  right: -9%;
  display: grid;
  place-items: center;
  width: 46cqi;
  height: 32cqi;
  color: var(--pen);
  transform: rotate(7deg);
}
.pen-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: none; stroke: var(--pen); stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; }
.pen-text { position: relative; font-size: max(17px, 15cqi); font-style: italic; font-weight: 800; letter-spacing: -.02em; line-height: 1; text-shadow: 0 0 2px #fff, 0 0 3px #fff, 0 0 5px #fff; }
.pocket.is-counting .pen-ring { animation: draw 460ms ease-out 140ms backwards; }
.pocket.is-counting .pen-text { animation: scrawl 240ms ease-out backwards; }
@keyframes draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes scrawl { from { opacity: 0; transform: scale(1.4) rotate(-8deg); } }

.pocket.is-landing .sleeve { animation: settle 360ms ease-out; }
@keyframes settle {
  0% { transform: scale(.97); }
  55% { transform: scale(1.012); }
  100% { transform: none; }
}
/* The destination pocket opens up while a card is on its way. */
.pocket.is-receiving .sleeve { border-color: var(--cobalt); box-shadow: inset 0 0 0 1px var(--cobalt); }
.pocket.is-receiving .pocket-empty { border-color: var(--receiving-edge); }
.pocket.is-receiving .silhouette { fill: var(--receiving-silhouette); }
.pocket.is-flash .sleeve { outline: 3px solid var(--highlighter-deep); outline-offset: 4px; }

.pocket-meta { display: flex; flex-wrap: wrap; gap: 0 8px; min-height: 20px; margin-top: 8px; font-size: var(--text-s); line-height: 1.35; }
.dup-label { color: var(--pen); font-weight: 700; }
.trade-link { padding: 0; border: 0; background: none; color: var(--cobalt); font-size: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.trade-link:hover { color: var(--cobalt-deep); }

.pocket-rest .sleeve {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 12%;
  border: 1.5px dashed var(--grid-strong);
  background: rgba(255, 255, 255, .55);
  box-shadow: none;
}
.pocket-rest .sleeve::before, .pocket-rest .sleeve::after { display: none; }
.rest-count { color: var(--cobalt); font-size: 26cqi; font-weight: 800; letter-spacing: -.04em; line-height: .95; }
.rest-label { font-size: max(13px, 10.5cqi); font-weight: 700; line-height: 1.2; }
.rest-total { color: var(--ink-muted); font-size: max(12px, 8.4cqi); line-height: 1.3; }

/* Recently added */
.recent { grid-area: recent; }
.recent h3 { margin-bottom: 8px; font-size: var(--text-m); font-weight: 700; }
.recent-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--grid-strong);
}
.recent-thumb { display: block; width: 36px; height: 36px; padding: 2px; border-radius: 3px; background: var(--rarity); }
.recent-thumb img { width: 100%; height: 100%; border-radius: 1px; background: var(--card-stock); }
.recent-text { min-width: 0; line-height: 1.25; }
.recent-text strong { display: block; overflow: hidden; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
.recent-text span { display: block; overflow: hidden; color: var(--ink-muted); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }
.recent-tag { font-size: 12.5px; font-weight: 700; }
.recent-tag.is-duplicate { color: var(--pen); font-size: 15px; font-style: italic; font-weight: 800; }
.recent-empty { max-width: 30ch; color: var(--ink-muted); font-size: var(--text-s); }

/* ---------- Toast (created by Kit) ---------- */

.toast {
  position: fixed;
  z-index: 70;
  bottom: 24px;
  left: calc(var(--sidebar-width) + 24px);
  max-width: min(440px, calc(100vw - 32px));
  padding: 11px 15px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 12px 26px -14px rgba(22, 33, 61, .7);
}

.scrim { display: none; }

/* ---------- Mid widths: recent list moves under the pockets ---------- */

@media (min-width: 900px) and (max-width: 1199px) {
  :root { --card-w: clamp(110px, 12vw, 142px); }
  .strip-side { display: flex; flex-basis: 100%; align-items: center; gap: 24px; max-width: none; }
  .status { flex: 1 1 auto; min-height: 0; max-width: 52ch; }
  .actions { flex: none; margin-top: 0; }
}

@media (max-width: 1199px) {
  .binder-body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "pockets" "recent"; }
  .recent { max-width: 460px; }
}

/* ---------- Phones and tablets: the cover becomes a top bar ---------- */

@media (max-width: 899px) {
  :root { --card-w: auto; }
  .app { display: block; }

  .cover {
    position: relative;
    height: auto;
    display: block;
    overflow: visible;
    padding: 0;
    background: var(--cobalt);
  }
  .cover-top { flex-direction: row; align-items: center; gap: 6px; padding: 10px 16px 10px; }
  .wordmark { margin-right: auto; padding: 0; font-size: 23px; }
  .toggles { flex-wrap: nowrap; }
  .toggle { justify-content: center; width: 40px; height: 40px; padding: 0; border-radius: 50%; }
  .toggle-icon { width: 18px; height: 18px; }
  .toggle [data-label] {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .menu-button, .sheet-close {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 15px;
    border: 1px solid rgba(255, 255, 255, .6);
    border-radius: 999px;
    background: transparent;
    color: var(--on-cobalt);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
  }
  .menu-button { margin-left: 4px; }

  .nav-sheet {
    position: fixed;
    z-index: 50;
    top: 0;
    left: 0;
    right: 0;
    max-height: 100dvh;
    overflow-y: auto;
    padding: 16px 16px 18px;
    background: var(--cobalt);
    box-shadow: 0 24px 40px -24px rgba(8, 20, 70, .8);
    visibility: hidden;
    transform: translateY(-102%);
    transition: transform 260ms cubic-bezier(.3, .7, .3, 1), visibility 0s linear 260ms;
  }
  .nav-sheet.is-open { visibility: visible; transform: none; transition: transform 260ms cubic-bezier(.3, .7, .3, 1); }
  .section-nav { grid-template-columns: 1fr 1fr; gap: 4px 8px; }
  .section-nav a, .section-nav button { padding: 11px 12px; font-size: var(--text-m); }
  .nav-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding: 12px 0 0; }
  .variants-link { padding: 8px 12px; }
  .scrim { position: fixed; z-index: 45; inset: 0; display: block; background: var(--scrim); }

  .boosters { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 12px; scrollbar-width: none; }
  .boosters::-webkit-scrollbar { display: none; }
  .boosters h2 {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .booster-list { display: flex; flex: none; gap: 8px; }
  .booster-list li { flex: none; }
  .booster { grid-template-areas: "swatch name" "swatch status"; grid-template-columns: 22px minmax(0, 1fr); column-gap: 9px; width: 162px; padding: 8px; background: rgba(255, 255, 255, .1); }
  .booster-name { font-size: 13.5px; }
  .booster-number { display: none; }
  .booster-status { text-align: left; }
  .open-all { flex: none; width: auto; margin: 0; padding: 0 14px; white-space: nowrap; }

  .desk { max-width: none; padding: 16px 16px calc(var(--dock-height) + 28px); }
  .strip-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 1px; margin-bottom: 12px; }
  .strip-head h1 { font-size: 21px; }
  .pack-no { grid-row: 2; font-size: var(--text-s); }
  .gift { grid-column: 2; grid-row: 1 / span 2; align-self: center; margin: 0; }

  .strip-row { display: block; }
  .strip-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 640px; }
  .pack { width: 100%; }
  .slots { display: grid; grid-column: span 3; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .slot-cell { width: auto; min-width: 0; }
  .slot-tag { min-height: 18px; margin-top: 5px; font-size: var(--text-xs); }
  .strip-side { max-width: 640px; margin-top: 6px; }
  .status { min-height: 0; font-size: 14.5px; }

  /* The dock: progress and the one next action, in the thumb zone. */
  .actions {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: var(--dock-height);
    margin: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--rule);
    background: var(--dock);
  }
  .dock-progress { display: grid; flex: 1 1 auto; gap: 6px; min-width: 56px; }
  .dock-count { color: var(--ink-muted); font-size: var(--text-s); white-space: nowrap; }
  .dock-count strong { color: var(--ink); font-size: var(--text-m); }
  .dock-progress.is-bumped .dock-count strong { display: inline-block; animation: bump 420ms ease-out; }
  @keyframes bump { 40% { transform: scale(1.35); color: var(--cobalt); } }
  .action-buttons { flex: none; flex-wrap: nowrap; }
  .button { min-height: 46px; padding: 8px 15px; font-size: var(--text-m); }

  .binder { margin-top: 22px; padding: 18px 16px 22px 50px; background:
    linear-gradient(90deg, var(--sheet) 0 36px, var(--grid-strong) 36px 37px, transparent 37px),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 -1px / var(--grid-step) var(--grid-step),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) -1px 0 / var(--grid-step) var(--grid-step),
    var(--sheet); }
  .rings { left: 11px; }
  .binder { box-shadow: 3px 3px 0 -1px #fff, 3px 3px 0 0 var(--grid-strong), 6px 6px 0 -1px #fff, 6px 6px 0 0 var(--grid-strong); margin-right: 6px; }
  .rings span { width: 15px; height: 15px; }
  .binder-head h2 { font-size: 18px; }
  .note { flex-basis: 100%; order: 3; margin-left: 0; }

  .toast { left: 16px; right: 16px; bottom: calc(var(--dock-height) + 12px); max-width: none; }
}

@media (min-width: 600px) and (max-width: 899px) {
  .strip-cards, .slots { gap: 14px; }
}

@media (max-width: 599px) {
  .pockets { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
  .button { padding: 8px 13px; }
}
