/* The binder page (js/pages/binder.js): a leather ring binder of 3×3 plastic
   sleeve pages that turn in 3D, the card viewer a card slides out into, and
   the collection laid out by game and set underneath. Original artwork. */

.binder-page { max-width: 1280px; }
.binder-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 30px; margin-bottom: 10px; }
.binder-head h1 { font-family: var(--display); font-size: clamp(1.9rem, 3.6vw, 2.8rem); line-height: 1.02; letter-spacing: -0.02em; margin: 0 0 0.25em; }
.binder-head .lede { margin: 0; max-width: 58ch; }
.binder-banner { margin: 6px 0 0; padding: 10px 16px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); font-weight: 600; }
.plus-chip { display: inline-grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: 50%; background: rgba(12, 10, 24, 0.8); border: 1.5px solid rgba(255, 255, 255, 0.75); line-height: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- stage */
.binder-stage { display: grid; justify-items: center; gap: 6px; margin-top: 8px; }
.book-frame { position: relative; width: 100%; display: grid; justify-items: center; outline: none; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.book-frame:focus-visible .book { outline: 2px solid var(--accent); outline-offset: 10px; border-radius: 20px; }
/* Clips sideways only (a turning page can swing past the edge), and reaches into the page margin so the book's shadow fades out instead of ending in a hard-edged box. */
.book-clip { width: calc(100% + 32px); min-width: 0; margin-inline: -16px; display: grid; justify-items: center; padding: 20px 16px 30px; overflow: hidden; overflow: clip visible; }
.book { position: relative; width: calc(var(--pw, 300px) * 2); height: var(--ph, 400px); }
.book.is-single { width: var(--pw, 300px); }
.book::before { content: ""; position: absolute; left: 4%; right: 4%; bottom: -26px; height: 40px; border-radius: 50%; background: rgba(0, 0, 0, 0.55); filter: blur(18px); transition: transform 0.7s var(--ease); }
.book-inner, .rings { position: absolute; inset: 0; transition: transform 0.7s var(--ease), opacity 0.4s; }
.book.is-double.is-closed .book-inner, .book.is-double.is-closed::before { transform: translateX(calc(var(--pw) * -0.5)); }
.book.is-double.is-closed::before { left: 54%; right: 4%; }

/* A leaf: one sheet with a page on each side, hinged on the rings. */
.leaf { position: absolute; top: 0; left: 50%; width: 50%; height: 100%; transform-origin: left center; transform: perspective(2600px) rotateY(0deg); transform-style: preserve-3d; transition: transform var(--turn, 780ms) cubic-bezier(0.45, 0.05, 0.2, 1); }
.book.is-single .leaf { left: 0; width: 100%; }
.leaf.is-turned { transform: perspective(2600px) rotateY(-180deg); }
.leaf.no-anim { transition: none; }
.book.is-single .leaf.is-turned:not(.is-turning) { visibility: hidden; }
.face { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.face.back { transform: rotateY(180deg); }
/* Only the side of each leaf that faces you takes clicks; otherwise the hidden side of a
   turned leaf can catch the pointer over the other page. A leaf in mid-turn takes none. */
.leaf.is-turned > .face.front, .leaf:not(.is-turned) > .face.back, .leaf.is-turning > .face { pointer-events: none; }
.face::after { content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: 0; border-radius: inherit; background: linear-gradient(90deg, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.08) 35%, rgba(255, 255, 255, 0.1) 62%, rgba(0, 0, 0, 0.12)); }
.leaf.is-turning .face::after { animation: page-shade var(--turn, 780ms) ease-in-out; }
@keyframes page-shade { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }

/* The inside of the back cover, under the last page. */
.board { position: absolute; top: 0; left: 50%; width: 50%; height: 100%; border-radius: 4px 16px 16px 4px; background: radial-gradient(130% 90% at 80% 10%, #3a2f5c, #1b1630 70%); box-shadow: inset 10px 0 18px rgba(0, 0, 0, 0.45), 0 26px 50px rgba(0, 0, 0, 0.45); }

/* Rings down the spine. */
.rings { z-index: 900; pointer-events: none; }
/* Three rings (pages/binder.js RING): each an SVG metal tube in two halves
   whose toothed ends interlock in the gutter, over a riveted spine plate. */
.rings { --rw: calc(var(--pw, 440px) * 0.15); --rh: calc(var(--rw) * 0.3611); }
.rings-plate { position: absolute; left: calc(50% - var(--rw) * 0.09); width: calc(var(--rw) * 0.18); top: 9%; bottom: 9%; border-radius: 5px; background: linear-gradient(90deg, #22252c, #6f7583 25%, #b7bcc7 45%, #7b8190 62%, #3a3e47 85%, #1d2026); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 4px 10px rgba(0, 0, 0, 0.5); }
.rings-plate::before, .rings-plate::after { content: ""; position: absolute; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #8c92a0 55%, #3b3f48); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.6); }
.rings-plate::before { top: 4%; }
.rings-plate::after { bottom: 4%; }
.ring-slot { position: absolute; left: calc(50% - var(--rw) / 2); width: var(--rw); height: var(--rh); filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 1px rgba(0, 0, 0, 0.5)); }
.ring-slot.r1 { top: calc(17% - var(--rh) / 2); }
.ring-slot.r2 { top: calc(50% - var(--rh) / 2); }
.ring-slot.r3 { top: calc(83% - var(--rh) / 2); }
.ring { display: block; width: 100%; height: 100%; overflow: visible; }
.ring-hole { fill: #050409; }
.ring-tube { fill: url(#ring-metal); stroke: rgba(20, 22, 28, 0.75); stroke-width: 0.5; stroke-linejoin: round; }
.ring-shine { fill: none; stroke: rgba(255, 255, 255, 0.85); stroke-width: 0.9; stroke-linecap: round; }
.ring-seam { fill: none; stroke: #23262e; stroke-width: 0.75; stroke-linejoin: miter; }
/* The far edge of each punched hole, drawn over the tube end so the ring threads through it. */
.ring-lip { fill: none; stroke: rgba(255, 255, 255, 0.34); stroke-width: 1.1; stroke-linecap: round; }
.ring-hole { stroke: rgba(0, 0, 0, 0.6); stroke-width: 0.6; }
.ring-l, .ring-r { transform-box: fill-box; transition: transform 0.36s cubic-bezier(0.3, 0.7, 0.2, 1.15); }
.ring-l { transform-origin: 0% 50%; }
.ring-r { transform-origin: 100% 50%; }
/* Rings open (Add page): the halves pull apart sideways at the teeth, the left half
   to the left and the right half to the right, staying level in their holes. */
.book.rings-open .ring-l { transform: translateX(-12%) scaleX(0.8); }
.book.rings-open .ring-r { transform: translateX(12%) scaleX(0.8); }
.book.rings-open .ring-slot { filter: drop-shadow(0 7px 5px rgba(0, 0, 0, 0.5)); }
.book.is-single .rings-plate { left: calc(var(--rw) * -0.09); }
.book.is-single .ring-slot { left: calc(var(--rw) / -2); }
.book.is-closed .rings { opacity: 0; }

/* ---------------------------------------------------------------- the cover */
.cover { position: absolute; inset: 0; border-radius: 10px; overflow: hidden; cursor: pointer;
  background-color: #4f2512;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .12 0 0 0 0 .06 0 0 0 0 .02 0 0 0 .5 0'/%3E%3C/filter%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.018' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .08 0 0 0 0 .03 0 0 0 0 0 0 0 0 -1.6 1.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"), radial-gradient(60% 45% at 32% 26%, rgba(255, 196, 132, 0.2), transparent 70%), radial-gradient(130% 100% at 50% 45%, #6e3820, #4b2210 60%, #260f05);
  box-shadow: inset 0 0 0 1px rgba(255, 220, 170, 0.08), inset 0 0 38px rgba(20, 8, 0, 0.75), inset 16px 0 22px rgba(0, 0, 0, 0.55), 0 30px 60px rgba(0, 0, 0, 0.5); }
/* Shading along the spine and a thin rolled edge. */
.cover::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: linear-gradient(90deg, rgba(0, 0, 0, 0.3), transparent 6%, transparent 95%, rgba(196, 140, 88, 0.14)), linear-gradient(transparent 96%, rgba(196, 140, 88, 0.1)); box-shadow: inset 0 0 0 1.5px rgba(30, 12, 2, 0.7), inset 0 0 0 3px rgba(196, 140, 88, 0.12); }
.cover-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.cover-art text { font-family: "Cinzel", "Times New Roman", serif; font-weight: 700; font-size: 10px; letter-spacing: 0.07em; }
.cv-stitch { stroke: #c9a46a; stroke-width: 1.1; stroke-dasharray: 3.4 2.6; stroke-linecap: round; opacity: 0.55; }
.cover-open { position: absolute; left: 50%; bottom: 4.5%; transform: translateX(-50%); padding: 7px 16px; border-radius: 999px; border: 1px solid rgba(232, 200, 122, 0.5); background: rgba(30, 14, 4, 0.55); color: #f1d796; font: inherit; font-size: 0.8rem; font-weight: 800; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255, 230, 180, 0.15), 0 2px 6px rgba(0, 0, 0, 0.4); }
.cover-open:hover { background: rgba(30, 14, 4, 0.75); }
.nameplate-row i, .shelf-jump i, .shelf-game h3 i { width: 9px; height: 9px; border-radius: 3px; transform: rotate(45deg); background: var(--gc); flex: none; }
.inside { position: absolute; inset: 0; border-radius: 16px 4px 4px 16px; display: grid; align-content: center; justify-items: center; gap: 14px; padding: 10%; background: radial-gradient(130% 90% at 20% 10%, #3a2f5c, #1b1630 70%); box-shadow: inset -10px 0 18px rgba(0, 0, 0, 0.45), 0 26px 50px rgba(0, 0, 0, 0.45); }
.book.is-single .inside { border-radius: 6px 16px 16px 6px; }
/* While the binder is shut, everything under the cover gets the same corners so nothing dark peeks out. */
.book.is-closed :is(.board, .face, .bpage, .inside) { border-radius: 10px; }
.nameplate { width: 100%; max-width: 330px; padding: 18px 20px; border-radius: 12px; background: linear-gradient(160deg, #fbf3dd, #e9dcb8); color: #2a2140; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.6); }
.nameplate .kicker { color: #8a6420; margin-bottom: 2px; }
.nameplate .quiet { color: #6b5f80; margin: 0; }
.nameplate-name { margin: 0 0 10px; font-family: var(--display); font-weight: 800; font-size: 1.4rem; border-bottom: 1px solid rgba(42, 33, 64, 0.2); padding-bottom: 6px; overflow-wrap: anywhere; }
.nameplate-row { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; font-size: 0.86rem; }
.nameplate-row b { flex: 1; }
.nameplate-row span { color: #5b5070; white-space: nowrap; }
.inside-hint { margin: 0; color: rgba(255, 240, 210, 0.7); font-size: 0.86rem; font-weight: 600; }

/* ---------------------------------------------------------------- pages and sleeves */
.bpage { position: absolute; inset: 0; padding: 6% 6% 8% 10%; border-radius: 4px 14px 14px 4px; background: radial-gradient(120% 70% at 35% 0%, color-mix(in srgb, var(--gc, #777) 12%, #25222f), #131219 75%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 6px 0 12px rgba(0, 0, 0, 0.5), 0 26px 50px rgba(0, 0, 0, 0.45); }
.bpage.is-left { padding: 6% 10% 8% 6%; border-radius: 14px 4px 4px 14px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset -6px 0 12px rgba(0, 0, 0, 0.5), 0 26px 50px rgba(0, 0, 0, 0.45); }
.bpage.is-blank { background: radial-gradient(120% 70% at 35% 0%, #22202b, #131219 75%); }
/* Punched holes along the spine edge. */
/* Each sits right under a ring end (pages/binder.js RING: hole at 5/72 of the ring width
   from the spine, 17%, 50% and 83% down), so the page threads onto its rings. */
.bpage::before { content: ""; position: absolute; top: 0; bottom: 0; left: calc(var(--pw, 440px) * 0.15 * (25 / 72)); width: calc(var(--pw, 440px) * 0.15 * (12 / 72)); pointer-events: none; --hole: calc(var(--pw, 440px) * 0.15 * 0.3611 * (7.2 / 26)); background: radial-gradient(closest-side, #050409 82%, rgba(255, 255, 255, 0.3) 88%, transparent 100%) 0 calc(var(--ph, 400px) * 0.17 - var(--hole)) / 100% calc(var(--hole) * 2) no-repeat, radial-gradient(closest-side, #050409 82%, rgba(255, 255, 255, 0.3) 88%, transparent 100%) 0 calc(var(--ph, 400px) * 0.5 - var(--hole)) / 100% calc(var(--hole) * 2) no-repeat, radial-gradient(closest-side, #050409 82%, rgba(255, 255, 255, 0.3) 88%, transparent 100%) 0 calc(var(--ph, 400px) * 0.83 - var(--hole)) / 100% calc(var(--hole) * 2) no-repeat; }
.bpage.is-left::before { left: auto; right: calc(var(--pw, 440px) * 0.15 * (25 / 72)); }
.bpage-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 2.6%; height: 100%; }
.bpage-foot { position: absolute; left: 0; right: 0; bottom: 2%; margin: 0; text-align: center; font-size: clamp(0.62rem, calc(var(--pw) * 0.024), 0.78rem); font-weight: 700; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.45); }
.bpage-foot span { color: color-mix(in srgb, var(--gc) 75%, white); }

.pocket { position: relative; display: block; padding: 0; border: 0; border-radius: 5px; background: rgba(255, 255, 255, 0.04); cursor: pointer; font: inherit; color: inherit; }
.pocket.is-empty { cursor: default; background: rgba(255, 255, 255, 0.025); }
.pocket.is-picked { z-index: 6; }
/* The plastic: a soft sheen over the card, and the open top edge. */
.pocket::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: 5px; background: linear-gradient(115deg, rgba(255, 255, 255, 0.17) 0%, rgba(255, 255, 255, 0.05) 20%, transparent 38%, transparent 68%, rgba(255, 255, 255, 0.08) 84%, transparent); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13), inset 0 -2px 4px rgba(0, 0, 0, 0.25); }
.pocket::before { content: ""; position: absolute; left: 3%; right: 3%; top: 6%; height: 1.5px; z-index: 3; pointer-events: none; border-radius: 2px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35) 15%, rgba(255, 255, 255, 0.35) 85%, transparent); }
.pocket-card { position: absolute; left: 5.5%; right: 5.5%; top: 4%; bottom: 3%; z-index: 1; overflow: hidden; border-radius: 5% / 3.6%; background: #0d0c12; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55); transition: transform 0.32s var(--ease), box-shadow 0.32s; }
.pocket-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pocket-card i { display: grid; place-items: center; height: 100%; padding: 8%; font-style: normal; font-size: 0.66rem; font-weight: 700; text-align: center; color: rgba(255, 255, 255, 0.7); }
.pocket-card.is-landscape img { position: absolute; left: -20%; top: 14.3%; width: 140%; height: 71.4%; transform: rotate(90deg); }
.pocket[data-k]:hover .pocket-card, .pocket[data-k]:focus-visible .pocket-card { transform: translateY(-6%); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5); }
.pocket[data-k]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pocket-card.is-out { transform: translateY(-48%) !important; box-shadow: 0 18px 30px rgba(0, 0, 0, 0.55); }
/* Holo cards shimmer in their sleeves only when the pointer is on them: a soft
   rainbow sheen that drifts, and a bright band of light that crosses the card.
   At rest the card is left clean (no stripes sliding across the page). */
.pocket-card[data-foil]::after, .pocket-card[data-foil]::before { content: ""; position: absolute; top: 0; bottom: 0; left: -80%; width: 260%; pointer-events: none; z-index: 1; }
.pocket-card[data-foil]::after { mix-blend-mode: color-dodge; opacity: 0; transition: opacity 0.35s ease; filter: brightness(0.62) contrast(1.6) saturate(1.15); background: linear-gradient(112deg, hsl(2 100% 73%) 8%, hsl(53 100% 69%) 22%, hsl(93 100% 69%) 36%, hsl(176 100% 76%) 50%, hsl(228 100% 74%) 64%, hsl(283 100% 73%) 78%, hsl(2 100% 73%) 92%); }
.pocket-card[data-foil="gold"]::after { background: linear-gradient(112deg, #fff1b8 10%, #e3b04b 30%, #fff7d6 50%, #b98a2e 70%, #fff1b8 90%); }
.pocket-card[data-foil="etched"]::after { background: linear-gradient(112deg, #d9c7a0 10%, #8f7a52 35%, #f0e2c0 55%, #8f7a52 75%, #d9c7a0 90%); }
.pocket[data-k]:hover .pocket-card[data-foil]::after { opacity: 0.28; animation: pocket-holo 3.5s ease-in-out infinite alternate; }
.pocket[data-k]:hover .pocket-card[data-foil="etched"]::after { opacity: 0.22; }
.pocket-card[data-foil]::before { mix-blend-mode: screen; opacity: 0; background: linear-gradient(112deg, transparent 40%, rgba(255, 255, 255, 0.55) 48%, color-mix(in srgb, var(--tc) 50%, transparent) 52%, transparent 60%); transform: translateX(-30%); }
.pocket[data-k]:hover .pocket-card[data-foil]::before { opacity: 1; animation: pocket-glint 1.5s ease-in-out infinite; }
@keyframes pocket-holo { from { transform: translateX(-14%); } to { transform: translateX(20%); } }
@keyframes pocket-glint { from { transform: translateX(-30%); } to { transform: translateX(30%); } }

/* Divider tabs, one per game, standing out from the right edge. */
.book-tabs { position: absolute; z-index: 950; top: calc(20px + var(--ph) * 0.07); left: calc(50% + var(--pw)); display: grid; gap: 6px; transition: transform 0.7s var(--ease); }
.book-tabs button { writing-mode: vertical-rl; padding: 12px 6px; border: 0; border-radius: 0 10px 10px 0; background: var(--gc); color: var(--gi); font: inherit; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; cursor: pointer; box-shadow: 3px 4px 10px rgba(0, 0, 0, 0.35); transform: translateX(-3px); transition: transform 0.25s var(--ease); }
.book-tabs button:hover, .book-tabs button[aria-current="true"] { transform: translateX(2px); }
.book-frame.is-double:has(.book.is-closed) .book-tabs { transform: translateX(calc(var(--pw) * -0.5)); }
.book-frame.is-single .book-tabs { position: static; order: -1; display: flex; flex-wrap: wrap; justify-content: center; margin-bottom: -6px; transform: none; }
.book-frame.is-single .book-tabs button { writing-mode: horizontal-tb; padding: 6px 12px; border-radius: 999px; transform: none; }
.book-frame.is-single .book-tabs button[aria-current="true"] { outline: 2px solid #fff; outline-offset: 1px; }

.book-bar { display: flex; align-items: center; justify-content: center; gap: 14px; }
.book-bar .chip-btn:disabled { opacity: 0.4; pointer-events: none; }
.book-count { margin: 0; min-width: 12ch; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.book-reel { display: flex; justify-content: center; }
.book-help { margin: 0; font-size: 0.85rem; text-align: center; }

/* ---------------------------------------------------------------- empty */
.binder-empty { max-width: 640px; margin: 18px auto 0; padding: 24px; text-align: center; border-radius: 22px; background: var(--surface); border: 1px solid var(--edge); }
.binder-empty h2 { margin: 0 0 6px; font-family: var(--display); }
.binder-empty-games { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 18px 0; }
.binder-empty-games .game-btn { flex: 1 1 150px; max-width: 190px; }
.binder-page:not(.has-cards) .book-bar, .binder-page:not(.has-cards) .book-help { display: none; }

/* ---------------------------------------------------------------- the shelf */
.binder-shelf { margin-top: clamp(40px, 6vw, 72px); }
.shelf-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.shelf-head h2 { margin: 0; font-family: var(--display); font-size: clamp(1.4rem, 2.6vw, 2rem); }
.shelf-search input { width: min(320px, 70vw); padding: 10px 16px; border-radius: 999px; border: 1px solid var(--edge); background: var(--surface); color: inherit; font: inherit; }
.shelf-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.shelf-jump a { display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--edge); background: var(--surface); text-decoration: none; font-weight: 700; font-size: 0.88rem; }
.shelf-jump a b { color: var(--muted); font-weight: 700; }
.shelf-game { margin-top: 34px; scroll-margin-top: calc(var(--nav-h) + 20px); }
.shelf-game header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; padding-bottom: 8px; border-bottom: 2px solid color-mix(in srgb, var(--gc) 55%, transparent); }
.shelf-game h3 { display: flex; align-items: center; gap: 10px; margin: 0; font-family: var(--display); font-size: 1.3rem; }
.shelf-game h3 i { width: 12px; height: 12px; }
.shelf-game header p { margin: 0; color: var(--muted); }
.shelf-set { margin-top: 18px; }
.shelf-set h4 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 10px; font-size: 1rem; }
.shelf-set h4 a { text-decoration: none; }
.shelf-set h4 a:hover { text-decoration: underline; }
.shelf-set h4 em { font-style: normal; color: var(--muted); font-weight: 600; }
.shelf-set h4 span { padding: 1px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-size: 0.78rem; }
.shelf-grid { grid-template-columns: repeat(auto-fill, minmax(min(122px, 28vw), 1fr)); }
.shelf-grid .own-mark { display: none; }
.shelf-grid .card-meta strong { font-size: 0.8rem; }
.shelf-grid .card-meta em { font-size: 0.72rem; }

/* ---------------------------------------------------------------- the card viewer */
.bview { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: var(--ink); overflow: auto; }
.bview::backdrop { background: rgba(6, 5, 14, 0.66); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.bview[open] .bview-info { animation: bview-in 0.45s var(--ease) both; }
.bview-shell { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); align-items: center; gap: clamp(16px, 4vw, 56px); max-width: 1100px; margin: 0 auto; padding: 64px var(--gutter) 40px; }
.bview-stage { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.bview-card { position: relative; justify-self: center; margin: 0; width: min(100%, 400px, calc((100dvh - 150px) * 0.716)); aspect-ratio: 63 / 88; overflow: hidden; border-radius: 4.6% / 3.3%; transform: perspective(1200px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 70px color-mix(in srgb, var(--tc) 32%, transparent); }
.bview-card .card-img { width: 100%; height: 100%; }
/* Only a holo card gets a layer over its face: the foil drifts by itself and
   follows the pointer when it is on the card. A plain card shows just its art;
   its colour glows around the edge (the box-shadow above). */
.bview-card .card-img { position: relative; overflow: hidden; }
.bview-card[data-foil] .card-img::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2; transition: opacity 0.35s; }
.bview-card[data-foil] .card-img::before { opacity: 0.5; animation: bview-holo 6s ease-in-out infinite alternate; }
.bview-card[data-foil].is-lit .card-img::before { animation: none; opacity: calc(0.45 + var(--far, 0) * 0.25); }
@property --py { syntax: "<percentage>"; inherits: true; initial-value: 50%; }
@keyframes bview-holo { 0% { --px: 8%; --py: 18%; } 50% { --px: 92%; --py: 46%; } 100% { --px: 30%; --py: 92%; } }
.bview-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bview-card.is-landscape { aspect-ratio: 88 / 63; width: min(100%, 540px); }
.bview-card.is-swap { animation: bview-swap 0.4s var(--ease); }
@keyframes bview-swap { from { opacity: 0.2; transform: translateY(18px) scale(0.96); } }
@keyframes bview-in { from { opacity: 0; transform: translateY(14px); } }
.bview-nav { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--edge); background: var(--surface); color: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.bview-nav:hover, .bview-close:hover { border-color: var(--accent); }
.bview-close { position: fixed; top: 14px; right: 14px; z-index: 3; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--edge); background: var(--surface); color: inherit; font-size: 1.1rem; cursor: pointer; }
.bview-info { padding: 22px 24px; border-radius: 22px; background: var(--surface); border: 1px solid var(--edge); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.bview-game { margin: 0; }
.bview-game .game-tag { background: color-mix(in srgb, var(--gc) 24%, transparent); color: color-mix(in srgb, var(--gc) 40%, white); }
.bview-name { margin: 0.25em 0 0.1em; font-family: var(--display); font-size: clamp(1.5rem, 3vw, 2.2rem); line-height: 1.08; }
.bview-set { margin: 0 0 16px; color: var(--muted); font-weight: 600; }
.bview-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 20px; }
.bview-facts dt { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.bview-facts dd { margin: 2px 0 0; font-weight: 700; }
.bview-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 760px) {
  .bview-shell { grid-template-columns: minmax(0, 1fr); align-content: start; padding-top: 70px; }
  .bview-card { width: min(70vw, 330px, calc((100dvh - 330px) * 0.716)); }
  .bview-nav { width: 38px; height: 38px; }
  .book-clip { padding: 14px 16px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .leaf, .book-inner, .pocket-card { transition: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .pocket-card[data-foil]::after, .pocket-card[data-foil]::before, .bview-card .card-img::before, .bview-card .card-img::after { animation: none !important; }
}

/* ---------------------------------------------------------------- RealBinder / PlayBinder */
.binder-modes { display: inline-flex; gap: 4px; margin: 14px 0 6px; padding: 4px; border-radius: 18px; background: var(--surface); border: 1px solid var(--edge); }
.binder-modes[hidden] { display: none; }
.binder-modes button { display: grid; gap: 1px; padding: 9px 18px; border: 0; border-radius: 14px; background: none; color: var(--muted); text-align: left; cursor: pointer; transition: background 0.2s, color 0.2s; }
.binder-modes button b { font-family: var(--display); font-size: 1.02rem; color: var(--ink); letter-spacing: -0.01em; }
.binder-modes button small { font-size: 0.74rem; font-weight: 600; }
.binder-modes button:hover { background: var(--line); }
.binder-modes button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.binder-modes button[aria-selected="true"] b { color: var(--accent-ink); }
.binder-mode-note { margin: 0 0 6px; max-width: 78ch; color: var(--muted); font-size: 0.92rem; }
.binder-mode-note b { color: var(--ink); }
/* The PlayBinder wears deep blue leather so the two never get mixed up. */
.book-frame.is-play .cover { filter: hue-rotate(195deg) saturate(0.9) brightness(0.95); }
.pocket-copies { position: absolute; right: 6%; bottom: 5%; z-index: 3; padding: 1px 7px; border-radius: 999px; background: rgba(12, 10, 24, 0.85); border: 1px solid rgba(255, 255, 255, 0.6); color: #fff; font-size: 0.72rem; font-weight: 800; pointer-events: none; }
@media (max-width: 560px) { .binder-modes { display: flex; } .binder-modes button { flex: 1; padding: 8px 12px; } }

/* ---- Arranging your own binder: drag a card to another sleeve, add a page. */
.book-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.book-tools[hidden], .book-tools [hidden] { display: none; }
.book-tools [aria-pressed="true"] { border-color: var(--accent); }
.binder-page:not(.has-cards) .book-tools { display: none; }
.pocket[data-k] { -webkit-touch-callout: none; touch-action: pan-y; }
.pocket.is-pressing .pocket-card { transform: translateY(-4%) scale(0.97); transition-duration: 0.36s; }
.book-frame.is-dragging .pocket[data-k]:hover .pocket-card { transform: none; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55); }
.book-frame.is-dragging .pocket { cursor: grabbing; }
.pocket.is-source { background: rgba(255, 255, 255, 0.02); }
.pocket.is-target { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.pocket.is-target::after { box-shadow: inset 0 0 0 2px var(--accent), 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent); }
.pocket.is-target .pocket-card { transform: translateY(5%) scale(0.95); }
html.is-card-drag, html.is-card-drag * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
.drag-ghost { position: fixed; z-index: 3000; margin: 0; pointer-events: none; transform-origin: 0 0; will-change: transform; box-shadow: 0 22px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.18); transition: opacity 0.2s, filter 0.2s; }
.drag-ghost.is-lifting { animation: drag-lift 0.24s cubic-bezier(0.3, 0.7, 0.2, 1); }
@keyframes drag-lift { from { translate: 0 var(--lift, 0px); scale: 0.94; } }
.drag-ghost.is-over-tray { opacity: 0.55; filter: grayscale(0.7); }
/* Hold a card past the edge of the book to turn: a glow shows which way. */
.book-frame::before, .book-frame::after { content: ""; position: absolute; top: 8%; bottom: 8%; width: 54px; z-index: 950; pointer-events: none; opacity: 0; transition: opacity 0.2s; border-radius: 30px; }
.book-frame::before { left: -6px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, transparent), transparent); }
.book-frame::after { right: -6px; background: linear-gradient(270deg, color-mix(in srgb, var(--accent) 55%, transparent), transparent); }
.book-frame.is-dragging::before, .book-frame.is-dragging::after { opacity: 0.18; }
.book-frame.edge-prev::before, .book-frame.edge-next::after { opacity: 1; }
.drag-tray { position: fixed; left: 50%; bottom: 18px; z-index: 2900; display: flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 999px; background: rgba(14, 12, 22, 0.92); border: 1px dashed rgba(255, 255, 255, 0.4); color: #fff; font-weight: 700; font-size: 0.9rem; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5); transform: translate(-50%, 140%); opacity: 0; transition: transform 0.26s var(--ease), opacity 0.26s, border-color 0.2s, background 0.2s; }
.drag-tray.is-on { transform: translate(-50%, 0); opacity: 1; }
.drag-tray.is-target { border-color: var(--accent); border-style: solid; background: color-mix(in srgb, var(--accent) 28%, #0e0c16); }
.drag-tray[hidden] { display: none; }
/* Add page: the new page waits, then drops onto the open rings. */
.bpage.is-waiting { opacity: 0; }
.bpage.is-dropping { animation: page-drop 0.62s cubic-bezier(0.25, 0.9, 0.3, 1.12) both; }
@keyframes page-drop { from { opacity: 0; transform: translateY(-26%) rotate(-2.5deg) scale(1.04); box-shadow: 0 60px 80px rgba(0, 0, 0, 0.6); } 60% { opacity: 1; } }
.bview-tip { margin: 10px 0 0; font-size: 0.8rem; color: var(--muted); }
.bview-tip[hidden], .bview-hide[hidden], .bview-remove[hidden] { display: none; }
/* Cards hidden from the pages still show on the shelf, faded, to put back. */
.shelf-grid [data-hidden] { opacity: 0.45; filter: grayscale(0.6); position: relative; }
.shelf-grid [data-hidden]::after { content: "Hidden"; position: absolute; top: 6px; left: 6px; z-index: 4; padding: 1px 8px; border-radius: 999px; background: rgba(12, 10, 24, 0.9); color: #fff; font-size: 0.7rem; font-weight: 800; }
.shelf-grid [data-hidden]:hover { opacity: 0.85; filter: none; }
.shelf-hidden-note { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--edge); }
.only-hidden .shelf-grid [data-k]:not([data-hidden]), .only-hidden .shelf-set:not(:has([data-hidden])), .only-hidden .shelf-game:not(:has([data-hidden])) { display: none; }
@media (prefers-reduced-motion: reduce) {
  .ring-l, .ring-r, .drag-tray, .drag-ghost { transition: none; }
  .drag-ghost.is-lifting, .bpage.is-dropping { animation: none; }
}
html.calm .ring-l, html.calm .ring-r { transition: none; }
html.calm .drag-ghost.is-lifting, html.calm .bpage.is-dropping { animation: none; }
