/* =========================================================
   ОйLA! — landing (3D book) + reader chrome + page turning
   ========================================================= */
html, body { height: 100%; }
body.is-landing, body.is-reading { overflow: hidden; }

.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1100px 760px at 12% 8%, #D9E9FF 0%, rgba(217,233,255,0) 62%),
    radial-gradient(900px 640px at 92% 96%, #FFF0CC 0%, rgba(255,240,204,0) 58%),
    radial-gradient(700px 500px at 85% 10%, #E6F3FF 0%, rgba(230,243,255,0) 60%),
    linear-gradient(180deg, #F6F9FF 0%, #FBF9F4 70%);
}
.sky .glow { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: drift 18s ease-in-out infinite alternate; }
.sky .g1 { width: 420px; height: 420px; left: -80px; top: 18%; background: #BFDDFF; }
.sky .g2 { width: 360px; height: 360px; right: 6%; top: -80px; background: #D6E8FF; animation-delay: -6s; }
.sky .g3 { width: 300px; height: 300px; right: 18%; bottom: -60px; background: #FFE6A8; opacity: .45; animation-delay: -11s; }
.sky .dots { position: absolute; inset: 0;
  background-image: radial-gradient(rgba(30,107,255,.16) 1.2px, transparent 1.4px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 45%, #000 0%, transparent 70%);
          mask-image: radial-gradient(ellipse at 50% 45%, #000 0%, transparent 70%);
  opacity: .55;
}
body.is-reading .sky .dots { opacity: .25; }
@keyframes drift { to { transform: translate(40px, -30px) scale(1.08); } }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: baseline; gap: .6em; text-decoration: none; color: inherit; }
.brand-mark { font-family: var(--font-display); font-weight: 900; font-size: 1.55rem; letter-spacing: -.035em; color: var(--navy); line-height: 1; }
.brand-mark b { color: var(--blue); font-weight: 900; }
.brand-mark i { color: var(--yellow-2); font-style: normal; }
.brand-sub { font-size: .78rem; font-weight: 650; color: var(--muted); letter-spacing: .04em; }

.land-top { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 18px clamp(16px, 3vw, 40px); }
.land-nav { display: flex; align-items: center; gap: 10px; }
.nav-link { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .95rem; padding: .5em .8em; border-radius: 999px; }
.nav-link:hover { background: rgba(255,255,255,.7); }
body.is-reading .land-top { display: none; }

/* ---------- landing stage ---------- */
.landing { position: relative; z-index: 1; height: 100svh; display: grid; place-items: center; }
body.is-reading .landing { display: none; }
.stage3d { position: relative; perspective: 2200px; perspective-origin: 50% 40%; display: grid; place-items: center; margin-top: 2vh; }
.stage3d::before { content: ""; position: absolute; left: 50%; top: 48%; width: calc(clamp(250px, min(31vw, 46vh), 430px) * 2.3); aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; background: radial-gradient(closest-side, rgba(255,255,255,.95), rgba(255,255,255,.5) 45%, rgba(255,255,255,0) 72%); z-index: -2; pointer-events: none; }
.orbits { position: absolute; left: 50%; top: 48%; width: 0; height: 0; z-index: -1; pointer-events: none; }
.orbit { position: absolute; left: 0; top: 0; border-radius: 50%; border: 1.5px dashed rgba(30,107,255,.22); transform: translate(-50%, -50%) rotate(-18deg); animation: orbitSpin 60s linear infinite; }
.orbit.o1 { width: calc(clamp(250px, min(31vw, 46vh), 430px) * 2.05); height: calc(clamp(250px, min(31vw, 46vh), 430px) * .95); }
.orbit.o2 { width: calc(clamp(250px, min(31vw, 46vh), 430px) * 2.7); height: calc(clamp(250px, min(31vw, 46vh), 430px) * 1.45); border-color: rgba(30,107,255,.12); animation-duration: 90s; animation-direction: reverse; }
.orbit i { position: absolute; width: 12px; height: 12px; border-radius: 50%; top: 50%; left: -6px; margin-top: -6px; background: var(--yellow); box-shadow: 0 0 0 5px rgba(255,197,61,.25); }
.orbit.o2 i { background: var(--blue); box-shadow: 0 0 0 5px rgba(30,107,255,.18); left: auto; right: -6px; }
.orbit.o1 b { position: absolute; width: 8px; height: 8px; border-radius: 50%; right: 18%; top: 4%; background: var(--green); }
@keyframes orbitSpin { to { transform: translate(-50%, -50%) rotate(342deg); } }

.book3d {
  --w: clamp(250px, min(31vw, 46vh), 430px);
  --h: calc(var(--w) * 1.38);
  --t: calc(var(--w) * .1);
  position: relative; width: var(--w); height: var(--h);
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, -9deg)) rotateY(var(--ry, 27deg)) rotateZ(-1deg);
  transition: transform .9s var(--ease);
  cursor: pointer;
  animation: bookIn 1.2s var(--ease) both, bob 7s ease-in-out 1.2s infinite;
}
@keyframes bookIn { from { transform: rotateX(-24deg) rotateY(60deg) translateY(60px) scale(.9); } }
@keyframes bob { 50% { translate: 0 -10px; } }
.book3d > div { position: absolute; }

.b-front, .b-back { inset: 0; transform-style: preserve-3d; }
.b-front { transform: translateZ(calc(var(--t) / 2)); transform-origin: 0 50%; transition: transform 1.15s cubic-bezier(.55,.05,.3,1); }
.b-back { transform: rotateY(180deg) translateZ(calc(var(--t) / 2)); border-radius: 16px 3px 3px 16px;
  background: linear-gradient(200deg, #0F3489, #081F55); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.cover, .b-front-inner { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.b-front-inner { transform: rotateY(180deg); border-radius: 16px 3px 3px 16px; background: #EAF4FF;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='70' height='70' viewBox='0 0 70 70'%3E%3Cg fill='none' stroke='%231E6BFF' stroke-opacity='.18' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M10 24c0-9 6-14 15-14 0 9-6 14-15 14zM10 24l9-9'/%3E%3Ccircle cx='50' cy='18' r='5'/%3E%3Cpath d='M41 18h18'/%3E%3Cpath d='M48 48c-4 6-6 9-6 12a6 6 0 0 0 12 0c0-3-2-6-6-12z'/%3E%3Cpath d='m18 47 2 5 5 1-4 3 1 5-4-3-4 3 1-5-4-3 5-1z'/%3E%3C/g%3E%3C/svg%3E"); }

.cover {
  border-radius: 3px 16px 16px 3px; overflow: hidden; color: #fff;
  background:
    radial-gradient(120% 70% at 85% -5%, rgba(80,150,255,.85) 0%, rgba(80,150,255,0) 55%),
    radial-gradient(90% 60% at -10% 105%, #05163F 0%, rgba(5,22,63,0) 60%),
    linear-gradient(162deg, #1546B8 0%, #0D338F 42%, #0A2768 78%, #081E52 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), inset -2px 0 0 rgba(255,255,255,.05);
  display: flex; flex-direction: column; align-items: flex-start;
  padding: calc(var(--w) * .1) calc(var(--w) * .1) calc(var(--w) * .08) calc(var(--w) * .13);
  font-size: calc(var(--w) * .036);
}
.cover::before { /* hinge groove */
  content: ""; position: absolute; top: 0; bottom: 0; left: calc(var(--w) * .055); width: calc(var(--w) * .025);
  background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(255,255,255,.12) 45%, rgba(0,0,0,.18));
  opacity: .7;
}
.cover-art { position: absolute; inset: 0; opacity: .95; pointer-events: none; }
.cover-art svg { width: 100%; height: 100%; }
.cover-light { position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at var(--lx, 30%) var(--ly, 18%), rgba(255,255,255,.28), rgba(255,255,255,0) 42%),
    linear-gradient(115deg, rgba(255,255,255,.16) 0%, rgba(255,255,255,0) 38%, rgba(255,255,255,0) 62%, rgba(255,255,255,.06) 100%);
  mix-blend-mode: screen; }
.cover-frame { position: absolute; inset: calc(var(--w) * .045) calc(var(--w) * .045) calc(var(--w) * .045) calc(var(--w) * .095);
  border: 1px solid rgba(255,255,255,.2); border-radius: calc(var(--w) * .03); pointer-events: none; }
.cover-frame::before, .cover-frame::after { content: ""; position: absolute; width: 14%; aspect-ratio: 1; border: 2px solid rgba(255,197,61,.55); }
.cover-frame::before { left: -1px; top: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: calc(var(--w) * .03); }
.cover-frame::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: calc(var(--w) * .03); }

.cover > *:not(.cover-art):not(.cover-light):not(.cover-frame) { position: relative; }
.cover-top { font-size: .72em; font-weight: 700; letter-spacing: .16em; line-height: 1.6; color: #A9CCFF; }
.cover-grade { position: absolute !important; right: calc(var(--w) * .09); top: calc(var(--w) * .085);
  width: calc(var(--w) * .2); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFE69A, #FFC53D 55%, #F2A100);
  color: #3D2A00; display: grid; place-content: center; text-align: center; transform: rotate(-10deg);
  box-shadow: 0 6px 18px -4px rgba(0,0,0,.45), inset 0 -3px 0 rgba(0,0,0,.08), inset 0 2px 0 rgba(255,255,255,.6);
}
.cover-grade b { font-family: var(--font-display); font-weight: 900; font-size: 2.3em; line-height: .85; }
.cover-grade span { font-size: .62em; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.cover-title { margin: auto 0 0; font-family: var(--font-display); font-weight: 900; line-height: .86; letter-spacing: -.045em;
  font-size: calc(var(--w) * .265); display: flex; align-items: baseline; filter: drop-shadow(0 4px 0 rgba(3,14,45,.35)); }
.ct-oi { color: #fff; }
.ct-la { background: linear-gradient(180deg, #D6EAFF 0%, #7DB8FF 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ct-ex { position: relative; background: linear-gradient(100deg, #FFE7A0 0%, #FFC53D 40%, #FFF5D6 50%, #F2A100 60%, #FFC53D 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 4.5s ease-in-out infinite; margin-left: .02em; }
@keyframes shine { 0%, 60% { background-position: 100% 0; } 100% { background-position: -150% 0; } }
.cover-slogan { margin-top: .8em; font-weight: 800; letter-spacing: .32em; font-size: .86em; color: #fff; display: flex; align-items: center; gap: .55em; }
.cover-slogan i { width: .42em; height: .42em; border-radius: 50%; background: var(--yellow); display: inline-block; }
.cover-subjects { list-style: none; padding: 0; margin: 1.5em 0 0; display: flex; flex-wrap: wrap; gap: .45em; }
.cover-subjects li { display: inline-flex; align-items: center; gap: .45em; padding: .42em .8em .42em .5em; border-radius: 999px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); font-weight: 650; font-size: .78em; backdrop-filter: blur(4px); }
.cs-ico { width: 1.6em; height: 1.6em; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.18); }
.cs-ico svg { width: 1.05em; height: 1.05em; }
.cover-subjects li[data-s="kaz"] .cs-ico { background: #3B5BFF; }
.cover-subjects li[data-s="math"] .cs-ico { background: #0E9BE8; }
.cover-subjects li[data-s="sci"] .cs-ico { background: #22A06B; }
.cover-open { margin-top: 1.6em; display: inline-flex; align-items: center; gap: .6em; border: 0; border-radius: 999px;
  padding: .85em 1.3em .85em 1.5em; font-weight: 800; font-size: 1.02em; color: var(--navy);
  background: linear-gradient(180deg, #fff, #E8F1FF); box-shadow: 0 10px 26px -6px rgba(0,0,0,.45), 0 0 0 6px rgba(255,255,255,.12);
  transition: transform .2s var(--ease), box-shadow .3s; position: relative; }
.cover-open svg { width: 1.2em; height: 1.2em; color: var(--blue); transition: transform .3s var(--ease); }
.cover-open::after { content: ""; position: absolute; inset: -6px; border-radius: 999px; border: 2px solid rgba(255,197,61,.8); animation: ring 2.4s ease-out infinite; }
.cover-open:hover { transform: translateY(-2px) scale(1.02); }
.cover-open:hover svg { transform: translateX(4px); }
@keyframes ring { 0% { opacity: .9; transform: scale(.96); } 70%, 100% { opacity: 0; transform: scale(1.18); } }
.cover-foot { margin-top: 1.1em; font-size: .7em; font-weight: 600; letter-spacing: .06em; color: #9EBEF0; }

.b-spine { left: 0; top: 0; width: var(--t); height: var(--h); transform: translateX(calc(var(--t) / -2)) rotateY(-90deg);
  background: linear-gradient(90deg, #061A49, #0E348C 40%, #0A2768 80%, #061A49);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 14% 0 10%;
  color: #fff; border-radius: 3px; }
.b-spine span { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--font-display); font-weight: 900; font-size: calc(var(--t) * .52); letter-spacing: -.02em; }
.b-spine em { writing-mode: vertical-rl; transform: rotate(180deg); font-style: normal; font-weight: 700; font-size: calc(var(--t) * .2); letter-spacing: .25em; color: #FFC53D; }
.b-edge { background: repeating-linear-gradient(90deg, #EDE6D6 0 1px, #FFFDF6 1px 3px); }
.b-edge-r { right: 6px; top: 6px; width: calc(var(--t) - 4px); height: calc(var(--h) - 12px); transform: translateX(calc((var(--t) - 4px) / 2)) rotateY(90deg);
  box-shadow: inset 0 0 12px rgba(120,100,60,.15); }
.b-edge-t, .b-edge-b { left: 3px; width: calc(var(--w) - 9px); height: calc(var(--t) - 4px);
  background: repeating-linear-gradient(180deg, #EDE6D6 0 1px, #FFFDF6 1px 3px); }
.b-edge-t { top: 6px; transform: translateY(calc((var(--t) - 4px) / -2)) rotateX(90deg); }
.b-edge-b { bottom: 6px; transform: translateY(calc((var(--t) - 4px) / 2)) rotateX(-90deg); }
.b-page1 { left: 2px; top: 5px; width: calc(var(--w) - 8px); height: calc(var(--h) - 10px); transform: translateZ(calc(var(--t) / 2 - 2px));
  background: linear-gradient(90deg, #EFEBE1, #FFFEFA 8%, #FFFEFB); border-radius: 2px 10px 10px 2px; overflow: hidden; }
.b-page1-in { position: absolute; inset: 12%; display: grid; place-items: center; }
.b-page1-in::before { content: "ОйLA!"; font-family: var(--font-display); font-weight: 900; color: var(--navy); font-size: calc(var(--w) * .16); letter-spacing: -.04em; }
.ribbon-bm { left: 58%; bottom: calc(var(--w) * -.09); width: calc(var(--w) * .05); height: calc(var(--w) * .16);
  transform: translateZ(calc(var(--t) / 2 - 3px)); background: linear-gradient(90deg, #F2A100, #FFC53D 50%, #F2A100);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); }

.book-shadow { position: absolute; left: 50%; bottom: calc(clamp(250px, min(31vw, 46vh), 430px) * -.12); width: calc(clamp(250px, min(31vw, 46vh), 430px) * 1.25); height: 60px;
  transform: translateX(-50%); background: radial-gradient(closest-side, rgba(11,42,111,.35), rgba(11,42,111,0)); filter: blur(6px); z-index: -1;
  animation: shadowBob 7s ease-in-out 1.2s infinite; transition: width .9s var(--ease), opacity .6s; }
@keyframes shadowBob { 50% { transform: translateX(-50%) scale(.92); opacity: .8; } }

/* opening */
.book3d.opening { animation: none; transform: rotateX(0) rotateY(0) translateX(calc(var(--w) / 2)) scale(1.06); cursor: default; }
.book3d.opening .b-front { transform: translateZ(calc(var(--t) / 2)) rotateY(-178deg); transition-delay: .25s; }
.book3d.opening .cover-open::after { display: none; }
.opening ~ .book-shadow { width: calc(clamp(250px, min(31vw, 46vh), 430px) * 2.4); }

/* mascot on landing */
.land-oi { position: absolute; right: calc(clamp(250px, min(31vw, 46vh), 430px) * -.95); bottom: -2%; width: calc(clamp(250px, min(31vw, 46vh), 430px) * .58);
  animation: oiIn 1s var(--ease) .9s both; transition: opacity .4s, transform .5s var(--ease); }
.land-oi.away { opacity: 0; transform: translateX(40px) scale(.9); }
.oi-body { animation: oiBob 3.2s ease-in-out infinite; filter: drop-shadow(0 14px 18px rgba(11,42,111,.25)); }
.oi-bubble { position: absolute; bottom: 92%; right: 30%; width: max-content; max-width: 220px; background: #fff; padding: .7em 1em; border-radius: 18px 18px 4px 18px;
  font-size: .92rem; line-height: 1.35; box-shadow: var(--sh-2); color: var(--ink); animation: oiIn .6s var(--ease) 1.6s both; }
.oi-bubble b { color: var(--blue); }
@keyframes oiIn { from { opacity: 0; transform: translateY(16px) scale(.9); } }
@keyframes oiBob { 50% { transform: translateY(-8px) rotate(-2deg); } }

.floaters { position: absolute; inset: 0; pointer-events: none; }
.fl { position: absolute; width: 64px; transition: translate .6s var(--ease); animation: float 9s ease-in-out infinite; filter: drop-shadow(0 10px 14px rgba(11,42,111,.15)); }
.fl-leaf { left: 16%; top: 22%; width: 58px; animation-delay: -2s; }
.fl-drop { left: 22%; bottom: 20%; width: 46px; animation-delay: -5s; }
.fl-planet { right: 15%; top: 16%; width: 96px; animation-delay: -1s; }
.fl-glass { left: 9%; top: 52%; width: 62px; animation-delay: -7s; }
.fl-star { right: 24%; bottom: 14%; width: 38px; animation-delay: -3s; }
.fl-num { right: 9%; top: 48%; width: 92px; animation-delay: -4s; }
@keyframes float { 50% { transform: translateY(-18px) rotate(6deg); } }

.land-caption { position: absolute; bottom: 4.5vh; left: 0; right: 0; text-align: center; color: var(--ink-2); font-weight: 600; font-size: 1rem; margin: 0; animation: oiIn .8s var(--ease) 1.3s both; }
.land-caption b { color: var(--blue); letter-spacing: .08em; }

@media (max-width: 760px) {
  .book3d { --w: min(64vw, 40vh); }
  .land-oi { right: auto; left: 50%; bottom: -34%; width: 34vw; transform: translateX(10%); }
  .oi-bubble { display: none; }
  .fl-num, .fl-glass { display: none; }
  .land-caption { bottom: 3vh; padding: 0 20px; font-size: .9rem; }
  .brand-sub { display: none; }
  .nav-link { display: none; }
}

/* ---------- reader chrome ---------- */
.reader { position: fixed; inset: 0; z-index: 3; display: grid; grid-template-rows: auto 1fr auto; }
.reader.arrive .r-stage .book { animation: bookArrive .85s var(--ease) both; }
.reader.arrive .r-top, .reader.arrive .r-bottom { animation: chromeIn .7s var(--ease) .25s both; }
@keyframes bookArrive { from { opacity: 0; transform: scale(.92) translateY(14px); filter: blur(4px); } }
@keyframes chromeIn { from { opacity: 0; transform: translateY(-8px); } }

.r-top { display: flex; align-items: center; gap: 14px; padding: 10px clamp(10px, 2vw, 22px); padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(251,249,244,.72); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid rgba(220,229,243,.8); position: relative; z-index: 4; }
.r-brand { border: 0; background: none; padding: 4px 6px; border-radius: 10px; }
.r-brand:hover { background: rgba(30,107,255,.08); }
.r-loc { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.r-loc-t { font-family: var(--font-display); font-weight: 700; font-size: 1rem; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-progress { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.rp-bar { width: 120px; height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.rp-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--azure), var(--blue)); transition: width .6s var(--ease); }
.r-actions { display: flex; align-items: center; gap: 6px; }
.r-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 8px 12px; border-radius: 12px; font-weight: 650; font-size: .9rem; color: var(--ink-2); position: relative; }
.r-btn:hover, .r-btn[aria-expanded="true"] { background: rgba(30,107,255,.09); color: var(--blue-2); }
.r-btn .i { width: 20px; height: 20px; }
.me-ava { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--azure), var(--blue)); color: #fff; font-weight: 800; font-size: .9rem; flex: none; }
.me-ava.big { width: 46px; height: 46px; font-size: 1.2rem; }
.me-dot { position: absolute; top: 6px; left: 30px; width: 10px; height: 10px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 2px #fff; }
.sync { width: 9px; height: 9px; border-radius: 50%; background: #C9D3E6; flex: none; }
.sync.on { background: var(--green); box-shadow: 0 0 0 4px rgba(34,160,107,.15); }
.sync.off { background: var(--coral); box-shadow: 0 0 0 4px rgba(255,122,107,.18); }

.r-stage { position: relative; display: grid; place-items: center; overflow: hidden; padding: 10px; min-height: 0; }
.r-bottom { display: flex; align-items: center; gap: 14px; padding: 8px clamp(10px, 2vw, 22px); padding-bottom: max(10px, env(safe-area-inset-bottom)); position: relative; z-index: 4; }
.nav-arrow { width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, #3A80FF, #1E6BFF); box-shadow: var(--sh-blue); transition: transform .2s var(--ease), opacity .2s; flex: none; }
.nav-arrow .i { width: 22px; height: 22px; }
.nav-arrow:hover { transform: scale(1.06); }
.nav-arrow:disabled { opacity: .3; box-shadow: none; }
.r-scrub { flex: 1; display: grid; gap: 4px; }
.rs-label { text-align: center; font-size: .8rem; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
#scrub { width: 100%; accent-color: var(--blue); height: 18px; }

@media (max-width: 1100px) { .r-progress { display: none; } }
@media (max-width: 760px) {
  .r-top { gap: 6px; }
  .r-btn-t { display: none; }
  .r-btn { padding: 8px; }
  .r-loc-t { font-size: .88rem; }
  #locStatus { display: none; }
  .brand-mark { font-size: 1.3rem; }
  .nav-arrow { width: 42px; height: 42px; }
}

/* ---------- the book ---------- */
.book { position: relative; width: calc(var(--pw) * 2); height: var(--ph); perspective: 2800px; transform-style: preserve-3d; }
.book[data-mode="single"] { width: var(--pw); perspective: 1800px; }
.book::before { content: ""; position: absolute; left: 2%; right: 2%; bottom: -14px; height: 40px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(11,42,111,.32), transparent); filter: blur(8px); z-index: -2; }
.book.fading .slot { opacity: 0; }
.slot { position: absolute; top: 0; width: var(--pw); height: var(--ph); transition: opacity .18s ease; }
.slot-l { left: 0; }
.slot-r { right: 0; }
.book[data-mode="single"] .slot-l { display: none; }
.book[data-mode="single"] .slot-r { left: 0; right: auto; }

.stack { position: absolute; top: 4px; bottom: -1px; border-radius: 12px; z-index: -1;
  background: repeating-linear-gradient(90deg, #E8E1D1 0 1px, #FFFDF7 1px 3px); box-shadow: 0 6px 18px -8px rgba(11,42,111,.35); }
.stack-l { left: calc(var(--stack-l, 6px) * -1); width: calc(var(--stack-l, 6px) + 20px); border-radius: 12px 0 0 12px; }
.stack-r { right: calc(var(--stack-r, 6px) * -1); width: calc(var(--stack-r, 6px) + 20px); border-radius: 0 12px 12px 0; }
.book[data-mode="single"] .stack-l { display: none; }
.gutter { position: absolute; top: 0; bottom: 0; left: calc(50% - 30px); width: 60px; pointer-events: none; z-index: 3;
  background: linear-gradient(90deg, rgba(19,34,74,0) 0%, rgba(19,34,74,.07) 40%, rgba(19,34,74,.16) 50%, rgba(19,34,74,.07) 60%, rgba(19,34,74,0) 100%); }
.book[data-mode="single"] .gutter { left: -10px; width: 24px; background: linear-gradient(90deg, rgba(19,34,74,.12), rgba(19,34,74,0)); }

.flipper { position: absolute; top: 0; width: var(--pw); height: var(--ph); transform-style: preserve-3d; z-index: 6; will-change: transform; }
.flipper.fwd { left: 50%; transform-origin: 0 50%; }
.flipper.back { left: 0; transform-origin: 100% 50%; }
.flipper.single { left: 0; transform-origin: 0 50%; }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; transform-style: preserve-3d; }
.face.back { transform: rotateY(180deg); }
.face .pg { box-shadow: 0 10px 40px -10px rgba(11,42,111,.4); }
.paper-back { background: linear-gradient(90deg, #F4F0E6, #FFFEFA 10%); border-radius: 3px 14px 14px 3px; }
.shade { position: absolute; inset: 0; pointer-events: none; opacity: 0; border-radius: inherit; z-index: 9; }
.flipper.fwd .front .shade, .flipper.single .front .shade { background: linear-gradient(90deg, rgba(11,26,70,.42) 0%, rgba(11,26,70,.12) 40%, rgba(255,255,255,0) 100%); }
.flipper.fwd .back .shade { background: linear-gradient(270deg, rgba(11,26,70,.45), rgba(11,26,70,0) 60%); }
.flipper.back .front .shade { background: linear-gradient(270deg, rgba(11,26,70,.42) 0%, rgba(11,26,70,.12) 40%, rgba(255,255,255,0) 100%); }
.flipper.back .back .shade { background: linear-gradient(90deg, rgba(11,26,70,.45), rgba(11,26,70,0) 60%); }
.cast { position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 8; }
.slot-r .cast { background: linear-gradient(90deg, rgba(11,26,70,.35), rgba(11,26,70,0) 55%); }
.slot-l .cast { background: linear-gradient(270deg, rgba(11,26,70,.35), rgba(11,26,70,0) 55%); }
.book.turning .slot .pg-body { overflow: hidden; }

.corner { position: absolute; bottom: 0; width: 30px; height: 30px; border: 0; padding: 0; background: transparent; z-index: 5; }
.corner-r { right: 0; }
.corner-l { left: 0; }
.corner::before { content: ""; position: absolute; bottom: 0; width: 0; height: 0; transition: width .25s var(--ease), height .25s var(--ease);
  background: linear-gradient(135deg, rgba(255,255,255,0) 45%, #E8E2D4 50%, #FFFDF8 75%); box-shadow: -4px -4px 10px rgba(11,42,111,.12); }
.corner-r::before { right: 0; border-top-left-radius: 8px; }
.corner-l::before { left: 0; transform: scaleX(-1); border-top-left-radius: 8px; }
.corner:hover::before { width: 30px; height: 30px; }
.book.at-end .corner-r, .book.at-start .corner-l { display: none; }
.book[data-mode="single"] .corner-l { display: none; }
@media (hover: none) { .corner { display: none; } }

.ribbons { position: absolute; left: 0; right: 0; top: 0; height: 0; z-index: 7; }
.ribbon { position: absolute; top: -26px; width: 22px; height: 40px; border: 0; padding: 0; background: var(--rc);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%); box-shadow: inset 0 -6px 0 rgba(0,0,0,.08);
  transition: transform .2s var(--ease); color: #fff; font-size: .62rem; font-weight: 800; }
.ribbon span { display: block; padding-top: 6px; }
.ribbon:hover { transform: translateY(-6px); }

/* ---------- popovers ---------- */
.pop { position: fixed; z-index: 50; width: min(440px, calc(100vw - 20px)); max-height: calc(100vh - 100px); overflow: auto;
  background: rgba(255,255,255,.96); backdrop-filter: blur(16px); border-radius: 20px; padding: 16px; box-shadow: var(--sh-3);
  border: 1px solid var(--line-2); animation: popIn .25s var(--ease) both; }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.pop-h { font-family: var(--font-display); font-weight: 700; font-size: .95rem; color: var(--navy); margin: 2px 2px 12px; }
.lg-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.lg-tile { border: 0; border-radius: 12px; padding: 8px 6px 7px; background: var(--accent-soft); text-align: left; display: grid; gap: 2px; min-height: 64px;
  box-shadow: inset 0 0 0 1.5px transparent; transition: transform .15s var(--ease), box-shadow .2s; position: relative; }
.lg-tile b { font-family: var(--font-display); font-weight: 800; color: var(--accent); font-size: 1rem; }
.lg-tile span { font-size: .64rem; line-height: 1.2; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lg-tile:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1.5px var(--accent); }
.lg-tile::after { content: ""; position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--st-none); }
.lg-tile.st-draft::after { background: var(--st-draft); }
.lg-tile.st-sent::after { background: var(--st-sent); }
.lg-tile.st-checked::after { background: var(--st-checked); }
.lg-tile.st-redo::after { background: var(--st-redo); }
.pop-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.pop-link { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--sky-3); color: var(--blue-2); font-weight: 650; font-size: .82rem; padding: 7px 11px; border-radius: 999px; }
.pop-link .i { width: 16px; height: 16px; }
.pop-link:hover { background: var(--sky-2); }
.mk-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; }
.mk-list li { display: flex; align-items: center; gap: 4px; }
.mk { flex: 1; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 8px; border-radius: 10px; text-align: left; font-weight: 600; font-size: .9rem; }
.mk:hover { background: var(--sky-3); }
.mk-n { min-width: 34px; height: 28px; padding: 0 6px; border-radius: 8px; display: grid; place-items: center; background: var(--yellow-soft); color: #8A5A00; font-weight: 800; font-size: .8rem; }
.mk-x { border: 0; background: transparent; padding: 6px; border-radius: 8px; color: var(--muted); }
.mk-x .i { width: 16px; height: 16px; }
.mk-x:hover { background: var(--coral-soft); color: #B4382B; }
.pop-empty { color: var(--muted); font-size: .9rem; margin: 0 0 12px; }
.pop-me { display: grid; gap: 12px; }
.me-head { display: flex; align-items: center; gap: 12px; }
.me-head b { display: block; font-size: 1.05rem; color: var(--navy); }
.me-head span { font-size: .85rem; color: var(--muted); }
.me-oi { width: 54px; height: 54px; }
.me-pin { display: grid; grid-template-columns: 1fr auto; align-items: center; background: var(--yellow-soft); border-radius: 14px; padding: 10px 14px; }
.me-pin span { font-weight: 700; font-size: .85rem; color: #6A4700; }
.me-pin b { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: .2em; color: #3D2A00; grid-row: span 2; }
.me-pin small { color: #8A6A20; font-size: .74rem; }
.me-reviews { display: grid; gap: 4px; }
.me-rev { display: flex; align-items: center; gap: 10px; border: 0; background: var(--sky-3); padding: 8px 10px; border-radius: 10px; font-weight: 600; font-size: .86rem; }
.me-rev b { margin-left: auto; color: var(--green); }
.me-sync { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: rgba(11,26,70,.28); backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s; }
.modal.in { opacity: 1; }
.modal-card { position: relative; width: min(460px, 100%); max-height: calc(100svh - 32px); overflow: auto; background: #fff; border-radius: 28px; padding: 26px; box-shadow: var(--sh-3);
  transform: translateY(14px) scale(.98); transition: transform .35s var(--ease); }
.modal.in .modal-card { transform: none; }
.modal-x { position: absolute; top: 14px; right: 14px; border: 0; background: var(--sky-3); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.modal-x .i { width: 18px; height: 18px; }
.join-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; padding-right: 30px; }
.join-oi { width: 86px; height: 86px; flex: none; }
.join-oi.big { width: 120px; height: 120px; margin: 0 auto; }
.join-hero h2 { font-family: var(--font-display); font-weight: 800; color: var(--navy); margin: 0 0 4px; font-size: 1.4rem; letter-spacing: -.01em; }
.join-hero p { margin: 0; color: var(--ink-2); line-height: 1.45; font-size: .95rem; }
.join-form { display: grid; gap: 14px; }
.code-in { font-family: var(--font-display); font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.pin-in { font-family: var(--font-display); font-weight: 700; letter-spacing: .4em; width: 9em; }
.field-help { color: var(--muted); font-size: .78rem; }
.form-err { color: #B4382B; font-weight: 600; font-size: .9rem; min-height: 1.2em; }
.form-err:empty { display: none; }
.w100 { width: 100%; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 14px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.join-foot { text-align: center; color: var(--muted); font-size: .85rem; margin: 14px 0 0; }
.join-foot a { color: var(--blue); font-weight: 650; }
.pin-step { text-align: center; display: grid; gap: 10px; }
.pin-step h2 { font-family: var(--font-display); color: var(--navy); margin: 0; }
.pin-step p { margin: 0; color: var(--ink-2); line-height: 1.5; }
.pin-step .small { font-size: .85rem; color: var(--muted); }
.pin-big { display: flex; justify-content: center; gap: 10px; margin: 8px 0; }
.pin-big span { width: 56px; height: 68px; border-radius: 16px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 900; font-size: 2rem; color: var(--navy);
  background: linear-gradient(180deg, #FFF6D9, #FFE6A0); box-shadow: inset 0 -4px 0 rgba(242,161,0,.35); animation: pinIn .5s var(--ease) both; }
.pin-big span:nth-child(2) { animation-delay: .08s; }
.pin-big span:nth-child(3) { animation-delay: .16s; }
.pin-big span:nth-child(4) { animation-delay: .24s; }
@keyframes pinIn { from { opacity: 0; transform: translateY(12px) rotate(-6deg); } }

.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 1.2em; height: 1.2em; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.5); border-top-color: #fff; animation: spin .8s linear infinite; }
.btn-ghost.loading::after { border-color: rgba(30,107,255,.3); border-top-color: var(--blue); }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { border: 0; background: none; padding: 0; color: var(--blue); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- celebration ---------- */
.celebrate { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.celebrate i { position: absolute; top: -20px; border-radius: 2px; animation: confetti linear forwards; }
@keyframes confetti { to { transform: translate(var(--drift), 110vh) rotate(var(--rot)); } }
.celebrate .plane { position: absolute; width: 56px; left: 50%; top: 60%; animation: plane 1.6s cubic-bezier(.5,0,.7,1) forwards; filter: drop-shadow(0 8px 10px rgba(11,42,111,.3)); }
@keyframes plane { 0% { transform: translate(-50%, 0) scale(.6) rotate(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(60vw, -80vh) scale(1.1) rotate(-12deg); opacity: 0; } }

/* prevent decorative layers from widening the page on phones */
html, body { overflow-x: hidden; }
.landing { overflow: hidden; }
.modal { overflow-y: auto; }
