/* Collé — receiving a card (open the mystery box) and the fixed book template.
   The box is only an animation for cards that are free; nothing is sold or drawn for money (ADR 0006). */

/* ---------- receiving a card ---------- */
.rv { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; color: #fff; overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #33206B 0, #120A2A 55%, #07040F 100%); --ray: rgba(255,255,255,.16); }
.rv[data-tier="SR"] { --ray: rgba(255,227,138,.30); }
.rv[data-tier="SSR"] { --ray: rgba(255,154,230,.34); }
.rv .close { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 16px; z-index: 3; }
.rv-stage { flex: 1; display: grid; place-items: center; position: relative; min-height: 0; cursor: pointer; }
.rv-stage > * { grid-area: 1 / 1; }
.rv-rays, .rv-flash { position: absolute; left: 50%; top: 50%; translate: -50% -50%; }
.rv-stage { overflow: hidden; grid-template-columns: minmax(0, 1fr); }
.rv-rays { width: min(150vw, 680px); aspect-ratio: 1; border-radius: 50%; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(var(--ray) 0 8deg, transparent 8deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 66%); mask: radial-gradient(circle, #000 18%, transparent 66%); }
.rv[data-tier="SSR"] .rv-rays { background: repeating-conic-gradient(rgba(124,243,255,.35) 0 8deg, transparent 8deg 16deg, rgba(255,154,230,.35) 16deg 24deg,
  transparent 24deg 32deg, rgba(255,227,138,.35) 32deg 40deg, transparent 40deg 48deg); }
.rv-flash { width: 60px; height: 60px; border-radius: 50%; background: #fff; opacity: 0; filter: blur(6px); pointer-events: none; }
.mbox { position: relative; width: 150px; height: 150px; animation: rv-bob 1.8s ease-in-out infinite; filter: drop-shadow(0 24px 30px rgba(0,0,0,.55)); }
.mbox-base { position: absolute; left: 12px; right: 12px; bottom: 0; height: 96px; border-radius: 12px 12px 18px 18px; display: grid; place-items: center;
  background: linear-gradient(160deg, #B99CFF, #6C4CF5); box-shadow: inset 0 -12px 22px rgba(0,0,0,.25); }
.mbox-base::before, .mbox-lid::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 22px; margin-left: -11px;
  background: linear-gradient(90deg, #FFE38A, #FFC94A); }
.mbox-base b { position: relative; font-family: var(--display); font-size: 46px; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.mbox-lid { position: absolute; left: 0; right: 0; top: 28px; height: 38px; border-radius: 12px; z-index: 1;
  background: linear-gradient(160deg, #FF9AE6, #B99CFF); box-shadow: 0 6px 12px rgba(0,0,0,.25); }
.mbox-lid .bow { position: absolute; left: 50%; top: -22px; width: 0; height: 0; }
.mbox-lid .bow::before, .mbox-lid .bow::after { content: ""; position: absolute; top: 0; width: 34px; height: 24px; border-radius: 50%; border: 7px solid #FFD04A; box-sizing: border-box; }
.mbox-lid .bow::before { right: 0; transform: rotate(-22deg); }
.mbox-lid .bow::after { left: 0; transform: rotate(22deg); }
.rv-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; padding: 0 20px; max-width: 520px; }
.rvc { opacity: 0; transform: translateY(70px) scale(.35); perspective: 1000px; padding: 0; background: none; }
.rvc-in { position: relative; transform-style: preserve-3d; transform: rotateY(180deg); }
.rvf { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.rvf.back { position: absolute; inset: 0; transform: rotateY(180deg); border-radius: 12px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; color: #24164A;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.25) 0 6px, transparent 6px 14px), var(--holo); box-shadow: inset 0 0 0 3px rgba(255,255,255,.6); }
.rv-cards:not(.many) .cc { --card-w: 156px; --card-h: 218px; }
.rv-cards:not(.many) .cc .art { font-size: 80px; }
.rv-cards:not(.many) .cc .lbl { font-size: 13px; padding: 7px; }
.rv-cards:not(.many) .rvf.back { font-size: 30px; }
.rv-hint { align-self: end; margin-bottom: 8%; font-size: 13px; opacity: .7; animation: rv-breathe 2s ease-in-out infinite; }
.rv-info { padding: 0 20px calc(24px + env(safe-area-inset-bottom, 0px)); text-align: center; display: grid; gap: 6px; justify-items: center;
  opacity: 0; transform: translateY(18px); }
.rv-tag { font-family: var(--display); font-weight: 800; font-size: 13px; letter-spacing: .06em; padding: 4px 12px; border-radius: 99px; background: rgba(255,255,255,.12); }
.rv[data-tier="SR"] .rv-tag { background: linear-gradient(90deg, #FFE38A, #FFC94A); color: #2A1A00; }
.rv[data-tier="SSR"] .rv-tag { background: var(--holo); color: #24164A; }
.rv-name { font-family: var(--display); font-size: 24px; line-height: 1.2; }
.rv-meta { font-size: 13px; opacity: .8; }
.rv-note { font-size: 12.5px; opacity: .65; }
.rv-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.rv-actions .btn.ghost { background: rgba(255,255,255,.12); color: #fff; box-shadow: none; }

/* phases: closed → opening (shake) → open (lid off, light, card rises and turns over, details) → done (final state, no replay) */
.rv.opening .mbox { animation: rv-shake .65s cubic-bezier(.36,.07,.19,.97); }
.rv.opening .rv-hint, .rv.open .rv-hint, .rv.done .rv-hint { display: none; }
.rv.open .mbox, .rv.done .mbox { animation: none; pointer-events: none; }
.rv.open .mbox-lid, .rv.done .mbox-lid { animation: rv-lid .6s cubic-bezier(.2,.8,.3,1) forwards; }
.rv.open .mbox-base, .rv.done .mbox-base { animation: rv-base .5s .25s ease-in forwards; }
.rv.open .rv-flash, .rv.done .rv-flash { animation: rv-flash .8s .15s ease-out forwards; }
.rv.open .rv-rays { animation: rv-on .9s .25s forwards, rv-spin 16s linear infinite; }
.rv.open .rvc, .rv.done .rvc { animation: rv-rise .8s calc(.35s + var(--i) * .12s) cubic-bezier(.2,1.3,.4,1) forwards; }
.rv.open .rvc-in, .rv.done .rvc-in { animation: rv-turn .7s calc(.95s + var(--i) * .12s) cubic-bezier(.3,.7,.2,1) forwards; }
.rv.open .rv-info, .rv.done .rv-info { animation: rv-up .5s 1.6s forwards; }
.rv.done .mbox-lid, .rv.done .mbox-base, .rv.done .rv-flash, .rv.done .rvc, .rv.done .rvc-in, .rv.done .rv-info { animation-delay: 0s; animation-duration: .01s; }
.rv.done .rv-rays { opacity: 1; animation: rv-spin 16s linear infinite; }
@keyframes rv-bob { 50% { transform: translateY(-10px) rotate(-2deg); } }
@keyframes rv-breathe { 50% { opacity: .35; } }
@keyframes rv-shake { 10%, 90% { transform: translateX(-2px) rotate(-3deg); } 20%, 80% { transform: translateX(4px) rotate(4deg); }
  30%, 50%, 70% { transform: translateX(-7px) rotate(-6deg) scale(1.04); } 40%, 60% { transform: translateX(7px) rotate(6deg) scale(1.06); } }
@keyframes rv-lid { to { transform: translateY(-190px) rotate(-28deg); opacity: 0; } }
@keyframes rv-base { to { transform: translateY(40px) scale(.7); opacity: 0; } }
@keyframes rv-flash { from { opacity: 1; transform: scale(.5); } to { opacity: 0; transform: scale(16); } }
@keyframes rv-on { to { opacity: 1; } }
@keyframes rv-spin { to { rotate: 360deg; } }
@keyframes rv-rise { to { opacity: 1; transform: none; } }
@keyframes rv-turn { to { transform: rotateY(0deg); } }
@keyframes rv-up { to { opacity: 1; transform: none; } }

/* ---------- the book: one fixed template for every book (5 a row, 20 a page) ---------- */
.bookfix { --slot-w: clamp(44px, calc((min(100vw, 520px) - 122px) / 5), 64px); --slot-h: calc(var(--slot-w) * 1.4);
  border-radius: 8px 20px 20px 8px; padding: 14px 14px 12px; color: #24164A;
  box-shadow: inset 6px 0 0 rgba(0,0,0,.18), 0 18px 40px -12px rgba(0,0,0,.6); display: grid; gap: 10px; }
:where(.bookfix) { background: var(--holo); }   /* default; a theme class or style wins */
.bookfix.dark { color: #fff; }
.bk-head { display: flex; gap: 10px; align-items: flex-start; }
.bk-name { display: block; font-family: var(--display); font-size: 17px; line-height: 1.2; }
.bk-sub { font-size: 12px; opacity: .8; margin-top: 2px; }
.bk-count { font-family: var(--display); font-weight: 800; font-size: 13px; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.6); color: #24164A; }
.bk-prog { height: 6px; border-radius: 99px; background: rgba(0,0,0,.18); overflow: hidden; }
.bk-prog i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #FFE38A, #7CF3C8); }
.bk-paper { position: relative; border-radius: 6px 14px 14px 6px; padding: 12px 10px 12px 24px; perspective: 900px;
  background: radial-gradient(rgba(60,40,110,.09) 1px, transparent 1.2px) 0 0 / 12px 12px, #FFFBF3;
  box-shadow: inset 0 0 0 1px rgba(60,40,110,.08), 0 2px 0 rgba(0,0,0,.08), 0 4px 0 -1px #EDE6D8; }
.bk-rings { position: absolute; left: 7px; top: 12px; bottom: 12px; width: 9px; opacity: .55;
  background: radial-gradient(circle at 50% 50%, #2A1D4A 3px, transparent 3.6px) 0 0 / 9px 24px repeat-y; }
.bk-paper .slots { display: grid; grid-template-columns: repeat(5, var(--slot-w)); grid-auto-rows: var(--slot-h); gap: 7px;
  justify-content: center; align-content: start; min-height: calc(var(--slot-h) * 4 + 21px); }
.slot { width: var(--slot-w); height: var(--slot-h); border-radius: 9px; border: 1.5px dashed rgba(60,40,110,.28); position: relative;
  display: grid; place-items: center; padding: 0; background: transparent; transition: transform .15s, opacity .2s, background .2s; }
.slot .hint-art { font-size: calc(var(--slot-w) * .42); filter: grayscale(1); opacity: .22; line-height: 1; }
.slot .no { position: absolute; bottom: 3px; left: 0; right: 0; text-align: center; font-size: 9px; font-weight: 700; color: rgba(60,40,110,.45); }
.slot.filled { border: 0; }
.slot.filled .cc { --card-w: var(--slot-w); --card-h: var(--slot-h); border-radius: 8px; padding: 2px; }
.slot.filled .cc .in { border-radius: 6px; }
.slot.filled .cc .art { font-size: calc(var(--slot-w) * .46); }
.slot.filled .cc .lbl, .slot.filled .cc .badge-foil, .slot.filled .cc .badge-new, .slot.filled .cc .count { display: none; }
.slot.drop { cursor: pointer; }
.slot.drop.hot { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); animation: glowpulse 1.4s ease-in-out infinite; }
.slot.drop.hot .hint-art { opacity: .45; filter: none; }
.slot.drop.over { transform: scale(1.12); background: color-mix(in srgb, var(--accent) 28%, transparent); }
body.is-dragging .slot.drop:not(.hot) { opacity: .4; }
.bk-pager { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.bk-pager button { min-width: 30px; height: 30px; border-radius: 9px; font-weight: 700; font-size: 13px; background: rgba(255,255,255,.5); color: #24164A; }
.bk-pager button.on { background: #24164A; color: #fff; }
.bk-pager button:disabled { opacity: .35; }
.bk-paper.turn-next .slots { animation: bk-next .45s ease-out; transform-origin: left; }
.bk-paper.turn-prev .slots { animation: bk-prev .45s ease-out; transform-origin: right; }
@keyframes bk-next { from { transform: rotateY(-28deg) translateX(30px); opacity: .1; } }
@keyframes bk-prev { from { transform: rotateY(28deg) translateX(-30px); opacity: .1; } }

/* picker search */
.pick-search { position: sticky; top: -1px; z-index: 2; padding: 2px 0 8px; background: inherit; }

@media (prefers-reduced-motion: reduce) {
  .mbox, .rv-hint, .slot.drop.hot, .bk-paper .slots, .rv .rv-rays { animation: none !important; }
  .rv .rvc, .rv .rvc-in, .rv .rv-info, .rv .mbox-lid, .rv .mbox-base, .rv .rv-flash { animation-duration: .01s !important; animation-delay: 0s !important; }
}

/* ---------- book page fills the screen: book on top, hand at the bottom (mockup v3.2) ---------- */
.full.bookview { overflow: hidden; }
.bookview .body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.bookview .body.with-dock { padding-bottom: 4px; }
.bookview .body > :not(.bookfix) { flex: none; }
.bookview .bookfix { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.bookview .bk-paper { flex: 1; min-height: 0; container-type: size; padding-right: 8px; }
/* cq units = the paper's content box: 5 columns across, 4 rows down, rows spread to fill the page */
.bookview .bk-paper .slots { min-height: 0; height: 100%; align-content: start; column-gap: 6px;
  --slot-w: clamp(40px, min(calc((100cqw - 24px) / 5), calc((100cqh - 24px) / 4 / 1.4)), 110px);
  --slot-h: calc(var(--slot-w) * 1.4);
  row-gap: max(8px, calc((100cqh - var(--slot-h) * 4) / 3)); }
.bookview .note { margin: 0; font-size: 12px; text-align: center; }
.bookview .dock { position: static; flex: none; margin-top: 0; padding-top: 6px; background: none; }

/* ---- Book grid (mockup v3.2) ---- */
.bgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; }
.btile { display: flex; flex-direction: column; text-align: center; min-width: 0; padding: 0; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
:where(.btile .bk) { background: var(--holo); }
.btile .bk { aspect-ratio: 3/4; border-radius: 5px 12px 12px 5px; position: relative; display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.1); box-shadow: inset 7px 0 0 rgba(0,0,0,.28), inset 8px 0 0 rgba(255,255,255,.06), 0 10px 20px rgba(0,0,0,.45); }
.btile .bk .e { font-size: 2.1rem; }
.btile .bk .cat { position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.45); display: grid; place-items: center; font-size: .72rem; }
.btile .bk .dot { position: absolute; top: 7px; left: 13px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.btile .bk .tag { position: absolute; left: 10px; bottom: 6px; font-size: 10px; padding: 2px 6px; }
.btile .prog { height: 5px; margin-top: 7px; }
.btile .t { font-size: 12px; font-weight: 700; margin-top: 5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.btile .s { font-size: 11px; opacity: .7; margin-top: 2px; }
.btile:active .bk { transform: scale(.97); }
.sf { gap: 8px; margin-bottom: 14px; }
.sf input { flex: 1; min-width: 0; font-size: 14px; padding-left: 12px; padding-right: 8px; }
.sf .catsel { flex: none; width: auto; max-width: 42%; font-size: 14px; padding: 10px 12px; background-color: var(--select-bg, var(--surface2)); color: var(--ink); }
.sf .tool { flex: none; position: relative; width: 44px; height: 44px; }
.sf .tool svg { width: 22px; height: 22px; }
.sf .tool .n { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #1A0F33;
  font: 800 11px/18px var(--display, inherit); font-style: normal; text-align: center; }
.nextcopy { margin-bottom: 12px; gap: 10px; }
.sf .add { flex: none; white-space: nowrap; padding: 0 12px; font-size: 14px; }
.full .body > .bn-wrap { margin-bottom: 12px; }

/* ---- Mini games ---- */
.game-card { background: var(--surface); border-radius: 18px; padding: 14px; box-shadow: 0 0 0 1px var(--line); display: grid; gap: 12px; margin-bottom: 12px; }
.gc-top { display: flex; gap: 12px; align-items: center; }
.gc-ic { width: 52px; height: 52px; border-radius: 14px; background: var(--holo); display: grid; place-items: center; font-size: 28px; flex: none; }
.gc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); gap: 8px; text-align: center; }
.gc-stats div { background: var(--surface2, rgba(255,255,255,.05)); border-radius: 12px; padding: 8px 4px; display: grid; }
.gc-stats b { font-size: 18px; } .gc-stats span { font-size: 11px; opacity: .7; }
.stake-opt { flex: none; display: grid; justify-items: center; gap: 4px; padding: 8px; min-width: 76px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: inherit; font: inherit; font-size: 11px; cursor: pointer; }
.stake-opt.on { outline: 2px solid var(--accent); }
.body.game { display: grid; gap: 14px; align-content: start; }
.g-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; text-align: center; }
.g-p { display: grid; justify-items: center; gap: 6px; } .g-p b { font-size: 14px; }
.g-x { font: 800 20px var(--display, inherit); opacity: .7; }
.g-wait { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: 0 0 0 1px var(--line); font-size: 22px; animation: glowpulse 1.4s ease-in-out infinite; }
.g-stake { display: flex; align-items: center; gap: 6px; font-size: 11px; opacity: .9; }
.g-room { display: grid; justify-items: center; gap: 4px; padding: 16px; border-radius: 18px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.g-room b { font: 800 34px/1 var(--display, inherit); letter-spacing: 6px; }
.g-status, .g-round, .g-last { text-align: center; } .g-round { font-weight: 800; font-size: 18px; } .g-last { font-size: 13px; opacity: .85; }
.g-moves { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.g-move { display: grid; justify-items: center; gap: 4px; padding: 14px 6px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.g-move span { font-size: 40px; line-height: 1; }
.g-move.on { background: var(--holo); color: #1A0F33; border-color: transparent; transform: scale(1.04); }
.g-move:disabled:not(.on) { opacity: .4; }
.g-result { text-align: center; font: 800 30px var(--display, inherit); padding: 12px 0; }
.g-result.win { background: var(--holo); -webkit-background-clip: text; background-clip: text; color: transparent; }
.center { text-align: center; }

/* ---- Confirm before sticking ---- */
.stick-ask { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; background: rgba(8,4,20,.6); animation: fadein .15s ease; }
.sa-card { width: min(340px, 100%); background: linear-gradient(var(--surface), var(--surface)), var(--bg-solid, #1A0F33); color: var(--ink, inherit); border-radius: 20px; padding: 20px; box-shadow: 0 0 0 1px var(--line), 0 20px 50px rgba(0,0,0,.5); display: grid; gap: 10px; }
.sa-card b { font-size: 17px; }
.sa-card p { margin: 0; font-size: 14px; opacity: .85; line-height: 1.5; }
.sa-skip { display: flex; align-items: center; gap: 8px; font-size: 13px; opacity: .85; }
.sa-skip input { width: 18px; height: 18px; margin: 0; }
.sa-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
@keyframes fadein { from { opacity: 0; } }

/* ---- Game rooms ---- */
.g-score { font: 800 26px var(--display, inherit); letter-spacing: 2px; }
.g-ready { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); opacity: .8; }
.g-ready.on { background: #0D3A2C; color: #7CF3C8; box-shadow: none; opacity: 1; }
