:root {
  --gold: #e0bd78; --gold-2: #f3dcaa; --ink: #f6efe2; --ink-2: rgba(246, 239, 226, .72); --ink-3: rgba(246, 239, 226, .5);
  --glass: rgba(20, 14, 10, .58); --glass-2: rgba(20, 14, 10, .78); --line: rgba(224, 189, 120, .28);
  --serif: 'Cormorant Garamond', Georgia, serif; --sans: Inter, system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #0e0a08; color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.tilt { position: fixed; left: 0; right: 0; height: 24%; pointer-events: none; backdrop-filter: blur(2.5px); -webkit-backdrop-filter: blur(2.5px); }
#tilt-t { top: 0; -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 100%); mask-image: linear-gradient(180deg, #000 0%, transparent 100%); }
#tilt-b { bottom: 0; height: 20%; -webkit-mask-image: linear-gradient(0deg, #000 0%, transparent 100%); mask-image: linear-gradient(0deg, #000 0%, transparent 100%); }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(10, 6, 4, .45) 100%); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 26px; border-radius: 999px; background: linear-gradient(180deg, #ecca88, #c99a52); color: #24170c; font-weight: 600; font-size: 15px; letter-spacing: .01em; box-shadow: 0 10px 30px -10px rgba(224, 160, 80, .6), inset 0 1px 0 rgba(255, 255, 255, .5); transition: transform .2s, box-shadow .2s, opacity .2s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 14px 34px -10px rgba(224, 160, 80, .75), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn:disabled { opacity: .45; cursor: default; transform: none; background: rgba(255, 255, 255, .12); color: var(--ink-2); box-shadow: none; }
.btn.ghost { background: rgba(255, 255, 255, .06); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { background: rgba(255, 255, 255, .1); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px var(--line); color: var(--gold-2); }
.icon-btn svg { width: 20px; height: 20px; }
.link { color: var(--ink-3); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--ink-2); }
#snd .off-i { display: none; } #snd.muted .off-i { display: block; } #snd.muted .on-i { display: none; }

/* ---------- accueil + frise ---------- */
#home { position: fixed; inset: 0; display: grid; grid-template-columns: 1fr minmax(300px, 400px); grid-template-rows: 1fr auto auto; padding: calc(36px + var(--safe-t)) 48px calc(20px + var(--safe-b)); gap: 18px 40px; opacity: 0; pointer-events: none; transition: opacity .6s; background: linear-gradient(90deg, rgba(12, 8, 6, .62) 0%, rgba(12, 8, 6, .1) 50%, rgba(12, 8, 6, .4) 100%), linear-gradient(0deg, rgba(12, 8, 6, .85) 0%, transparent 38%); }
#home.on { opacity: 1; pointer-events: auto; }
.brand { align-self: start; max-width: 560px; }
.kicker { font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.brand h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(46px, 6.4vw, 92px); line-height: .92; margin: 14px 0 18px; letter-spacing: -.01em; text-shadow: 0 2px 30px rgba(0, 0, 0, .35); }
.brand h1 em { font-style: italic; font-weight: 500; color: var(--gold-2); }
.tag { font-family: var(--serif); font-size: 21px; line-height: 1.35; color: var(--ink-2); max-width: 420px; font-style: italic; }
#panel { grid-column: 2; grid-row: 1; align-self: end; padding: 28px 28px 26px; border-radius: 22px; background: var(--glass); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); box-shadow: inset 0 0 0 1px var(--line), 0 30px 60px -30px rgba(0, 0, 0, .6); }
#panel.swap > * { animation: rise .55s cubic-bezier(.2, .8, .2, 1) both; }
#panel.swap > *:nth-child(2) { animation-delay: .04s } #panel.swap > *:nth-child(3) { animation-delay: .08s } #panel.swap > *:nth-child(4) { animation-delay: .12s } #panel.swap > *:nth-child(5) { animation-delay: .16s } #panel.swap > *:nth-child(6) { animation-delay: .2s }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.p-ref { font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.p-title { font-family: var(--serif); font-size: 42px; font-weight: 600; line-height: 1; margin: 10px 0 8px; }
.p-meta { font-size: 13px; color: var(--ink-3); }
.p-desc { font-family: var(--serif); font-size: 19px; line-height: 1.4; color: var(--ink-2); margin: 16px 0 12px; }
.p-hero { font-size: 13px; color: var(--gold-2); margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.p-hero::before { content: ''; width: 18px; height: 1px; background: var(--gold); }
#play { width: 100%; }

#frise { grid-column: 1 / -1; grid-row: 2; position: relative; overflow-x: auto; scrollbar-width: none; padding: 6px 0 4px; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
#frise::-webkit-scrollbar { display: none; }
#frise ol { list-style: none; display: flex; justify-content: space-between; min-width: 900px; position: relative; padding: 0 2%; }
#frise ol::before { content: ''; position: absolute; left: 4%; right: 4%; top: 33px; height: 1px; background: linear-gradient(90deg, transparent, var(--line) 8%, var(--line) 92%, transparent); }
.ep { flex: 1; display: flex; justify-content: center; position: relative; }
.ep button { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 0 4px; cursor: default; }
.ep.play button { cursor: pointer; }
.med { position: relative; width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; background: rgba(20, 14, 10, .75); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-3); transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s, color .3s, background .3s; }
.med svg { width: 30px; height: 30px; }
.ep.soon .med { width: 30px; height: 30px; margin: 18px 0; background: rgba(20, 14, 10, .55); }
.ep.soon .med svg { width: 18px; height: 18px; opacity: .6; }
.ep.play.locked .med { color: rgba(246, 239, 226, .35); }
.ep.play.open .med { color: var(--gold-2); box-shadow: inset 0 0 0 1.5px var(--gold); }
.ep.play.open button:hover .med { transform: translateY(-3px); }
.ep.sel .med { background: linear-gradient(180deg, #ecca88, #c99a52); color: #24170c; box-shadow: 0 0 0 5px rgba(224, 189, 120, .18), 0 10px 30px -6px rgba(224, 170, 90, .7); transform: scale(1.06); }
.ep.sel.locked .med { background: rgba(60, 46, 34, .9); color: var(--ink-2); box-shadow: 0 0 0 5px rgba(224, 189, 120, .12); }
.ck { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%; background: #2c6b4a; color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 2px #120d0a; }
.ck svg { width: 13px !important; height: 13px !important; opacity: 1 !important; }
.nm { font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.ep.soon .nm { font-size: 15px; color: var(--ink-3); font-weight: 500; }
.er { font-size: 11px; color: var(--ink-3); letter-spacing: .04em; white-space: nowrap; }
.ep.play.locked .nm { color: var(--ink-3); }
.ep.fresh .med { animation: unlock 1.6s cubic-bezier(.2, .8, .2, 1) .5s both; }
@keyframes unlock { 0% { transform: scale(.6); box-shadow: 0 0 0 0 rgba(255, 220, 150, .9); } 50% { transform: scale(1.18); box-shadow: 0 0 0 22px rgba(255, 220, 150, 0); } 100% { transform: scale(1.06); } }
.home-foot { grid-column: 1 / -1; grid-row: 3; display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--ink-3); }
.foot-r { display: flex; align-items: center; gap: 16px; }

/* ---------- jeu ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity .5s; }
#hud.on { opacity: 1; }
#obj { position: absolute; left: 22px; top: calc(20px + var(--safe-t)); max-width: min(360px, calc(100vw - 100px)); padding: 14px 18px 15px 18px; border-radius: 16px; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: inset 0 0 0 1px var(--line); opacity: 0; transform: translateY(-8px); transition: opacity .5s, transform .5s; }
#obj.on { opacity: 1; transform: none; }
#obj.pulse { animation: pulse 1.4s ease-out; }
@keyframes pulse { 0% { box-shadow: inset 0 0 0 1px var(--gold), 0 0 0 0 rgba(224, 189, 120, .55); } 100% { box-shadow: inset 0 0 0 1px var(--line), 0 0 0 18px rgba(224, 189, 120, 0); } }
.o-step { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.o-title { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 3px 0 4px; }
.o-text { font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
#menu-btn { position: absolute; right: 20px; top: calc(20px + var(--safe-t)); pointer-events: auto; }
#prompt { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: 6px 13px 6px 6px; border-radius: 999px; background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--line), 0 8px 20px -8px rgba(0, 0, 0, .5); font-size: 13.5px; font-weight: 500; white-space: nowrap; opacity: 0; transition: opacity .2s; }
#prompt.on { opacity: 1; }
#prompt kbd { font-family: var(--sans); font-size: 12px; font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #24170c; }
.touch #prompt kbd { display: none; } .touch #prompt { padding-left: 13px; }
#arrow { position: absolute; left: 0; top: 0; width: 34px; height: 34px; color: var(--gold-2); filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); opacity: 0; transition: opacity .3s; }
#arrow.on { opacity: .95; animation: nudge 1.2s ease-in-out infinite; }
#arrow svg { width: 100%; height: 100%; }
#toast { position: absolute; left: 50%; top: calc(26px + var(--safe-t)); transform: translate(-50%, -10px); font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--gold-2); text-shadow: 0 2px 12px rgba(0, 0, 0, .7); opacity: 0; transition: opacity .4s, transform .4s; white-space: nowrap; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* dialogue */
#dlg { position: fixed; left: 50%; bottom: calc(26px + var(--safe-b)); width: min(780px, calc(100vw - 28px)); transform: translate(-50%, 24px); opacity: 0; pointer-events: none; transition: opacity .3s, transform .35s cubic-bezier(.2, .8, .2, 1); z-index: 5; }
#dlg.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; cursor: pointer; }
.d-in { position: relative; padding: 26px 30px 24px; border-radius: 20px; background: linear-gradient(180deg, rgba(28, 20, 14, .86), rgba(16, 11, 8, .9)); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: inset 0 0 0 1px var(--line), 0 30px 60px -25px rgba(0, 0, 0, .7); }
.d-in::before { content: ''; position: absolute; left: 30px; right: 30px; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .7; }
.d-name { position: absolute; top: -14px; left: 24px; padding: 5px 14px; border-radius: 999px; background: #1c140e; box-shadow: inset 0 0 0 1px var(--gold); font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; color: var(--gold-2); }
.d-text { font-family: var(--serif); font-size: 24px; line-height: 1.38; min-height: 66px; color: var(--ink); font-weight: 500; }
.d-text .ghost { opacity: 0; }
.d-next { position: absolute; right: 20px; bottom: 12px; width: 18px; height: 18px; color: var(--gold); opacity: 0; }
#dlg.ready .d-next { opacity: 1; animation: bob 1s ease-in-out infinite; }
#dlg.voice .d-in { background: radial-gradient(ellipse at 50% 0%, rgba(120, 90, 40, .55), rgba(16, 11, 8, .9) 70%); box-shadow: inset 0 0 0 1px rgba(243, 220, 170, .55), 0 0 70px -10px rgba(255, 210, 130, .35), 0 30px 60px -25px rgba(0, 0, 0, .7); }
#dlg.voice .d-text { font-style: italic; text-align: center; color: #fff6e2; text-shadow: 0 0 22px rgba(255, 210, 140, .45); }
#dlg.voice .d-name { left: 50%; transform: translateX(-50%); background: linear-gradient(180deg, #ecca88, #c99a52); color: #24170c; box-shadow: none; }
#dlg.narr .d-name { display: none; }
#dlg.narr .d-text { font-style: italic; text-align: center; color: var(--ink-2); }
@keyframes bob { 50% { transform: translateY(3px); } }
@keyframes nudge { 50% { filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)) brightness(1.25); } }

/* tactile */
#joyzone, #joy, #act { display: none; }
.touch.playing #joyzone { display: block; position: fixed; left: 0; bottom: 0; width: 55%; height: 62%; z-index: 2; touch-action: none; }
.touch.playing #joy { display: block; position: fixed; left: 90px; top: calc(100% - 130px); width: 116px; height: 116px; margin: -58px 0 0 -58px; border-radius: 50%; background: rgba(20, 14, 10, .28); box-shadow: inset 0 0 0 1.5px rgba(243, 220, 170, .35); pointer-events: none; z-index: 3; opacity: .55; transition: opacity .2s; }
.touch.playing #joy.on { opacity: 1; }
#knob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; border-radius: 50%; transform: translate(-50%, -50%); background: radial-gradient(circle at 40% 35%, #f6dfae, #c99a52); box-shadow: 0 6px 16px -4px rgba(0, 0, 0, .5); }
.touch.playing #act { display: grid; place-items: center; position: fixed; right: 26px; bottom: calc(40px + var(--safe-b)); width: 84px; height: 84px; border-radius: 50%; background: rgba(20, 14, 10, .45); box-shadow: inset 0 0 0 1.5px rgba(243, 220, 170, .4); z-index: 3; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background .2s, transform .1s; }
.touch.playing #act span { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.15; padding: 0 8px; color: var(--ink-2); }
.touch.playing #act.ready { background: linear-gradient(180deg, #ecca88, #c99a52); box-shadow: 0 10px 30px -8px rgba(224, 160, 80, .7); }
.touch.playing #act.ready span { color: #24170c; }
.touch.playing #act:active { transform: scale(.94); }
.touch #dlg { bottom: calc(14px + var(--safe-b)); }
.touch.playing #dlg.on ~ #act, .touch.playing #dlg.on ~ #joy { opacity: 0; pointer-events: none; }

/* carte d'épisode */
#card { position: fixed; inset: 0; z-index: 20; background: radial-gradient(ellipse at 50% 40%, #241911, #0b0806 75%); display: grid; place-items: center; text-align: center; opacity: 0; pointer-events: none; transition: opacity .7s; padding: 24px; }
#card.on { opacity: 1; pointer-events: auto; }
#card.on.out { opacity: 0; }
#card.on .c-in > * { animation: card 1.4s cubic-bezier(.2, .8, .2, 1) both; }
#card.on .c-ref { animation-delay: .25s } #card.on .c-title { animation-delay: .45s } #card.on .c-rule { animation-delay: .75s } #card.on .c-sub { animation-delay: .9s } #card.on .c-hero { animation-delay: 1.1s }
@keyframes card { from { opacity: 0; transform: translateY(12px); letter-spacing: .02em; filter: blur(4px); } }
.c-num { font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--ink-3); }
.c-ref { font-size: 13px; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); margin-top: 18px; font-weight: 600; }
.c-title { font-family: var(--serif); font-weight: 600; font-size: clamp(52px, 9vw, 110px); line-height: 1; margin: 14px 0 22px; }
.c-rule { width: 64px; height: 1px; margin: 0 auto 18px; background: var(--gold); }
.c-sub { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--ink-2); }
.c-hero { margin-top: 16px; font-size: 13px; color: var(--ink-3); letter-spacing: .06em; }

/* épisode accompli */
#done { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 50%, rgba(14, 10, 8, .55), rgba(10, 7, 5, .9)); opacity: 0; pointer-events: none; transition: opacity 1s; text-align: center; }
#done.on { opacity: 1; pointer-events: auto; }
.dn-in { max-width: 640px; }
#done.on .dn-in > * { animation: card 1.3s cubic-bezier(.2, .8, .2, 1) both; }
#done.on .dn-in > *:nth-child(2) { animation-delay: .2s } #done.on .dn-in > *:nth-child(3) { animation-delay: .5s } #done.on .dn-in > *:nth-child(4) { animation-delay: .7s } #done.on .dn-in > *:nth-child(5) { animation-delay: .9s } #done.on .dn-in > *:nth-child(6) { animation-delay: 1.1s }
.dn-k { font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
#done h2 { font-family: var(--serif); font-size: clamp(44px, 7vw, 76px); font-weight: 600; margin: 12px 0 26px; line-height: 1; }
#done blockquote { font-family: var(--serif); font-style: italic; font-size: clamp(22px, 3vw, 30px); line-height: 1.35; color: var(--ink); }
#done cite { display: block; margin-top: 12px; font-style: normal; font-size: 13px; letter-spacing: .12em; color: var(--gold-2); text-transform: uppercase; }
.dn-note { margin: 26px 0 26px; font-size: 14px; color: var(--ink-3); }

/* menu */
#menu { position: fixed; inset: 0; z-index: 12; display: grid; place-items: center; background: rgba(10, 7, 5, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .25s; }
#menu.on { opacity: 1; pointer-events: auto; }
.m-in { width: min(360px, calc(100vw - 40px)); padding: 30px 26px 24px; border-radius: 22px; background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 10px; text-align: center; }
.m-in h3 { font-family: var(--serif); font-size: 34px; font-weight: 600; margin-bottom: 8px; }
.m-help { font-size: 12px; color: var(--ink-3); line-height: 1.5; margin-top: 8px; }
.touch .m-help { display: none; }

#fade { position: fixed; inset: 0; z-index: 30; background: #0b0806; opacity: 0; pointer-events: none; transition: opacity .7s; }
#fade.on { opacity: 1; pointer-events: auto; }
#loading { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; align-content: center; gap: 22px; background: #0b0806; transition: opacity .8s; }
#loading.off { opacity: 0; pointer-events: none; }
.l-title { font-family: var(--serif); font-size: 34px; font-weight: 600; } .l-title em { color: var(--gold-2); font-weight: 500; }
.l-bar { width: 140px; height: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; border-radius: 2px; margin: 0 auto; }
.l-bar i { display: block; width: 40%; height: 100%; background: var(--gold); animation: load 1.2s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ---------- mobile ---------- */
@media (max-width: 820px) {
  #home { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto auto; padding: calc(22px + var(--safe-t)) 18px calc(14px + var(--safe-b)); gap: 12px; background: linear-gradient(180deg, rgba(12, 8, 6, .6) 0%, transparent 30%), linear-gradient(0deg, rgba(12, 8, 6, .92) 0%, rgba(12, 8, 6, .5) 45%, transparent 70%); }
  .brand h1 { font-size: 46px; margin: 8px 0 8px; }
  .tag { font-size: 17px; }
  #panel { grid-column: 1; grid-row: 2; padding: 20px 20px 18px; border-radius: 18px; }
  .p-title { font-size: 32px; }
  .p-desc { font-size: 16.5px; margin: 10px 0 10px; }
  .p-hero { margin-bottom: 14px; }
  #frise { grid-row: 3; }
  #frise ol { min-width: 760px; }
  .med { width: 56px; height: 56px; } .med svg { width: 26px; height: 26px; }
  #frise ol::before { top: 28px; }
  .ep.soon .med { margin: 13px 0; }
  .nm { font-size: 16px; }
  .home-foot { grid-row: 4; font-size: 11px; }
  .home-foot .hint { display: none; }
  #obj { left: 12px; top: calc(12px + var(--safe-t)); padding: 10px 14px 11px; }
  .o-title { font-size: 18px; } .o-text { font-size: 12.5px; }
  #menu-btn { right: 12px; top: calc(12px + var(--safe-t)); }
  .d-in { padding: 22px 20px 20px; }
  .d-text { font-size: 19.5px; min-height: 54px; }
  .c-sub { font-size: 18px; }
  #toast { font-size: 18px; top: auto; bottom: 46%; }
}
@media (max-height: 520px) and (orientation: landscape) {
  #home { grid-template-columns: 1fr minmax(280px, 360px); grid-template-rows: 1fr auto; padding: 16px 24px 10px; }
  .brand h1 { font-size: 40px; } .tag { display: none; }
  #panel { padding: 16px 18px; } .p-desc { display: none; }
  .home-foot { display: none; }
}

/* v2 : portrait, intertitre, rouleaux */
.d-face { display: none; position: absolute; left: 22px; top: 50%; width: 80px; height: 72px; margin-top: -34px; image-rendering: pixelated; border-radius: 14px; background: radial-gradient(circle at 50% 35%, rgba(224, 189, 120, .28), rgba(20, 14, 10, .5)); box-shadow: inset 0 0 0 1px var(--line); }
#dlg.face .d-face { display: block; }
#dlg.face .d-in { padding-left: 122px; }
#dlg.face .d-name { left: 116px; }
#inter { position: fixed; inset: 0; z-index: 21; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .7s; background: radial-gradient(ellipse at center, rgba(12, 8, 6, .62), rgba(12, 8, 6, .28) 55%, rgba(12, 8, 6, 0) 80%); }
#inter.on { opacity: 1; }
#inter p { font-family: var(--serif); font-style: italic; font-size: clamp(24px, 4.4vw, 40px); color: var(--gold-2); text-align: center; padding: 0 30px; text-shadow: 0 2px 3px rgba(0, 0, 0, .7), 0 0 30px rgba(255, 210, 140, .35); }
.m-scrolls { font-size: 12.5px; color: var(--gold-2); letter-spacing: .08em; margin-top: 4px; }
@media (max-width: 560px) { .d-face { width: 60px; height: 54px; margin-top: -26px; left: 14px; } #dlg.face .d-in { padding-left: 88px; } #dlg.face .d-name { left: 84px; } }

/* ---------- livre des passages ---------- */
#book-btn { position: absolute; right: 74px; top: calc(20px + var(--safe-t)); pointer-events: auto; }
#book-n { position: absolute; right: -4px; bottom: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: linear-gradient(180deg, #ecca88, #c99a52); color: #24170c; font: 600 10px/20px var(--sans); font-style: normal; text-align: center; }
#book { position: fixed; inset: 0; z-index: 13; display: grid; place-items: center; padding: 20px; background: rgba(10, 7, 5, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .25s; }
#book.on { opacity: 1; pointer-events: auto; }
.bk { position: relative; width: min(940px, 100%); height: min(600px, calc(100vh - 40px)); display: grid; grid-template-columns: 290px 1fr; border-radius: 10px 18px 18px 10px; overflow: hidden; color: #33241a; background: #efe2c4; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8), inset 0 0 0 1px rgba(120, 84, 40, .35); transform: translateY(14px) scale(.98); transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
#book.on .bk { transform: none; }
.bk-l { padding: 30px 22px 18px 30px; background: linear-gradient(90deg, #e2d0a6, #ecdcb8 80%, #d9c69a); box-shadow: inset -14px 0 22px -14px rgba(90, 60, 24, .45); display: flex; flex-direction: column; min-height: 0; }
.bk-k { font: 600 11px var(--sans); letter-spacing: .2em; text-transform: uppercase; color: #8a6430; }
.bk-tot { font-family: var(--serif); font-size: 26px; font-weight: 600; margin: 6px 0 14px; }
.bk-ch { list-style: none; overflow-y: auto; flex: 1; min-height: 0; margin-right: -8px; padding-right: 8px; }
.bk-ch button { width: 100%; display: grid; grid-template-columns: 30px 1fr auto; align-items: baseline; gap: 6px; padding: 8px 10px; border-radius: 8px; text-align: left; color: inherit; font-family: var(--serif); font-size: 19px; cursor: pointer; }
.bk-ch button i { font: 600 10px var(--sans); font-style: normal; letter-spacing: .08em; color: #9a7a48; }
.bk-ch button b { font: 600 12px var(--sans); color: #8a6430; }
.bk-ch button:hover { background: rgba(138, 100, 48, .1); }
.bk-ch button.sel { background: rgba(138, 100, 48, .2); }
.bk-ch button.full b { color: #2f7a3a; }
.bk-ch button.shut { opacity: .45; }
.bk-src { font: 11px var(--sans); color: #8a7350; margin-top: 12px; }
.bk-r { padding: 34px 40px 26px 36px; overflow-y: auto; background: linear-gradient(90deg, #e6d6b0, #f3e8cc 12%); }
.bk-ref { font: 600 11px var(--sans); letter-spacing: .2em; text-transform: uppercase; color: #8a6430; }
.bk-title { font-family: var(--serif); font-size: 38px; font-weight: 600; line-height: 1.05; margin: 6px 0 12px; }
.bk-rule { width: 54px; height: 2px; background: #b98a4a; margin-bottom: 16px; }
.bk-ps { list-style: none; display: grid; gap: 14px; }
.bk-ps li { padding-left: 16px; border-left: 2px solid #c9a868; }
.bk-ps q { display: block; quotes: none; font-family: var(--serif); font-size: 20px; line-height: 1.32; }
.bk-ps cite { display: block; margin-top: 4px; font: 600 11px var(--sans); font-style: normal; letter-spacing: .12em; text-transform: uppercase; color: #8a6430; }
.bk-ps li.no { border-left-style: dashed; border-left-color: rgba(138, 100, 48, .4); color: #9a8560; }
.bk-ps li.no q { font-style: italic; font-size: 18px; }
.bk-ps li.new { animation: bknew 1.6s ease-out; }
@keyframes bknew { from { background: rgba(236, 202, 136, .9); } to { background: transparent; } }
.bk-x { position: absolute; right: 10px; top: 8px; width: 40px; height: 40px; font-size: 26px; color: #6a4a24; cursor: pointer; z-index: 1; }
.foot-r { display: flex; align-items: center; gap: 18px; }
#jump { display: none; }
.touch.playing #jump { display: grid; place-items: center; position: fixed; right: 122px; bottom: calc(30px + var(--safe-b)); width: 62px; height: 62px; border-radius: 50%; background: rgba(20, 14, 10, .45); box-shadow: inset 0 0 0 1.5px rgba(243, 220, 170, .4); color: var(--gold-2); z-index: 3; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.touch.playing #jump svg { width: 26px; height: 26px; }
.touch.playing #jump:active { transform: scale(.92); }
.touch.playing #dlg.on ~ #jump { opacity: 0; pointer-events: none; }
@media (max-width: 720px) {
  #book-btn { right: 64px; top: calc(12px + var(--safe-t)); }
  #book { padding: 10px; }
  .bk { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: calc(100vh - 20px); border-radius: 14px; }
  .bk-l { padding: 16px 14px 10px; box-shadow: inset 0 -12px 18px -14px rgba(90, 60, 24, .45); }
  .bk-tot { font-size: 20px; margin: 2px 0 8px; }
  .bk-ch { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; flex: none; margin: 0; padding: 0 0 6px; }
  .bk-ch button { width: auto; white-space: nowrap; grid-template-columns: auto auto auto; font-size: 16px; padding: 6px 10px; background: rgba(138, 100, 48, .08); }
  .bk-src { display: none; }
  .bk-r { padding: 18px 18px 22px; }
  .bk-title { font-size: 28px; }
  .bk-ps q { font-size: 18px; }
}

/* réglages */
.no-blur .tilt { display: none; }
.foot-r #snd { margin-left: -8px; }
#settings { position: fixed; inset: 0; z-index: 14; display: grid; place-items: center; background: rgba(10, 7, 5, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .25s; }
#settings.on { opacity: 1; pointer-events: auto; }
.s-in { width: min(470px, calc(100vw - 28px)); max-height: calc(100vh - 24px); overflow-y: auto; gap: 14px; padding: 26px 24px 22px; touch-action: pan-y; }
.s-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; text-align: left; font-size: 14px; color: var(--ink-2); }
.seg { display: flex; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px var(--line); }
.seg button { padding: 8px 13px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap; cursor: pointer; transition: background .2s, color .2s; }
.seg button.sel { background: linear-gradient(180deg, #ecca88, #c99a52); color: #24170c; font-weight: 600; }
#s-vol { width: 180px; accent-color: var(--gold); touch-action: none; }
#s-vol:disabled { opacity: .35; }
.s-note { font-size: 12px; color: var(--ink-3); display: none; }
.playing .s-note { display: block; }
.playing #reset { display: none; }
#reset { justify-self: center; padding: 4px; }
@media (max-width: 720px) {
  .s-in { gap: 11px; padding: 20px 16px 16px; } .s-in h3 { font-size: 28px; margin-bottom: 2px; }
  .s-row { font-size: 13px; gap: 8px; } .seg button { padding: 7px 9px; font-size: 12px; } #s-vol { width: 150px; }
}

/* récit : carte de scène, parole, tableau, éclair, livres de la frise */
#scard { position: fixed; inset: 0; z-index: 21; display: grid; place-items: center; text-align: center; pointer-events: none; opacity: 0; transition: opacity .7s; background: radial-gradient(ellipse at center, rgba(12, 8, 6, .82), rgba(12, 8, 6, .5) 60%, rgba(12, 8, 6, .2)); padding: 24px; }
#scard.on { opacity: 1; }
.sc-rule { width: 54px; height: 1px; background: var(--gold); margin: 0 auto 16px; }
#scard h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(34px, 6vw, 62px); line-height: 1.05; }
#scard p { margin-top: 12px; font-family: var(--serif); font-style: italic; font-size: clamp(17px, 2.4vw, 22px); color: var(--ink-2); }
#verse { position: fixed; inset: 0; z-index: 22; display: grid; place-items: center; text-align: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity .6s; background: radial-gradient(ellipse at center, rgba(16, 11, 7, .9), rgba(10, 7, 5, .72)); }
#verse.on { opacity: 1; pointer-events: auto; }
.v-in { max-width: 820px; }
.v-orn { width: 9px; height: 9px; margin: 0 auto 22px; transform: rotate(45deg); background: var(--gold); box-shadow: 0 0 24px rgba(255, 210, 140, .8); }
#verse blockquote { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: clamp(23px, 3.6vw, 38px); line-height: 1.34; color: var(--ink); text-shadow: 0 0 30px rgba(255, 210, 140, .25); }
#verse cite { display: block; margin-top: 18px; font-style: normal; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-2); font-weight: 600; }
.v-next { width: 18px; height: 18px; margin: 22px auto 0; color: var(--gold); animation: vnext 1.2s ease-in-out .9s infinite both; opacity: 0; }
@keyframes vnext { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(4px); } }
#tab { position: fixed; inset: 0; z-index: 19; background: #05040a; opacity: 0; pointer-events: none; transition: opacity .8s; }
#tab.on { opacity: 1; pointer-events: auto; }
#tab canvas { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; display: block; }
#tab p { position: absolute; left: 0; right: 0; bottom: calc(9% + var(--safe-b)); padding: 0 26px; text-align: center; font-family: var(--serif); font-style: italic; font-size: clamp(21px, 3.4vw, 34px); line-height: 1.3; color: var(--ink); text-shadow: 0 2px 4px rgba(0, 0, 0, .9), 0 0 26px rgba(0, 0, 0, .9); }
#tab p.in { animation: capin 1.1s ease-out both; }
@keyframes capin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#flash { position: fixed; inset: 0; z-index: 23; pointer-events: none; opacity: 0; }
.bk-echo { display: block; margin-top: 3px; font: 500 12px var(--sans); font-style: normal; color: #a07a3c; }
#frise ol { padding-top: 22px; }
#frise ol::before { top: 55px; }
.ep[data-book]::before { content: attr(data-book); position: absolute; top: -20px; left: 50%; transform: translateX(-26px); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-weight: 600; white-space: nowrap; }
.ep[data-book]::after { content: ''; position: absolute; left: 0; top: 6px; height: 54px; width: 1px; background: linear-gradient(180deg, transparent, var(--line), transparent); }
@media (max-width: 720px) { #frise ol::before { top: 50px; } }
#inter, #scard, #tab { z-index: 31; } #verse { z-index: 32; } #flash { z-index: 33; }

/* ---------- v4 : accueil, menu pause, réglages, responsive ---------- */
:root { --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); }
button svg { pointer-events: none; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; }
#home { padding-left: calc(48px + var(--safe-l)); padding-right: calc(48px + var(--safe-r)); }
.home-tools { position: absolute; top: calc(22px + var(--safe-t)); right: calc(28px + var(--safe-r)); display: flex; align-items: center; gap: 10px; z-index: 2; }
.pill { height: 44px; padding: 0 18px 0 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 9px; background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px var(--line); color: var(--gold-2); font-size: 13px; font-weight: 500; white-space: nowrap; transition: background .2s; }
.pill svg { width: 20px; height: 20px; }
.pill:hover, .icon-btn:hover { background: rgba(44, 30, 20, .8); }
.prog { display: flex; align-items: center; gap: 12px; margin-top: 18px; font-size: 12px; color: var(--ink-3); letter-spacing: .03em; }
.prog-bar { width: 120px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .14); overflow: hidden; flex: none; }
.prog-bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, #c99a52, #f3dcaa); transition: width .8s; }
.p-desc { margin: 16px 0 14px; }
.p-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.chip { padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 500; color: var(--ink-2); background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
.chip.ok { color: #bfe8c8; box-shadow: inset 0 0 0 1px rgba(120, 200, 140, .4); }
.chip.new { color: var(--gold-2); box-shadow: inset 0 0 0 1px var(--line); }
.chip.v { color: #d8ccff; box-shadow: inset 0 0 0 1px rgba(170, 150, 240, .35); }
.p-hero { margin-bottom: 18px; }
#frise { touch-action: pan-x; cursor: grab; }
.fr-nav { grid-row: 2; grid-column: 1 / -1; align-self: center; z-index: 2; width: 38px; height: 38px; margin-top: 6px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--line), 0 8px 20px -8px rgba(0, 0, 0, .6); color: var(--gold-2); transition: opacity .25s, background .2s; }
.fr-nav:hover { background: rgba(60, 42, 26, .9); }
.fr-nav svg { width: 16px; height: 16px; }
.fr-nav.prev { justify-self: start; margin-left: -22px; } .fr-nav.next { justify-self: end; margin-right: -22px; }
.fr-nav.off, .touch .fr-nav { opacity: 0; pointer-events: none; }

/* menu pause */
.pm { width: min(440px, calc(100vw - 28px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; text-align: left; padding: 26px 24px 20px; gap: 12px; touch-action: pan-y; }
#menu.on .pm, #settings.on .s-in { animation: pop .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes pop { from { transform: translateY(10px) scale(.97); opacity: 0; } }
.pm-k { font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.pm .pm-title { font-size: 34px; line-height: 1.05; margin: -6px 0 0; }
.pm-obj { display: none; gap: 2px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.pm-obj.on { display: grid; }
.pm-obj b { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink); }
.pm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pm-grid .btn { padding: 12px 10px; font-size: 14px; gap: 8px; }
.pm-grid svg { width: 18px; height: 18px; color: var(--gold-2); flex: none; }
.pm-n { font: 600 11px var(--sans); font-style: normal; color: var(--gold-2); }
.pm .btn.ask { background: rgba(200, 90, 60, .28); box-shadow: inset 0 0 0 1px rgba(240, 150, 110, .75); }
.pm .m-scrolls { text-align: center; }
.m-help { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 12px; margin-top: 2px; font-size: 11.5px; color: var(--ink-3); }
.m-help span { display: inline-flex; align-items: center; gap: 6px; } .m-help em { font-style: normal; }
.m-help kbd { font: 600 10.5px var(--sans); padding: 3px 7px; border-radius: 6px; background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 1px 0 rgba(0, 0, 0, .4); color: var(--ink-2); }

/* réglages */
.s-in { position: relative; width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); text-align: left; gap: 16px; padding: 26px 26px 20px; }
.s-in h3 { margin: 0; }
.s-x { position: absolute; right: 12px; top: 10px; width: 40px; height: 40px; border-radius: 50%; font-size: 26px; line-height: 1; color: var(--ink-2); }
.s-x:hover { background: rgba(255, 255, 255, .08); }
.s-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 32px; }
.s-cols section { display: grid; gap: 11px; align-content: start; }
.s-cols h4 { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); font-weight: 600; padding-bottom: 8px; border-bottom: 1px solid rgba(224, 189, 120, .18); }
.s-row { min-height: 38px; } .s-row > span { flex: 1; }
.s-row.wide { flex-wrap: wrap; gap: 6px; } .s-row.wide > span { flex: 1 1 100%; } .s-row.wide .seg { flex: 1; } .s-row.wide .seg button { flex: 1; padding-left: 6px; padding-right: 6px; }
.rng { display: flex; align-items: center; gap: 10px; }
.rng input { width: 150px; accent-color: var(--gold); touch-action: none; } .rng input:disabled { opacity: .35; }
.rng output { width: 26px; text-align: right; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.s-hint { font-size: 11.5px; line-height: 1.4; color: var(--ink-3); }
.s-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.s-foot .btn { min-width: 150px; margin-left: auto; }

/* tableau d'ouverture : image lisse, bouton Passer */
#tab canvas.smooth { image-rendering: auto; }
#tab p { max-width: 1000px; margin: 0 auto; }
.t-skip { position: absolute; right: calc(18px + var(--safe-r)); top: calc(16px + var(--safe-t)); padding: 8px 16px; border-radius: 999px; background: rgba(10, 7, 5, .42); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); color: var(--ink-2); font-size: 12.5px; letter-spacing: .06em; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: .8; transition: opacity .2s; }
.t-skip:hover { opacity: 1; }
#verse.on, #tab.on { cursor: pointer; }
.bk { height: min(600px, calc(100dvh - 40px)); }

@media (min-width: 1600px) {
  #home { grid-template-columns: 1fr minmax(380px, 460px); padding: calc(52px + var(--safe-t)) calc(72px + var(--safe-r)) calc(26px + var(--safe-b)) calc(72px + var(--safe-l)); }
  .home-tools { right: calc(52px + var(--safe-r)); top: calc(34px + var(--safe-t)); }
  .p-desc { font-size: 21px; } .tag { font-size: 24px; max-width: 480px; }
}
@media (max-width: 820px) {
  #home { padding-left: calc(18px + var(--safe-l)); padding-right: calc(18px + var(--safe-r)); }
  .home-tools { top: calc(14px + var(--safe-t)); right: calc(14px + var(--safe-r)); gap: 8px; }
  .pill { width: 44px; padding: 0; justify-content: center; } .pill span { display: none; }
  .touch #fs { display: none; }
  .kicker { display: none; } .brand { padding-top: 46px; } .prog { margin-top: 10px; gap: 10px; font-size: 11px; } .prog-bar { width: 70px; }
  .p-desc { margin: 10px 0 10px; } .p-chips { margin-bottom: 10px; } .p-hero { margin-bottom: 14px; }
  .fr-nav { grid-row: 3; }
  #obj { max-width: calc(100vw - 136px); }
  .bk { height: calc(100dvh - 20px); }
}
@media (max-width: 820px) and (max-height: 740px) {
  .tag { display: none; } .brand h1 { font-size: 40px; }
  .p-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
}
@media (max-width: 720px) {
  .s-cols { grid-template-columns: 1fr; } .s-in { padding: 20px 16px 14px; gap: 12px; } .rng input { width: 130px; }
  .pm { padding: 22px 18px 16px; } .pm .pm-title { font-size: 28px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  #home { grid-template-columns: 1fr minmax(280px, 350px); grid-template-rows: 1fr auto; padding: calc(12px + var(--safe-t)) calc(22px + var(--safe-r)) calc(8px + var(--safe-b)) calc(22px + var(--safe-l)); gap: 6px 24px; }
  .brand { padding-top: 0; } .brand h1 { font-size: 34px; margin: 0 0 4px; } .prog { margin-top: 8px; }
  .home-tools { top: calc(118px + var(--safe-t)); left: calc(22px + var(--safe-l)); right: auto; }
  #panel { grid-column: 2; grid-row: 1; padding: 14px 16px 14px; align-self: end; }
  .p-title { font-size: 28px; margin: 6px 0 4px; } .p-desc { display: none; } .p-chips { margin: 8px 0 8px; } .p-hero { margin-bottom: 10px; } #play { padding: 11px 20px; }
  #frise, .fr-nav { grid-row: 2; } #frise ol { padding-top: 16px; }
  .med { width: 44px; height: 44px; } .med svg { width: 22px; height: 22px; } .er { display: none; } .nm { font-size: 14px; }
  #frise ol::before { top: 38px; } .ep.soon .med { margin: 7px 0; } .ep[data-book]::before { top: -15px; font-size: 9px; } .ep[data-book]::after { height: 40px; }
  .d-text { font-size: 18px; min-height: 44px; } .d-in { padding: 18px 20px 16px; }
  #obj { max-width: 300px; padding: 8px 12px 9px; } .o-title { font-size: 17px; } .o-text { font-size: 12px; }
  .pm { width: min(580px, calc(100vw - 28px)); padding: 16px 18px 14px; gap: 8px; } .pm .pm-title { font-size: 24px; }
  .pm-grid { grid-template-columns: repeat(4, 1fr); } .pm-grid .btn { flex-direction: column; gap: 4px; font-size: 12px; padding: 9px 6px; }
  .m-help { display: none; } .pm-obj { padding: 8px 12px; } .pm-obj b { font-size: 16px; }
  .s-in { padding: 16px 18px 12px; gap: 10px; } .s-in h3 { font-size: 24px; } .s-cols section { gap: 7px; } .s-row { min-height: 34px; }
  #verse blockquote { font-size: clamp(18px, 3vw, 26px); } #scard h2 { font-size: 34px; }
  #tab p { bottom: calc(5% + var(--safe-b)); font-size: clamp(17px, 2.6vw, 24px); }
}
.prog-t { color: var(--ink-2); text-shadow: 0 1px 6px rgba(0, 0, 0, .8); }
@media (max-width: 820px) { .prog-bar { display: none; } }
@media (max-height: 520px) and (orientation: landscape) {
  .kicker { display: none; } .pill { width: 44px; padding: 0; justify-content: center; } .pill span { display: none; }
  .home-tools { top: calc(106px + var(--safe-t)); } .prog-bar { display: none; }
}

/* ---------- v5 : nom du jeu, écrans de chargement ---------- */
.brand h1 { text-transform: uppercase; letter-spacing: .04em; font-size: clamp(50px, 7vw, 104px); line-height: .9; }
.brand h1 em { display: block; letter-spacing: .12em; }
@media (max-width: 820px) { .brand h1 { font-size: 50px; } }
@media (max-width: 820px) and (max-height: 740px) { .brand h1 { font-size: 42px; } }
@media (max-height: 520px) and (orientation: landscape) { .brand h1 { font-size: 36px; } }
.l-rays { position: absolute; inset: -40%; pointer-events: none; background: conic-gradient(from 0deg at 50% 50%, transparent 0 8deg, rgba(240, 200, 130, .07) 12deg, transparent 18deg 40deg, rgba(240, 200, 130, .05) 46deg, transparent 54deg 95deg, rgba(240, 200, 130, .08) 101deg, transparent 108deg 150deg, rgba(240, 200, 130, .05) 158deg, transparent 166deg 205deg, rgba(240, 200, 130, .07) 211deg, transparent 219deg 262deg, rgba(240, 200, 130, .05) 268deg, transparent 276deg 318deg, rgba(240, 200, 130, .07) 324deg, transparent 332deg); -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 62%); mask-image: radial-gradient(circle, #000 0%, transparent 62%); animation: lrays 60s linear infinite; }
@keyframes lrays { to { transform: rotate(360deg); } }
#loading { overflow: hidden; align-content: center; gap: 0; padding: 24px; text-align: center; background: radial-gradient(ellipse at 50% 42%, #2b1d12 0%, #120c08 48%, #070504 100%); transition: opacity .9s, visibility 0s .9s; }
#loading.off { visibility: hidden; }
.l-in { position: relative; display: grid; justify-items: center; gap: 0; animation: lin 1s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes lin { from { opacity: 0; transform: translateY(10px); } }
.l-med, .c-med { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; color: var(--gold-2); box-shadow: inset 0 0 0 1.5px var(--gold), 0 0 60px rgba(255, 200, 120, .35), 0 0 0 9px rgba(224, 189, 120, .08); background: radial-gradient(circle at 50% 35%, rgba(224, 189, 120, .22), rgba(20, 14, 10, .7)); }
.l-med svg, .c-med svg { width: 36px; height: 36px; }
.l-med svg { animation: lrays 24s linear infinite; }
.l-title { margin-top: 26px; font-size: clamp(44px, 8vw, 84px); line-height: 1; text-transform: uppercase; letter-spacing: .1em; text-shadow: 0 0 50px rgba(255, 205, 130, .3); }
.l-title em { font-style: italic; }
.l-kick { margin-top: 14px; font-size: 11.5px; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
#loading .l-bar { width: min(300px, 70vw); height: 3px; margin: 34px auto 0; background: rgba(255, 255, 255, .1); }
#loading .l-bar i { width: 0; animation: none; background: linear-gradient(90deg, #c99a52, #f6e2b4); box-shadow: 0 0 12px rgba(255, 210, 140, .8); transition: width .35s ease-out; }
.l-step { width: min(300px, 70vw); margin-top: 10px; display: flex; justify-content: space-between; font-size: 11.5px; letter-spacing: .08em; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.l-verse { position: absolute; left: 0; right: 0; bottom: calc(6% + var(--safe-b)); padding: 0 24px; font-family: var(--serif); font-style: italic; font-size: clamp(17px, 2.4vw, 22px); color: var(--ink-2); animation: lin 1.2s .5s both; }
.l-verse cite { display: block; margin-top: 6px; font: 600 11px var(--sans); font-style: normal; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
@media (max-height: 460px) { .l-verse { display: none; } .l-med { width: 54px; height: 54px; } .l-title { margin-top: 14px; font-size: 40px; } #loading .l-bar { margin-top: 20px; } }
/* carte d'épisode : médaillon, livre, trait d'attente */
#card { overflow: hidden; }
.c-in { position: relative; display: grid; justify-items: center; }
.c-med { margin-bottom: 22px; }
.c-bar { width: 120px; height: 2px; margin-top: 30px; border-radius: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; }
#card.on .c-in > .c-bar { animation-delay: 1.2s; }
#card.on .c-bar i { display: block; height: 100%; background: linear-gradient(90deg, #c99a52, #f6e2b4); transform-origin: left; animation: cbar 3.4s linear both; }
@keyframes cbar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (max-height: 520px) { .c-med { width: 50px; height: 50px; margin-bottom: 10px; } .c-med svg { width: 26px; height: 26px; } .c-title { font-size: 46px; margin: 8px 0 12px; } .c-bar { margin-top: 14px; } .c-ref { margin-top: 8px; } }
#card { z-index: 31; }

/* v6 : ouverture de la Genèse jouée dans la vue du jeu (le tableau ne garde que les légendes) */
#tab.live { background: linear-gradient(to top, rgba(5, 4, 10, .72), rgba(5, 4, 10, 0) 34%); }
#tab.live canvas { display: none; }
body:has(#tab.live.on) #hud { opacity: 0; pointer-events: none; }

/* ================= v7 : identité propre au jeu =================
   Polices pixel (hébergées ici) : Jacquard 24 (gothique en pixels) pour les titres, Jersey 15 pour tout le reste.
   Le menu principal est un livre ; le livre des passages range ses textes en petits blocs. */
@font-face { font-family: 'Jacquard 24'; src: url(fonts/jacquard24.woff2?v=2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Jersey 15'; src: url(fonts/jersey15.woff2?v=2) format('woff2'); font-display: swap; }
:root { --disp: 'Jacquard 24', 'Jersey 15', Georgia, serif; --serif: 'Jersey 15', 'Trebuchet MS', sans-serif; --sans: 'Jersey 15', 'Trebuchet MS', sans-serif; --parch: #ecdcb8; --parch-2: #f4e9cb; --bink: #33241a; --bink-2: #6b5236; --rub: #9a3324; --brass: #8a6430; }
* { font-synthesis: none; }
html, body { font-size-adjust: .5; -webkit-font-smoothing: none; font-smooth: never; letter-spacing: .01em; }
button, input, kbd, output { font-family: var(--sans); }
/* titres en gothique */
.c-title, #done h2, .m-in h3, .l-title, #scard h2, .bk-title, .t-title, .cover h1, .pm-title { font-family: var(--disp); font-weight: 400; font-style: normal; font-size-adjust: none; letter-spacing: 0; text-transform: none; }
.l-title em, .c-title em { font-style: normal; }
/* textes : la police pixel est étroite, on aère un peu */
.d-text { font-size: 25px; line-height: 1.22; font-weight: 400; letter-spacing: .015em; }
#verse blockquote, #tab p, #inter p, #done blockquote, .l-verse, #scard p, .c-sub { font-style: normal; line-height: 1.2; }
#dlg.voice .d-text, #dlg.narr .d-text, #toast { font-style: normal; }
.o-text { line-height: 1.25; } .o-title { font-size: 21px; }
/* boutons : biseau en pixels plutôt que pastille lisse */
.btn { border-radius: 0; padding: 12px 24px 13px; font-size: 17px; font-weight: 400; letter-spacing: .04em; background: #d9ac5e; color: #24170c; box-shadow: 0 0 0 3px #2a1a0e, inset -3px -3px 0 #a87a3a, inset 3px 3px 0 #f3d898, 0 9px 0 -3px rgba(0, 0, 0, .35); transition: transform .08s, filter .15s; }
.btn:hover { transform: none; filter: brightness(1.08); box-shadow: 0 0 0 3px #2a1a0e, inset -3px -3px 0 #a87a3a, inset 3px 3px 0 #f3d898, 0 9px 0 -3px rgba(0, 0, 0, .35); }
.btn:active { transform: translateY(2px); }
.btn:disabled { background: #6b5a48; color: #d8c8ac; box-shadow: 0 0 0 3px #2a1a0e, inset -3px -3px 0 #54463a, inset 3px 3px 0 #85735e; opacity: .8; filter: none; }
.btn.ghost { background: rgba(30, 21, 14, .85); color: var(--ink); box-shadow: 0 0 0 3px #2a1a0e, inset 0 0 0 2px rgba(224, 189, 120, .4); }
.btn.ghost:hover { box-shadow: 0 0 0 3px #2a1a0e, inset 0 0 0 2px rgba(224, 189, 120, .8); }
.seg, .seg button, .chip, .d-name, .pill, .m-in, .d-in, #obj, #prompt { border-radius: 4px; }
.seg button.sel { background: #d9ac5e; font-weight: 400; }
.icon-btn { border-radius: 6px; }
.d-in { border-radius: 6px; box-shadow: 0 0 0 3px #2a1a0e, inset 0 0 0 2px rgba(224, 189, 120, .45), 0 30px 60px -25px rgba(0, 0, 0, .7); }
.d-name { font-size: 12.5px; }

/* ---------- le menu principal : un livre, une double page par livre de la frise ---------- */
#home.th { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; grid-template: none; padding: calc(58px + var(--safe-t)) calc(20px + var(--safe-r)) calc(14px + var(--safe-b)) calc(20px + var(--safe-l)); background: radial-gradient(ellipse at 50% 46%, rgba(12, 8, 6, .5), rgba(12, 8, 6, .82)); }
.home-tools > :not(#home-set) { display: none; } .home-tools { z-index: 9; }
.gear { width: 46px; height: 46px; display: grid; place-items: center; color: #f1dfb4; background: #4a2416; box-shadow: 0 0 0 3px #1e0f08, inset 0 0 0 3px #6e3a22; transition: filter .15s; } .gear svg { width: 24px; height: 24px; transition: transform .4s; } .gear:hover { filter: brightness(1.25); } .gear:hover svg { transform: rotate(90deg); }
.tome-wrap { flex: 1; min-height: 0; width: 100%; display: grid; place-items: center; perspective: 2400px; }
.tome { position: relative; width: min(1060px, calc(100% - 84px)); height: min(640px, 100%); display: grid; grid-template-columns: 1fr 1fr; padding: 12px 14px; background: #4a2416; box-shadow: 0 0 0 3px #1e0f08, inset 0 0 0 3px #6e3a22, 0 34px 70px -24px rgba(0, 0, 0, .9); transition: transform 1.05s cubic-bezier(.45, 0, .2, 1), background .3s .45s, box-shadow .3s .45s; color: var(--bink); transform-style: preserve-3d; }
.pg { position: relative; min-width: 0; min-height: 0; background: linear-gradient(90deg, var(--parch), var(--parch-2) 30%, var(--parch-2)); display: flex; flex-direction: column; }
.pg-l { box-shadow: inset -26px 0 30px -22px rgba(70, 44, 16, .55), inset 0 0 0 1px rgba(120, 84, 40, .3), -3px 0 0 #d9c69a, -6px 0 0 #c9b488; }
.pg-r { background: linear-gradient(270deg, var(--parch), var(--parch-2) 30%, var(--parch-2)); box-shadow: inset 26px 0 30px -22px rgba(70, 44, 16, .55), inset 0 0 0 1px rgba(120, 84, 40, .3), 3px 0 0 #d9c69a, 6px 0 0 #c9b488; }
.pg-in { flex: 1; min-height: 0; padding: 30px 40px 10px 40px; display: flex; flex-direction: column; overflow: hidden; }
.pg-r .pg-in { padding: 30px 38px 10px 42px; }
.pg-no { text-align: center; padding: 0 0 11px; font-size: 14px; color: #a08a62; letter-spacing: .1em; } .pg-no::before { content: '· '; } .pg-no::after { content: ' ·'; }
.tome::after { content: ''; position: absolute; left: 50%; top: 12px; bottom: 12px; width: 2px; margin-left: -1px; background: rgba(70, 44, 16, .5); pointer-events: none; }
/* page de gauche : le livre et son chemin */
.t-book { font-size: 14px; letter-spacing: .16em; text-transform: uppercase; color: var(--brass); }
.t-bname { font-family: var(--disp); font-weight: 400; font-size-adjust: none; font-size: clamp(38px, 4.4vw, 56px); line-height: 1; margin-top: 4px; color: #2a1c12; } .t-bname::first-letter { color: var(--rub); }
.t-rule { display: flex; align-items: center; gap: 8px; margin: 10px 0 12px; color: var(--brass); }
.t-rule::before, .t-rule::after { content: ''; height: 2px; background: currentColor; opacity: .55; } .t-rule::before { width: 46px; } .t-rule::after { flex: 1; max-width: 120px; opacity: .25; }
.t-rule i { width: 8px; height: 8px; background: var(--rub); transform: rotate(45deg); }
.trail { position: relative; flex: 1; min-height: 0; }
.trail svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; } .trail rect { fill: #8a6430; }
.md { position: absolute; width: var(--s); height: var(--s); translate: -50% -50%; cursor: pointer; }
.md i { display: block; width: 100%; height: 100%; border-radius: 50%; background: #5a4630 center / cover; box-shadow: 0 0 0 3px #3a2616, 0 0 0 7px #c9a868, 0 0 0 9px #3a2616, 6px 10px 0 2px rgba(70, 44, 16, .2); transition: box-shadow .2s, filter .2s; }
.md b { position: absolute; left: -8px; top: -9px; min-width: 28px; height: 28px; padding: 0 5px 1px; display: grid; place-items: center; font-weight: 400; font-size: 15px; background: #8a2e20; color: #fbeed2; box-shadow: 0 0 0 3px #2a120c; }
.md span { position: absolute; left: 50%; top: calc(100% + 13px); translate: -50% 0; font-size: 18px; line-height: 1; color: #2a1c12; white-space: nowrap; }
.md:hover i { filter: brightness(1.12); }
.md.done b { background: #3f7a3a; }
.md.locked i { filter: grayscale(1) sepia(.5) brightness(.55); } .md.locked span { opacity: .55; } .md.locked b { background: #7a6a52; }
.md.sel i { box-shadow: 0 0 0 3px #3a2616, 0 0 0 8px #e9c15e, 0 0 0 11px #8a2e20, 0 0 0 13px #3a2616, 0 0 26px 8px rgba(233, 193, 94, .7); } .md.sel span { color: var(--rub); }
.md.fresh i { animation: mdfresh 1.2s ease-in-out 3; } @keyframes mdfresh { 50% { filter: brightness(1.5); } }
.trail.draw rect { animation: dotin .2s both; } .trail.draw .md { animation: mdin .42s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes dotin { from { opacity: 0; } } @keyframes mdin { from { opacity: 0; scale: .4; } }
.still *, .still { animation: none !important; transition: none !important; }
/* page de droite : l'épisode choisi */
.ill { position: relative; flex: 1 1 0; min-height: 90px; margin: 0 0 18px; background: #1a120c center / cover; image-rendering: pixelated; box-shadow: 0 0 0 3px #3a2616, 0 0 0 6px #c9a868, 0 0 0 8px #3a2616, 8px 12px 0 0 rgba(70, 44, 16, .18); }
#ill, .ill canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; transition: opacity .5s, filter .4s; }
#home.turning #ill { opacity: 0; transition: opacity .1s; }
.ill-lock { position: absolute; inset: 0; display: grid; place-items: center; color: #f1dfb4; opacity: 0; transition: opacity .3s; pointer-events: none; } .ill-lock svg { width: 56px; height: 56px; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .5)); }
#home.is-locked .ill { filter: grayscale(1) sepia(.55) brightness(.55) contrast(.9); } #home.is-locked .ill-lock { opacity: 1; }
.t-num { font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--rub); }
.t-title { font-size: clamp(38px, 4.4vw, 56px); line-height: 1; margin: 3px 0 0; color: #2a1c12; } .t-title::first-letter { color: var(--rub); }
.t-desc { margin: 9px 0 8px; font-size: 19px; line-height: 1.16; color: var(--bink); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.t-hero { font-size: 15.5px; color: var(--bink-2); display: flex; align-items: center; gap: 8px; } .t-hero::before { content: ''; width: 6px; height: 6px; background: var(--brass); flex: none; }
.t-act { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 16px; margin: 14px 0 6px 3px; }
.t-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.t-chips .chip { padding: 3px 9px 4px; font-size: 13.5px; background: rgba(255, 250, 232, .6); color: var(--bink-2); box-shadow: 0 0 0 2px #c2a66e; border-radius: 0; }
.t-chips .chip.ok { color: #2f6a36; box-shadow: 0 0 0 2px #7fae78; } .t-chips .chip.new { color: var(--rub); box-shadow: 0 0 0 2px #c98a6e; } .t-chips .chip.lock { color: #7a6a52; }
#play { background: #8a2e20; color: #fbeed2; box-shadow: 0 0 0 3px #2a120c, inset -3px -3px 0 #62190f, inset 3px 3px 0 #b85a44, 0 9px 0 -3px rgba(60, 30, 10, .35); font-size: 20px; padding: 10px 26px 11px; }
#play:hover { box-shadow: 0 0 0 3px #2a120c, inset -3px -3px 0 #62190f, inset 3px 3px 0 #b85a44, 0 9px 0 -3px rgba(60, 30, 10, .35); }
#play:disabled { background: #a89878; color: #5a4a36; box-shadow: 0 0 0 3px #6a5a44, inset -3px -3px 0 #948463, inset 3px 3px 0 #c2b290; opacity: 1; font-size: 16px; }
.pg-r.swap .pg-in > :not(.ill) { animation: rise .4s cubic-bezier(.2, .8, .2, 1) both; }
/* la feuille qui tourne : deux faces, l'ancienne page au recto, la nouvelle au verso */
.leaf { position: absolute; top: 12px; bottom: 12px; width: calc(50% - 14px); display: none; z-index: 4; transform-style: preserve-3d; pointer-events: none; }
.lf { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; } .lf.b { transform: rotateY(180deg); } .lf > .pg { position: absolute; inset: 0; }
.leaf.fwd { display: block; left: 50%; transform-origin: left center; animation: turnF .7s cubic-bezier(.45, .05, .3, 1) both; }
.leaf.bwd { display: block; right: 50%; transform-origin: right center; animation: turnB .7s cubic-bezier(.45, .05, .3, 1) both; }
@keyframes turnF { to { transform: rotateY(-180deg); } } @keyframes turnB { to { transform: rotateY(180deg); } }
.pg.hold { position: absolute; top: 12px; bottom: 12px; width: calc(50% - 14px); z-index: 3; } .pg.hl { left: 14px; } .pg.hr { right: 14px; }
.tn { position: absolute; top: 50%; width: 44px; height: 64px; margin-top: -32px; display: grid; place-items: center; color: #f1dfb4; background: #4a2416; box-shadow: 0 0 0 3px #1e0f08, inset 0 0 0 3px #6e3a22; z-index: 5; transition: opacity .3s, filter .15s; }
.tn svg { width: 12px; height: 18px; } .tn.prev { left: -36px; } .tn.next { right: -36px; } .tn:hover { filter: brightness(1.25); } .tn.off { opacity: 0; pointer-events: none; }
/* le ruban : le livre des passages */
.rib { position: absolute; right: 64px; top: -5px; z-index: 6; height: 46px; padding: 0 16px 9px; display: grid; place-items: center; font-size: 15px; color: #fbeed2; background: #8a2e20; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); transition: height .2s, filter .15s, opacity .3s; filter: drop-shadow(0 3px 0 rgba(40, 18, 10, .5)); }
.rib:hover { height: 54px; filter: brightness(1.15) drop-shadow(0 3px 0 rgba(40, 18, 10, .5)); }
/* livre fermé, puis il s'ouvre : la couverture se lève, son revers se pose à gauche, les pages étaient déjà dessous */
.cover { position: absolute; left: 50%; top: 0; bottom: 0; width: 50%; z-index: 8; display: none; cursor: pointer; transform-origin: left center; transform-style: preserve-3d; }
.cv-f, .cv-b { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.cv-f { display: grid; place-items: center; text-align: center; color: #e9c77e; background: radial-gradient(ellipse at 50% 40%, #7a3220, #4a1f14 75%), #4a2416; box-shadow: 0 0 0 3px #1e0f08, inset 0 0 0 3px #7a3e26, inset 0 0 0 14px #4a1f14, inset 0 0 0 17px #c9a05a, inset 0 0 0 20px #4a1f14, inset 0 0 0 22px rgba(201, 160, 90, .45), inset 18px 0 0 -4px rgba(0, 0, 0, .28); }
.cv-b { transform: rotateY(180deg); background: repeating-linear-gradient(45deg, #6e3a22 0 6px, #663520 6px 12px); box-shadow: 0 0 0 3px #1e0f08, inset 0 0 0 12px #4a2416, inset 0 0 0 14px rgba(201, 160, 90, .4); }
.cv-in { padding: 40px 34px; display: grid; justify-items: center; gap: 14px; }
.cv-orn svg { width: 54px; height: 54px; } .cv-orn { animation: bob 3s ease-in-out infinite; }
.cover h1 { font-size: clamp(64px, 8.4vw, 118px); line-height: .86; color: #f1d490; text-shadow: 0 4px 0 #2a120c; }
.cv-rule { width: 120px; height: 3px; background: #c9a05a; box-shadow: 0 6px 0 -1px rgba(201, 160, 90, .4); margin: 4px 0 8px; }
.cv-k { font-size: 15px; letter-spacing: .12em; text-transform: uppercase; color: #d9b572; max-width: 300px; line-height: 1.3; }
.cv-open { margin-top: 18px; padding: 9px 20px 10px; font-size: 18px; letter-spacing: .06em; color: #2a120c; background: #d9ac5e; box-shadow: 0 0 0 3px #2a120c, inset -3px -3px 0 #a87a3a, inset 3px 3px 0 #f3d898; animation: cvp 1.6s ease-in-out infinite; }
@keyframes cvp { 50% { filter: brightness(1.18); transform: translateY(-2px); } }
#home.closed .cover, #home.opening .cover { display: block; }
#home.closed .tome { transform: translateX(-25%); background: transparent; box-shadow: none; transition: none; }
#home.closed .pg-l, #home.opening:not(.opened) .pg-l { opacity: 0; }
#home.closed .tn, #home.closed .rib, #home.closed .tome::after, #home.closed .t-foot, #home.opening .tn, #home.opening .rib { opacity: 0; pointer-events: none; }
.pg-l { transition: opacity .4s; } .tn, .rib, .t-foot { transition: opacity .4s; }
#home.opening .cover { animation: cvo 1.05s cubic-bezier(.45, 0, .2, 1) both; pointer-events: none; }
#home.opening .cv-orn, #home.opening .cv-open { animation: none; }
@keyframes cvo { to { transform: rotateY(-180deg); } }
#home.opened .cv-b { opacity: 0; transition: opacity .4s; } #home.opened .cv-f { visibility: hidden; }
.t-foot { width: min(1060px, calc(100% - 84px)); display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 14px; color: var(--ink-3); }
.t-prog { display: flex; align-items: center; gap: 12px; } .prog-bar { height: 6px; border-radius: 0; box-shadow: 0 0 0 2px rgba(0, 0, 0, .5); } .prog-bar i { border-radius: 0; background: #d9ac5e; }
/* téléphone en portrait : une seule colonne, le chemin en haut, l'épisode dessous */
@media (max-width: 820px) and (orientation: portrait) {
  #home.th { padding-top: calc(62px + var(--safe-t)); gap: 10px; }
  .tome { width: 100%; grid-template-columns: 1fr; grid-template-rows: 44% 1fr; height: 100%; max-height: 800px; padding: 9px; } .t-foot { width: 100%; justify-content: center; font-size: 13px; } .t-foot .hint { display: none; }
  .pg-l, .pg-r { background: var(--parch-2); box-shadow: inset 0 0 0 1px rgba(120, 84, 40, .3); } .pg-r { box-shadow: inset 0 14px 18px -14px rgba(70, 44, 16, .5), inset 0 0 0 1px rgba(120, 84, 40, .3); }
  .pg-in, .pg-r .pg-in { padding: 14px 20px 8px; } .pg-no, .tome::after, .t-rule { display: none; } .t-bname { font-size: 36px; margin-bottom: 8px; } .t-book { font-size: 12.5px; }
  .md span { font-size: 15px; top: calc(100% + 10px); } .md b { min-width: 24px; height: 24px; font-size: 13px; }
  .ill { flex: 0 0 24%; margin-bottom: 12px; } .t-title { font-size: 36px; } .t-desc { font-size: 17px; -webkit-line-clamp: 4; } .t-act { margin-top: auto; padding-top: 8px; } #play { flex: 1; }
  .tn { top: 44%; width: 34px; height: 50px; margin-top: -25px; } .tn.prev { left: -6px; } .tn.next { right: -6px; } .t-hero { display: none; } .t-desc { -webkit-line-clamp: 3 !important; } .rib { right: 14px; top: -4px; height: 38px; font-size: 13px; padding: 0 10px 8px; }
  .cover { left: 0; width: 100%; } #home.closed .tome { transform: none; background: #4a2416; } #home.opening .cover { animation: cvfade .6s both; } @keyframes cvfade { to { opacity: 0; transform: scale(1.04); } }
}
@media (max-height: 560px) {
  #home.th { padding-top: calc(10px + var(--safe-t)); gap: 6px; padding-bottom: calc(6px + var(--safe-b)); } .home-tools { top: calc(6px + var(--safe-t)); right: calc(8px + var(--safe-r)); }
  .tome { padding: 8px 10px; width: min(1060px, calc(100% - 130px)); } .pg-in, .pg-r .pg-in { padding: 12px 22px 6px; } .pg-no, .t-rule, .t-foot { display: none; }
  .t-bname { font-size: 32px; margin-bottom: 6px; } .md span { font-size: 14px; top: calc(100% + 9px); } .md b { min-width: 22px; height: 22px; font-size: 12px; left: -6px; top: -7px; }
  .ill { margin-bottom: 10px; min-height: 60px; } .t-title { font-size: 32px; } .t-desc { font-size: 15.5px; -webkit-line-clamp: 2; margin: 5px 0; } .t-hero { display: none; } .t-act { margin: 6px 0 2px 3px; } #play { font-size: 17px; padding: 7px 18px 8px; }
  .cover h1 { font-size: 56px; } .cv-in { padding: 16px; gap: 8px; } .cv-orn svg { width: 34px; height: 34px; } .cv-open { margin-top: 6px; } .rib { height: 36px; font-size: 13px; }
}

/* ---------- réglages : un seul panneau, par onglets ---------- */
.st { position: relative; width: min(820px, calc(100vw - 24px)); height: min(580px, calc(100dvh - 24px)); display: grid; grid-template-columns: 200px 1fr; text-align: left; background: #1e150e; color: var(--ink); box-shadow: 0 0 0 3px #0c0705, inset 0 0 0 2px rgba(224, 189, 120, .45), 0 30px 70px -20px #000; }
#settings.on .st { animation: pop .3s cubic-bezier(.2, .8, .2, 1); }
.st-nav { padding: 22px 0 10px 2px; background: #17100a; box-shadow: inset -2px 0 0 rgba(224, 189, 120, .25); display: flex; flex-direction: column; min-height: 0; }
.st-nav h3 { font-family: var(--disp); font-weight: 400; font-size-adjust: none; font-size: 38px; padding: 0 20px 12px; color: var(--gold-2); }
.st-nav button { text-align: left; font-size: 19px; padding: 11px 22px 12px; color: #cdbb98; } .st-nav button:hover { color: #fff; }
.st-nav button.sel { background: #8a2e20; color: #fbeed2; box-shadow: inset 4px 0 0 #e9c15e; }
.st-body { padding: 24px 28px 20px; overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: #6e5a3a transparent; touch-action: pan-y; }
.st-body section { display: none; } .st-body section.on { display: grid; gap: 4px; align-content: start; animation: rise .3s both; }
.st-body h4 { font-weight: 400; font-size: 14px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); padding-bottom: 7px; margin-bottom: 4px; border-bottom: 2px solid rgba(224, 189, 120, .25); }
.st .s-row { min-height: 50px; font-size: 18px; color: var(--ink); gap: 16px; } .st .s-row > span { flex: 1; font-size: 18px; } .st .s-row small { display: block; font-size: 14px; color: #a8977a; margin-top: 1px; }
.st .seg { border-radius: 0; padding: 0; background: none; box-shadow: 0 0 0 2px rgba(224, 189, 120, .4); } .st .seg button { border-radius: 0; padding: 7px 12px 8px; font-size: 16px; }
.st .rng input { width: 190px; } .st .rng output { font-size: 15px; width: 30px; }
.st-x { position: absolute; right: 10px; top: 6px; width: 40px; height: 40px; font-size: 28px; color: #cdbb98; z-index: 2; } .st-x:hover { color: #fff; }
.st-keys { display: grid; gap: 8px; margin: 8px 0 10px; } .st-keys div { display: flex; align-items: center; gap: 14px; font-size: 18px; } .st-keys kbd { min-width: 76px; text-align: center; padding: 5px 8px 6px; font-size: 15px; background: #2c2016; box-shadow: 0 0 0 2px rgba(224, 189, 120, .4), 0 3px 0 0 #0c0705; color: var(--gold-2); }
.st-p { font-size: 16px; line-height: 1.25; color: #cdbb98; margin: 6px 0; } .st-p.s-note { display: none; } .playing .st-p.s-note { display: block; }
.st #reset { font-size: 16px; padding: 8px 18px 9px; } .st #reset:disabled { opacity: .4; }
@media (max-width: 700px) {
  .st { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: calc(100dvh - 20px); }
  .st-nav { flex-direction: row; overflow-x: auto; padding: 10px 44px 0 6px; box-shadow: inset 0 -2px 0 rgba(224, 189, 120, .25); scrollbar-width: none; } .st-nav h3 { display: none; }
  .st-nav button { padding: 9px 12px 10px; font-size: 16px; white-space: nowrap; } .st-nav button.sel { box-shadow: inset 0 -4px 0 #e9c15e; }
  .st-body { padding: 16px 16px; } .st .s-row { flex-wrap: wrap; gap: 6px 12px; padding: 5px 0; } .st .rng input { width: 150px; }
}
/* taille du texte (réglage) */
body[data-size=small] :is(.d-text, #verse .v-in, #tab p, #inter p, #obj, #toast) { zoom: .86; } body[data-size=large] :is(.d-text, #verse .v-in, #tab p, #inter p, #obj, #toast) { zoom: 1.2; }

/* ---------- le livre des passages : des petits blocs ---------- */
.bk { border-radius: 0; background: #4a2416; padding: 10px 12px; box-shadow: 0 0 0 3px #1e0f08, inset 0 0 0 3px #6e3a22, 0 30px 80px -20px rgba(0, 0, 0, .8); width: min(1040px, 100%); height: min(640px, calc(100dvh - 40px)); }
.bk-l { background: linear-gradient(90deg, var(--parch), var(--parch-2) 40%); padding: 26px 18px 14px 24px; }
.bk-r { background: linear-gradient(270deg, var(--parch), var(--parch-2) 30%); padding: 28px 30px 24px 30px; box-shadow: inset 26px 0 30px -22px rgba(70, 44, 16, .5); scrollbar-width: thin; scrollbar-color: #b79a62 transparent; }
.bk-k, .bk-ref { font-size: 13px; letter-spacing: .16em; color: var(--brass); font-weight: 400; }
.bk-tot { font-size: 22px; font-weight: 400; margin: 4px 0 12px; color: var(--rub); }
.bk-title { font-size: 46px; line-height: 1; margin: 2px 0 10px; } .bk-title::first-letter { color: var(--rub); }
.bk-rule { width: 100%; height: 2px; background: linear-gradient(90deg, #b98a4a 60px, rgba(185, 138, 74, .25) 60px); margin-bottom: 18px; }
.bk-ch button { border-radius: 0; font-size: 18px; padding: 6px 8px; align-items: center; } .bk-ch button i { font-size: 12px; } .bk-ch button b { font-size: 14px; font-weight: 400; }
.bk-ch button.sel { background: #8a2e20; color: #fbeed2; box-shadow: 0 0 0 2px #2a120c; } .bk-ch button.sel i, .bk-ch button.sel b { color: #f1d490; }
.bk-ch { scrollbar-width: thin; scrollbar-color: #b79a62 transparent; padding: 2px 8px 2px 2px; }
.bk-ps { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px 14px; align-items: start; counter-reset: ps; }
.bk-ps li { counter-increment: ps; position: relative; display: flex; flex-direction: column; padding: 14px 14px 12px; border: 0; background: rgba(255, 251, 236, .7); box-shadow: 0 0 0 2px #b79a62, 4px 4px 0 0 rgba(90, 60, 24, .2); }
.bk-ps li::before { content: counter(ps); position: absolute; right: 8px; top: 5px; font-size: 13px; color: #b79a62; }
.bk-ps cite { order: -1; align-self: flex-start; margin: -2px 22px 9px 0; padding: 2px 8px 3px; font-size: 13px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; background: #8a6430; color: #fbeed2; }
.bk-ps q { font-size: 18.5px; line-height: 1.17; color: var(--bink); }
.bk-echo { margin-top: 9px; padding-top: 7px; border-top: 2px dotted #c9a868; font-size: 14px; font-weight: 400; color: var(--brass); }
.bk-ps li.no { background: transparent; box-shadow: none; outline: 2px dashed rgba(138, 100, 48, .45); outline-offset: -1px; min-height: 86px; justify-content: center; text-align: center; color: #9a8560; }
.bk-ps li.no q { font-size: 15.5px; font-style: normal; color: #9a8560; } .bk-ps li.no::before { content: '?'; position: static; display: block; font-size: 30px; color: #c2a66e; line-height: 1; margin-bottom: 4px; }
.bk-ps li.new { box-shadow: 0 0 0 2px var(--rub), 4px 4px 0 0 rgba(154, 51, 36, .25); }
.bk-x { font-family: var(--sans); color: #6a4a24; z-index: 3; right: 16px; top: 14px; }
.bk-src { font-size: 13px; }
@media (max-width: 720px) { .bk { padding: 7px; height: calc(100dvh - 20px); } .bk-r { padding: 16px 14px 20px; box-shadow: none; } .bk-title { font-size: 34px; } .bk-ps { grid-template-columns: 1fr; } .bk-ch button { font-size: 16px; } }
.bk-src { font-size: 14px; }
.pm .btn { font-size: 18px; } .pm .btn.ghost { font-size: 16px; } .pm-k { font-size: 13px; } .pm-title { font-size: 40px; }
.m-help { font-size: 14px; } .m-help kbd { font-size: 13px; border-radius: 2px; } .m-scrolls { font-size: 15px; }
.s-row > span, .seg button { font-size: 15px; } #settings h4 { font-size: 13px; }
.o-step { font-size: 12.5px; } .o-text { font-size: 15.5px; } #prompt { font-size: 15px; } #prompt kbd { border-radius: 3px; font-size: 14px; }
.pill { font-size: 15px; }

/* v9 : accueil léger. Le monde n'est plus dessiné derrière le livre : un fond fixe (image floutée) qui glisse lentement en boucle, et des images toutes prêtes dans les pages. */
#home.th { background: #0c0806; overflow: hidden; isolation: isolate; }
#home.th::before { content: ''; position: absolute; inset: -9%; z-index: -2; background: url(thumbs/_bg.jpg?v=1) center / cover; animation: bgpan 80s ease-in-out infinite alternate; will-change: transform; }
#home.th::after { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse at 50% 46%, rgba(12, 8, 6, .45), rgba(12, 8, 6, .86)); }
@keyframes bgpan { from { transform: translate3d(-4%, -2%, 0) scale(1.02); } to { transform: translate3d(4%, 3%, 0) scale(1.1); } }
#home:not(.on)::before { animation-play-state: paused; }
.ill { overflow: hidden; background-size: cover; image-rendering: auto; }
.ill .im { position: absolute; inset: -5%; background: center / cover no-repeat; animation: illpan 26s ease-in-out infinite alternate; will-change: transform; }
.ill .im.in { animation: illin .35s ease-out both, illpan 26s ease-in-out infinite alternate; }
@keyframes illpan { from { transform: translate3d(-3%, 0, 0); } to { transform: translate3d(3%, -2%, 0); } } @keyframes illin { from { opacity: 0; } }
.still .im { animation: none !important; }
@media (prefers-reduced-motion: reduce) { #home.th::before, .ill .im { animation: none; } }

/* ---------- v10 : voix off en sous-titre (on continue à jouer) et titre de scène posé en haut ---------- */
#vo { position: fixed; left: 0; right: 0; bottom: calc(clamp(18px, 7vh, 64px) + var(--safe-b, 0px)); z-index: 31; display: grid; place-items: center; padding: 0 16px; pointer-events: none; opacity: 0; transform: translateY(6px); transition: opacity .35s, transform .35s; }
#vo.on { opacity: 1; transform: none; }
#vo .vo-in { max-width: min(980px, 92vw); text-align: center; padding: 9px 20px 11px; background: rgba(14, 9, 6, .74); box-shadow: 0 0 0 2px rgba(12, 7, 5, .9), 0 0 0 4px rgba(224, 189, 120, .28); pointer-events: auto; cursor: pointer; }
#vo p { font-family: var(--serif); font-size: clamp(18px, 2.5vw, 25px); line-height: 1.2; color: #f4ead6; text-shadow: 0 2px 0 rgba(0, 0, 0, .55); text-wrap: balance; }
#vo cite { display: none; font-style: normal; margin-top: 5px; font-size: 13.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-2); }
#vo[data-k=god] p, #vo[data-k=verse] p { color: #ffe9a8; text-shadow: 0 2px 0 rgba(0, 0, 0, .55), 0 0 22px rgba(255, 214, 130, .45); }
#vo[data-k=god] .vo-in, #vo[data-k=verse] .vo-in { box-shadow: 0 0 0 2px rgba(12, 7, 5, .9), 0 0 0 4px rgba(233, 193, 94, .7), 0 0 34px rgba(255, 214, 130, .22); }
#vo[data-k=verse] cite:not(:empty) { display: block; }
body[data-size=small] #vo .vo-in { zoom: .86; } body[data-size=large] #vo .vo-in { zoom: 1.2; }
#scard.flow { inset: calc(13vh + var(--safe-t, 0px)) 0 auto 0; background: none; transition: opacity .6s; }
#scard.flow .sc-in { padding: 10px 34px 12px; background: radial-gradient(ellipse at center, rgba(12, 8, 6, .72), rgba(12, 8, 6, .4) 60%, rgba(12, 8, 6, 0) 100%); }
#scard.flow h2 { font-size: clamp(28px, 4.4vw, 46px); text-shadow: 0 3px 0 rgba(0, 0, 0, .6); } #scard.flow p { margin-top: 4px; font-size: clamp(15px, 2vw, 19px); text-shadow: 0 2px 0 rgba(0, 0, 0, .6); }
@media (max-width: 700px), (max-height: 520px) { #vo { bottom: calc(96px + var(--safe-b, 0px)); } #vo p { font-size: 17px; } #scard.flow { top: calc(64px + var(--safe-t, 0px)); } }
@media (max-height: 520px) { #vo { bottom: calc(8px + var(--safe-b, 0px)); padding: 0 150px; } }
