:root {
  --night: #181425; --night-2: #262b44; --night-3: #3a4466;
  --ink: #f4ead2; --ink-soft: #c0cbdc; --muted: #8b9bb4;
  --glow: #feae34; --glow-2: #f77622; --danger: #e43b44;
  --pix: 'Pixelify Sans', ui-rounded, system-ui, sans-serif;
  --radius: 12px;
  --tabs-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); line-height: 1.5;
  font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(ellipse at 50% -10%, #2c2450 0%, var(--night) 55%) fixed, var(--night);
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px);
}
h1, h2, .brand, .card-name, .btn, .pack { font-family: var(--pix); }
/* numbers stay in a plain font: the pixel face makes small 2/3/5 look like 8 */
.no, .count, .big-num, .stats dd, .pack-sub { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif !important; font-variant-numeric: tabular-nums; }
h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); line-height: 1.15; margin: .2em 0 .5em; outline: none; }
h2 { font-size: 1.35rem; margin: 1.6em 0 .6em; }
a { color: var(--glow); }
code { font: .85em ui-monospace, Consolas, monospace; color: var(--ink-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--glow); color: #000; padding: 8px 12px; z-index: 50; border-radius: 6px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--glow); outline-offset: 3px; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; max-width: 1080px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-size: 1.3rem; font-weight: 700; }
.brand img { image-rendering: pixelated; border-radius: 6px; }
.proto-pill { font-size: .75rem; border: 1px solid var(--night-3); color: var(--ink-soft); padding: 3px 10px; border-radius: 99px; }
main { max-width: 1080px; margin: 0 auto; padding: 0 16px; outline: none; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }

/* tabs */
.tabs { position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(24, 20, 37, .94); backdrop-filter: blur(8px); border-top: 1px solid var(--night-3);
  padding-bottom: env(safe-area-inset-bottom); }
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tabs-h); color: var(--muted); text-decoration: none; font-size: .72rem; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tabs a[aria-current] { color: var(--glow); }
.tabs a[aria-current] svg { fill: rgba(254, 174, 52, .2); }
.badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font: 700 .7rem/18px system-ui; text-align: center; }
@media (min-width: 820px) {
  /* floating pill that stays at the bottom, with breathing room above it */
  .tabs { position: sticky; bottom: 14px; inset: auto; max-width: 640px; margin: 32px auto 14px; border: 1px solid var(--night-3); border-radius: 99px;
    box-shadow: 0 8px 28px rgba(0,0,0,.45); }
  .tabs a { flex-direction: row; height: 46px; font-size: .85rem; gap: 6px; }
  .badge { top: 4px; left: auto; right: 10px; }
  body { padding-bottom: 32px; }
}

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px;
  border-radius: 10px; border: 2px solid var(--night-3); background: var(--night-2); color: var(--ink);
  font-size: 1rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.big { font-size: 1.15rem; min-height: 54px; padding: 10px 26px; }
.btn.glow { background: linear-gradient(180deg, var(--glow), var(--glow-2)); color: #2a1406; border-color: #ffd28a;
  box-shadow: 0 0 0 0 rgba(254, 174, 52, .5), 0 6px 22px rgba(247, 118, 34, .35); }
.btn.glow:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.on { background: #5a2238; border-color: #f6757a; }
.btn.danger { background: transparent; border-color: var(--danger); color: #ff8a90; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.fine { color: var(--muted); font-size: .85rem; }
.notice { background: var(--night-2); border: 1px solid var(--night-3); border-left: 4px solid var(--glow); padding: 12px 14px; border-radius: 8px; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* pixel art */
.pix, .sprite img { image-rendering: pixelated; image-rendering: crisp-edges; display: block; width: 100%; height: auto; user-select: none; }
.sprite { position: relative; overflow: hidden; aspect-ratio: 1; width: 100%; }
.sprite .strip { position: absolute; top: 0; left: 0; width: calc(var(--frames) * 100%); max-width: none; height: 100%;
  animation: play var(--dur) steps(var(--frames)) infinite; }
.sprite .still { display: none; }
@keyframes play { to { transform: translateX(-100%); } }
.reduce .sprite .strip { display: none; }
.reduce .sprite .still { display: block; }

/* habitats */
.hab-mossglen    { --h1: #265c42; --h2: #63c74d; --h3: #1b3a2c; }
.hab-tidepool    { --h1: #124e89; --h2: #2ce8f5; --h3: #0d2c4d; }
.hab-emberhearth { --h1: #a22633; --h2: #feae34; --h3: #4a1620; }
.hab-duskhollow  { --h1: #68386c; --h2: #f6757a; --h3: #2e1a3a; }
.hab-skyreach    { --h1: #5a6988; --h2: #c0cbdc; --h3: #2b3350; }

/* card */
/* Rarity owns the frame; habitat owns the background tint. */
.card { --rb: #8b9bb4; --rb2: #5a6988; --band-ink: #181425;
  position: relative; display: flex; flex-direction: column; aspect-ratio: 5 / 7; width: 100%;
  padding: 8px; border-radius: var(--radius); text-decoration: none; color: var(--ink); overflow: hidden;
  background: linear-gradient(170deg, var(--h1), var(--h3)); border: 3px solid var(--rb);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.35), 0 6px 18px rgba(0,0,0,.35); }
.card.rar-common   { --rb: #c0cbdc; --rb2: #8b9bb4; }
.card.rar-uncommon { --rb: #63c74d; --rb2: #3e8948; border-width: 4px; }
.card.rar-rare     { --rb: #feae34; --rb2: #f77622; border-width: 4px;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.35), 0 0 0 1px #fee761, 0 0 20px rgba(254, 174, 52, .55); }
.card.rar-mythic   { --rb2: #b55088; border: 4px solid transparent;
  background: linear-gradient(170deg, #2c2450, #181425) padding-box,
              linear-gradient(135deg, #63c74d, #2ce8f5, #b55088, #feae34, #63c74d) border-box;
  box-shadow: 0 0 26px rgba(44, 232, 245, .5), 0 0 40px rgba(181, 80, 136, .35); }
.rar-band { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 6px -8px -8px; padding: 4px 8px;
  background: linear-gradient(90deg, var(--rb), var(--rb2)); color: var(--band-ink); font: 700 .78rem var(--pix); letter-spacing: .03em; text-transform: uppercase; }
.rar-band .pips { letter-spacing: .12em; font-size: 1.05em; }
.card.rar-mythic .rar-band { background: linear-gradient(90deg, #63c74d, #2ce8f5, #b55088, #feae34); }
/* foil sheen on rare and mythic */
.card.rar-rare::after, .card.rar-mythic::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.38) 47%, rgba(255,255,255,.05) 55%, transparent 65%);
  background-size: 300% 100%; mix-blend-mode: overlay; animation: sheen 4s ease-in-out infinite; }
.card.rar-mythic::after { background: linear-gradient(115deg, transparent 25%, rgba(44,232,245,.35) 38%, rgba(254,174,52,.3) 48%, rgba(181,80,136,.35) 58%, transparent 72%);
  background-size: 300% 100%; mix-blend-mode: color-dodge; opacity: .55; }
@keyframes sheen { 0% { background-position: 120% 0; } 60%, 100% { background-position: -120% 0; } }
a.card:hover { transform: translateY(-2px); }
.card-top { display: flex; justify-content: space-between; align-items: center; font-size: .72rem; gap: 4px; min-height: 18px; }
.no { font: 700 .8rem var(--pix); opacity: .9; }
.art-window { flex: 1; margin: 6px 0; border-radius: 8px; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, rgba(255,255,255,.28), rgba(255,255,255,.06) 70%), var(--h3);
  border: 2px solid rgba(0,0,0,.35); }
.art-window > * { width: 92%; }
.card-name { font-size: 1.05rem; font-weight: 700; line-height: 1.1; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.card-hab { font-size: .72rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rar { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 99px; background: rgba(0,0,0,.4); font-weight: 600; white-space: nowrap; }
.rar .mark { font-size: .85em; }
.rar-common .mark { color: #c0cbdc; } .rar-uncommon .mark { color: #63c74d; }
.rar-rare .mark { color: #fee761; } .rar-mythic .mark { color: #2ce8f5; text-shadow: 0 0 6px #b55088; }
.card.rar-mythic .art-window { background: radial-gradient(circle at 50% 40%, rgba(44,232,245,.35), rgba(181,80,136,.15) 70%), #1b2140; }
.count { position: absolute; right: 8px; top: 30px; z-index: 3; font: 700 .8rem var(--pix); background: var(--glow); color: #2a1406; padding: 0 6px; border-radius: 6px; }
.flag { position: absolute; z-index: 3; left: 50%; top: -10px; transform: translateX(-50%); font: 700 .75rem var(--pix); padding: 2px 10px; border-radius: 99px; }
.flag.new { background: #63c74d; color: #0d2a12; } .flag.dup { background: var(--night-3); color: var(--ink); }
.card.missing { background: var(--night-2); border: 2px dashed var(--night-3); box-shadow: none; color: var(--muted); }
.card.missing .art-window { background: rgba(0,0,0,.25); }
.silhouette { filter: brightness(0) invert(.25); opacity: .55; }

/* discover */
.hero { text-align: center; padding: 8px 0 12px; }
.lede { max-width: 560px; margin: 0 auto 18px; color: var(--ink-soft); font-size: 1.05rem; }
.showcase { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 520px; margin: 0 auto 22px; }
.show-item { background: linear-gradient(170deg, var(--h1), var(--h3)); border: 2px solid var(--h2); border-radius: 14px; padding: 6px 6px 8px; font: 600 .85rem var(--pix); }
@media (min-width: 700px) { .showcase { grid-template-columns: repeat(6, 1fr); max-width: 900px; } }
.steps { padding-left: 1.3em; display: grid; gap: 8px; max-width: 640px; }
.hab-list { list-style: none; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.hab-list li { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: linear-gradient(170deg, var(--h1), var(--h3)); border: 2px solid var(--h2); }
.hab-list img { width: 64px; flex: none; }
.hab-list b { display: block; font-family: var(--pix); font-size: 1.05rem; }
.hab-list span { font-size: .85rem; color: var(--ink-soft); }

/* collection */
.progress-wrap p { margin: 0 0 6px; }
.progress { height: 14px; border-radius: 7px; background: var(--night-2); border: 1px solid var(--night-3); overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--glow-2), var(--glow)); }
.done { color: var(--glow); font-family: var(--pix); margin-top: 6px !important; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 16px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 12px; min-height: 36px; display: inline-flex; align-items: center; border-radius: 99px; border: 1px solid var(--night-3); color: var(--ink-soft); text-decoration: none; font-size: .9rem; }
.chip[aria-current] { background: var(--glow); color: #2a1406; border-color: var(--glow); font-weight: 600; }
.select select { min-height: 40px; background: var(--night-2); color: var(--ink); border: 1px solid var(--night-3); border-radius: 8px; padding: 0 10px; font-size: .95rem; }
.album { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
@media (min-width: 600px) { .album { gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
@media (max-width: 599px) {
  .album .card { padding: 5px; border-width: 2px; }
  .album .card-name { font-size: .8rem; }
  .album .card-hab { font-size: .62rem; }
  .album .rar-band { margin: 4px -5px -5px; padding: 2px 5px; font-size: .62rem; justify-content: center; }
  .album .rar-band .pips { font-size: .95rem; line-height: 1; }
  .album .rar-band .word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .album .card-top .card-hab { display: none; }
  .album .art-window { margin: 4px 0; }
  .album .count { right: 5px; top: 24px; font-size: .7rem; }
  .album .fav-dot { left: 8px; top: 24px; }
}
.album li { position: relative; }
.album.small { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.album .none { grid-column: 1 / -1; color: var(--muted); }
.fav-dot { position: absolute; z-index: 3; left: 12px; top: 30px; color: #f6757a; font-size: .9rem; text-shadow: 0 1px 2px #000; }
.card.missing .rar-band { background: rgba(0,0,0,.3); color: var(--muted); }
.empty { text-align: center; padding: 18px; background: var(--night-2); border-radius: 12px; margin-bottom: 16px; }

/* detail */
.back { display: inline-block; margin-bottom: 10px; color: var(--ink-soft); text-decoration: none; }
.detail { display: grid; gap: 20px; }
.detail-card { max-width: 320px; width: 100%; margin: 0 auto; }
.detail-card .card-name { font-size: 1.5rem; }
.lore { font-size: 1.05rem; color: var(--ink-soft); font-style: italic; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 18px 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.copies { list-style: none; padding: 0; display: grid; gap: 6px; }
.copies li { display: flex; flex-wrap: wrap; gap: 4px 12px; background: var(--night-2); padding: 8px 10px; border-radius: 8px; font-size: .85rem; }
.copies span { color: var(--muted); }
@media (min-width: 760px) { .detail { grid-template-columns: 340px 1fr; align-items: start; } .detail-card { position: sticky; top: 70px; } }

/* packs */
.pack-row { display: grid; gap: 20px; align-items: center; justify-items: center; text-align: center; }
@media (min-width: 700px) { .pack-row { grid-template-columns: 240px 1fr; justify-items: start; text-align: left; } }
.pack { position: relative; width: 200px; aspect-ratio: 5 / 7.4; border-radius: 10px 10px 14px 14px; padding: 14px 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  background: linear-gradient(160deg, #3a4466 0%, #262b44 45%, #68386c 100%); border: 3px solid #c0cbdc;
  box-shadow: inset 0 10px 0 rgba(255,255,255,.08), 0 12px 30px rgba(0,0,0,.45); color: var(--ink); }
.pack::before { content: ''; position: absolute; inset: 6px 6px auto; height: 10px; background: repeating-linear-gradient(90deg, #c0cbdc 0 6px, transparent 6px 12px); opacity: .5; }
.pack img { width: 78%; filter: drop-shadow(0 0 14px rgba(44,232,245,.5)); }
.pack-set { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-top: 10px; }
.pack-title { font-size: 1.6rem; font-weight: 700; color: var(--glow); text-shadow: 0 2px 0 #3e2731; }
.pack-sub { font-size: .85rem; color: var(--ink-soft); }
.big-num { font-size: 1.3rem; margin: 0 0 12px; } .big-num b { font-size: 2rem; color: var(--glow); }
.pack-row .btn { margin: 0 0 10px; }
.rules p { max-width: 720px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; min-width: 520px; font-size: .9rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--night-3); text-align: left; }
thead th { color: var(--muted); font-weight: 600; }

/* opening */
.opening { text-align: center; padding-top: 8px; }
.stage { min-height: 380px; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; }
.pack-btn { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; display: grid; justify-items: center; gap: 14px; }
.pack-btn .pack { width: 230px; animation: float 3s ease-in-out infinite; }
.tap { font: 600 1.1rem var(--pix); color: var(--glow); }
@keyframes float { 50% { transform: translateY(-8px) rotate(-1deg); } }
.pack-btn.tearing .pack { animation: shake .7s ease-in; }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: rotate(-4deg) scale(1.03); } 40% { transform: rotate(4deg) scale(1.06); }
  60% { transform: rotate(-3deg) scale(1.1); filter: brightness(1.4); } 100% { transform: scale(1.3); opacity: 0; filter: brightness(3); } }
.reveal-row { list-style: none; padding: 0; margin: 0 auto; display: grid; gap: 14px 10px; width: 100%; max-width: 920px;
  grid-template-columns: repeat(2, minmax(0, 168px)); justify-content: center; }
@media (min-width: 560px) { .reveal-row { grid-template-columns: repeat(3, minmax(0, 168px)); } }
@media (min-width: 900px) { .reveal-row { grid-template-columns: repeat(5, minmax(0, 168px)); } }
.flip { position: relative; width: 100%; aspect-ratio: 5 / 7; border: 0; padding: 0; background: none; cursor: pointer; color: inherit; }
/* 2D flip: back squeezes to nothing, then the front grows in. No 3D needed. */
.flip .face { position: absolute; inset: 0; display: block; transition: transform .2s ease-in; }
.flip .back { border-radius: var(--radius); border: 3px solid #c0cbdc; display: grid; place-items: center;
  background: repeating-linear-gradient(45deg, #262b44 0 10px, #2e3454 10px 20px); box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.flip:not(.flipped):hover .back { transform: translateY(-4px); }
.back-mark { font-size: 2.4rem; color: var(--glow); text-shadow: 0 0 12px var(--glow-2); }
.flip .front { transform: scaleX(0); }
.flip.flipped .back { transform: scaleX(0); }
.flip.flipped .front { transform: none; transition: transform .28s cubic-bezier(.3,.7,.3,1.3) .2s; }
.flip.instant .face { transition: none; }
/* build-up: a rare or mythic card glows through its back before you flip it */
.flip.rar-rare .back { border-color: #feae34; box-shadow: 0 0 18px rgba(254,174,52,.55); animation: pulse-gold 1.6s ease-in-out infinite; }
.flip.rar-mythic .back { border-color: #2ce8f5; animation: pulse-myth 1.4s ease-in-out infinite; }
.flip.rar-rare .back-mark { color: #fee761; } .flip.rar-mythic .back-mark { color: #2ce8f5; text-shadow: 0 0 14px #b55088; }
@keyframes pulse-gold { 50% { box-shadow: 0 0 30px rgba(254,174,52,.9); } }
@keyframes pulse-myth { 0%,100% { box-shadow: 0 0 22px rgba(44,232,245,.7); } 50% { box-shadow: 0 0 34px rgba(181,80,136,.9); } }
.flip.charge .back { animation: charge .7s ease-in forwards; }
@keyframes charge { 0% { transform: none; } 25% { transform: rotate(-3deg) scale(1.03); } 50% { transform: rotate(3deg) scale(1.06); } 75% { transform: rotate(-2deg) scale(1.09); filter: brightness(1.5); } 100% { transform: scale(1.12); filter: brightness(2.2); } }
.flip:disabled { cursor: default; }
.flip.flipped.rar-rare::after, .flip.flipped.rar-mythic::after { content: ''; position: absolute; inset: -14px; z-index: -1; border-radius: 24px; pointer-events: none;
  background: radial-gradient(circle, rgba(254,231,97,.55), transparent 70%); animation: burst 1.2s ease-out forwards; }
.flip.flipped.rar-mythic::after { background: conic-gradient(from 0deg, #63c74d, #2ce8f5, #b55088, #feae34, #63c74d); filter: blur(14px); opacity: .7; animation: burst 1.6s ease-out forwards, spin 4s linear infinite; }
@keyframes burst { from { transform: scale(.6); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); opacity: .5; } }
@keyframes spin { to { rotate: 360deg; } }
.reveal-actions { margin-top: 18px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.summary { margin-top: 20px; font-size: 1.1rem; } .summary .row { justify-content: center; }

/* profile */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0; }
.stats div { background: var(--night-2); border-radius: 10px; padding: 12px; }
.stats dt { color: var(--muted); font-size: .85rem; } .stats dd { margin: 0; font: 700 1.6rem var(--pix); color: var(--glow); }
.radio { border: 1px solid var(--night-3); border-radius: 10px; padding: 10px 14px; display: grid; gap: 6px; }
.radio label { display: flex; gap: 8px; align-items: center; min-height: 36px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 18px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--night); padding: 10px 16px; border-radius: 10px; font-weight: 600; transition: .25s; pointer-events: none; z-index: 30; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
dialog.confirm { background: var(--night-2); color: var(--ink); border: 1px solid var(--night-3); border-radius: 14px; max-width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.6); }

.reduce *, .reduce *::before, .reduce *::after { animation-duration: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; }
.reduce .flip.flipped::after, .reduce .card::after { display: none; }

/* binder */
.binder { position: relative; margin: 6px auto 0; padding: 14px 14px 14px 30px; border-radius: 14px; outline-offset: 4px;
  background: linear-gradient(135deg, #3e2731, #2a1a24 60%, #3e2731); box-shadow: inset 0 0 0 2px rgba(0,0,0,.4), 0 14px 34px rgba(0,0,0,.5);
  touch-action: pan-y; user-select: none; }
.binder::before { /* stitched cover edge */
  content: ''; position: absolute; inset: 6px; border: 2px dashed rgba(234, 212, 170, .22); border-radius: 10px; pointer-events: none; }
.binder-pages { position: relative; display: grid; gap: 0; perspective: 1400px; }
.binder-pages.span-2 { grid-template-columns: 1fr 1fr; }
.page { position: relative; padding: 12px 12px 26px; background: linear-gradient(180deg, #262b44, #20243a); border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 2px 0 #151225; min-height: 100%; }
.page.blank { background: repeating-linear-gradient(45deg, #20243a 0 12px, #23283f 12px 24px); }
/* rings: down the left edge on one page, down the spine on a spread */
.binder::after { content: ''; position: absolute; top: 12%; bottom: 12%; left: 9px; width: 14px; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, #c0cbdc 0 4px, #5a6988 5px 6px, transparent 7px) 0 0 / 14px 25% repeat-y;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.5)); }
.binder.spread { padding-left: 14px; }
.binder.spread::after { left: calc(50% - 7px); }
.span-2 .page:first-child { border-radius: 6px 2px 2px 6px; box-shadow: inset -18px 0 22px -16px rgba(0,0,0,.6), 0 2px 0 #151225; }
.span-2 .page:nth-child(2) { border-radius: 2px 6px 6px 2px; box-shadow: inset 18px 0 22px -16px rgba(0,0,0,.6), 0 2px 0 #151225; }
.sleeves { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 8px !important; }
.sleeve { position: relative; padding: 4px; border-radius: 10px; background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.sleeve::after { /* plastic sleeve gloss */
  content: ''; position: absolute; inset: 0; border-radius: 10px; pointer-events: none; z-index: 4;
  background: linear-gradient(160deg, rgba(255,255,255,.16), rgba(255,255,255,0) 32%, rgba(255,255,255,0) 70%, rgba(255,255,255,.06)); }
.empty-sleeve { aspect-ratio: 5 / 7; box-sizing: content-box; }
.sleeve .fav-dot { left: 14px; top: 34px; }
.page-no { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font: .75rem system-ui; color: var(--muted); }
.binder-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0 4px; }
.binder-nav .turn { font-size: 1.6rem; width: 52px; padding: 0; }
.binder-nav .turn:disabled { opacity: .35; cursor: default; }
.page-label { min-width: 130px; text-align: center; color: var(--ink-soft); font-size: .95rem; }
@media (max-width: 599px) { .binder { padding: 10px 8px 10px 26px; } .page { padding: 8px 8px 22px; } .sleeves { gap: 5px !important; } .sleeve { padding: 3px; } }

/* page-turn sheets: a page folding toward the spine, then the next opening out of it */
.turn-sheet { position: absolute; top: 0; bottom: 0; z-index: 5; pointer-events: none; }
.turn-sheet .page { height: 100%; }
.turn-sheet.slot-full { left: 0; right: 0; }
.turn-sheet.slot-left { left: 0; width: 50%; }
.turn-sheet.slot-right { left: 50%; width: 50%; }
.turn-sheet::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; border-radius: 6px; }
.fold-left   { transform-origin: left center;  animation: fold .34s ease-in forwards; }
.fold-right  { transform-origin: right center; animation: fold .34s ease-in forwards; }
.unfold-left  { transform-origin: left center;  transform: scaleX(0); animation: unfold .34s ease-out forwards; }
.unfold-right { transform-origin: right center; transform: scaleX(0); animation: unfold .34s ease-out forwards; }
.fold-left::after, .fold-right::after { background: linear-gradient(90deg, rgba(0,0,0,.55), rgba(0,0,0,.1)); animation: shade-in .34s ease-in forwards; }
.unfold-left::after, .unfold-right::after { background: linear-gradient(90deg, rgba(0,0,0,.1), rgba(0,0,0,.55)); animation: shade-out .34s ease-out forwards; }
@keyframes fold   { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes unfold { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes shade-in  { to { opacity: 1; } }
@keyframes shade-out { from { opacity: 1; } to { opacity: 0; } }
