/* The opening (game/opening.js; docs/superpowers/specs/2026-11-29-slavic-book-sound.md, section 7a): a book on a table, over the whole
   view, while the world's files arrive. Loaded at the game door only, after game.css. Everything that moves is a transform or an
   opacity of one element at a time (a leaf, the book's slide, the shade); nothing animates once the book rests. --op-paper and
   --op-leather are the colours the pictures were drawn for (assets/book/opening-*.svg). Reduced motion: no turn, a plain 0.3 s fade. */
.op{--op-paper:#f4e9d3;--op-ink:#2b2118;--op-gold:#b0832a;--op-leaf:#d9ae58;--op-ember:#c2410c;--op-leather:#3a1c12;--op-ph:min(72vh,57.5vw);--op-pw:calc(var(--op-ph)*.8);--op-open:1.15s;--op-turn:.95s;--op-persp:calc(var(--op-ph)*4.2);--op-serif:"Brygada 1918","Palatino Linotype","Iowan Old Style",Georgia,serif;
  position:absolute;inset:0;z-index:50;overflow:hidden;pointer-events:auto;color:#f6e7c8;font-family:var(--op-serif);user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation;animation:op-in .6s ease both}
@supports (height:1dvh){.op{--op-ph:min(72dvh,57.5vw)}}
.op[hidden]{display:none}
.op-table{position:absolute;inset:0;background:radial-gradient(ellipse 62% 72% at 50% 43%,rgba(255,196,120,.24),rgba(255,170,90,.07) 55%,transparent 72%),radial-gradient(ellipse 112% 104% at 50% 45%,transparent 32%,rgba(6,3,1,.9) 100%),repeating-linear-gradient(0deg,transparent 0 118px,rgba(0,0,0,.4) 118px 120px,rgba(255,255,255,.03) 120px 121px),repeating-linear-gradient(90deg,rgba(0,0,0,.07) 0 1px,transparent 1px 7px,rgba(255,255,255,.02) 7px 8px,transparent 8px 19px),linear-gradient(180deg,#4a2c18,#33200f 60%,#281709)}
.op-stage{position:absolute;inset:0 0 12% 0;display:grid;place-items:center}
.op-book{position:relative;width:calc(var(--op-pw)*2);height:var(--op-ph);transform:translateX(-25%);transition:transform var(--op-open) cubic-bezier(.4,.05,.25,1)}
.op:not([data-state=closed]) .op-book{transform:none}
/* the block of pages under the right hand, on its board; the leaves lie on it and turn about the spine */
.op-block{position:absolute;left:50%;top:0;width:50%;height:100%;border-radius:2px 5px 5px 2px;background:linear-gradient(90deg,rgba(74,52,26,.34),rgba(74,52,26,.08) 5%,transparent 13%),linear-gradient(180deg,#f6ecd8,#f0e3c8);box-shadow:2px 2px 0 #e2d3b0,4px 4px 0 #cbb98f,6px 6px 0 #e6d8b6,8px 8px 0 #c2ae82,0 0 0 5px var(--op-leather),10px 12px 0 5px #2a130c,22px 30px 54px rgba(0,0,0,.66)}
.op-leaf{position:absolute;left:50%;top:0;width:50%;height:100%;transform-origin:0 50%;transform-style:preserve-3d;transform:perspective(var(--op-persp)) rotateY(0deg);transition:transform var(--op-turn) cubic-bezier(.42,.02,.3,1)}
.op-leaf.op-turned{transform:perspective(var(--op-persp)) rotateY(-180deg)}
.op-leaf.op-cover{transition-duration:var(--op-open)}
.op-leaf.op-under{visibility:hidden}
.op-f,.op-b{position:absolute;inset:0;overflow:hidden;backface-visibility:hidden;-webkit-backface-visibility:hidden}
.op-f{border-radius:2px 5px 5px 2px;background:linear-gradient(90deg,rgba(74,52,26,.34),rgba(74,52,26,.08) 5%,transparent 13%),linear-gradient(180deg,#f6ecd8,#f0e3c8)}
.op-b{transform:rotateY(180deg);border-radius:5px 2px 2px 5px;background:linear-gradient(270deg,rgba(74,52,26,.34),rgba(74,52,26,.08) 5%,transparent 13%),linear-gradient(180deg,#f6ecd8,#f0e3c8)}
/* the cover: leather, gold tooling, the name; its inside is the endpaper */
.op-cover .op-f{inset:-5px -6px -5px 0;border-radius:3px 9px 9px 3px;background:linear-gradient(90deg,#1c0b06 0,#2c140c 3.5%,transparent 6.5%),var(--op-leather);box-shadow:inset 0 0 0 1px rgba(255,220,160,.09),inset 0 0 44px rgba(0,0,0,.6)}
.op-cover .op-b{inset:-5px 0 -5px -6px;border-radius:9px 3px 3px 9px;background:radial-gradient(circle,rgba(217,174,88,.3) 0 1.5px,transparent 2px) 0 0/22px 22px,radial-gradient(circle,rgba(217,174,88,.16) 0 1px,transparent 1.5px) 11px 11px/22px 22px,linear-gradient(270deg,rgba(20,6,2,.5),transparent 12%),linear-gradient(135deg,#6b2a1c,#4f1f18);box-shadow:-22px 30px 54px rgba(0,0,0,.6)}
.op-tool{position:absolute;inset:0;width:100%;height:100%}
.op-title{position:absolute;left:0;right:0;top:19.6%;margin:0;text-align:center;font:600 calc(var(--op-ph)*.052)/1 var(--op-serif);letter-spacing:.14em;text-indent:.14em;text-transform:uppercase;color:var(--op-leaf);text-shadow:0 1px 0 rgba(0,0,0,.65),0 0 16px rgba(215,150,60,.28)}
.op-half{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7%}
.op-sign{width:60%}
.op-name{margin:0;font:600 calc(var(--op-ph)*.04)/1 var(--op-serif);letter-spacing:.3em;text-indent:.3em;text-transform:uppercase;color:var(--op-ink)}
.op-img{position:absolute;inset:4%;width:92%;height:92%;object-fit:contain}
/* a told page: the line as the book's own text, a painted initial, the folio */
.op-text{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:9% 10% 12% 11%}
.op-orn{width:22%;margin-bottom:8%;opacity:.92}
.op-line{margin:0;font:500 calc(var(--op-ph)*.05)/1.34 var(--op-serif);color:var(--op-ink);text-wrap:pretty}
.op-line::first-letter{float:left;margin:.04em .09em 0 0;font-size:2.7em;line-height:.8;font-weight:600;color:var(--op-ember)}
.op-folio{position:absolute;left:0;right:0;bottom:5%;text-align:center;font:500 calc(var(--op-ph)*.03)/1 var(--op-serif);letter-spacing:.24em;text-indent:.24em;color:rgba(43,33,24,.62)}
/* the last page: one picture over both leaves, the world's own frame in ink */
.op-frame{position:absolute;inset:5.5% 4.2%;z-index:30;opacity:0;pointer-events:none;border:2px solid var(--op-ink);outline:1px solid rgba(43,33,24,.55);outline-offset:3px;transition:opacity .3s ease,box-shadow .5s ease}
.op[data-page="5"] .op-book:not(.op-turning) .op-frame{opacity:1}
.op[data-plate="1"][data-ready="1"] .op-frame{box-shadow:0 0 0 5px rgba(217,174,88,.0),0 0 30px rgba(217,174,88,.42)}
.op-plate{position:absolute;inset:0;width:100%;height:100%;opacity:0}
.op[data-plate="1"] .op-plate{opacity:1}
.op-blank{position:absolute;left:50%;top:50%;width:19%;transform:translate(-50%,-50%);opacity:.26;transition:opacity .4s ease}
.op[data-plate="1"] .op-blank{opacity:0}
.op-gutter{position:absolute;left:46.8%;width:6.4%;top:0;bottom:0;z-index:31;opacity:0;pointer-events:none;background:linear-gradient(90deg,transparent,rgba(40,24,10,.26) 40%,rgba(20,10,4,.5) 50%,rgba(40,24,10,.26) 60%,transparent);transition:opacity .4s ease .5s}
.op:not([data-state=closed]) .op-gutter{opacity:1}
.op-shade{position:absolute;inset:0;z-index:32;opacity:0;pointer-events:none;background:radial-gradient(ellipse 36% 62% at 50% 50%,rgba(20,10,4,.46),transparent 72%)}
.op-turning .op-shade{animation:op-shade var(--op-turn) ease-in-out}
/* the player's hand: the whole book is one button; a corner leafs back */
.op-go{position:absolute;inset:-2%;z-index:40;padding:0;border:0;border-radius:10px;background:none;cursor:pointer}
.op[data-state=closed] .op-go{left:49%}
.op-go:disabled{cursor:default}
.op-back{position:absolute;left:.8%;bottom:1.4%;z-index:41;width:9%;aspect-ratio:1;padding:0;border:0;border-radius:50%;background:none;color:rgba(43,33,24,.7);font:500 calc(var(--op-ph)*.085)/1 var(--op-serif);cursor:pointer}
.op :is(.op-go,.op-back,.op-skip,.op-l):focus-visible{outline:2px solid var(--op-leaf);outline-offset:3px}
.op-cue{position:absolute;left:50%;bottom:calc(var(--sb,0px) + 3.6%);transform:translateX(-50%);margin:0;white-space:nowrap;font:italic 500 clamp(13px,1.5vh + .55vw,21px)/1.2 var(--op-serif);letter-spacing:.02em;color:#f3dfb8;text-shadow:0 1px 3px rgba(0,0,0,.95)}
.op-foot{position:absolute;left:calc(var(--sl,0px) + 18px);right:calc(var(--sr,0px) + 18px);bottom:calc(var(--sb,0px) + 12px);display:flex;align-items:center;justify-content:flex-end;gap:10px;min-height:32px;pointer-events:none;font:500 11px/1.2 "Mona Sans","Segoe UI",system-ui,sans-serif;letter-spacing:.12em;text-transform:uppercase;color:rgba(246,231,200,.74)}
.op-foot>*{pointer-events:auto}
/* the cue stands in the middle of the same row: the load ends 12px short of it (--op-cue-w: the cue's width, opening.js); a long line wraps */
.op-load{display:flex;align-items:center;gap:10px;min-width:0;max-width:calc(50% + (var(--sr,0px) - var(--sl,0px))/2 - var(--op-cue-w,0px)/2 - 12px);margin:0 auto 0 0}
.op-load b{position:relative;flex:none;width:112px;height:2px;overflow:hidden;background:rgba(246,231,200,.2)}
.op-load i{position:absolute;inset:0;background:var(--op-leaf);transform-origin:left;transform:scaleX(var(--op-load,0));transition:transform .3s ease}
.op-load-n:not(:empty)::before{content:"·";margin:0 .6em}
.op-lang{display:flex;gap:6px}
.op-skip,.op-l{min-height:32px;padding:6px 12px;border:1px solid rgba(246,231,200,.28);border-radius:999px;background:rgba(20,10,4,.3);color:inherit;font:inherit;letter-spacing:inherit;text-transform:inherit;cursor:pointer}
.op-l[aria-pressed=true],.op[data-ready="1"] .op-skip{border-color:var(--op-leaf);background:rgba(217,174,88,.22);color:#ffe9c2}
.op[data-touch] :is(.op-skip,.op-l){min-height:40px;padding:8px 14px}
/* the Bajarz's line when it is not the page's own; it outlives the book by the length of his last words */
.op-sub{position:absolute;left:50%;bottom:calc(var(--sb,0px) + 9%);z-index:62;transform:translateX(-50%);box-sizing:border-box;width:max-content;max-width:min(88vw,780px);margin:0;padding:.5em 1.4em;pointer-events:none;text-align:center;font:italic 500 clamp(15px,1.5vh + 1vw,25px)/1.34 "Brygada 1918","Palatino Linotype","Iowan Old Style",Georgia,serif;color:#fff3d6;text-shadow:0 1px 2px #000,0 0 14px rgba(0,0,0,.85);background:radial-gradient(ellipse at center,rgba(12,7,3,.66),rgba(12,7,3,0) 72%);animation:op-in .35s ease both}
/* leaving: the book goes under the picture that grows out of it; the table stays until the picture covers the view (opening.js uncovers it) */
.op[data-state=leaving] :is(.op-stage,.op-cue,.op-foot){opacity:0;transition:opacity .28s ease}
.op[data-state=leaving][data-plate="0"]{opacity:0;transition:opacity .45s ease}
/* while the book is up the game's own cover is silent under it; while the ink drains the HUD and the thumbs wait */
#game.op-on .g-cover>*{visibility:hidden}
#game>.bp{--bp-z:20}
#game>.bp.bp-into{--bp-z:60}
#game.bp-into.bp-into :is(.g-hud,.gt-pad){opacity:0}
#game:is(.bp-into,.bp-after) :is(.g-hud,.gt-pad){transition:opacity .5s ease}
@keyframes op-in{from{opacity:0}to{opacity:1}}
@keyframes op-shade{0%,100%{opacity:0}50%{opacity:1}}
.op[data-reduced]{animation-duration:.3s}
.op[data-reduced] :is(.op-leaf,.op-book,.op-load i){transition:none}
.op[data-reduced] .op-turning{animation:op-in .3s ease}
.op[data-reduced] .op-turning .op-shade{animation:none}
.op[data-reduced] .op-plate{transition:opacity .3s ease}
/* a phone held upright: a smaller book, the words in rows under it */
@media (max-aspect-ratio:1/1){
  .op-stage{inset:0 0 28% 0}
  .op-cue{bottom:calc(var(--sb,0px) + 17%);width:88vw;white-space:normal;text-align:center}
  .op-sub{bottom:calc(var(--sb,0px) + 23%)}
  .op-foot{flex-wrap:wrap;justify-content:center;row-gap:10px}
  .op-load{flex:1 0 100%;justify-content:center;max-width:none;margin:0}
}
/* a narrow or a short landscape screen (a phone held sideways is 915 wide and more): the count alone, or what is going on while nothing is counted */
@media (max-width:900px) and (min-aspect-ratio:1/1),(max-height:430px) and (min-aspect-ratio:1/1){.op-load-what{display:none}.op-load-n::before{content:none}.op-load-t:has(.op-load-n:empty) .op-load-what{display:inline}}
@media (max-height:430px) and (min-aspect-ratio:1/1){.op{--op-ph:min(70vh,57.5vw)}.op-foot{bottom:calc(var(--sb,0px) + 6px);font-size:10px}.op-cue{bottom:calc(var(--sb,0px) + 4.6%)}.op-sub{bottom:calc(var(--sb,0px) + 14%)}}
