/* Malcolm book reader. Sizes inside the book use --u (pixels per unit; a page is 100 units wide). */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column; overflow: hidden;
  font-family: Nunito, system-ui, sans-serif; color: #f3ede0;
  background: #2b2320; --tint: #10131f; --glow: rgba(255, 220, 120, .3);
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}

/* ---------- bars ---------- */
#bar, #nav, #tools { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(0, 0, 0, .38); }
#bar { padding-top: max(6px, env(safe-area-inset-top)); }
#nav { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
#bar label { display: flex; align-items: center; gap: 5px; font-size: 13px; min-width: 0; }
#bar label span { opacity: .7; white-space: nowrap; }
select, button {
  font: inherit; font-size: 14px; color: #f3ede0; background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .25); border-radius: 7px; padding: 6px 9px; min-height: 34px; min-width: 0;
}
select { max-width: 100%; text-overflow: ellipsis; }
select option { color: #222; background: #fff; }
button { cursor: pointer; }
button:hover:not(:disabled), select:hover { background: rgba(255, 255, 255, .22); }
button:disabled { opacity: .3; cursor: default; }
:focus-visible { outline: 2px solid #ffd35a; outline-offset: 2px; }
.home { color: inherit; text-decoration: none; font-size: 22px; line-height: 1; padding: 4px 6px; }
#edit { margin-left: auto; }
#tools { flex-wrap: wrap; font-size: 13px; background: #0a4f9e; }
#tools .hint { flex: 1 1 260px; }
[hidden] { display: none !important; }
#range { flex: 1; min-width: 40px; accent-color: #ffd35a; }
#pos { font-size: 13px; min-width: 62px; text-align: center; font-variant-numeric: tabular-nums; }
#prev, #next { font-size: 20px; padding: 3px 16px; }

/* ---------- stage ---------- */
#wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
#stage { position: relative; perspective: 2600px; --u: 5px; cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.screen { position: absolute; inset: 0; overflow: hidden; }
.it { position: absolute; }
.it.img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.it.txt { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.it.txt .in { width: 100%; outline: none; }
.it.txt p { margin: 0 0 .55em; }
.it.txt p:last-child { margin-bottom: 0; }
.folio { position: absolute; bottom: calc(var(--u) * 2.2); left: 0; right: 0; text-align: center; font-size: calc(var(--u) * 2.3); opacity: .45; pointer-events: none; }

/* ---------- page turns ---------- */
.under { position: absolute; inset: 0; }
.half { position: absolute; top: 0; width: 50%; height: 100%; overflow: hidden; }
.half.L { left: 0; } .half.R { left: 50%; }
.half .screen { inset: auto; top: 0; width: 200%; height: 100%; }
.half.L .screen { left: 0; } .half.R .screen { left: -100%; }
.leaf { position: absolute; top: 0; width: 50%; height: 100%; transform-style: preserve-3d; transition: transform .75s cubic-bezier(.45, .05, .35, 1); z-index: 5; }
.leaf .half { left: 0; width: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.leaf .backface { transform: rotateY(180deg); }
.leaf.fwd { left: 50%; transform-origin: left center; } .leaf.fwd.go { transform: rotateY(-180deg); }
.leaf.back { left: 0; transform-origin: right center; } .leaf.back.go { transform: rotateY(180deg); }
.leaf .half::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .16), transparent 30%); pointer-events: none; }
.leaf.back .front::after, .leaf.fwd .backface::after { background: linear-gradient(270deg, rgba(0, 0, 0, .16), transparent 30%); }
.in-right { animation: inR .42s ease both; } .in-left { animation: inL .42s ease both; }
.out-left { animation: outL .42s ease both; } .out-right { animation: outR .42s ease both; }
.in-fade { animation: fadeIn .42s ease both; } .out-fade { animation: fadeOut .42s ease both; }
@keyframes inR { from { transform: translateX(100%); } }
@keyframes inL { from { transform: translateX(-100%); } }
@keyframes outL { to { transform: translateX(-35%); opacity: 0; } }
@keyframes outR { to { transform: translateX(35%); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .leaf { transition-duration: .01s; }
  .in-right, .in-left, .out-left, .out-right, .in-fade, .out-fade { animation-duration: .01s; }
}

/* ---------- look 1: storybook ---------- */
body[data-look=storybook] { background: radial-gradient(ellipse at center, #4a3a30, #241b17); }
body[data-look=storybook] #stage { box-shadow: 0 calc(var(--u) * 1.5) calc(var(--u) * 5) rgba(0, 0, 0, .55); border-radius: calc(var(--u) * .8); }
body[data-look=storybook] .screen {
  color: #2e2622; border-radius: calc(var(--u) * .8);
  background: linear-gradient(90deg, transparent 46%, rgba(90, 60, 30, .07) 48.8%, rgba(70, 45, 20, .22) 50%, rgba(90, 60, 30, .07) 51.2%, transparent 54%), #fbf4e3;
}
body[data-look=storybook][data-format=single] .screen { background: #fbf4e3; }
body[data-look=storybook] .it.img img { border-radius: calc(var(--u) * .7); box-shadow: 0 calc(var(--u) * .5) calc(var(--u) * 1.6) rgba(60, 40, 20, .28); }
body[data-look=storybook] .txt { font-family: Lora, Georgia, serif; line-height: 1.5; text-align: center; }
body[data-look=storybook] .txt.chapter { font-family: Fraunces, Georgia, serif; font-style: italic; font-weight: 500; color: #a14a24; }
body[data-look=storybook] .txt.title { font-family: Fraunces, Georgia, serif; font-weight: 600; line-height: 1.12; color: #7a2f17; }
body[data-look=storybook] .txt.title p { margin: 0; }
body[data-look=storybook] .txt.byline { font-style: italic; }

/* ---------- look 2: scrapbook on black card (pictures keep their rough paper edge) ---------- */
body[data-look=scrapbook] { background: #050506; }
body[data-look=scrapbook] #stage { box-shadow: 0 calc(var(--u) * 1.5) calc(var(--u) * 5) rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .07); }
body[data-look=scrapbook] .screen {
  color: #f4efe4;
  background: linear-gradient(90deg, transparent 49.3%, rgba(255, 255, 255, .06) 49.8%, rgba(0, 0, 0, .7) 50%, rgba(255, 255, 255, .05) 50.3%, transparent 50.8%), #121214;
}
body[data-look=scrapbook][data-format=single] .screen { background: #121214; }
body[data-look=scrapbook] .txt { font-family: 'Patrick Hand', 'Comic Sans MS', cursive; line-height: 1.3; text-align: center; padding: 0 calc(var(--u) * 4); }
body[data-look=scrapbook] .txt.chapter, body[data-look=scrapbook] .txt.title { font-family: Caveat, 'Patrick Hand', cursive; font-weight: 600; color: #f2c14e; line-height: 1.05; }
body[data-look=scrapbook] .txt.chapter { transform: rotate(-2deg); }
body[data-look=scrapbook] .txt.title p { margin: 0; }
body[data-look=scrapbook] .folio { font-family: 'Patrick Hand', cursive; }

/* ---------- look 2b: scrapbook on brown paper ---------- */
body[data-look=paper] { background: #24302f; }
body[data-look=paper] #stage { box-shadow: 0 calc(var(--u) * 1.5) calc(var(--u) * 5) rgba(0, 0, 0, .5); }
body[data-look=paper] .screen {
  color: #26262e;
  background:
    linear-gradient(90deg, transparent 49.2%, rgba(60, 40, 20, .28) 50%, transparent 50.8%),
    radial-gradient(rgba(90, 60, 30, .13) 1px, transparent 1.6px) 0 0 / 11px 11px,
    radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1.6px) 5px 6px / 13px 13px,
    #d6bf9b;
}
body[data-look=paper][data-format=single] .screen { background: radial-gradient(rgba(90, 60, 30, .13) 1px, transparent 1.6px) 0 0 / 11px 11px, radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1.6px) 5px 6px / 13px 13px, #d6bf9b; }
body[data-look=paper] .it.img { background: #fffdf6; padding: calc(var(--u) * 1.3); box-shadow: 0 calc(var(--u) * .5) calc(var(--u) * 1.4) rgba(40, 25, 10, .4); }
body[data-look=paper] .txt { font-family: 'Patrick Hand', 'Comic Sans MS', cursive; line-height: 1.3; text-align: center; }
body[data-look=paper] .txt.body { background: #fffaf0; padding: 0 calc(var(--u) * 2); box-shadow: 0 calc(var(--u) * .3) calc(var(--u) * .9) rgba(40, 25, 10, .28); }
body[data-look=paper] .txt.chapter, body[data-look=paper] .txt.title { font-family: Caveat, 'Patrick Hand', cursive; font-weight: 600; color: #8a2c17; line-height: 1.05; }
body[data-look=paper] .txt.chapter { font-size-adjust: none; transform: rotate(-2deg); }
body[data-look=paper] .txt.title p { margin: 0; }
body[data-look=paper] .folio { font-family: 'Patrick Hand', cursive; }

/* ---------- look 4: Wilde edition (a fin-de-siecle fairy-tale book: ivory, peacock green, gold rules) ---------- */
body[data-look=wilde] { background: radial-gradient(ellipse at center, #17443d, #071c19); }
body[data-look=wilde] #stage { box-shadow: 0 calc(var(--u) * 1.5) calc(var(--u) * 5) rgba(0, 0, 0, .6), 0 0 0 calc(var(--u) * .5) #b08d3c; }
body[data-look=wilde] .screen {
  color: #26221c;
  background: linear-gradient(90deg, transparent 46%, rgba(90, 70, 30, .08) 48.8%, rgba(70, 50, 20, .25) 50%, rgba(90, 70, 30, .08) 51.2%, transparent 54%), #f5edd8;
}
body[data-look=wilde][data-format=single] .screen { background: #f5edd8; }
body[data-look=wilde] .screen::before, body[data-look=wilde] .screen::after {
  content: ''; position: absolute; top: calc(var(--u) * 4); bottom: calc(var(--u) * 4); width: calc(var(--u) * 92); pointer-events: none;
  border: calc(var(--u) * .28) solid #b08d3c; outline: calc(var(--u) * .12) solid #1d5a50; outline-offset: calc(var(--u) * .7);
}
body[data-look=wilde] .screen::before { left: calc(var(--u) * 4); }
body[data-look=wilde] .screen::after { left: calc(var(--u) * 104); }
body[data-look=wilde][data-format=single] .screen::after { display: none; }
body[data-look=wilde] .it.img { background: #fbf7ea; padding: calc(var(--u) * .9); border: calc(var(--u) * .2) solid #b08d3c; box-shadow: 0 calc(var(--u) * .4) calc(var(--u) * 1.2) rgba(40, 30, 10, .25); }
body[data-look=wilde] .txt { font-family: 'Cormorant Garamond', Garamond, Georgia, serif; font-weight: 500; line-height: 1.42; text-align: center; }
body[data-look=wilde][data-text=wilde] .txt.body { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
body[data-look=wilde][data-text=wilde] .txt.body p { text-indent: 1.4em; margin-bottom: .2em; }
body[data-look=wilde][data-text=wilde] .txt.body p:first-child { text-indent: 0; }
body[data-look=wilde][data-text=wilde] .screen.opens .txt.body p:first-child::first-letter { float: left; font-size: 3.1em; line-height: .82; padding: .06em .08em 0 0; color: #1d5a50; font-weight: 600; }
body[data-look=wilde] .txt.chapter { font-variant: small-caps; letter-spacing: .14em; color: #1d5a50; font-weight: 600; }
body[data-look=wilde] .txt.chapter p::before { content: '\2766'; color: #b08d3c; letter-spacing: 0; margin-right: .5em; }
body[data-look=wilde] .txt.chapter p::after { content: '\2766'; color: #b08d3c; letter-spacing: 0; margin-left: .4em; }
body[data-look=wilde] .txt.title { font-weight: 600; line-height: 1.1; color: #1d5a50; font-style: italic; }
body[data-look=wilde] .txt.title p { margin: 0; }
body[data-look=wilde] .txt.byline { font-style: italic; }
body[data-look=wilde] .folio { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; bottom: calc(var(--u) * 5.6); }

/* ---------- look 5: Rumpus edition (bright and cheeky, for the comic verse) ---------- */
body[data-look=rumpus] { background: #1f6fb5; }
body[data-look=rumpus] #stage { box-shadow: 0 calc(var(--u) * 1.5) calc(var(--u) * 4) rgba(0, 20, 60, .5); border-radius: calc(var(--u) * 1.2); }
body[data-look=rumpus] .screen {
  color: #1c1c28; border-radius: calc(var(--u) * 1.2);
  background: linear-gradient(90deg, transparent 47%, rgba(0, 0, 0, .05) 49.2%, rgba(0, 0, 0, .16) 50%, rgba(0, 0, 0, .05) 50.8%, transparent 53%), #fffdf4;
}
body[data-look=rumpus][data-format=single] .screen { background: #fffdf4; }
body[data-look=rumpus] .it.img { border-radius: calc(var(--u) * 1.2); border: calc(var(--u) * .55) solid #ffd23f; box-shadow: calc(var(--u) * .8) calc(var(--u) * .8) 0 #1c1c28; overflow: hidden; }
body[data-look=rumpus] .it.img:nth-of-type(odd) { rotate: -1.3deg; }
body[data-look=rumpus] .it.img:nth-of-type(even) { rotate: 1.1deg; }
body[data-look=rumpus] .txt { font-family: Nunito, system-ui, sans-serif; font-weight: 600; line-height: 1.42; text-align: center; }
body[data-look=rumpus] .txt.chapter, body[data-look=rumpus] .txt.title { font-family: 'Gochi Hand', 'Patrick Hand', cursive; font-weight: 400; color: #e4572e; line-height: 1.05; }
body[data-look=rumpus] .txt.chapter { rotate: -2deg; }
body[data-look=rumpus] .txt.chapter .in { text-decoration: underline wavy #ffd23f; text-underline-offset: .22em; }
body[data-look=rumpus] .txt.title p { margin: 0; }
body[data-look=rumpus] .folio { font-family: 'Gochi Hand', cursive; opacity: .6; }

/* ---------- look 7: Midnight matinee (an old horror film: near-black, off-white and blood-red title cards) ---------- */
body[data-look=horror] { background: radial-gradient(ellipse at center, #1a1111, #030202); }
body[data-look=horror] #stage { box-shadow: 0 calc(var(--u) * 1.5) calc(var(--u) * 5) rgba(0, 0, 0, .9), 0 0 0 1px rgba(240, 230, 210, .14); }
body[data-look=horror] .screen {
  color: #f1ebe0;
  background: linear-gradient(90deg, transparent 49.3%, rgba(255, 255, 255, .05) 49.8%, rgba(0, 0, 0, .8) 50%, rgba(255, 255, 255, .04) 50.3%, transparent 50.8%), #0b0909;
}
body[data-look=horror][data-format=single] .screen { background: #0b0909; }
/* the vignette: the corners and edges of every page fall away into the dark (it never reaches the words) */
body[data-look=horror] .screen::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 3; background: radial-gradient(ellipse at center, transparent 62%, rgba(0, 0, 0, .55) 100%); }
body[data-look=horror][data-format=spread] .screen::after { background: radial-gradient(ellipse at center, transparent 62%, rgba(0, 0, 0, .55) 100%) left top / 50% 100% no-repeat, radial-gradient(ellipse at center, transparent 62%, rgba(0, 0, 0, .55) 100%) right top / 50% 100% no-repeat; }
body[data-look=horror] .it.img { border: calc(var(--u) * .3) solid #d9d2c3; box-shadow: 0 0 calc(var(--u) * 2.4) rgba(0, 0, 0, .9); }
body[data-look=horror] .txt { font-family: 'Libre Baskerville', Georgia, serif; line-height: 1.5; text-align: center; }
body[data-look=horror][data-text=grim] .txt.body { text-align: left; }
body[data-look=horror] .txt.chapter, body[data-look=horror] .txt.title { font-family: Cinzel, 'Cormorant Garamond', Georgia, serif; font-weight: 700; color: #ff6b6b; letter-spacing: .08em; line-height: 1.15; text-shadow: 0 0 .6em rgba(170, 0, 0, .55); }
body[data-look=horror] .txt.chapter { font-weight: 600; }
body[data-look=horror] .txt.title p { margin: 0; }
body[data-look=horror] .txt.byline { font-style: italic; }
body[data-look=horror] .folio { font-family: 'Libre Baskerville', Georgia, serif; opacity: .6; }

/* ---------- look 3: night flight ---------- */
body[data-look=night] { background: radial-gradient(ellipse at 50% 40%, var(--tint), #05060b 85%); transition: background .6s; }
body[data-look=night] .screen { color: #f6f0e1; }
body[data-look=night] .it.img img { border-radius: calc(var(--u) * 1); box-shadow: 0 0 calc(var(--u) * 7) var(--glow), 0 calc(var(--u) * .6) calc(var(--u) * 2) rgba(0, 0, 0, .6); }
body[data-look=night] .txt { font-family: Nunito, system-ui, sans-serif; font-weight: 600; line-height: 1.42; text-align: center; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
body[data-look=night] .txt.chapter { color: #ffd35a; text-transform: uppercase; letter-spacing: .16em; font-weight: 800; }
body[data-look=night] .txt.title { font-weight: 800; line-height: 1.12; color: #ffd35a; }
body[data-look=night] .txt.title p { margin: 0; }

/* ---------- movement: Malcolm flying, eyes blinking ---------- */
#move { white-space: nowrap; flex: none; }
#move .short { display: none; }
.pic { position: relative; width: 100%; height: 100%; }
.pic > img { position: absolute; inset: 0; }
.fly { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.fly-x, .fly-y, .fly-f, .fly-s { position: absolute; }
.fly-y, .fly-f, .fly-s { inset: 0; }
.fly-x { animation: fly-x var(--tx) ease-in-out infinite; }
.fly-y { animation: fly-y var(--ty) ease-in-out infinite; }
.fly-f { transform-origin: var(--bx) var(--by); animation: fly-flip var(--tx) step-end infinite; }
.fly-f.bank { animation: fly-bank var(--tb) ease-in-out infinite; }
.fly-s { background-repeat: no-repeat; }
@keyframes fly-x { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(var(--x1)); } 50% { transform: translateX(var(--x2)); } 75% { transform: translateX(var(--x3)); } }
@keyframes fly-y { 0%, 100% { transform: translateY(0); } 25% { transform: translateY(var(--y1)); } 50% { transform: translateY(var(--y2)); } 75% { transform: translateY(var(--y3)); } }
@keyframes fly-flip { 0% { transform: scaleX(var(--f0)); } 25% { transform: scaleX(var(--f1)); } 50% { transform: scaleX(var(--f2)); } 75% { transform: scaleX(var(--f3)); } }
@keyframes fly-bank { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(4deg); } 50% { transform: rotate(-2deg); } 75% { transform: rotate(3deg); } }
.lid { position: absolute; opacity: 0; pointer-events: none; }
.lid svg { display: block; width: 100%; height: 100%; overflow: visible; }
@media (prefers-reduced-motion: reduce) { .fly, .lid { display: none; } }
@media (max-width: 620px) { #move .long { display: none; } #move .short { display: inline; } #move { padding: 6px 7px; } }

/* ---------- edit mode ---------- */
body.editing #stage { cursor: default; }
body.editing .it { outline: 1px dashed rgba(10, 124, 255, .55); cursor: move; touch-action: none; }
body.editing .it.txt { overflow: visible; }
body.editing .it.sel { outline: 2px solid #0a7cff; z-index: 4; }
body.editing .it.typing { cursor: text; background: rgba(255, 255, 255, .92); color: #111; }
.grip { display: none; }
body.editing .it.sel .grip { display: block; position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%; background: #0a7cff; border: 2px solid #fff; cursor: nwse-resize; }

/* ---------- small screens ---------- */
@media (max-width: 620px) {
  #bar { gap: 5px; padding-left: 6px; padding-right: 6px; }
  #bar label span { display: none; }
  #bar label { flex: 1 1 0; }
  select { width: 100%; padding: 6px 5px; font-size: 13px; }
}
@media (max-height: 460px) {
  #bar, #nav { padding-top: 2px; padding-bottom: 2px; }
  select, button { min-height: 28px; padding: 2px 8px; }
}

/* ---------- edit bar: style row and picture chooser ---------- */
#tools .style { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .25); }
#tools .style label { display: flex; align-items: center; gap: 6px; }
#tools input[type=color] { width: 38px; height: 30px; padding: 0; border: 1px solid rgba(255, 255, 255, .5); border-radius: 6px; background: none; cursor: pointer; }
#tools button, #tools select { min-height: 30px; padding: 3px 9px; font-size: 13px; }
#picker { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .65); display: flex; align-items: center; justify-content: center; padding: 16px; }
#picker .box { background: #23262e; color: #f3ede0; border-radius: 12px; width: min(980px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; }
#picker header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, .15); }
#picker-grid { overflow-y: auto; padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
#picker-grid button { padding: 4px; min-height: 0; height: 96px; display: flex; align-items: center; justify-content: center; background: #14161b; }
#picker-grid img { max-width: 100%; max-height: 100%; display: block; }

/* ---------- saved versions ---------- */
#tools button.strong { background: #ffd35a; color: #1c1c28; border-color: #ffd35a; font-weight: 800; }
#tools button.strong:hover { background: #ffe38f; }
#toast { position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); z-index: 60; background: #1c1c28; color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 14px; box-shadow: 0 4px 18px rgba(0, 0, 0, .5); max-width: 92vw; text-align: center; }
/* a saved version on a phone: one page of the facing pages at a time */
body[data-format=half] #stage > .half { left: 0; width: 100%; }

/* the straight scrapbook: nothing tilted */
body[data-straight] .txt.chapter { transform: none !important; }

/* ---------- zoom: one picture large over a dark backdrop ---------- */
body:not(.editing) #stage .it.img { cursor: zoom-in; }
#stage .it.img:focus-visible { outline-offset: -3px; }
#zoom { position: fixed; inset: 0; z-index: 70; background: rgba(6, 5, 5, .97); opacity: 0; transition: opacity .18s; }
#zoom.on { opacity: 1; }
#zoom-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
#zoom-stage.fitted { cursor: default; }
#zoom-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
#zoom-img.smooth { transition: transform .2s ease; }
#zoom .zb { min-width: 52px; min-height: 52px; padding: 0; font-size: 28px; line-height: 1; border-radius: 50%; background: rgba(40, 36, 34, .82); border-color: rgba(255, 255, 255, .35); }
#zoom .zb:hover:not(:disabled) { background: rgba(90, 82, 78, .9); }
#zoom-close { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); font-size: 34px; }
#zoom-bar { position: absolute; left: 0; right: 0; bottom: max(12px, env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 14px; pointer-events: none; }
#zoom-bar .zb { pointer-events: auto; }
#zoom-count { position: absolute; top: max(10px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); line-height: 52px; font-size: 14px; opacity: .75; font-variant-numeric: tabular-nums; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { #zoom { transition: none; } #zoom-img.smooth { transition: none; } }
