:root { --emerald: #062a1f; --emerald2: #0c4a36; --gold: #d9b45b; --gold2: #f3dc9a; --paper: #fbf6e8; --ink: #0d1b16; --pw: 400px; --ph: 565px; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { font-family: Inter, system-ui, sans-serif; color: #f4efe0; background: radial-gradient(1200px 700px at 50% -10%, #11624a 0%, transparent 60%), var(--emerald);
  display: flex; flex-direction: column; overflow: hidden; }
body::before { content: ''; position: fixed; inset: 0; pointer-events: none; opacity: .09; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'><g fill='none' stroke='%23f3dc9a' stroke-width='1.2'><path d='M45 6 56 24 78 24 67 45 78 66 56 66 45 84 34 66 12 66 23 45 12 24 34 24Z'/><circle cx='45' cy='45' r='11'/></g></svg>"); background-size: 90px 90px; }
.qh { position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 14px 8px; background: linear-gradient(#04201700, #04201755); border-bottom: 1px solid #d9b45b33; }
.qback { color: var(--gold2); text-decoration: none; font-weight: 600; font-size: 15px; padding: 8px 12px; border-radius: 999px; background: #ffffff10; white-space: nowrap; }
.qtitle { text-align: center; line-height: 1.1; } .qar { display: block; font: 700 clamp(26px, 5vw, 38px)/1.2 Amiri, serif; color: var(--gold2); text-shadow: 0 2px 12px #0008; } .qtitle small { color: #cfe6da; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.qtools { display: flex; gap: 6px; } .qb { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid #d9b45b44; background: #ffffff10; color: var(--gold2); cursor: pointer; } .qb:hover { background: #ffffff22; } .qb:not(.on) .w { opacity: .15; } .qb.on { background: #d9b45b2b; }
.qnav { position: relative; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; padding: 10px 12px; }
.qnav label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #cfe6da; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.qnav select, .qnav input[type=number] { font: 600 15px Inter, sans-serif; color: #fff; background: #0a3a2b; border: 1px solid #d9b45b66; border-radius: 12px; padding: 9px 12px; min-width: 0; max-width: 52vw; } .qnav input[type=number] { width: 92px; }
#goForm { display: flex; gap: 8px; align-items: center; }
.qgo { font: 700 14px Inter, sans-serif; color: #2a1d00; background: linear-gradient(#f3dc9a, #d9b45b); border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; box-shadow: 0 6px 16px #0006; } .qgo.ghost { color: var(--gold2); background: #ffffff12; border: 1px solid #d9b45b66; box-shadow: none; }
.qstage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 6px; }
.qarrow { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 1px solid #d9b45b66; background: #0a3a2bcc; color: var(--gold2); display: grid; place-items: center; cursor: pointer; z-index: 6; backdrop-filter: blur(6px); box-shadow: 0 8px 20px #0007; } .qarrow:hover { background: #12654b; } .qarrow[disabled] { opacity: .25; pointer-events: none; }
.qbook-wrap { position: relative; width: calc(var(--pw) * var(--cols, 2)); height: var(--ph); perspective: 2600px; flex: none; }
/* the book: a leather frame, page edges and a shadow on the table */
.qbook { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; filter: drop-shadow(0 30px 40px #000a); }
.qbook::before { content: ''; position: absolute; inset: -10px -12px; border-radius: 14px; background: linear-gradient(135deg, #5a3a17, #2a1808 55%, #4b2f12); box-shadow: inset 0 0 0 2px #d9b45b88, inset 0 0 0 5px #00000040; z-index: -1; }
.pg { position: absolute; top: 0; height: 100%; width: calc(100% / var(--cols, 2)); overflow: hidden; background: var(--paper); }
.pg img, .face img { width: 100%; height: 100%; object-fit: fill; display: block; user-select: none; -webkit-user-drag: none; background: var(--paper); }
.pg.pl { left: 0; border-radius: 3px 0 0 3px; box-shadow: inset -26px 0 28px -22px #0007, -3px 0 0 #e7dcc1, -5px 1px 0 #cdbf9d, -7px 2px 0 #e7dcc1, -9px 3px 0 #bba97e; }
.pg.pr { left: calc(100% / var(--cols, 2)); border-radius: 0 3px 3px 0; box-shadow: inset 26px 0 28px -22px #0007, 3px 0 0 #e7dcc1, 5px 1px 0 #cdbf9d, 7px 2px 0 #e7dcc1, 9px 3px 0 #bba97e; }
.single .pg.pr { left: 0; border-radius: 3px; } .single .pg.pl { display: none; } .single .spine { display: none; }
.pg.blank, .face.blank { background: linear-gradient(135deg, #0c4a36, #062a1f); } .pg.blank img, .face.blank img { opacity: 0; }
.spine { position: absolute; top: 0; bottom: 0; left: 50%; width: 10px; margin-left: -5px; background: linear-gradient(90deg, transparent, #0006 45%, #0006 55%, transparent); pointer-events: none; z-index: 3; }
.leaf { position: absolute; top: 0; height: 100%; width: calc(100% / var(--cols, 2)); transform-style: preserve-3d; z-index: 4; display: none; will-change: transform; }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; background: var(--paper); }
.face.back { transform: rotateY(180deg); }
.face .shade { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: linear-gradient(90deg, #0000 40%, #0006); }
.qstage.zoomed { overflow: auto; align-items: flex-start; justify-content: flex-start; -webkit-overflow-scrolling: touch; } .qstage.zoomed .qbook-wrap { margin: 12px auto; } .qstage.zoomed .qarrow { position: fixed; top: 50%; transform: translateY(-50%); } .qstage.zoomed .qarrow.l { left: 8px; } .qstage.zoomed .qarrow.r { right: 8px; }
.qfoot { position: relative; z-index: 5; padding: 6px 16px calc(10px + env(safe-area-inset-bottom)); text-align: center; }
.qinfo { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 14px; color: #cfe6da; } .qinfo b { font: 700 20px Amiri, serif; color: var(--gold2); } .qinfo span:not(:empty)::before { content: '\00b7\00a0'; color: #d9b45b88; }
#slider { width: min(720px, 92vw); accent-color: #d9b45b; direction: rtl; margin: 6px 0 0; } /* the book reads right to left, so the slider does too */
.qhint { margin: 2px 0 0; font-size: 11px; color: #9fc2b2; }
@media (max-width: 899px) { .qarrow { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; background: #0a3a2baa; } .qarrow.l { left: 6px; } .qarrow.r { right: 6px; } .qhint { display: none; } .qnav label { font-size: 11px; } .qtitle small { display: none; } }
@media (prefers-reduced-motion: reduce) { .leaf { transition: none !important; } }