/* =========================================================================
 * ReadMyanmar — styles (no framework, no external requests)
 * ========================================================================= */

/* ---------- Myanmar font (local first, bundled file second) ----------------
 * The browser tries fonts already on the device first (Android: Noto Sans
 * Myanmar, Windows: Myanmar Text, macOS/iOS: Myanmar Sangam MN, Pyidaungsu /
 * Padauk where installed). If you drop Padauk-Regular.ttf / Padauk-Bold.ttf
 * into /fonts (see fonts/README.md) it is used as the bundled fallback.
 * unicode-range keeps this font for Myanmar characters only.            */
@font-face {
  font-family: 'MM Script';
  src: local('Noto Sans Myanmar'), local('NotoSansMyanmar-Regular'), local('Pyidaungsu'),
       local('Padauk'), local('Myanmar Text'), local('Myanmar Sangam MN'),
       url('../fonts/Padauk-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
  unicode-range: U+1000-109F, U+A9E0-A9FF, U+AA60-AA7F, U+200B-200D, U+25CC;
}
@font-face {
  font-family: 'MM Script';
  src: local('Noto Sans Myanmar Bold'), local('NotoSansMyanmar-Bold'), local('Pyidaungsu Bold'),
       local('Padauk Bold'), local('Myanmar Text Bold'),
       url('../fonts/Padauk-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
  unicode-range: U+1000-109F, U+A9E0-A9FF, U+AA60-AA7F, U+200B-200D, U+25CC;
}

:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #f1eee6;
  --ink: #1d2422;
  --muted: #66706c;
  --line: #e4dfd3;
  --brand: #0f766e;        /* deep teal */
  --brand-2: #115e59;
  --brand-soft: #d6efec;
  --gold: #c27c0e;         /* pagoda gold */
  --gold-soft: #fbefd6;
  --ok: #15803d;  --ok-soft: #dcfce7;
  --bad: #b91c1c; --bad-soft: #fee2e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 30, 20, .06), 0 6px 20px rgba(30, 30, 20, .06);
  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'MM Script',
             'Noto Sans Myanmar', 'Myanmar Text', 'Myanmar Sangam MN', sans-serif;
  --font-my: 'MM Script', 'Noto Sans Myanmar', 'Myanmar Text', 'Myanmar Sangam MN', 'Pyidaungsu', 'Padauk', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121615; --surface: #1a201e; --surface-2: #222a27; --ink: #e9efec; --muted: #9aa6a1;
    --line: #2d3633; --brand: #2dd4bf; --brand-2: #5eead4; --brand-soft: #123a36;
    --gold: #f2b84b; --gold-soft: #3a2e14; --ok: #4ade80; --ok-soft: #12321e; --bad: #f87171; --bad-soft: #3a1717;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font-ui); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.ic { flex: none; vertical-align: -3px; }

/* Myanmar text: generous line-height so stacked vowels / medials never clip */
.my { font-family: var(--font-my); line-height: 2; letter-spacing: 0; }
.my-xl { font-family: var(--font-my); font-size: 2.6rem; line-height: 1.7; }
.my-lg { font-family: var(--font-my); font-size: 1.6rem; line-height: 1.9; }

/* ---------- Buttons & form controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  padding: .6em 1.05em; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s; text-decoration: none;
}
.btn:hover { border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { padding: .35em .7em; font-size: .88rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn.on { color: var(--gold); border-color: var(--gold); background: var(--gold-soft); }
.pulse { animation: pulse .6s ease; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(15,118,110,.5);} 100% { box-shadow: 0 0 0 12px rgba(15,118,110,0);} }

input[type=text], input[type=password], textarea, select {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: .6em .8em; width: 100%;
}
input:focus, textarea:focus, select:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--brand-soft); border-color: var(--brand); }
.field { display: grid; gap: .35em; margin: 1rem 0 .6rem; text-align: left; font-weight: 600; font-size: .92rem; }
.check { display: flex; gap: .5em; align-items: center; font-size: .9rem; color: var(--muted); }

/* ---------- Login gate ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent),
              radial-gradient(900px 500px at 110% 110%, var(--gold-soft), transparent), var(--bg); }
.gate-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 2rem 1.8rem; box-shadow: var(--shadow); text-align: center; }
.gate-logo { font-size: 2.4rem; color: var(--brand); line-height: 1.6; }
.gate-welcome { font-size: 1.4rem; margin: .4rem 0 0; }
.gate-error { color: var(--bad); min-height: 1.4em; font-size: .9rem; margin: .4rem 0; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px);} 50% { transform: translateX(7px);} 75% { transform: translateX(-4px);} }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 1rem .8rem; gap: 1rem; z-index: 30; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); padding: .3rem .4rem; }
.brand small { display: block; color: var(--muted); font-family: var(--font-my); font-size: .78rem; line-height: 1.6; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 1.5rem; line-height: 1; }
.sidebar nav { display: grid; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-weight: 500; }
.sidebar nav a:hover { background: var(--surface-2); }
.sidebar nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.sidebar-foot { margin-top: auto; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .8rem;
  padding: .75rem 1.5rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
.page-title { margin: 0; font-size: 1.15rem; flex: 1; }
.level-select { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .9rem; }
.level-select select { width: auto; padding: .45em .7em; font-weight: 600; border-color: var(--brand); color: var(--brand); }
.view { padding: 1.5rem; max-width: 1100px; width: 100%; margin: 0 auto; }
.scrim { display: none; }
.only-mobile { display: none; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .only-mobile { display: inline-grid; }
  .topbar { padding: .6rem 1rem; }
  .view { padding: 1rem; }
  .hide-sm { display: none; }
}

/* ---------- Cards, grids, misc ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.stack > * + * { margin-top: .8rem; }
.section-title { margin: 1.6rem 0 .8rem; font-size: 1.05rem; }
.pill { display: inline-flex; align-items: center; gap: .3em; padding: .15em .65em; border-radius: 999px; font-size: .78rem;
  font-weight: 700; background: var(--surface-2); color: var(--muted); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.hero { background: linear-gradient(135deg, var(--brand), #134e4a); color: #fff; border: 0; }
.hero .muted { color: rgba(255,255,255,.8); }
.hero .btn { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.12); color: #fff; }
.hero .btn.gold { background: var(--gold); border-color: var(--gold); }
.link-card { display: block; text-decoration: none; color: inherit; transition: transform .12s, border-color .12s; }
.link-card:hover { transform: translateY(-2px); border-color: var(--brand); }
.link-card .ic-wrap { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); margin-bottom: .7rem; }

/* stats */
.stat { display: flex; gap: .9rem; align-items: center; }
.stat .ic-wrap { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.stat .ic-wrap.gold { background: var(--gold-soft); color: var(--gold); }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }

/* progress bars & ring */
.bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--gold)); transition: width .6s; }
.level-row { display: grid; grid-template-columns: 70px 1fr 48px; align-items: center; gap: .8rem; padding: .45rem 0; }
.level-row b { font-size: .92rem; }
.level-row .pct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.ring { --p: 0; width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring::before { content: ''; grid-area: 1/1; width: 108px; height: 108px; border-radius: 50%; background: var(--surface); }
.ring span { grid-area: 1/1; font-size: 1.7rem; font-weight: 800; z-index: 1; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Reading ---------- */
.passage { font-size: 1.55rem; }
.line { padding: .55rem 0 .7rem; border-bottom: 1px dashed var(--line); }
.line:last-child { border-bottom: 0; }
.speaker { display: block; font-family: var(--font-ui); font-size: .78rem; font-weight: 700; color: var(--gold);
  text-transform: uppercase; letter-spacing: .05em; line-height: 1.2; }
.tok { font-family: var(--font-my); line-height: 2.1; cursor: pointer; border-radius: 6px; padding: 0 .06em;
  border-bottom: 2px dotted color-mix(in srgb, var(--brand) 45%, transparent); background: none; border-top: 0; border-left: 0; border-right: 0;
  font-size: inherit; color: inherit; margin: 0 .02em; }
.tok:hover, .tok.active { background: var(--brand-soft); color: var(--brand); }
.tok.saved { border-bottom-color: var(--gold); border-bottom-style: solid; }
.punct { font-family: var(--font-my); margin-right: .25em; }
.trans { font-size: .95rem; color: var(--muted); font-family: var(--font-ui); line-height: 1.5; margin-top: .1rem; }
.trans[hidden] { display: none; }
.reading-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1rem; align-items: start; }
.gloss-panel { position: sticky; top: 76px; }
.gloss-word { font-size: 2.2rem; line-height: 1.8; color: var(--brand); }
.gloss-tr { font-style: italic; color: var(--gold); font-weight: 600; }
@media (max-width: 860px) {
  .reading-layout { grid-template-columns: 1fr; }
  .gloss-panel { position: fixed; left: .6rem; right: .6rem; bottom: .6rem; top: auto; z-index: 40; transform: translateY(130%); transition: transform .2s; }
  .gloss-panel.show { transform: none; }
}

/* ---------- Exercises ---------- */
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab { padding: .5rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; font-weight: 600; color: var(--ink); display: inline-flex; gap: .4rem; align-items: center; text-decoration: none; }
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.prompt { text-align: center; padding: 1rem 0 .5rem; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6rem; }
.choice { padding: .9rem 1rem; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font: inherit;
  color: var(--ink); cursor: pointer; text-align: left; font-size: 1.02rem; transition: border-color .12s, background .12s; }
.choice.my { font-size: 1.35rem; line-height: 1.8; text-align: center; }
.choice:hover:not(:disabled) { border-color: var(--brand); }
.choice.correct { border-color: var(--ok); background: var(--ok-soft); animation: pop .3s; }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .35s; }
.choice:disabled { cursor: default; }
@keyframes pop { 50% { transform: scale(1.04);} }
.feedback { min-height: 1.6em; text-align: center; font-weight: 700; margin: .8rem 0; }
.feedback.ok { color: var(--ok); } .feedback.bad { color: var(--bad); }
.score-chip { font-variant-numeric: tabular-nums; }

/* flashcards */
.flash-wrap { perspective: 1200px; max-width: 460px; margin: 0 auto; touch-action: pan-y; }
.flash { position: relative; height: 290px; transform-style: preserve-3d; transition: transform .5s; cursor: pointer; }
.flash.flipped { transform: rotateY(180deg); }
.flash .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 20px;
  display: grid; place-items: center; text-align: center; padding: 1.5rem; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.flash .back { transform: rotateY(180deg); background: linear-gradient(160deg, var(--brand-soft), var(--surface)); }
.flash-wrap.swipe-left .flash { transform: translateX(-120%) rotate(-12deg); opacity: 0; transition: .3s; }
.flash-wrap.swipe-right .flash { transform: translateX(120%) rotate(12deg); opacity: 0; transition: .3s; }

/* word search */
.ws-layout { display: grid; grid-template-columns: auto 1fr; gap: 1.2rem; align-items: start; }
.ws-grid { display: grid; gap: 4px; user-select: none; touch-action: none; }
.ws-cell { width: clamp(34px, 8.6vw, 54px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 8px;
  background: var(--surface-2); font-family: var(--font-my); font-size: clamp(.85rem, 2.6vw, 1.15rem); line-height: 1; cursor: pointer; overflow: hidden; }
.ws-cell.sel { background: var(--gold-soft); color: var(--gold); outline: 2px solid var(--gold); }
.ws-cell.found { background: var(--brand); color: #fff; }
.ws-list li { margin: .25rem 0; list-style: none; }
.ws-list li.done { text-decoration: line-through; color: var(--muted); }
.ws-list { padding: 0; margin: 0; }
@media (max-width: 760px) { .ws-layout { grid-template-columns: 1fr; } }

/* matching */
.match-cols { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.match-item { width: 100%; margin-bottom: .5rem; }
.match-item.sel { border-color: var(--gold); background: var(--gold-soft); }
.match-item.done { border-color: var(--ok); background: var(--ok-soft); opacity: .65; }

/* ---------- Writing ---------- */
.glyph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: .5rem; }
.glyph { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: .4rem; text-align: center; cursor: pointer; font: inherit; color: inherit; }
.glyph:hover, .glyph.active { border-color: var(--brand); background: var(--brand-soft); }
.glyph .my { font-size: 1.7rem; line-height: 1.7; display: block; }
.glyph small { color: var(--muted); font-size: .72rem; display: block; line-height: 1.3; }
.canvas-wrap { position: relative; width: 100%; max-width: 420px; aspect-ratio: 1; margin: 0 auto; border-radius: 16px;
  border: 2px dashed var(--line); background: var(--surface); overflow: hidden; touch-action: none; }
.canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.anatomy { display: flex; gap: 1rem; flex-wrap: wrap; }
.anatomy .cell { border: 1px solid var(--line); border-radius: 12px; padding: .4rem .7rem; text-align: center; min-width: 110px; }
.reveal { position: relative; display: inline-block; font-family: var(--font-my); font-size: 7rem; line-height: 1.5; color: var(--brand); }
.reveal.play { animation: wipe 2.4s ease-in-out; }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.keyboard { display: grid; gap: 4px; margin-top: .8rem; }
.keyboard .krow { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.keyboard button { min-width: 40px; height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  font-family: var(--font-my); font-size: 1.15rem; cursor: pointer; color: var(--ink); }
.keyboard button:hover { border-color: var(--brand); background: var(--brand-soft); }
.keyboard button.wide { min-width: 90px; font-family: var(--font-ui); font-size: .85rem; font-weight: 600; }
.type-input { font-family: var(--font-my) !important; font-size: 1.6rem !important; line-height: 1.9 !important; text-align: center; }
.diff span { font-family: var(--font-my); font-size: 1.5rem; padding: 0 .15em; border-radius: 6px; }
.diff .ok { background: var(--ok-soft); color: var(--ok); }
.diff .bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- Quiz ---------- */
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.qmeta { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.review-item { border-left: 4px solid var(--line); padding: .6rem .9rem; margin: .6rem 0; background: var(--surface-2); border-radius: 0 10px 10px 0; }
.review-item.ok { border-color: var(--ok); }
.review-item.bad { border-color: var(--bad); }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: .4rem; width: min(92vw, 460px); pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: .65rem 1rem; border-radius: 10px; box-shadow: var(--shadow); font-size: .92rem;
  font-family: var(--font-ui); transition: opacity .3s, transform .3s; animation: slideup .25s; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes slideup { from { opacity: 0; transform: translateY(10px);} }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Flip-book library ---------- */
.book-card { display: grid; grid-template-columns: 130px 1fr; gap: 1rem; align-items: start; }
.book-cover { position: relative; aspect-ratio: 1 / 1.414; border-radius: 6px 10px 10px 6px; overflow: hidden; background: #fff;
  box-shadow: 0 2px 0 #e7e1d3, 0 4px 0 #ddd6c5, 0 8px 18px rgba(0,0,0,.18); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 18%; }
.book-cover-title { color: #c2410c; font-size: .72rem; line-height: 1.8; text-align: center; padding: .3rem .4rem; font-weight: 700; }
.book-cover::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 8px; background: linear-gradient(90deg, rgba(0,0,0,.18), transparent); }
.book-cover img { width: 100%; height: auto; }
.book-cover .pill { position: absolute; top: 6px; right: 6px; }
@media (max-width: 480px) { .book-card { grid-template-columns: 96px 1fr; } }
.spinner { width: 28px; height: 28px; margin: 0 auto .8rem; border-radius: 50%; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* viewer */
.fb { display: flex; flex-direction: column; height: calc(100vh - 110px); min-height: 460px; background: var(--bg); }
.fb.fake-full, .fb:fullscreen { position: fixed; inset: 0; z-index: 90; height: 100vh; padding: .6rem; }
.fb-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.fb-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-toc { width: auto; max-width: 230px; padding: .35em .6em; font-size: .88rem; }
.fb-stage { position: relative; flex: 1; display: grid; place-items: center; perspective: 2200px; touch-action: pan-y; user-select: none; overflow: hidden;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--brand-soft) 60%, transparent), transparent 70%); border-radius: 14px; }
.fb-book { position: relative; display: flex; transform-style: preserve-3d; }
.fb-page { position: relative; flex: 1; height: 100%; overflow: hidden; background: #fffefa; box-shadow: 0 6px 24px rgba(0,0,0,.22); }
.fb-page.blank { background: transparent; box-shadow: none; }
.fb-page.left { border-radius: 6px 0 0 6px; }
.fb-page.right { border-radius: 0 6px 6px 0; }
.fb-page.single { border-radius: 4px 8px 8px 4px; }
.fb-book.spread .fb-page.left:not(.blank)::after { content: ''; position: absolute; inset: 0 0 0 auto; width: 40px; background: linear-gradient(90deg, transparent, rgba(0,0,0,.13)); pointer-events: none; }
.fb-book.spread .fb-page.right:not(.blank)::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 40px; background: linear-gradient(270deg, transparent, rgba(0,0,0,.13)); pointer-events: none; }
.fb-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 5; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
.fb-arrow.left { left: 6px; } .fb-arrow.right { right: 6px; }
.fb-arrow:disabled { opacity: .3; cursor: default; }
.fb-arrow:hover:not(:disabled) { color: var(--brand); border-color: var(--brand); }
.fb-foot { display: flex; align-items: center; gap: .8rem; padding: .6rem .2rem 0; }
.fb-foot input[type=range] { flex: 1; accent-color: var(--brand); }

/* turning leaf */
.fb-leaf { position: absolute; top: 0; height: 100%; transform-style: preserve-3d; transition: transform .75s cubic-bezier(.45,.05,.3,1); z-index: 4; }
.fb-leaf.on-right { left: 50%; width: 50%; transform-origin: left center; }
.fb-leaf.on-left { left: 0; width: 50%; transform-origin: right center; }
.fb-leaf.on-single { left: 0; width: 100%; transform-origin: left center; }
.fb-leaf.on-single.from-left { transform: rotateY(-180deg); }
.fb-leaf.on-right.turn-next, .fb-leaf.on-single.turn-next { transform: rotateY(-180deg); }
.fb-leaf.on-left.turn-prev { transform: rotateY(180deg); }
.fb-leaf.on-single.from-left.turn-prev { transform: rotateY(0deg); }
.fb-face { position: absolute; inset: 0; display: flex; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fb-face.back { transform: rotateY(180deg); }
.fb-face .fb-page { box-shadow: 0 0 30px rgba(0,0,0,.25); }
.fb-face.back .fb-page.blank { background: #f4f1e8; }

/* zoom overlay */
.fb-zoom { position: absolute; inset: 0; z-index: 20; overflow: auto; background: color-mix(in srgb, var(--bg) 96%, transparent); padding: 3.2rem 12px 2rem; }
.fb-zoom-close { position: sticky; top: 0; float: right; z-index: 2; }
.fb-zoom-pages { display: grid; gap: 1rem; justify-content: center; }
.fb-zoom .fb-page { flex: none; }
.fb:fullscreen .fb-zoom, .fb.fake-full .fb-zoom { position: fixed; }

/* ---------- Book content (from Word) — always printed on white paper ---------- */
.bk { color: #222; font-family: 'Times New Roman', Times, var(--font-my); font-size: 12pt; line-height: 1.25; text-align: left; }
.bk .my, .bk td, .bk p { font-family: 'Times New Roman', Times, var(--font-my); }
.bk-sheet { position: absolute; top: 0; left: 0; transform: scale(var(--s, 1)); transform-origin: top left; box-sizing: border-box; background: #fffefa; overflow: hidden; }
.bk-flow { display: flow-root; }
.bk-measure { position: absolute; left: -100000px; top: 0; visibility: hidden; }
.bk p { margin: 0; overflow-wrap: anywhere; }
.bk table { border-collapse: collapse; table-layout: fixed; max-width: 100%; }
.bk td { overflow-wrap: anywhere; }
.bk img { max-width: 100%; object-fit: contain; vertical-align: middle; }
.bk .dx-tab { display: inline-block; width: 48px; }
.bk .dx-li { position: relative; padding-left: 1.2em; }
.bk .dx-li::before { content: '•'; position: absolute; left: .2em; }
.bk .dx-anchor { display: block; text-align: center; }
.bk-num { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; font: 11pt/1 system-ui, sans-serif; color: #999; }

/* ---------- Free taster & paywall ---------- */
.gate-or { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .85rem; margin: 1.1rem 0 .2rem; }
.gate-or::before, .gate-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.trial-box { margin-bottom: .7rem; padding: .7rem; border-radius: 12px; background: var(--gold-soft); text-align: center; }
.trial-banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; background: var(--gold-soft); border-color: var(--gold); margin-bottom: 1rem; }
.paywall { text-align: center; max-width: 440px; margin: 0 auto; }
.paywall-lock { width: 60px; height: 60px; margin: 0 auto .4rem; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); }
.paywall-price { margin: .8rem auto; padding: .7rem 1rem; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: inline-grid; }
.paywall-price .my { font-size: 1.35rem; font-weight: 700; }
.paywall-price small { color: var(--muted); }
.paywall-form { text-align: left; border-top: 1px dashed var(--line); padding-top: 1rem; }
.modal { position: fixed; inset: 0; z-index: 95; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 1rem; overflow-y: auto; }
.modal-card { position: relative; width: min(480px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto; }
.modal-x { position: absolute; top: .7rem; right: .7rem; }
.cover-lock { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.55); color: var(--gold); }
