/* ============================================================
   KOMA — jeu de packs et carnet (même DA que le site : papier & encre)
   ============================================================ */
.game {
  position: fixed; inset: 0; z-index: 70; overflow: hidden; user-select: none;
  background:
    radial-gradient(circle at 50% 46%, rgba(229, 25, 47, 0.16), transparent 42%),
    repeating-conic-gradient(from 0deg at 50% 46%, rgba(20, 19, 18, 0.045) 0deg 2deg, transparent 2deg 7deg),
    radial-gradient(circle, rgba(20, 19, 18, 0.12) 1.1px, transparent 1.6px) 0 0 / 10px 10px,
    var(--paper);
  animation: gIn 0.45s var(--ease);
}
body.in-game { overflow: hidden; }
body.in-game .top, body.in-game .decks, body.in-game .caption, body.in-game .arc, body.in-game .sound, body.in-game .corner-left { visibility: hidden; }
@keyframes gIn { from { opacity: 0; transform: scale(1.03); } }
#g-stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- barre du haut ---------- */
.g-top { position: absolute; z-index: 5; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 18px 10px; }
.g-title { font: 400 26px/1 var(--manga); letter-spacing: 0.04em; }
.g-title i { font-style: normal; color: var(--red); font-size: 15px; margin-left: 6px; }
.g-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.g-counter { display: flex; align-items: baseline; gap: 5px; height: 40px; padding: 0 14px; border-radius: 99px; background: #fff; border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--red); align-items: center; }
.g-counter b { font: 400 18px/1 var(--manga); }
.g-counter span { font: 900 12px/1 var(--round); }
.g-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 99px;
  background: #fff; color: var(--ink); border: 3px solid var(--ink); box-shadow: 3px 4px 0 var(--ink); font: 900 14.5px/1 var(--round);
  transition: transform 0.25s var(--spring), box-shadow 0.2s;
}
.g-btn:hover { transform: translateY(-2px) rotate(-1deg); }
.g-btn:active { transform: translateY(2px) scale(0.97); box-shadow: 1px 1px 0 var(--ink); }
.g-btn.red { background: var(--red); color: #fff; }
.g-btn.ghost { background: rgba(255, 255, 255, 0.7); box-shadow: none; border-width: 2.5px; }
.g-btn.small { height: 34px; padding: 0 14px; font-size: 13px; }
.g-badge { position: absolute; top: -9px; right: -8px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--red); color: #fff; font: 400 12px/22px var(--manga); border: 2px solid #fff; animation: badge 1.2s ease-in-out infinite; }
@keyframes badge { 50% { transform: scale(1.15) rotate(-6deg); } }
.g-round { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 3px solid var(--ink); box-shadow: 2px 3px 0 var(--ink); font-weight: 900; }
.g-round svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
.g-round.off { opacity: 0.4; }

/* ---------- étiquettes sous les packs ---------- */
.g-label {
  position: absolute; z-index: 4; left: 0; top: 0; display: grid; justify-items: center; gap: 2px; padding: 8px 16px 9px; border-radius: 12px;
  background: #fff; border: 3px solid var(--ink); box-shadow: 3px 4px 0 var(--ink); pointer-events: none; white-space: nowrap; will-change: transform;
}
.g-label b { font: 400 20px/1 var(--manga); letter-spacing: 0.04em; }
.g-label small { font: 900 11px/1.2 var(--round); opacity: 0.75; }
.g-label.ready { background: var(--red); color: #fff; animation: bob 1.6s ease-in-out infinite; }
.g-label.wait { background: var(--ink); color: var(--paper); box-shadow: 3px 4px 0 var(--red); }
.g-label.wait b { font-variant-numeric: tabular-nums; color: var(--gold); }
.g-label.prep b::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 6px; border: 3px solid var(--ink); border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -1px; }
.g-label.err { background: var(--gold); }
.game:not([data-mode="home"]) .g-label { opacity: 0; }
@keyframes bob { 50% { margin-top: -4px; } }
@keyframes spin { to { transform: rotate(360deg); } }

.g-hint {
  position: absolute; z-index: 4; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: min(560px, 90vw);
  padding: 11px 18px; border-radius: 22px; background: #fff; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); font: 700 14px/1.35 var(--round); text-align: center;
}
.g-hint:empty { display: none; }
.game[data-mode="burst"] .g-hint, .game[data-mode="reveal"] .g-hint, .game[data-mode="summary"] .g-hint { display: none; }
.game:not([data-mode="home"]) .g-top { opacity: 0; pointer-events: none; transform: translateY(-20px); transition: 0.3s; }

/* ---------- déchirure ---------- */
#g-tear-zone { position: absolute; inset: 0; z-index: 6; display: none; touch-action: none; cursor: grab; }
.game[data-mode="opening"] #g-tear-zone { display: block; }
#g-tear-guide { position: absolute; z-index: 7; left: 0; top: 0; height: 0; transform-origin: 0 0; pointer-events: none; display: none; }
.game[data-mode="opening"] #g-tear-guide { display: block; }
.tg-line { position: absolute; left: 0; right: 0; top: -2px; height: 4px; background: repeating-linear-gradient(90deg, var(--red) 0 14px, transparent 14px 24px); animation: dash 0.8s linear infinite; }
#g-tear-fill { position: absolute; left: 0; top: -4px; height: 8px; width: 0; border-radius: 4px; background: var(--ink); box-shadow: 0 0 0 2px #fff; }
.tg-finger { position: absolute; left: 0; top: 4px; width: 42px; animation: finger 1.8s var(--ease) infinite; filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.3)); }
#g-tear-guide.nudge { animation: nudge 0.35s; }
@keyframes dash { to { background-position: 24px 0; } }
@keyframes finger { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 75% { left: calc(100% - 30px); opacity: 1; } 100% { left: calc(100% - 30px); opacity: 0; } }
@keyframes nudge { 30% { margin-top: -8px; } 60% { margin-top: 6px; } }
#g-cancel { position: absolute; z-index: 8; left: 16px; top: max(16px, env(safe-area-inset-top)); display: none; }
.game[data-mode="opening"] #g-cancel { display: inline-flex; }

/* ---------- révélation ---------- */
.g-reveal { position: absolute; inset: 0; z-index: 6; display: none; cursor: pointer; }
.game[data-mode="reveal"] .g-reveal { display: block; }
.g-rv-info { position: absolute; left: 50%; bottom: calc(40px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 8px; opacity: 0; white-space: nowrap; pointer-events: none; }
.g-rv-info.show { animation: infoIn 0.5s var(--spring) forwards; }
.g-rv-info span { padding: 7px 14px; border-radius: 99px; font: 900 14px/1 var(--round); border: 3px solid var(--ink); background: #fff; box-shadow: 3px 3px 0 var(--ink); }
.g-rv-info .rv-r { font: 400 15px/1 var(--manga); }
.rv-r.r-R { background: var(--red); color: #fff; }
.rv-r.r-L { background: var(--gold); }
.rv-r.r-M { background: var(--ink); color: var(--gold); box-shadow: 3px 3px 0 var(--red); }
.rv-new { background: var(--red) !important; color: #fff; }
.g-rv-hint { position: absolute; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom)); text-align: center; font: 900 14px/1 var(--round); animation: pulse 1.6s ease-in-out infinite; }
#g-skip { position: absolute; right: 16px; top: max(16px, env(safe-area-inset-top)); }
@keyframes infoIn { from { opacity: 0; transform: translate(-50%, 12px) scale(0.8); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes pulse { 50% { opacity: 0.4; } }

.g-summary { position: absolute; left: 0; right: 0; top: max(18px, env(safe-area-inset-top)); z-index: 6; display: none; text-align: center; pointer-events: none; }
.game[data-mode="summary"] .g-summary { display: block; }
.g-summary h2 { margin: 0; font: 400 32px/1 var(--manga); text-shadow: 3px 3px 0 var(--red); color: var(--ink); }
.g-summary p { margin: 6px 0 0; font: 700 14px/1.3 var(--round); }
.r-txt-C { color: #6b6259; } .r-txt-R, .r-txt-M { color: var(--red); } .r-txt-L { color: #b07d00; }
.g-sum-actions { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 10px; pointer-events: auto; }

/* ---------- objectifs ---------- */
.g-quests {
  position: absolute; z-index: 9; right: 14px; top: 72px; width: min(380px, calc(100vw - 28px)); max-height: calc(100vh - 100px); overflow-y: auto;
  padding: 18px; border-radius: 16px; background: #fffdf8; border: 3.5px solid var(--ink); box-shadow: 6px 7px 0 var(--ink); animation: pop 0.3s var(--spring);
  overflow-x: hidden;
}
.g-quests header { display: flex; align-items: center; justify-content: space-between; }
.g-quests h3 { margin: 0; font: 400 20px/1 var(--manga); }
.g-quests-sub { margin: 6px 0 12px; font: 700 13px/1.35 var(--round); color: #6b6259; }
#g-quests-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.q { position: relative; padding: 12px 14px; border-radius: 4px; background: #fff7c7; border: 2.5px solid var(--ink); box-shadow: 3px 3px 0 rgba(20, 19, 18, 0.25); transform: rotate(-0.6deg); }
.q:nth-child(2n) { background: #ffe1e4; transform: rotate(0.5deg); }
.q-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.q-top b { font: 900 14px/1.3 var(--round); }
.q-rew { flex: none; font: 400 13px/1 var(--manga); color: var(--red); text-align: right; }
.q-rew.boost { padding: 3px 7px; border-radius: 6px; background: var(--ink); color: var(--gold); }
.q-tier { margin-top: 5px; font: 700 10.5px/1 var(--round); color: #8a8175; }
.g-qtabs { display: flex; gap: 8px; margin: 12px 0 0; }
.g-qtabs button { position: relative; flex: 1; padding: 8px 10px; border: 2.5px solid var(--ink); border-radius: 8px; background: #fff; font: 400 14px/1 var(--manga); cursor: pointer; }
.g-qtabs button.on { background: var(--ink); color: #fff; }
.g-qtabs .g-badge { top: -10px; right: -6px; }
.q-bar { position: relative; height: 14px; margin-top: 8px; border-radius: 7px; border: 2px solid var(--ink); background: #fff; overflow: hidden; }
.q-bar i { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(45deg, var(--ink) 0 4px, #3a3632 4px 8px); transition: width 0.5s var(--ease); }
.q-bar span { position: absolute; right: 3px; top: 0; padding: 0 5px; border-radius: 6px; background: #fff; font: 900 9.5px/10px var(--round); color: var(--ink); }
.q .g-btn { margin-top: 10px; }
.q.done { animation: qGlow 1.4s ease-in-out infinite; }
.q.claimed { opacity: 0.55; }
.q-stamp { position: absolute; right: 10px; bottom: 6px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; border: 3px solid var(--red); color: var(--red); font: 400 20px/1 var(--manga); transform: rotate(-14deg); }
.g-quests-bank { margin: 12px 0 0; font: 900 13px/1.3 var(--round); color: var(--red); }
.g-quests-bank:empty { display: none; }
.g-quests-reset { margin: 8px 0 0; font: 700 12px/1 var(--round); color: #8a8175; }
@keyframes qGlow { 50% { box-shadow: 3px 3px 0 var(--red), 0 0 0 3px rgba(229, 25, 47, 0.25); } }
@keyframes pop { from { opacity: 0; transform: scale(0.92) translateY(-8px); } }

.g-loading { position: absolute; inset: 0; z-index: 20; display: grid; place-content: center; justify-items: center; gap: 12px; background: var(--paper); font: 900 15px/1 var(--round); }
.g-spin { width: 44px; height: 44px; border: 5px solid var(--ink); border-right-color: var(--red); border-radius: 50%; animation: spin 0.8s linear infinite; }
.g-dev { position: absolute; z-index: 30; right: 12px; bottom: 12px; font: 700 11px/1 var(--round); padding: 6px 10px; border-radius: 99px; border: 2px dashed var(--ink); background: #fff; }

/* bouton du jeu dans l'en-tête de Koma */
.game-btn svg { fill: none !important; stroke-width: 2.2 !important; stroke-linecap: round; }
.game-btn .count { background: var(--red); }
.account-btn { overflow: visible; }
.account-btn svg { fill: none !important; stroke-width: 2.2 !important; stroke-linecap: round; }

/* ============================================================
   Carnet
   ============================================================ */
#binder { position: absolute; inset: 0; z-index: 12; }
.bn {
  position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(circle, rgba(20, 19, 18, 0.1) 1px, transparent 1.5px) 0 0 / 12px 12px,
    linear-gradient(#e9e2d4, #ddd4c2);
  animation: gIn 0.35s var(--ease);
}
.bn-top { display: flex; align-items: center; gap: 10px; padding: max(12px, env(safe-area-inset-top)) 14px 8px; flex-wrap: wrap; }
.bn-title { font: 400 24px/1 var(--manga); }
.bn-title i { font-style: normal; color: var(--red); font-size: 14px; margin-left: 6px; }
.bn-search { height: 40px; min-width: 0; flex: 1; max-width: 300px; margin-left: auto; padding: 0 14px; border-radius: 99px; border: 3px solid var(--ink); background: #fff; font: 700 14px/1 var(--round); outline: none; }
.bn-search:focus { box-shadow: 3px 3px 0 var(--red); }
.seg { display: flex; padding: 3px; border-radius: 99px; background: #fff; border: 3px solid var(--ink); }
.seg button { height: 30px; padding: 0 12px; border-radius: 99px; font: 900 12.5px/1 var(--round); }
.seg button.on { background: var(--ink); color: #fff; }
.bn-stage { position: relative; display: grid; place-items: center; perspective: 2400px; overflow: hidden; touch-action: pan-y; }
.bn-dock { display: grid; gap: 8px; padding: 6px 12px calc(12px + env(safe-area-inset-bottom)); }
.bn-nav { display: flex; align-items: center; justify-content: center; gap: 16px; font: 900 13px/1 var(--round); }
.bn-arrow { width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font-size: 16px; transition: transform 0.2s var(--spring); }
.bn-arrow:active { transform: scale(0.9); }
.bn-arrow:disabled { opacity: 0.3; }

/* livre */
.bn-book {
  --pw: min(88vw, 440px, calc((100vh - 250px) / 1.36));
  position: relative; width: var(--pw); height: calc(var(--pw) * 1.36); transform-style: preserve-3d; transition: transform 0.8s var(--ease);
}
.bn-book.spread { --pw: min(44vw, 480px, calc((100vh - 240px) / 1.36)); width: calc(var(--pw) * 2); }
.bn-book.spread.closed { transform: translateX(-25%) rotateX(10deg) rotateZ(-2deg); }
.bn-book.single.closed { transform: rotateX(10deg) rotateZ(-2deg) scale(0.95); }
.bn-book.thud { animation: thud 0.35s; }
@keyframes thud { 30% { transform: translateY(6px) scale(0.99); } }
.bn-page { position: absolute; top: 0; height: 100%; }
.bn-book.single .bn-page.left { display: none; }
.bn-book.single .bn-page.right { left: 0; width: 100%; }
.bn-book.spread .bn-page.left { left: 0; width: 50%; }
.bn-book.spread .bn-page.right { left: 50%; width: 50%; }

.bn-cover { position: absolute; top: 0; height: 100%; transform-origin: left center; transform-style: preserve-3d; z-index: 30; transition: transform 0.9s cubic-bezier(.5, 0, .2, 1), visibility 0s 0.9s; }
.bn-book.spread .bn-cover { left: 50%; width: 50%; }
.bn-book.single .bn-cover { left: 0; width: 100%; }
.bn-book:not(.closed) .bn-cover { transform: rotateY(-178deg); visibility: hidden; }
.bn-book.closed .bn-cover { visibility: visible; transition: transform 0.6s cubic-bezier(.5, 0, .2, 1); cursor: pointer; }
.bn-cover-front, .bn-cover-back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 4px 14px 14px 4px; }
.bn-cover-front {
  display: grid; place-content: center; justify-items: center; overflow: hidden; border: 4px solid var(--ink);
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.05) 0 2px, transparent 2px 4px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0 2px, transparent 2px 4px),
    radial-gradient(circle, rgba(0, 0, 0, 0.14) 1px, transparent 1.5px) 0 0 / 6px 6px,
    linear-gradient(140deg, #e5192f, #b8101f);
  box-shadow: 12px 16px 0 rgba(20, 19, 18, 0.45), inset 10px 0 0 rgba(0, 0, 0, 0.18);
}
.bn-cover-back { transform: rotateY(180deg); background: var(--paper); border: 4px solid var(--ink); }
.bn-label { display: grid; justify-items: center; gap: 6px; padding: 18px 26px; background: var(--paper); border: 3px solid var(--ink); border-radius: 6px; transform: rotate(-2deg); box-shadow: 4px 4px 0 var(--ink); }
.bn-label b { font: 400 clamp(34px, calc(var(--pw) * 0.13), 60px)/1 var(--manga); letter-spacing: 0.05em; }
.bn-label span { font: 900 12px/1 var(--round); letter-spacing: 0.1em; color: var(--red); }
.bn-label em { font: 700 13px/1 var(--round); font-style: normal; }
.bn-kanji { position: absolute; right: 12%; bottom: 6%; font: 400 calc(var(--pw) * 0.3)/1 var(--manga); color: rgba(255, 255, 255, 0.14); }
.bn-band {
  position: absolute; z-index: 40; top: -4%; bottom: -4%; width: 18px; border-radius: 9px; background: linear-gradient(90deg, #0d0c0b, #34302b 45%, #0d0c0b);
  box-shadow: 3px 0 0 rgba(0, 0, 0, 0.3); cursor: pointer; transition: transform 0.35s cubic-bezier(.5, -0.6, .3, 1.4), opacity 0.3s 0.1s;
}
.bn-book.spread .bn-band { right: 9%; }
.bn-book.single .bn-band { right: 9%; }
.bn-band:hover { transform: translateX(4px); }
.bn-band.snap { transform: translateX(160px) rotate(24deg) scaleY(0.9); opacity: 0; pointer-events: none; }
.bn-book:not(.closed) .bn-band { display: none; }
.bn-book.closed .bn-band { animation: bandHint 2.2s ease-in-out infinite; }
@keyframes bandHint { 0%, 70%, 100% { transform: none; } 80% { transform: translateX(6px); } 90% { transform: translateX(-2px); } }

/* intercalaires */
.bn-tabs { position: absolute; right: -34px; top: 8%; display: grid; gap: 6px; z-index: 5; }
.bn-book.closed .bn-tabs { opacity: 0; pointer-events: none; }
.bn-tab {
  width: 40px; height: 46px; padding-left: 6px; border-radius: 0 10px 10px 0; border: 3px solid var(--ink); border-left: 0; background: #fff;
  font: 400 15px/1 var(--manga); box-shadow: 3px 3px 0 rgba(20, 19, 18, 0.35); transition: transform 0.2s var(--spring);
}
.bn-tab:hover, .bn-tab.on { transform: translateX(5px); }
.bn-tab.t-ix { font: 900 10px/1 var(--round); writing-mode: vertical-rl; }
.bn-tab.t-M { background: var(--ink); color: var(--gold); }
.bn-tab.t-L { background: var(--gold); }
.bn-tab.t-R { background: var(--red); color: #fff; }
.bn-tab.t-C { background: #d8d1c4; }

/* feuille qui tourne */
.bn-leaf { position: absolute; top: 0; height: 100%; transform-origin: left center; transform-style: preserve-3d; z-index: 20; --shade: 0; }
.bn-book.spread .bn-leaf { left: 50%; width: 50%; }
.bn-book.single .bn-leaf { left: 0; width: 100%; }
.leaf-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.leaf-back { transform: rotateY(180deg); }
.leaf-shade { position: absolute; inset: 0; pointer-events: none; opacity: var(--shade); background: linear-gradient(90deg, rgba(20, 19, 18, 0.28), transparent 40%, rgba(255, 255, 255, 0.25) 75%, rgba(20, 19, 18, 0.15)); }

/* pages */
.pg { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto; padding: 5% 6% 3% 8%; overflow: hidden; border-radius: 3px 12px 12px 3px; color: var(--ink); }
.bn-page.left .pg, .leaf-back .pg { border-radius: 12px 3px 3px 12px; padding: 5% 8% 3% 6%; }
.pg-paper {
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.1), transparent 5%), radial-gradient(circle, rgba(20, 19, 18, 0.12) 0.9px, transparent 1.3px) 0 0 / 14px 14px, #fbf8f1;
  box-shadow: inset 0 0 0 2px rgba(20, 19, 18, 0.2);
}
.bn-page.left .pg-paper, .leaf-back .pg-paper { background: linear-gradient(270deg, rgba(0, 0, 0, 0.1), transparent 5%), radial-gradient(circle, rgba(20, 19, 18, 0.12) 0.9px, transparent 1.3px) 0 0 / 14px 14px, #fbf8f1; }
.pg-endpaper { position: absolute; inset: 0; border-radius: 12px 3px 3px 12px; background: radial-gradient(circle, rgba(0, 0, 0, 0.18) 1px, transparent 1.5px) 0 0 / 6px 6px, #b8101f; box-shadow: inset 0 0 0 4px var(--ink); }
.pg-head { position: relative; display: flex; align-items: center; gap: 8px; padding-bottom: 6px; margin-bottom: 8px; border-bottom: 3px solid var(--ink); }
.pg-stamp { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; font: 400 17px/1 var(--manga); border: 3px solid var(--ink); transform: rotate(-8deg); }
.pg-head.r-C .pg-stamp { background: #d8d1c4; } .pg-head.r-R .pg-stamp { background: var(--red); color: #fff; }
.pg-head.r-L .pg-stamp { background: var(--gold); } .pg-head.r-M .pg-stamp { background: var(--ink); color: var(--gold); box-shadow: 0 0 0 3px var(--red); }
.pg-titles { min-width: 0; flex: 1; display: grid; }
.pg-titles b { font: 400 clamp(13px, calc(var(--pw) * 0.042), 18px)/1.15 var(--manga); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-titles small { font: 700 11px/1.2 var(--round); color: #6b6259; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-prog { display: grid; justify-items: end; gap: 3px; width: 24%; flex: none; }
.pg-prog b { font: 400 13px/1 var(--manga); }
.pg-bar { width: 100%; height: 8px; border-radius: 4px; border: 2px solid var(--ink); background: #fff; overflow: hidden; }
.pg-bar i { display: block; height: 100%; background: var(--red); transition: width 0.5s var(--ease); }
.pg-seal { position: absolute; right: -4px; top: -10px; padding: 5px 9px; border-radius: 6px; background: var(--gold); border: 2.5px solid var(--ink); font: 400 11px/1 var(--manga); transform: rotate(8deg); box-shadow: 2px 2px 0 var(--ink); }
.pg-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 4%; min-height: 0; }
.pg-foot { font: 700 10px/1 var(--round); color: #8a8175; text-align: right; padding-top: 6px; }
.pg-kan {
  position: absolute; right: 9%; bottom: 7%; width: 30%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%;
  border: 5px solid var(--red); color: var(--red); font: 400 calc(var(--pw) * 0.13)/1 var(--manga); transform: rotate(-16deg); opacity: 0.85; pointer-events: none; mix-blend-mode: multiply;
}
.pg-kan.slam { animation: slam 0.45s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes slam { 0% { transform: rotate(-30deg) scale(3); opacity: 0; } 60% { transform: rotate(-12deg) scale(0.92); opacity: 1; } 100% { transform: rotate(-16deg) scale(1); } }

/* pochettes */
.sl { position: relative; min-height: 0; border-radius: 6px; overflow: hidden; }
.sl.own { padding: 0; border: 2.5px solid var(--ink); background: var(--ink); cursor: zoom-in; transition: transform 0.25s var(--spring); }
.sl.own img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sl.own::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(125deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.06) 28%, transparent 55%, rgba(255, 255, 255, 0.14) 82%); }
.sl.own:hover { transform: translateY(-3px) rotate(-1.2deg); }
.sl.own.r-R { box-shadow: 0 0 0 2.5px var(--red); }
.sl.own.r-L { box-shadow: 0 0 0 2.5px var(--gold), 0 0 12px rgba(242, 177, 0, 0.6); }
.sl.own.r-M { box-shadow: 0 0 0 2.5px var(--red), 0 0 0 5px var(--ink), 0 0 14px rgba(229, 25, 47, 0.7); }
.sl.snap { animation: snapIn 0.45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes snapIn { 0% { transform: scale(1.18) rotate(-4deg); } 55% { transform: scale(0.94); } 100% { transform: none; } }
.sl-vol { position: absolute; left: 3px; top: 3px; min-width: 20px; padding: 2px 4px; border-radius: 4px; background: var(--ink); color: #fff; font: 400 11px/1 var(--manga); text-align: center; z-index: 1; }
.sl-n { position: absolute; right: 3px; bottom: 3px; padding: 2px 5px; border-radius: 99px; background: var(--gold); font: 400 10px/1 var(--manga); border: 1.5px solid var(--ink); z-index: 1; }
.sl-gen { position: absolute; inset: auto 0 0 0; padding: 3px; background: rgba(20, 19, 18, 0.82); color: var(--gold); font: 400 11px/1 var(--manga); text-align: center; }
.sl.empty { display: grid; place-content: center; justify-items: center; gap: 2px; border: 2.5px dashed rgba(20, 19, 18, 0.35); background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(20, 19, 18, 0.04)); color: rgba(20, 19, 18, 0.3); }
.sl.empty span { font: 400 12px/1 var(--manga); }
.sl.empty b { font: 400 clamp(16px, calc(var(--pw) * 0.06), 28px)/1 var(--manga); }
.sl.empty em { font: 900 9px/1 var(--round); font-style: normal; color: var(--red); }
.sl.pending { border-color: var(--red); color: var(--red); animation: pendingPulse 1.2s ease-in-out infinite; }
.sl.target { outline: 4px solid var(--red); outline-offset: 2px; animation: pendingPulse 0.6s ease-in-out infinite; }
@keyframes pendingPulse { 50% { background-color: rgba(229, 25, 47, 0.12); } }
.sl-void { visibility: hidden; }

/* intro & index */
.pg-intro, .pg-index { align-content: start; gap: 12px; grid-template-rows: none; }
.pg-intro h3 { margin: 0; font: 400 26px/1.1 var(--manga); }
.intro-jp { margin: -6px 0 0; font: 400 15px/1 var(--manga); color: var(--red); letter-spacing: 0.25em; }
.intro-big { display: flex; align-items: baseline; gap: 10px; padding: 12px 16px; border: 3px solid var(--ink); border-radius: 12px; background: var(--red); color: #fff; box-shadow: 4px 4px 0 var(--ink); }
.intro-big b { font: 400 42px/1 var(--manga); }
.intro-big span { font: 900 14px/1 var(--round); }
.intro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.intro-grid div { display: grid; justify-items: center; padding: 8px 4px; border: 2.5px solid var(--ink); border-radius: 10px; background: #fff; }
.intro-grid b { font: 400 20px/1 var(--manga); }
.intro-grid span { font: 900 11px/1.2 var(--round); color: #6b6259; }
.intro-rar { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.intro-rar li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; border: 2px solid var(--ink); background: #fff; font: 900 13px/1 var(--round); }
.intro-rar li span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 400 13px/1 var(--manga); border: 2px solid var(--ink); }
.intro-rar li b { margin-left: auto; font: 400 16px/1 var(--manga); }
.intro-rar .r-C span { background: #d8d1c4; } .intro-rar .r-R span { background: var(--red); color: #fff; } .intro-rar .r-L span { background: var(--gold); } .intro-rar .r-M span { background: var(--ink); color: var(--gold); }
.intro-tip { margin: 0; font: 700 13px/1.4 var(--round); color: #6b6259; }
.pg-index h4 { margin: 0; font: 400 20px/1 var(--manga); }
.ix-list { display: grid; gap: 6px; align-content: start; }
.ix { display: grid; grid-template-columns: 26px 1fr 60px 40px; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; border: 2px solid var(--ink); background: #fff; text-align: left; transition: transform 0.2s var(--spring); }
.ix:hover { transform: translateX(4px); }
.ix-stamp { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 400 12px/1 var(--manga); border: 2px solid var(--ink); }
.ix.r-C .ix-stamp { background: #d8d1c4; } .ix.r-R .ix-stamp { background: var(--red); color: #fff; } .ix.r-L .ix-stamp { background: var(--gold); } .ix.r-M .ix-stamp { background: var(--ink); color: var(--gold); }
.ix-title { font: 900 12.5px/1.2 var(--round); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ix-prog { height: 7px; border-radius: 4px; border: 1.5px solid var(--ink); overflow: hidden; }
.ix-prog i { display: block; height: 100%; background: var(--red); }
.ix b { font: 400 11px/1 var(--manga); text-align: right; }

/* pile à ranger */
.bn-tray { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 70px; }
.tray-label { font: 900 13px/1.2 var(--round); text-align: right; }
.tray-label b { display: block; font: 400 24px/1 var(--manga); color: var(--red); }
.tray-pile { position: relative; display: flex; height: 76px; }
.tray-card {
  position: relative; width: 52px; height: 72px; margin-left: -16px; border-radius: 6px; overflow: hidden; border: 2.5px solid var(--ink); background: var(--ink);
  transform: rotate(calc((var(--k) - 3) * 4deg)) translateY(calc(var(--k) * -1px)); box-shadow: 2px 3px 0 rgba(20, 19, 18, 0.4); touch-action: none; cursor: grab;
  transition: transform 0.25s var(--spring);
}
.tray-card:first-child { margin-left: 0; }
.tray-card:hover { transform: translateY(-10px) rotate(-3deg); z-index: 3; }
.tray-card.lifted { opacity: 0.3; }
.tray-card img { width: 100%; height: 100%; object-fit: cover; }
.tray-card span { position: absolute; left: 2px; top: 2px; padding: 1px 4px; border-radius: 3px; background: var(--ink); color: #fff; font: 400 10px/1 var(--manga); }
.tray-card em { position: absolute; right: 2px; bottom: 2px; padding: 1px 3px; border-radius: 3px; background: var(--gold); font: 900 8px/1 var(--round); font-style: normal; }
.tray-card.r-R { border-color: var(--red); } .tray-card.r-L { border-color: var(--gold); } .tray-card.r-M { box-shadow: 0 0 0 2px var(--red), 2px 3px 0 rgba(20, 19, 18, 0.4); }
.tray-empty { font: 900 14px/1 var(--round); color: #6b6259; }
.fly-card { position: fixed; z-index: 400; left: 0; top: 0; border-radius: 6px; overflow: hidden; border: 2.5px solid var(--ink); background: var(--ink); pointer-events: none; box-shadow: 6px 10px 0 rgba(20, 19, 18, 0.35); }
.fly-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fly-card.drag { width: 68px; height: 96px; }

/* zoom sur une carte */
.card-zoom { position: fixed; inset: 0; z-index: 300; display: grid; place-content: center; justify-items: center; gap: 16px; background: rgba(243, 239, 230, 0.86); backdrop-filter: blur(6px); animation: gIn 0.25s; }
.cz-card { --rx: 0deg; --ry: 0deg; --px: 50%; --py: 50%; position: relative; width: min(72vw, 330px, 48vh); aspect-ratio: 512 / 732; perspective: 900px; animation: pop 0.4s var(--spring); }
.cz-tilt { position: absolute; inset: 0; transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform 0.12s linear; filter: drop-shadow(8px 12px 0 rgba(20, 19, 18, 0.35)); }
.cz-canvas { width: 100%; height: 100%; display: block; border-radius: 6%/4%; }
.cz-glare { position: absolute; inset: 0; border-radius: 6%/4%; pointer-events: none; mix-blend-mode: overlay; background: radial-gradient(circle at var(--px) var(--py), rgba(255, 255, 255, 0.7), transparent 55%); }
.cz-card.r-M .cz-tilt { filter: drop-shadow(0 0 22px rgba(229, 25, 47, 0.7)) drop-shadow(8px 12px 0 rgba(20, 19, 18, 0.35)); }
.cz-card.r-L .cz-tilt { filter: drop-shadow(0 0 18px rgba(242, 177, 0, 0.7)) drop-shadow(8px 12px 0 rgba(20, 19, 18, 0.35)); }
.cz-info { display: grid; justify-items: center; gap: 6px; text-align: center; }
.cz-info b { font: 400 20px/1.2 var(--manga); max-width: 80vw; }
.cz-info span { font: 900 14px/1.3 var(--round); }
.cz-actions { display: flex; gap: 8px; margin-top: 6px; }

@media (max-width: 700px) {
  /* téléphone : bandeau sur deux lignes (Accueil + musique / compteur + boutons) au lieu de déborder */
  .g-top { flex-wrap: wrap; column-gap: 8px; row-gap: 0; padding-left: 12px; padding-right: 12px; }
  .g-top::after { content: ""; order: 2; flex: 1 1 100%; height: 0; }
  .g-right { display: contents; }
  #g-back { order: 0; }
  #g-music { order: 1; margin-left: auto; }
  .g-counter, #g-quests-btn, #g-binder, #g-friends { order: 3; margin-top: 10px; }
  #g-quests-btn, #g-binder, #g-friends { flex: 1 1 0; min-width: 0; padding: 0 6px; }
  .g-quests { top: 172px; max-height: calc(100vh - 186px); }
  .g-title { display: none; }
  .g-top .g-shelves { position: static; transform: none; order: 4; flex: 1 1 100%; justify-content: center; margin-top: 10px; }
  .g-top .g-shelves .g-btn { flex: 1 1 0; min-width: 0; height: 38px; padding: 0 8px; }
  .g-counter span { display: none; }
  .g-btn { padding: 0 13px; font-size: 13px; height: 40px; }
  .bn-title { display: none; }
  .bn-search { max-width: none; }
  .bn-tabs { right: -30px; }
  .bn-tab { width: 34px; height: 40px; font-size: 13px; }
  .tray-card { width: 44px; height: 62px; }
}
@media (prefers-reduced-motion: reduce) { .game *, .card-zoom * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* coffre du jour et défis de la semaine */
.q-chest { position: relative; padding: 14px; border-radius: 10px; background: var(--ink); color: #fff; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--red); list-style: none; }
.q-chest .q-top b { font: 400 16px/1 var(--manga); }
.q-chest .q-rew { color: var(--gold); }
.q-chest p { margin: 6px 0 0; font: 700 12px/1.35 var(--round); opacity: 0.8; }
.q-chest .q-bar { border-color: #fff; }
.q-chest .q-bar i { background: repeating-linear-gradient(45deg, var(--gold) 0 4px, #d69a00 4px 8px); }
.q-chest.done { animation: qGlow 1.2s ease-in-out infinite; }
.q-chest.claimed { opacity: 0.6; }
.q-chest .q-stamp { border-color: var(--gold); color: var(--gold); }
.q-head { list-style: none; margin-top: 8px; font: 400 16px/1 var(--manga); }

/* ---------- étagères : mangas / OST / openings ---------- */
.g-shelves { position: absolute; z-index: 5; top: calc(max(14px, env(safe-area-inset-top)) + 58px); left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.g-shelves .g-btn { height: 38px; padding: 0 16px; font-size: 13.5px; }
.g-shelves .g-btn.on { background: var(--ink); color: #fff; }
.g-shelves .g-btn.on .sh-note { color: var(--gold); }
.g-shelves .sh-note { color: var(--red); font-size: 15px; }
.game:not([data-mode="home"]) .g-shelves { display: none; }
@media (max-width: 520px) { .g-shelves .g-btn { padding: 0 12px; font-size: 12.5px; } }

/* ---------- bouton lecture posé sur les cartes musicales ---------- */
.g-play { position: absolute; left: 0; top: 0; z-index: 8; padding: 0; border-radius: 50%; border: 0; background: transparent; cursor: pointer; will-change: transform; }
.g-play[hidden] { display: none; }
.g-play::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--gold); opacity: 0; }
.g-play:not(.playing)::after { animation: playHint 1.6s ease-out infinite; }
@keyframes playHint { 0% { opacity: 0.9; transform: scale(0.85); } 100% { opacity: 0; transform: scale(1.35); } }
.g-play i { position: absolute; inset: 0; border-radius: 50%; display: none; background: var(--red); border: 3.5px solid var(--ink); }
.g-play.playing i { display: block; animation: playPulse 1s ease-in-out infinite; }
.g-play.playing i::before, .g-play.playing i::after { content: ""; position: absolute; top: 28%; bottom: 28%; width: 13%; background: #fff; border: 2px solid var(--ink); border-radius: 2px; }
.g-play.playing i::before { left: 31%; } .g-play.playing i::after { right: 31%; }
@keyframes playPulse { 50% { transform: scale(1.08); } }

/* ---------- carnet : pages spéciales des cartes musicales ---------- */
.bn-tab.t-mu { background: #1d2b4f; color: #fff; font: 900 10px/1 var(--round); }
.pg-music .pg-grid { background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(29, 43, 79, 0.05) 22px 23px); }
.sl.music.empty span { color: var(--red); opacity: 0.55; font-size: 16px; }
.sl-mname {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 4px 3px; z-index: 1; text-align: center; color: #fff;
  font: 900 9.5px/1.15 var(--round); background: linear-gradient(transparent, rgba(20, 19, 18, 0.92) 55%);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sl.music .sl-n { bottom: 26px; }
.sl-play {
  position: absolute; right: 3px; top: 3px; z-index: 2; width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: var(--red); border: 2.5px solid var(--ink); transition: transform 0.2s var(--spring);
}
.sl-play:hover { transform: scale(1.15); }
.sl-play i { width: 0; height: 0; margin-left: 2px; border-left: 8px solid #fff; border-top: 5.5px solid transparent; border-bottom: 5.5px solid transparent; }
.sl-play.playing { background: var(--gold); animation: playPulse 1s ease-in-out infinite; }
.sl-play.playing i { width: 8px; height: 9px; margin: 0; border: 0; border-left: 3px solid var(--ink); border-right: 3px solid var(--ink); }
.intro-music { margin: 10px 0 0; font: 900 12.5px/1.4 var(--round); color: #1d2b4f; text-align: center; }
.cz-play { position: absolute; z-index: 3; transform: translate(-50%, -50%); padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.cz-play i { position: absolute; inset: 0; border-radius: 50%; display: none; background: var(--red); border: 3px solid var(--ink); }
.cz-play.playing i { display: block; animation: playPulse 1s ease-in-out infinite; }
.cz-play.playing i::before, .cz-play.playing i::after { content: ""; position: absolute; top: 28%; bottom: 28%; width: 13%; background: #fff; border: 2px solid var(--ink); border-radius: 2px; }
.cz-play.playing i::before { left: 31%; } .cz-play.playing i::after { right: 31%; }

/* ---------- téléphone : carnet, résumé du pack (rien ne change sur ordinateur) ---------- */
@media (max-width: 700px) {
  .g-sum-actions { flex-wrap: wrap; justify-content: center; }
  .g-sum-actions .g-btn { white-space: nowrap; }
  .bn-top { row-gap: 8px; }
  .bn-top .seg { margin-left: auto; }
  .bn-top .bn-search { order: 5; flex: 1 1 100%; margin-left: 0; }
  .bn-book { --pw: min(82vw, 440px, calc((100vh - 330px) / 1.36)); --pw: min(82vw, 440px, calc((100dvh - 330px) / 1.36)); }   /* dvh : la barre du navigateur du téléphone est comptée */
  .bn-tab.t-mu { font-size: 9px; padding-left: 3px; }
  .bn-nav { gap: 12px; }
  .bn-tray { gap: 8px; }
  .tray-label { white-space: nowrap; font-size: 11px; }
  .tray-label b { font-size: 20px; }
  .bn-tray .g-btn { white-space: nowrap; padding: 0 12px; }
  .tray-card { width: 40px; height: 56px; margin-left: -20px; }
  .tray-pile { height: 62px; }
  .bn-top .bn-search { box-sizing: border-box; }
  .bn-top .seg button { padding: 0 9px; font-size: 12px; }
  .pg-intro { gap: 7px; }
  .pg-intro h3 { font-size: 21px; }
  .intro-jp { margin-top: -4px; font-size: 13px; }
  .intro-big { padding: 7px 12px; }
  .intro-big b { font-size: 30px; }
  .intro-big span { font-size: 12px; }
  .intro-grid { gap: 6px; }
  .intro-grid div { padding: 4px 3px; }
  .intro-grid b { font-size: 17px; }
  .intro-rar { gap: 4px; }
  .intro-rar li { padding: 3px 8px; font-size: 12px; }
  .intro-rar li span { width: 21px; height: 21px; font-size: 11px; }
  .intro-tip, .intro-music { font-size: 11.5px; line-height: 1.3; }
  .pg-titles b { font-size: 13px; }
}

/* pendant un rangement automatique, la navigation du carnet est suspendue (voir binder.js) */
.bn-busy .bn-nav, .bn-busy .bn-tabs, .bn-busy .bn-top .seg, .bn-busy .bn-top .bn-search { opacity: 0.55; pointer-events: none; }
