/* PALAVRA VIVA — o livro. Pergaminho sobre a mesa à luz de vela, moldura de folha de ouro,
   quadros com a borda da matriz de madeira, figuras em xilogravura. Tempos de animação tirados do
   estudo de sensação (F:\estudo\storyteller\SENSACAO.md): cena dissolve em 0,4 s, carta solta encolhe
   para 75%, brilho de acerto de 0,5 s com 0,125 s entre quadros. */
:root {
  --ink: #1d1916; --paper: #efe2c2; --paper2: #e3cfa6; --edge: #c9ae7c; --verm: #b23a28; --gold: #c9962e; --gold2: #f3d683; --gold3: #8a6420;
  --night: #15121d; --rose: #a8615a; --muted: #6d5b48;
  color-scheme: dark;
}
img { -webkit-user-drag: none; -webkit-touch-callout: none; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); overflow: hidden; font-family: "EB Garamond", Georgia, serif; color: var(--ink); -webkit-user-select: none; user-select: none; touch-action: none; }
/* fixed, and tiny until fit() runs: a 1600 px box in the flow makes phone browsers zoom the page out to fit it */
#stage { position: fixed; left: 50%; top: 50%; width: 1600px; height: 900px; transform: translate(-50%, -50%) scale(0.2); transform-origin: 50% 50%; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #2a2132 0%, #15121d 70%); }
#bg, #fx { position: absolute; inset: 0; width: 1600px; height: 900px; pointer-events: none; }
#fx { z-index: 40; }
#screens { position: absolute; inset: 0; z-index: 5; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------------------------------------------------------------- parchment + gold frame */
.parch {
  position: absolute; border-radius: 6px;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255, 250, 235, 0.55) 0%, rgba(255, 250, 235, 0) 60%),
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(120, 80, 30, 0.28) 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.33  0 0 0 0 0.18  0 0 0 0.22 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"),
    linear-gradient(160deg, #f3e7c9, #e8d5ab 60%, #e2cb9b);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(80, 50, 20, 0.35), inset 0 0 60px rgba(140, 95, 40, 0.28);
}
.gold-frame { position: absolute; inset: 16px; border-radius: 4px; pointer-events: none; border: 3px solid transparent;
  background: linear-gradient(115deg, var(--gold3), var(--gold2) 30%, var(--gold) 45%, #fff3c4 50%, var(--gold) 55%, var(--gold3) 80%, var(--gold2)) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  background-size: 300% 100%; animation: shimmer 9s linear infinite; }
.gold-frame::after { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(160, 110, 40, 0.55); border-radius: 2px; }
.corner { position: absolute; width: 46px; height: 46px; color: var(--gold); font: 34px/46px "IM Fell English"; text-align: center; text-shadow: 0 0 6px rgba(255, 220, 140, 0.6); pointer-events: none; }
.corner.tl { left: 6px; top: 6px; } .corner.tr { right: 6px; top: 6px; } .corner.bl { left: 6px; bottom: 6px; } .corner.br { right: 6px; bottom: 6px; }
@keyframes shimmer { 0% { background-position: 0% 0; } 100% { background-position: 300% 0; } }
.gilt { background: linear-gradient(100deg, var(--gold3), var(--gold2) 35%, #fff4cf 50%, var(--gold2) 65%, var(--gold3)); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 6s linear infinite; }

/* ---------------------------------------------------------------- buttons */
.btn { font: 26px "IM Fell English SC", Georgia, serif; color: #f6ead0; background: linear-gradient(#b8402c, #8e2a1c); border: 2px solid #5a170e; border-radius: 6px; padding: 10px 30px; box-shadow: 0 4px 0 #4a120a, 0 6px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 200, 160, 0.45); transition: transform 0.08s, box-shadow 0.08s, filter 0.15s; letter-spacing: 0.5px; }
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #4a120a, 0 2px 6px rgba(0, 0, 0, 0.35); }
.btn.alt { background: linear-gradient(#f2e5c6, #ddc699); color: var(--ink); border-color: #8a6a3a; box-shadow: 0 4px 0 #7a5a30, 0 6px 14px rgba(0, 0, 0, 0.25); }
.btn.small { font-size: 20px; padding: 6px 18px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.linkish { background: none; border: 0; color: var(--muted); font: italic 18px "EB Garamond"; text-decoration: underline; }
.round { width: 54px; height: 54px; border-radius: 50%; border: 2px solid var(--gold3); background: radial-gradient(#f2e3c0, #d9bf8a); color: var(--ink); font: 26px/1 "IM Fell English"; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4); }
.round:hover { filter: brightness(1.1); }
#hud { position: absolute; right: 22px; top: 18px; z-index: 50; display: flex; gap: 10px; }
#hud.dark .round { opacity: 0.85; }

/* ---------------------------------------------------------------- title */
.title-screen .cover { position: absolute; left: 160px; top: 70px; width: 1280px; height: 640px; overflow: hidden; border-radius: 4px; }
.title-screen .cover canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.title-screen .cover::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 14px #1d1916, inset 0 0 0 18px var(--gold), inset 0 0 120px rgba(40, 20, 10, 0.55); }
.title-screen h1 { position: absolute; left: 0; right: 0; top: 96px; text-align: center; margin: 0; font: 112px/1 "IM Fell English SC", serif; letter-spacing: 3px; filter: drop-shadow(0 3px 0 #1d1916) drop-shadow(0 0 18px rgba(0, 0, 0, 0.45)); }
.title-screen .sub { position: absolute; left: 0; right: 0; top: 214px; text-align: center; font: italic 30px "IM Fell English"; color: #fff3d8; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8); }
.title-screen .menu { position: absolute; left: 0; right: 0; top: 735px; display: flex; justify-content: center; gap: 22px; }
.title-screen .tag { position: absolute; left: 0; right: 0; top: 850px; text-align: center; color: #cbb796; font: italic 18px "EB Garamond"; }

/* ---------------------------------------------------------------- chapter (open book) */
.chapter-screen .book { position: absolute; left: 90px; top: 50px; width: 1420px; height: 800px; }
.chapter-screen .leaf { position: absolute; top: 0; height: 800px; width: 710px; }
.chapter-screen .leaf.l { left: 0; border-radius: 8px 2px 2px 8px; }
.chapter-screen .leaf.r { left: 710px; border-radius: 2px 8px 8px 2px; }
.chapter-screen .spine { position: absolute; left: 690px; top: 0; width: 40px; height: 800px; background: linear-gradient(90deg, transparent, rgba(80, 50, 20, 0.35) 45%, rgba(80, 50, 20, 0.35) 55%, transparent); pointer-events: none; z-index: 3; }
.chapter-screen .plate { position: absolute; left: 70px; top: 80px; width: 580px; height: 600px; border-radius: 3px; overflow: hidden; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
.chapter-screen .plate canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.chapter-screen .plate::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 10px #1d1916, inset 0 0 0 13px var(--gold), inset 0 0 70px rgba(40, 20, 10, 0.35); pointer-events: none; }
.chapter-screen .r h2 { margin: 80px 70px 0; font: 54px/1.05 "IM Fell English SC"; color: var(--ink); }
.chapter-screen .r .chref { margin: 8px 70px 0; font: italic 24px "IM Fell English"; color: var(--verm); }
.chapter-screen .r .intro { margin: 18px 70px 24px; font: italic 22px/1.35 "EB Garamond"; color: var(--muted); }
.chapter-screen .stories { margin: 0 60px; }
.story-row { display: grid; grid-template-columns: 54px 1fr 70px; align-items: center; gap: 12px; padding: 7px 12px; border-bottom: 1px dashed rgba(120, 90, 50, 0.45); cursor: pointer; border-radius: 6px; transition: background 0.15s, transform 0.12s; }
.story-row:hover:not(.locked) { background: rgba(255, 245, 210, 0.55); transform: translateX(4px); }
.story-row .num { font: 34px "IM Fell English SC"; color: var(--verm); text-align: center; }
.story-row .t { font: 25px/1.1 "IM Fell English"; }
.story-row .t small { display: block; font: italic 17px "EB Garamond"; color: var(--muted); margin-top: 2px; }
.story-row .seal { width: 60px; height: 60px; }
.story-row.locked { opacity: 0.42; cursor: default; }
.story-row.next { background: rgba(255, 240, 200, 0.5); box-shadow: inset 4px 0 0 var(--gold); }
/* a long chapter: tighter rows so every story fits on the leaf */
.stories.many .story-row { grid-template-columns: 44px 1fr 46px; padding: 3px 12px; }
.stories.many .story-row .num { font-size: 27px; }
.stories.many .story-row .t { font-size: 21px; }
.stories.many .story-row .t small { font-size: 14.5px; margin-top: 0; }
.stories.many .story-row .seal { width: 42px; height: 42px; }

/* ---------------------------------------------------------------- story page */
.story-screen .page { left: 34px; top: 22px; width: 1532px; height: 856px; }
.head { position: absolute; left: 0; right: 0; top: 34px; text-align: center; }
.head h1 { margin: 0; font: 46px/1.1 "IM Fell English SC"; color: var(--ink); display: inline-flex; align-items: center; gap: 14px; }
.head h1 .dropcap { font-size: 64px; color: var(--verm); text-shadow: 1px 1px 0 var(--gold2), -1px -1px 0 rgba(0, 0, 0, 0.15); }
.head .ref { font: italic 22px "IM Fell English"; color: var(--verm); margin-top: 2px; }
.titleSeal { position: absolute; width: 92px; height: 92px; left: 60px; top: 28px; }
.titleSeal.blank { border: 2px dashed rgba(140, 100, 50, 0.45); border-radius: 50%; }
.goals { position: absolute; left: 0; right: 0; top: 140px; display: flex; justify-content: center; gap: 10px; font: 19px "EB Garamond"; }
.goal { display: flex; align-items: center; gap: 8px; padding: 5px 14px 5px 6px; border-radius: 30px; background: rgba(255, 248, 225, 0.55); border: 1px solid rgba(140, 100, 50, 0.35); color: var(--muted); transition: background 0.3s, color 0.3s, box-shadow 0.3s; }
.goal img { width: 34px; height: 34px; filter: grayscale(0.85) opacity(0.6); transition: filter 0.3s; }
.goal.on { background: linear-gradient(#fff3cf, #f2d98f); color: var(--ink); box-shadow: 0 0 0 1px var(--gold), 0 0 16px rgba(243, 214, 131, 0.8); }
.goal.on img { filter: none; }
.goal.flash { animation: goalFlash 0.6s ease-out; }
@keyframes goalFlash { 0% { transform: scale(1); } 35% { transform: scale(1.14); } 100% { transform: scale(1); } }
.goal .arrow { color: var(--gold3); margin-left: 4px; }
.panels { position: absolute; left: 0; right: 0; top: 196px; display: flex; justify-content: center; gap: 24px; }
.pcol { display: flex; flex-direction: column; align-items: center; }
.panel { position: relative; background: #f5ecd4; overflow: hidden; border-radius: 3px; box-shadow: 0 0 0 5px var(--ink), 0 0 0 7px var(--gold), 0 10px 22px rgba(60, 35, 10, 0.35); transition: box-shadow 0.15s, transform 0.12s; }
.panel .num { position: absolute; left: 8px; top: 6px; font: 22px "IM Fell English SC"; color: rgba(60, 40, 20, 0.35); z-index: 1; }
.panel .emptyHint { position: absolute; inset: 22px; border: 2px dashed rgba(120, 85, 40, 0.35); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: rgba(110, 80, 40, 0.5); font: italic 19px "EB Garamond"; text-align: center; padding: 0 20px; }
.panel.hover { box-shadow: 0 0 0 5px var(--ink), 0 0 0 8px var(--gold2), 0 0 34px rgba(243, 214, 131, 0.95), 0 10px 22px rgba(60, 35, 10, 0.35); transform: scale(1.015); }
.panel.reject { animation: reject 0.32s ease-out; }
@keyframes reject { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.panel .bd { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.panel .bd.reveal { -webkit-mask-image: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), #000 calc(var(--r) - 9%), transparent var(--r)); mask-image: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), #000 calc(var(--r) - 9%), transparent var(--r)); animation: inkReveal 0.4s cubic-bezier(0.2, 0.75, 0.25, 1) forwards; }
@property --r { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
@keyframes inkReveal { from { --r: 0%; } to { --r: 160%; } }
.panel .flash { position: absolute; inset: 0; background: #fffaf0; pointer-events: none; animation: flash 0.32s ease-out forwards; z-index: 6; }
@keyframes flash { 0% { opacity: 0.95; } 100% { opacity: 0; } }
.panel .figs { position: absolute; inset: 0; z-index: 2; }
.fig { position: absolute; transform-origin: 50% 100%; cursor: grab; will-change: transform; }
.fig .sp { position: absolute; inset: 0; transform-origin: 50% 100%; }
.fig .sp img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.fig.drop { animation: figDrop 0.34s cubic-bezier(0.25, 0.9, 0.3, 1.25) both; }
@keyframes figDrop { 0% { transform: translateY(-46px) scale(0.86, 1.14); opacity: 0; } 55% { transform: translateY(0) scale(1.1, 0.88); opacity: 1; } 78% { transform: scale(0.97, 1.04); } 100% { transform: scale(1, 1); } }
.fig.breathe .sp { animation: breathe 2.6s ease-in-out infinite alternate; transform-origin: 50% 100%; }
@keyframes breathe { from { transform: scaleY(1); } to { transform: scaleY(1.014); } }
.fig.reprint .sp { animation: reprint 0.3s ease-out; }
@keyframes reprint { 0% { filter: brightness(2.2) contrast(0.6); } 100% { filter: none; } }
.fig.leave { animation: dissolve 0.4s ease-in forwards; pointer-events: none; }
@keyframes dissolve { 0% { opacity: 1; filter: none; } 100% { opacity: 0; filter: blur(3px) brightness(1.6); transform: scale(0.92); } }
.fig .shadow { position: absolute; left: 50%; bottom: -6px; width: 70%; height: 14px; transform: translateX(-50%); background: radial-gradient(ellipse, rgba(40, 25, 10, 0.35), transparent 70%); pointer-events: none; }
.emblem { position: absolute; z-index: 4; pointer-events: none; transform-origin: 50% 100%; animation: pop 0.3s cubic-bezier(0.3, 1.6, 0.5, 1) both, bob 2.2s 0.3s ease-in-out infinite alternate; filter: drop-shadow(0 3px 3px rgba(40, 25, 10, 0.35)); }
@keyframes pop { 0% { transform: scale(0) rotate(-18deg); } 60% { transform: scale(1.22) rotate(5deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes bob { from { translate: 0 0; } to { translate: 0 -5px; } }
.ribbon { position: absolute; left: 50%; bottom: 10px; z-index: 5; transform: translateX(-50%) rotate(-3deg); background: linear-gradient(#c24a33, #9a2e1f); color: #fbecd0; font: italic 19px/1 "IM Fell English"; padding: 8px 22px 9px; border-radius: 2px; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35); white-space: nowrap; cursor: grab; }
.ribbon::before, .ribbon::after { content: ""; position: absolute; top: 4px; border: 14px solid #8a2618; border-left-color: transparent; z-index: -1; }
.ribbon::before { left: -18px; } .ribbon::after { right: -18px; border-left-color: #8a2618; border-right-color: transparent; }
.ribbon.stamp { animation: stamp 0.38s cubic-bezier(0.3, 1.4, 0.5, 1) both; }
@keyframes stamp { 0% { transform: translateX(-50%) scale(1.8) rotate(-14deg); opacity: 0; } 60% { transform: translateX(-50%) scale(0.92) rotate(-2deg); opacity: 1; } 100% { transform: translateX(-50%) scale(1) rotate(-3deg); } }
.ribbon.unused { filter: grayscale(0.6) opacity(0.75); }
.panel.win::after { content: ""; position: absolute; inset: 0; z-index: 7; pointer-events: none; background: radial-gradient(ellipse at 50% 60%, rgba(255, 246, 200, 0.95), rgba(243, 214, 131, 0.75) 50%, rgba(201, 150, 46, 0.35)); mix-blend-mode: screen; animation: winGlow 0.5s ease-out var(--d, 0s) both; }
@keyframes winGlow { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
.caption { width: 100%; margin-top: 14px; min-height: 92px; font: 18.5px/1.32 "EB Garamond"; color: #2c231b; text-align: left; padding: 0 4px; }
.caption .ref { font: 600 15px "EB Garamond"; color: var(--verm); letter-spacing: 0.4px; margin-right: 6px; font-variant: small-caps; }
.caption.neutral { font-style: italic; color: var(--muted); }
.caption .cursor { display: inline-block; width: 2px; height: 1em; background: var(--verm); vertical-align: -2px; animation: blink 0.8s steps(1) infinite; margin-left: 1px; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------------------------------------------------------------- tray */
.tray { position: absolute; left: 56px; right: 56px; bottom: 30px; height: 168px; display: flex; gap: 28px; align-items: flex-end; justify-content: center; }
.group { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.group .lbl { font: 17px "IM Fell English SC"; color: var(--muted); letter-spacing: 1px; }
.group .row { display: flex; gap: 10px; align-items: flex-end; }
.tile { position: relative; cursor: grab; transition: transform 0.12s, opacity 0.2s, filter 0.2s; }
.tile:hover { transform: translateY(-5px) rotate(-1deg); }
.tile .card { background: #f7efd9; border: 2px solid var(--ink); border-radius: 5px; box-shadow: 0 4px 0 rgba(60, 40, 20, 0.35), 0 6px 12px rgba(0, 0, 0, 0.2); overflow: hidden; position: relative; }
.tile.place .card { width: 128px; height: 96px; }
.tile.place .card img { width: 100%; height: 100%; object-fit: cover; }
.tile.person .card { width: 92px; height: 112px; background: radial-gradient(ellipse at 50% 80%, #f9f2df, #e9dab6); }
.tile.person .card img { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); max-height: 104px; max-width: 86px; }
.tile .name { margin-top: 6px; font: 15px/1.05 "EB Garamond"; text-align: center; width: 100%; max-width: 128px; color: #3a2d22; }
.tile.word .card { width: auto; height: auto; border: 0; box-shadow: none; background: none; overflow: visible; }
.tile.word .ribbon { position: relative; left: 0; bottom: 0; transform: rotate(-3deg); display: block; margin: 16px 16px 8px; }
.tile.dim { opacity: 0.32; filter: grayscale(0.7); pointer-events: none; }
.tile.lit { animation: litPulse 1.1s ease-in-out infinite; z-index: 3; }
@keyframes litPulse { 0%, 100% { filter: drop-shadow(0 0 0 rgba(243, 214, 131, 0)); } 50% { filter: drop-shadow(0 0 16px rgba(243, 214, 131, 1)); } }
.ghost { position: absolute; z-index: 60; pointer-events: none; will-change: transform, translate, rotate; transform-origin: 50% 30%; filter: drop-shadow(14px 18px 10px rgba(30, 15, 5, 0.35)); }
.ghost.drop { transition: transform 0.02s linear, opacity 0.16s ease-out; }
.hintBtn { position: absolute; right: 70px; top: 60px; }
.hintBtn.nudge { animation: nudge 1.3s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { scale: 1; } 50% { scale: 1.13; box-shadow: 0 4px 0 #7a5a30, 0 0 0 3px var(--gold2), 0 0 26px rgba(243, 214, 131, 1); } }
.hintBox { position: absolute; left: 50%; top: 598px; translate: -50% 0; z-index: 20; background: #fff8e6; border: 2px solid var(--gold3); border-radius: 10px; padding: 10px 20px; font: italic 21px "EB Garamond"; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); animation: pop 0.3s both; white-space: nowrap; }
.backBtn { position: absolute; left: 60px; top: 132px; }

/* ---------------------------------------------------------------- success card */
.win-card { position: absolute; left: 50%; bottom: 36px; transform: translate(-50%, 0); width: 980px; z-index: 30; padding: 22px 30px 24px; text-align: center; animation: rise 0.45s cubic-bezier(0.2, 1.2, 0.4, 1) both; }
.win-card h2 { margin: 0 0 6px; font: 40px "IM Fell English SC"; color: var(--verm); }
.win-card p { margin: 0 auto 16px; max-width: 860px; font: italic 22px/1.35 "EB Garamond"; }
.win-card .row { display: flex; gap: 16px; justify-content: center; }
@keyframes rise { 0% { transform: translate(-50%, 120%); } 100% { transform: translate(-50%, 0); } }
.stampSeal { animation: sealIn 0.45s cubic-bezier(0.2, 1.35, 0.45, 1) both; }
@keyframes sealIn { 0% { transform: scale(2.3) rotate(-24deg); opacity: 0; } 70% { transform: scale(0.92) rotate(4deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }

/* ---------------------------------------------------------------- modal, tutorial */
#modal { position: absolute; inset: 0; z-index: 70; background: rgba(15, 10, 20, 0.62); display: flex; align-items: center; justify-content: center; }
#modal .card { position: relative; width: 760px; max-height: 800px; padding: 40px 54px; text-align: center; }
#modal h2 { margin: 0 0 18px; font: 44px "IM Fell English SC"; }
#modal .col { display: flex; flex-direction: column; gap: 14px; align-items: center; }
#modal label { display: flex; align-items: center; gap: 16px; font: 22px "EB Garamond"; width: 520px; justify-content: space-between; }
#modal input[type=range] { width: 260px; accent-color: var(--verm); }
#modal .langs { display: flex; gap: 10px; }
#modal .reading { text-align: left; max-height: 560px; overflow-y: auto; padding-right: 12px; font: 22px/1.5 "EB Garamond"; }
#modal .reading sup { color: var(--verm); font: 600 14px "EB Garamond"; margin-right: 4px; }
#modal .note { font: italic 15px "EB Garamond"; color: var(--muted); margin-top: 10px; }
#tut { position: absolute; inset: 0; z-index: 65; pointer-events: none; }
#tut .tut-box { position: absolute; left: 50%; top: 600px; translate: -50% 0; width: 820px; background: #fff8e6; border: 3px solid var(--gold3); border-radius: 12px; padding: 14px 26px; text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); pointer-events: auto; animation: pop 0.3s both; }
#tut .tut-box.top { top: 240px; }
#tut p { margin: 0 0 8px; font: 25px/1.3 "EB Garamond"; }
#tut .tut-row { display: flex; gap: 18px; justify-content: center; align-items: center; }
#tut .hand { position: absolute; font-size: 64px; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.45)); transform-origin: 30% 10%; pointer-events: none; opacity: 0; }
#rotate { position: fixed; inset: 0; z-index: 100; background: #15121d; color: #f3e7c9; display: flex; flex-direction: column; align-items: center; justify-content: center; font: 22px "EB Garamond"; text-align: center; padding: 30px; }
#rotate div { font-size: 80px; animation: spin 2s ease-in-out infinite; }
@keyframes spin { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(90deg); } }
.shake { animation: stageShake 0.22s linear; }
@keyframes stageShake { 0% { translate: 0 0; } 25% { translate: -7px 4px; } 50% { translate: 6px -5px; } 75% { translate: -4px 3px; } 100% { translate: 0 0; } }
.pageTurn { animation: pageTurn 0.9s cubic-bezier(0.55, 0.05, 0.3, 1) both; transform-origin: 0% 50%; }
@keyframes pageTurn { 0% { transform: perspective(2400px) rotateY(0); filter: none; } 100% { transform: perspective(2400px) rotateY(-100deg); filter: brightness(0.7); opacity: 0.2; } }
.pageIn { animation: pageIn 0.6s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
@keyframes pageIn { 0% { transform: perspective(2400px) rotateY(18deg) translateX(40px); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* ---------------------------------------------------------------- phones and slow machines
   the gold stays still on touch screens (a sweeping gradient repaints the whole page every frame);
   "lite" is switched on by fx.js when frames come slow */
@media (pointer: coarse) { .gold-frame { animation: none; background-position: 55% 0; } .gilt { animation: none; background-position: 50% 0; } }
.lite .gold-frame { animation: none; background-position: 55% 0; }
.lite .gilt { animation: none; background-position: 50% 0; }
.lite .fig.breathe .sp { animation: none; }
.lite .emblem { animation: pop 0.3s cubic-bezier(0.3, 1.6, 0.5, 1) both; }

/* ---------------------------------------------------------------- chapters */
.chapNav { position: absolute; top: 50%; translate: 0 -50%; z-index: 6; width: 64px; height: 64px; font-size: 40px; }
.chapNav.prev { left: -34px; } .chapNav.next { right: -34px; }
.reading .capHead { display: block; margin: 14px 0 4px; font: 600 17px "IM Fell English SC", serif; color: var(--verm); letter-spacing: 0.6px; }
.reading .capHead:first-child { margin-top: 0; }

/* ---------------------------------------------------------------- relaxed or challenge */
#modal .modes { display: flex; gap: 16px; justify-content: center; margin: 10px 0 4px; }
#modal .mode { width: 300px; padding: 16px 18px; text-align: left; border-radius: 10px; border: 2px solid #8a6a3a; background: linear-gradient(#f7ecd2, #e8d5ab); color: var(--ink); box-shadow: 0 4px 0 #7a5a30; transition: transform 0.12s, box-shadow 0.12s; }
#modal .mode b { display: block; font: 30px "IM Fell English SC", serif; color: var(--verm); }
#modal .mode small { display: block; margin-top: 4px; font: italic 19px/1.25 "EB Garamond"; color: var(--muted); }
#modal .mode.on { border-color: var(--gold3); background: linear-gradient(#fff3cf, #f2d98f); box-shadow: 0 4px 0 #7a5a30, 0 0 0 3px var(--gold2), 0 0 22px rgba(243, 214, 131, 0.8); }
#modal .mode:hover { transform: translateY(-2px); }
#modal label.stack { flex-direction: column; align-items: flex-start; gap: 6px; width: 560px; }
#modal label .modes { justify-content: flex-start; margin: 0; }
#modal label .mode { width: 272px; padding: 10px 14px; } #modal label .mode b { font-size: 24px; } #modal label .mode small { font-size: 16px; }

/* study: a small chip after the verse reference, and the study card */
.caption .studyBtn { display: inline-block; margin: 0 8px 0 -2px; padding: 0 9px 1px; border-radius: 10px; border: 1.5px solid var(--gold3); background: linear-gradient(#fff3cf, #f2d98f); color: var(--verm); font: 600 13px "EB Garamond"; font-variant: small-caps; letter-spacing: 0.5px; cursor: pointer; vertical-align: 2px; font-style: normal; }
.caption .studyBtn:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(120, 80, 20, 0.35); }
#modal .studyBody { text-align: left; max-height: 520px; overflow-y: auto; padding-right: 12px; }
#modal .study + .study { margin-top: 26px; padding-top: 20px; border-top: 1px solid rgba(110, 85, 55, 0.35); }
#modal .study .sref { font: 600 18px "IM Fell English SC", serif; color: var(--verm); letter-spacing: 0.6px; }
#modal .study .verse { margin: 4px 0 10px; font: italic 21px/1.45 "EB Garamond"; color: #2c231b; }
#modal .study h3 { margin: 14px 0 4px; font: 22px "IM Fell English SC", serif; color: #5a3a1e; }
#modal .study p { margin: 0; font: 20px/1.45 "EB Garamond"; color: #2c231b; }
#modal .study .link { margin-top: 6px; font: 19px/1.4 "EB Garamond"; }
#modal .study .link b { color: var(--verm); font-weight: 600; margin-right: 6px; }
