/* دوراهی — نسخهٔ ۴
   مفهوم بصری: نگارگری ایرانی در شب. صحنهٔ تمام‌صفحه، کادر لاجوردی با قاب طلایی، نستعلیق برای عنوان و بیت.
   قلم‌ها فقط «انجمن» (متن و رابط) و «ایران‌نستعلیق» (عنوان‌ها و ابیات). */
@font-face { font-family: "Anjoman"; font-weight: 300; font-display: swap; src: url(fonts/anjoman-300.woff) format("woff"); }
@font-face { font-family: "Anjoman"; font-weight: 400; font-display: swap; src: url(fonts/anjoman-400.woff) format("woff"); }
@font-face { font-family: "Anjoman"; font-weight: 500; font-display: swap; src: url(fonts/anjoman-500.woff) format("woff"); }
@font-face { font-family: "Anjoman"; font-weight: 700; font-display: swap; src: url(fonts/anjoman-700.woff) format("woff"); }
@font-face { font-family: "Anjoman"; font-weight: 800; font-display: swap; src: url(fonts/anjoman-800.woff) format("woff"); }
@font-face { font-family: "IranNastaliq"; font-weight: 400; font-display: swap; src: url(fonts/iran-nastaliq.woff) format("woff"); }

:root {
  --lapis-950: #070c1f;
  --lapis-900: #0c1430;
  --lapis-800: #142049;
  --lapis-700: #1e2d5e;
  --gold: #d8b45f;
  --gold-hi: #f0d48a;
  --gold-soft: #b8975088;
  --gold-dim: #a48a55;
  --ivory: #f1e9d6;
  --ivory-dim: #bfb6a0;
  --vermilion: #c9563e;
  --malachite: #4a9a82;
  --parchment: #ebdfc2;
  --ink: #2a2214;
  --f-body: "Anjoman", Tahoma, sans-serif;
  --f-display: "IranNastaliq", "Anjoman", serif;
  --radius: 6px;
  --col: 640px;
  --box-a: .82;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--lapis-950); color: var(--ivory);
  font-family: var(--f-body); font-weight: 400; font-size: var(--fs, 18px); line-height: 1.95;
  -webkit-tap-highlight-color: transparent;
}
html.on-stage, html.on-stage body { overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; }
em, i, cite { font-style: normal; } /* فارسی ایتالیک ندارد؛ کج‌نمایی جعلی ممنوع */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.app { min-height: 100%; }
.wrap { max-width: var(--col); margin: 0 auto; padding-inline: max(16px, env(safe-area-inset-left, 0px)); }
.loading { padding: 40px 16px; text-align: center; color: var(--ivory-dim); }
.ico { width: 1.1em; height: 1.1em; display: inline-block; vertical-align: -0.18em; flex: none; }
.key, .coin { color: var(--gold); }

/* ---------- دکمه‌ها ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 22px; border-radius: var(--radius);
  border: 1px solid var(--gold); background: var(--gold); color: var(--lapis-950);
  font-weight: 700; font-size: 18px; cursor: pointer; text-decoration: none;
  box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 0 4px #7a5a2088;
  transition: transform .12s ease, filter .12s ease;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--gold); box-shadow: none; }
.btn.quiet { background: var(--lapis-800); color: var(--ivory); border-color: #d8b45f40; font-weight: 500; box-shadow: none; }
.btn.small { min-height: 44px; font-size: 16px; padding: 6px 16px; }
.btn.danger { background: var(--vermilion); border-color: var(--vermilion); color: var(--ivory); box-shadow: none; }
.linkish { background: none; border: 0; color: var(--gold); cursor: pointer; padding: 4px 0; font-size: 15px; }
.iconbtn { background: #0a112655; border: 1px solid #ffffff1a; padding: 0; border-radius: 50%; cursor: pointer; color: var(--ivory); display: inline-grid; place-items: center; width: 42px; height: 42px; backdrop-filter: blur(6px); }
.iconbtn:hover { color: var(--gold); }
.wallet { display: flex; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; background: #0a1126aa; border: 1px solid #d8b45f40; font-size: 15px; font-variant-numeric: tabular-nums; cursor: pointer; backdrop-filter: blur(6px); }

/* ---------- نوار بالای صفحه‌های معمولی ---------- */
.bar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--lapis-950) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid #d8b45f22; padding-top: env(safe-area-inset-top, 0px); }
.bar .wrap { display: flex; align-items: center; gap: 10px; padding-block: 8px; min-height: 56px; }
.bar .title { flex: 1; min-width: 0; font-size: 16px; color: var(--ivory-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .title b { color: var(--ivory); font-weight: 700; }

/* ---------- نقاشی صحنه (مشترک) ---------- */
.art { position: absolute; inset: 0; transition: opacity .9s ease; }
.art svg, .art img { width: 100%; height: 100%; display: block; object-fit: cover; }
.art.enter { opacity: 0; }
.art.kb { animation: kb 46s ease-in-out infinite alternate; transform-origin: 50% 60%; }
@keyframes kb { from { transform: scale(1.02); } to { transform: scale(1.12) translate(-1.5%, -1%); } }
.scene-svg .tw { animation: tw 4s ease-in-out infinite alternate; }
@keyframes tw { from { opacity: .15; } to { opacity: .9; } }

/* ---------- خانه و صفحه‌های لحظه ---------- */
.reward { display: inline-flex; gap: 6px; align-items: center; padding: 4px 14px; border-radius: 999px; background: #0a1126cc; border: 1px solid var(--gold-soft); color: var(--gold-hi); font-size: 15px; margin: 6px 4px 0; }

.section-h { font-size: 15px; color: var(--gold-dim); letter-spacing: .03em; margin: 0 0 12px; font-weight: 700; }
.eps { display: grid; gap: 10px; }
.ep { display: grid; grid-template-columns: 74px 1fr auto; gap: 14px; align-items: center; padding: 10px; background: var(--lapis-900); border: 1px solid #d8b45f1f; border-radius: var(--radius); text-align: start; cursor: pointer; width: 100%; }
.ep:hover { border-color: var(--gold-soft); }
.ep .thumb { position: relative; width: 74px; height: 74px; border-radius: 4px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--gold-soft); }
.ep .thumb svg, .ep .thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.ep .num { position: absolute; bottom: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #070c1fdd; color: var(--gold); font-weight: 700; font-size: 15px; border: 1px solid var(--gold-soft); line-height: 1; }
.ep .meta { min-width: 0; }
.ep .meta b { display: block; font-size: 18px; line-height: 1.6; font-weight: 700; }
.ep .meta span { display: block; font-size: 14.5px; color: var(--ivory-dim); line-height: 1.75; }
.ep .state { font-size: 14px; color: var(--ivory-dim); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.ep.locked .meta b { color: var(--ivory-dim); }
.ep[disabled] { opacity: .45; cursor: default; }
.endings-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.seal { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; border: 1px dashed #d8b45f66; color: var(--ivory-dim); font-size: 16px; }
.seal.got { border-style: solid; color: var(--lapis-950); background: var(--gold); border-color: var(--gold); font-weight: 700; }
.seal.got.tragic { background: var(--vermilion); border-color: var(--vermilion); color: var(--ivory); }
.seal.got.dark { background: #5a4a6e; border-color: #8a77a3; color: var(--ivory); }
.foot { font-size: 13.5px; color: #8b8573; text-align: center; line-height: 1.9; }

/* ---------- صحنهٔ سینمایی ---------- */
.stage { position: fixed; inset: 0; overflow: hidden; background: #03050f; user-select: none; -webkit-user-select: none; touch-action: manipulation; cursor: pointer; }
.st-bg { position: absolute; inset: 0; transition: filter .6s ease; }
.st-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.st-vig { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 90% at 50% 40%, transparent 55%, #000a 100%), linear-gradient(180deg, #0007 0%, transparent 16%, transparent 52%, #03050fcc 100%); }
.stage:not(.vd-lit).deciding .st-bg, .stage:not(.vd-lit).cinema .st-bg { filter: brightness(.45) saturate(.75); }

.st-cast { position: absolute; inset: 0; pointer-events: none; }
.bust { position: absolute; margin: 0; bottom: 30svh; width: min(58vw, 330px); opacity: 0; transform: translateY(26px); transition: opacity .45s ease, transform .45s ease, filter .45s ease; filter: drop-shadow(0 10px 30px #000c); }
.bust.r { right: -6%; }
.bust.l { left: -6%; }
.bust.in { opacity: 1; transform: none; filter: brightness(.42) saturate(.6) drop-shadow(0 10px 30px #000c); }
.bust.in.on { opacity: 1; filter: drop-shadow(0 10px 30px #000c); }
.bust svg, .bust img { width: 100%; height: auto; display: block; }
.stage.cinema .st-cast, .stage.deciding .st-cast { opacity: 0; transition: opacity .4s; }

.st-hud { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 6px; padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px; z-index: 5; }
.hud-b { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #070c1f80; border: 1px solid #ffffff1f; color: var(--ivory); cursor: pointer; backdrop-filter: blur(6px); flex: none; }
.hud-b:hover, .hud-b.on { color: var(--gold); border-color: var(--gold-soft); }
.st-prog { flex: 1; height: 3px; background: #ffffff26; border-radius: 2px; overflow: hidden; margin: 0 4px; }
.st-prog i { display: block; height: 100%; width: 4%; background: var(--gold); transition: width .8s ease; }
.st-skip { position: absolute; top: calc(60px + env(safe-area-inset-top, 0px)); left: 12px; z-index: 5; display: inline-flex; gap: 6px; align-items: center; padding: 4px 14px; border-radius: 999px; background: #070c1fcc; border: 1px solid var(--gold-soft); color: var(--gold-hi); font-size: 14px; cursor: pointer; }
.st-skip[hidden] { display: none; }

.st-box {
  position: absolute; z-index: 4; left: 50%; transform: translateX(-50%);
  bottom: max(14px, env(safe-area-inset-bottom, 0px)); width: min(820px, calc(100% - 24px)); min-height: 24svh;
  padding: 26px 22px 30px; border-radius: var(--radius);
  background: rgba(8, 13, 34, var(--box-a)); backdrop-filter: blur(3px);
  box-shadow: inset 0 0 0 1px var(--gold), inset 0 0 0 4px rgba(8, 13, 34, var(--box-a)), inset 0 0 0 5px #c9563e88, 0 18px 50px #000a;
  transition: opacity .35s ease;
}
.st-box.hide { opacity: 0; pointer-events: none; }
.st-box .plate { position: absolute; top: -16px; right: 20px; min-height: 30px; padding: 2px 16px; border-radius: 3px; background: var(--c, var(--gold)); color: #0a1126; font-weight: 700; font-size: 16px; line-height: 26px; box-shadow: 0 0 0 2px #0a1126, 0 0 0 3px var(--c, var(--gold)); }
.st-box .plate small { font-size: 13px; font-weight: 500; opacity: .8; }
.st-box.narr .plate { display: none; }
.st-box.think .plate { background: #0a1126; color: var(--ivory-dim); box-shadow: 0 0 0 1px var(--gold-soft); font-weight: 500; }
.st-box .txt { margin: 0; font-size: var(--fs, 18px); line-height: 2.05; text-wrap: pretty; }
.st-box.think .txt { color: #d6cba8; }
.st-box.think .txt::before { content: "❁ "; color: var(--gold-dim); }
.w { opacity: 0; transition: opacity .28s ease; }
.w.v { opacity: 1; }
.st-box .more { position: absolute; left: 16px; bottom: 8px; color: var(--gold); opacity: 0; transform: rotate(90deg); }
.st-box.done .more { opacity: .9; animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: rotate(90deg) translateX(0); } 50% { transform: rotate(90deg) translateX(5px); } }

/* پیش‌درآمد سینمایی: نوار سیاه بالا و پایین و متن در میانه */
.stage::before, .stage::after { content: ""; position: absolute; left: 0; right: 0; height: 0; background: #000; z-index: 3; transition: height .8s ease; pointer-events: none; }
.stage::before { top: 0; } .stage::after { bottom: 0; }
.stage.cinema::before, .stage.cinema::after { height: 12svh; }
.st-center { position: absolute; inset: 14svh 7vw; display: grid; place-items: center; text-align: center; z-index: 4; pointer-events: none; }
.st-center p { margin: 0; font-size: calc(var(--fs, 18px) + 5px); line-height: 2.1; color: #f6eedb; text-shadow: 0 2px 16px #000; max-width: 640px; font-weight: 500; }
.st-center p.thought { color: var(--gold-hi); font-weight: 400; }
.st-center p.thought::before { content: "❁ "; }

/* لایه‌های لحظه‌های ویژه */
.st-ov { position: absolute; inset: 0; z-index: 6; display: none; pointer-events: none; }
.st-ov.show { display: grid; place-items: center; }
.st-ov.title { background: #03050f; pointer-events: auto; }
.tc-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .35; }
.tc { position: relative; text-align: center; padding: 0 9vw; }
.tc > * { opacity: 0; animation: rise 1.1s ease forwards; }
.tc-over { margin: 0; color: var(--gold-dim); font-size: 17px; letter-spacing: .1em; animation-delay: .2s; }
.tc-title { margin: 0; font-family: var(--f-display); font-weight: 400; color: var(--gold-hi); font-size: clamp(60px, 17vw, 120px); line-height: 1.8; animation-delay: .6s; text-shadow: 0 0 40px #d8b45f33; }
.tc-pov { margin: 0; color: var(--ivory); font-size: 17px; animation-delay: 1.2s; }
.tc-blurb { margin: 10px auto 0; color: var(--ivory-dim); font-size: 16px; max-width: 460px; animation-delay: 1.5s; }
.tc-hint { margin: 34px 0 0; color: var(--gold-dim); font-size: 14px; animation: rise 1s ease 2.4s forwards, pulse 2.2s ease-in-out 3.4s infinite; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.st-ov.verse { background: #03050fc4; backdrop-filter: blur(2px); }
.verse-card { text-align: center; padding: 0 6vw; position: relative; }
.verse-card::before, .verse-card::after { content: ""; display: block; width: 120px; height: 1px; margin: 0 auto 18px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.verse-card::after { margin: 14px auto 0; }
.verse-card .m1, .verse-card .m2 { margin: 0; font-family: var(--f-display); font-size: clamp(32px, 8.4vw, 56px); line-height: 2.25; color: var(--gold-hi); text-shadow: 0 2px 20px #000; }
.verse-card .by { display: block; margin-top: 4px; font-size: 14px; color: var(--gold-dim); letter-spacing: .1em; }
.st-ov.anim .m1 { animation: ink 1.2s ease both; }
.st-ov.anim .m2 { animation: ink 1.2s ease .8s both; }
.st-ov.anim .by { animation: rise .8s ease 1.6s both; }
@keyframes ink { from { opacity: 0; filter: blur(6px); clip-path: inset(0 0 0 100%); } to { opacity: 1; filter: none; clip-path: inset(0 0 0 0); } }

.st-ov.letter { background: #03050fa8; }
.letter-card { position: relative; width: min(560px, 86vw); padding: 34px 30px 40px; background: var(--parchment); color: var(--ink); border-radius: 3px; transform: rotate(-.6deg); box-shadow: 0 20px 60px #000c, inset 0 0 60px #b8975055; animation: rise .6s ease both; }
.letter-card .lbl { position: absolute; top: -14px; right: 22px; padding: 0 12px; background: var(--vermilion); color: var(--ivory); font-size: 14px; border-radius: 2px; }
.letter-card p { margin: 0; font-size: calc(var(--fs, 18px) + 1px); line-height: 2.1; }
.letter-card::after { content: ""; position: absolute; left: 22px; bottom: -16px; width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #d8664e, #8a2a1a); box-shadow: 0 3px 8px #0008; }

.st-seal { position: absolute; top: calc(66px + env(safe-area-inset-top, 0px)); left: 50%; z-index: 7; transform: translate(-50%, -16px); opacity: 0; pointer-events: none; }
.st-seal.show { animation: sealin 2.6s ease forwards; }
@keyframes sealin { 0% { opacity: 0; transform: translate(-50%, -16px) scale(.96); } 12%, 82% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -8px); } }
.seal-card { display: flex; align-items: center; gap: 12px; padding: 8px 18px 8px 14px; border-radius: var(--radius); background: #0a1126f2; box-shadow: inset 0 0 0 1px var(--gold), 0 10px 30px #000a; white-space: nowrap; }
.seal-card .stamp { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--vermilion); color: var(--ivory); animation: stamp .5s cubic-bezier(.3, 1.6, .5, 1) .15s both; }
@keyframes stamp { from { transform: scale(1.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.seal-card small { display: block; font-size: 13px; color: var(--gold-dim); line-height: 1.5; }
.seal-card b { font-size: 16px; color: var(--gold-hi); }

/* آیین دوراهی */
.st-choices { position: absolute; z-index: 8; left: 50%; transform: translateX(-50%); width: min(720px, calc(100% - 24px)); bottom: calc(var(--boxh, 26svh) + 30px + env(safe-area-inset-bottom, 0px)); max-height: calc(100% - var(--boxh, 26svh) - 110px); overflow-y: auto; display: grid; gap: 9px; cursor: default; }
.fork-head { display: grid; justify-items: center; color: var(--gold); line-height: 1.3; margin-bottom: 4px; animation: rise .6s ease both; }
.fork-head .ico { width: 30px; height: 30px; }
.fork-t { font-family: var(--f-display); font-size: 40px; line-height: 1.7; color: var(--gold-hi); text-shadow: 0 2px 16px #000; }
.fork-s { font-size: 15px; color: var(--ivory-dim); text-shadow: 0 1px 8px #000; }
@keyframes shrink { from { width: 100%; } to { width: 0; } }
.ch { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; width: 100%; text-align: start; cursor: pointer; padding: 13px 15px; border-radius: var(--radius); background: #0a1126ee; border: 1px solid var(--gold-soft); font-size: calc(var(--fs, 18px) - 1px); line-height: 1.85; box-shadow: 0 8px 26px #0008; opacity: 0; animation: rise .45s ease forwards; transition: border-color .15s, transform .15s, opacity .35s; }
.ch:nth-child(2) { animation-delay: .08s; } .ch:nth-child(3) { animation-delay: .16s; } .ch:nth-child(4) { animation-delay: .24s; } .ch:nth-child(5) { animation-delay: .32s; }
.ch:hover:not([disabled]) { border-color: var(--gold); transform: translateY(-1px); }
.ch .k { width: 28px; height: 28px; margin-top: 3px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; color: var(--gold); border: 1px solid var(--gold-soft); }
.ch .why { display: block; font-size: 14px; color: var(--ivory-dim); line-height: 1.7; margin-top: 2px; }
.ch.premium { border-color: var(--gold); background: linear-gradient(180deg, #2a2410f0, #0a1126f0); }
.ch.premium .why { color: var(--gold-hi); }
.ch .cost { display: inline-flex; gap: 4px; align-items: center; padding: 2px 10px; border-radius: 999px; background: var(--gold); color: var(--lapis-950); font-weight: 700; font-size: 15px; margin-top: 3px; }
.ch .cost .ico { color: var(--lapis-950); }
.ch.locked { border-style: dashed; color: var(--ivory-dim); cursor: not-allowed; background: #0a1126c8; }
.st-choices.picked .ch:not(.chosen) { opacity: 0 !important; transform: scale(.98); }
.st-choices.picked .fork-head, .st-choices.picked .ch-timer, .st-choices.picked .ch-wallet { opacity: 0; transition: opacity .3s; }
.ch.chosen { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold), 0 0 30px #d8b45f44; }
.whisper { margin: 4px 0 0; text-align: center; color: var(--gold-hi); font-size: 15px; animation: rise .5s ease both; text-shadow: 0 1px 8px #000; }

.stage.fade .st-box, .stage.fade .st-cast, .stage.fade .st-hud { opacity: 0; transition: opacity .5s; }
.stage.fade .st-bg { filter: brightness(0); transition: filter .6s; }
.st-embed { position: absolute; z-index: 9; bottom: 4px; left: 50%; transform: translateX(-50%); font-size: 12px; color: #fff; background: #c9563ecc; padding: 0 10px; border-radius: 999px; pointer-events: none; }

/* ---------- مودال ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: #03050fb8; display: grid; place-items: end center; padding: 12px; backdrop-filter: blur(3px); animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; } }
.sheet { width: min(100%, 560px); max-height: 90svh; overflow: auto; background: var(--lapis-900); border-radius: 10px; padding: 22px 20px; margin-bottom: env(safe-area-inset-bottom, 0px); box-shadow: inset 0 0 0 1px var(--gold), inset 0 0 0 4px var(--lapis-900), inset 0 0 0 5px #c9563e77, 0 20px 60px #000; animation: rise .25s ease; cursor: default; }
.sheet.tall { height: 86svh; display: flex; flex-direction: column; }
.sheet h3 { margin: 0 0 6px; font-size: 21px; color: var(--gold-hi); font-weight: 700; }
.sheet p { margin: 8px 0; color: var(--ivory-dim); font-size: 16px; }
.sheet > .btn, .sheet .btn-row { width: 100%; margin-top: 12px; }
.sheet .have { color: var(--ivory); font-size: 15px; }
.menu-list { display: grid; gap: 6px; margin: 10px 0; }
.menu-list button { text-align: start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid #d8b45f26; background: var(--lapis-800); cursor: pointer; font-size: 16px; }
.menu-list button:hover:not([disabled]) { border-color: var(--gold-soft); }
.menu-list button[disabled] { opacity: .5; }
.menu-list .danger { color: #f0a090; }
.hist-ep { color: var(--gold-dim); font-size: 14px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1; min-width: 70px; padding: 8px 10px; border-radius: var(--radius); border: 1px solid #d8b45f33; background: var(--lapis-800); cursor: pointer; font-size: 15px; }
.seg button.on { border-color: var(--gold); color: var(--gold-hi); background: #2a2410; }
.backlog { flex: 1; overflow-y: auto; margin: 8px -6px; padding: 0 6px; display: grid; gap: 8px; align-content: start; }
.lg { margin: 0; font-size: 16px; line-height: 1.95; color: var(--ivory); }
.lg.n { color: var(--ivory); }
.lg.i { color: #d6cba8; } .lg.i::before { content: "❁ "; color: var(--gold-dim); }
.lg.say b { display: block; color: var(--c); font-size: 14px; }
.lg.verse { font-family: var(--f-display); color: var(--gold-hi); text-align: center; font-size: 22px; line-height: 2.3; }
.lg.letter { background: var(--parchment); color: var(--ink); padding: 10px 14px; border-radius: 3px; }
.lg.pick { color: var(--gold); padding: 6px 12px; border-inline-start: 2px solid var(--gold); }
.lg.clue { color: var(--gold-hi); font-size: 15px; }
.lg.sep { text-align: center; color: var(--gold-dim); font-size: 14px; }
.onb { text-align: center; }
.onb-ico { width: 64px; height: 64px; margin: 4px auto 10px; border-radius: 50%; display: grid; place-items: center; color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold-soft); }
.onb-ico .ico { width: 30px; height: 30px; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 14px 0 6px; }
.dots span { width: 8px; height: 8px; border-radius: 50%; background: #ffffff33; }
.dots span.on { background: var(--gold); }
.clue-list { display: grid; gap: 8px; margin: 10px 0; }
.clue-card { display: grid; gap: 2px; padding: 10px 14px; border-radius: var(--radius); background: var(--lapis-800); box-shadow: inset 3px 0 0 var(--vermilion); }
.clue-card b { color: var(--gold-hi); }
.clue-card span { color: var(--ivory-dim); font-size: 15px; line-height: 1.85; }
.clue-seals { display: flex; flex-wrap: wrap; gap: 6px; }
.clue-seals .seal { width: 36px; height: 36px; font-size: 14px; }
.count { color: var(--ivory-dim); font-size: 15px; }
.pack { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; width: 100%; padding: 12px; margin: 8px 0; border-radius: var(--radius); background: var(--lapis-800); border: 1px solid #d8b45f33; text-align: start; cursor: pointer; }
.pack.best { border-color: var(--gold); }
.pack .pic { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 10px; background: var(--lapis-950); font-size: 22px; }
.pack b { display: block; font-size: 17px; }
.pack span span { display: block; font-size: 14px; color: var(--ivory-dim); }
.pack .price { color: var(--gold-hi); font-size: 15px; white-space: nowrap; }
.badge { margin-inline-start: 8px; padding: 0 8px; border-radius: 999px; background: var(--vermilion); color: var(--ivory); font-size: 12px; }
.timer { font-size: 30px; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); max-width: min(92vw, 520px); padding: 10px 18px; border-radius: var(--radius); background: #0a1126f5; color: var(--ivory); font-size: 15.5px; line-height: 1.8; box-shadow: inset 0 0 0 1px var(--gold-soft), 0 10px 30px #000a; animation: rise .25s ease; text-align: center; }
html.on-stage .toast { bottom: auto; top: calc(64px + env(safe-area-inset-top, 0px)); }

/* ---------- پایان قسمت و پایان داستان ---------- */
.moment { display: grid; gap: 10px; }
.moment p { margin: 0; text-wrap: pretty; }
.moment .teaser { color: var(--ivory-dim); font-size: 16px; padding: 12px 14px; border-radius: var(--radius); background: var(--lapis-900); box-shadow: inset 3px 0 0 var(--gold); }
.moment .epilogue { font-size: calc(var(--fs, 18px) + 1px); line-height: 2.1; }
.moment .epilogue:first-child::first-letter { color: var(--gold); }
.moment .coda { color: var(--ivory-dim); font-size: var(--fs, 18px); padding-inline-start: 14px; box-shadow: inset 2px 0 0 #d8b45f55; }
.btn-row { display: grid; gap: 10px; margin-top: 8px; }
.btn-row.two { grid-template-columns: 1fr 1fr; }
.recap { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; counter-reset: r; }
.recap li { counter-increment: r; padding: 10px 14px; border-radius: var(--radius); background: var(--lapis-900); display: grid; gap: 6px; font-size: 16px; }
.recap li::before { content: counter(r, persian) "."; color: var(--gold-dim); font-size: 14px; }
.pct { position: relative; display: block; height: 26px; border-radius: 4px; background: #ffffff10; overflow: hidden; }
.pct i { position: absolute; inset: 0 0 0 auto; background: #d8b45f40; }
.pct b { position: relative; padding: 0 10px; font-size: 13.5px; font-weight: 500; line-height: 26px; }
.tone { display: inline-block; padding: 2px 12px; border-radius: 999px; font-size: 14px; border: 1px solid currentColor; margin-top: 4px; background: #070c1fbb; }
.tone.hope { color: #9fd3b8; } .tone.epic { color: var(--gold-hi); } .tone.tragic { color: #f0a090; } .tone.dark { color: #c3b2dc; }
.fb-block { display: grid; gap: 8px; }
.stars { display: flex; gap: 6px; justify-content: center; }
.star { width: 44px; height: 44px; border: 0; background: none; color: #ffffff30; cursor: pointer; padding: 6px; }
.star.on { color: var(--gold); }
.vote { display: grid; gap: 6px; }
.opt { padding: 10px 14px; text-align: start; border-radius: var(--radius); background: var(--lapis-900); border: 1px solid #d8b45f26; cursor: pointer; font-size: 16px; }
.opt.on { border-color: var(--gold); color: var(--gold-hi); }
.thanks { color: var(--malachite); text-align: center; font-size: 15px; }
textarea.fb { width: 100%; min-height: 80px; background: var(--lapis-950); border: 1px solid #ffffff1a; color: var(--ivory); border-radius: var(--radius); padding: 10px; font: inherit; font-size: 16px; resize: vertical; }
.gallery { padding-block: 18px 40px; display: grid; gap: 12px; }
.gcard { padding: 14px 16px; border-radius: var(--radius); background: var(--lapis-900); border: 1px solid #d8b45f26; }
.gcard .gimg { width: calc(100% + 32px); margin: -14px -16px 10px; aspect-ratio: 16/9; object-fit: cover; display: block; border-radius: var(--radius) var(--radius) 0 0; }
.gcard.locked { opacity: .78; }
.gcard .row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.gcard h3 { margin: 0; font-size: 18px; }
.gcard p { margin: 6px 0 0; color: var(--ivory-dim); font-size: 15.5px; }

/* ---------- دسکتاپ ---------- */
@media (min-width: 900px) {
  .bust { width: min(25vw, 400px); bottom: 24svh; }
  .bust.r { right: 7%; } .bust.l { left: 7%; }
  .st-box { min-height: 19svh; padding: 30px 36px 32px; }
  .st-box .txt { font-size: calc(var(--fs, 18px) + 4px); line-height: 2; }
  .st-box .plate { font-size: 18px; }
  .ch { font-size: calc(var(--fs, 18px) + 2px); padding: 14px 18px; }
  .fork-t { font-size: 54px; }
  .fork-s { font-size: 17px; }
  .st-center p { font-size: calc(var(--fs, 18px) + 10px); }
  .st-center { inset: 14svh 18vw; }
  .scrim { place-items: center; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .bust { width: 24vw; bottom: 34svh; }
  .st-box { min-height: 30svh; padding: 20px 20px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-delay: 0s !important; transition-duration: .001s !important; }
  .art.kb { animation: none; }
}

/* تصویرهای شخصیت: پرتره کنار نام، تمام‌قد روی کارت عنوان */
.st-box .plate.has-face { padding-inline-start: 50px; }
.st-box .plate .face, .lg.say .face { position: absolute; right: -6px; top: 50%; width: 52px; height: 52px; margin-top: -26px; border-radius: 50%; object-fit: cover; object-position: 50% 20%; box-shadow: 0 0 0 2px #0a1126, 0 0 0 3px var(--c, var(--gold)), 0 6px 16px #000a; background: #0a1126; }
.lg.say b { position: relative; }
.lg.say .face { position: static; display: inline-block; width: 26px; height: 26px; margin: 0 0 0 6px; vertical-align: middle; box-shadow: 0 0 0 1px var(--c); }
.tc-full { position: absolute; bottom: 0; left: 4%; height: 78svh; max-width: 46vw; object-fit: contain; object-position: bottom; opacity: 0; animation: rise 1.4s ease .3s forwards; filter: drop-shadow(0 0 40px #000); pointer-events: none; }
@media (max-width: 700px) { .tc-full { left: 50%; transform: translateX(-50%); opacity: 0; animation: fullin 1.4s ease .3s forwards; height: 64svh; max-width: 90vw; } .st-ov.title .tc { position: relative; z-index: 1; text-shadow: 0 2px 16px #000; } }
@keyframes fullin { to { opacity: .45; } }

/* تصویر میان داستان */
.st-ov.pic { background: #000d; }
.pic-card { margin: 0; width: min(760px, 94vw); max-height: 86vh; display: flex; flex-direction: column; align-items: center; gap: 12px; animation: rise .5s ease both; }
.pic-card img { max-width: 100%; max-height: 74vh; object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px #000c, 0 0 0 1px #d8b45f44; }
.pic-card .pic-ph { position: relative; width: min(560px, 90vw); aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px #d8b45f44; }
.pic-card .pic-ph svg { width: 100%; height: 100%; display: block; }
.pic-card .pic-ph span { position: absolute; inset: auto 0 0 0; padding: 10px; text-align: center; background: linear-gradient(transparent, #000c); color: var(--gold-hi); }
.pic-card figcaption { max-width: 640px; text-align: center; font-size: calc(var(--fs, 18px) - 1px); line-height: 1.9; color: var(--ivory); text-shadow: 0 2px 10px #000; }
.lg.pic img { display: block; max-width: 160px; border-radius: 4px; margin-bottom: 4px; }

/* ---------- کتابخانه (صفحهٔ نخست) ---------- */
.section-h small { color: var(--ivory-dim); font-weight: 400; }
.fchip { font: inherit; font-size: 14px; padding: 3px 12px; border-radius: 999px; border: 1px solid #d8b45f40; background: transparent; color: var(--ivory-dim); cursor: pointer; }
.fchip.on, .fchip:hover { background: var(--gold); color: var(--lapis-950); border-color: var(--gold); }
.empty { color: var(--ivory-dim); text-align: center; padding: 30px 0; }
.brandlink { font-family: var(--f-display); font-size: 26px; color: var(--gold); padding: 0; line-height: 1.6; text-shadow: 0 2px 10px #000a; }

/* ---------- حساب کاربری ---------- */
.acc-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 150px; }
.acc-chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-chip.on { border-color: var(--gold); }
@media (max-width: 420px) { .acc-chip .nm { display: none; } }
.lib-logo { max-height: 40px; max-width: 160px; display: block; }
.acc { display: grid; gap: 10px; text-align: center; }
.acc h3 { margin: 0; }
.acc p { margin: 0; }
.acc h4 { margin: 10px 0 0; font-size: 15px; color: var(--gold); text-align: start; }
.acc-ico { justify-self: center; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: #d8b45f22; color: var(--gold); }
.acc-ico .ico { width: 28px; height: 28px; }
.acc .fld { display: grid; gap: 4px; text-align: start; font-size: 14px; color: var(--ivory-dim); }
.acc .fld input { font: inherit; font-size: 20px; padding: 10px 12px; border-radius: 8px; border: 1px solid #d8b45f55; background: #070c1f; color: var(--ivory); text-align: center; letter-spacing: .04em; width: 100%; box-sizing: border-box; }
.acc .fld input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.acc .fld input.code { letter-spacing: .5em; font-size: 26px; }
.acc .chk { display: flex; gap: 8px; align-items: flex-start; text-align: start; font-size: 14px; color: var(--ivory-dim); cursor: pointer; }
.acc .chk input { margin-top: 5px; accent-color: var(--gold); }
.acc .terms { text-align: start; font-size: 13.5px; color: var(--ivory-dim); }
.acc .terms summary { cursor: pointer; color: var(--gold); }
.acc .terms div { max-height: 200px; overflow: auto; padding: 8px 0; line-height: 1.9; }
.acc .err { color: #f0a08a; min-height: 1.2em; font-size: 14px; }
.acc .dev-code { background: #d8b45f1a; border: 1px dashed var(--gold); border-radius: 8px; padding: 6px 10px; color: var(--gold-hi); font-size: 14px; }
.acc-sub { color: var(--ivory-dim); font-size: 14px; }
.acc-stories, .acc-dev { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; text-align: start; }
.acc-stories li, .acc-dev li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; padding: 6px 10px; border-radius: 8px; background: #ffffff0a; font-size: 14px; }
.acc-stories li span { color: var(--ivory-dim); }
.acc-dev .cur { color: var(--gold); font-weight: 400; font-size: 12.5px; }
.linkish.danger { color: #f0a08a; }
.acc-nudge { border: 1px solid #d8b45f44; border-radius: 10px; padding: 12px 14px; display: grid; gap: 8px; justify-items: center; text-align: center; background: #d8b45f0d; margin-top: 14px; }
.acc-nudge p { margin: 0; color: var(--ivory-dim); }
.acc-tabs { display: flex; justify-content: center; }
.acc-tabs button { flex: 1; }

/* ---------- گزینهٔ طلایی: روشن‌ترین عنصر لحظهٔ انتخاب ---------- */
.ch.premium { border: 2px solid var(--gold); background: #2b220c; color: var(--ivory); box-shadow: 0 0 0 1px #0a1126, 0 10px 30px #d8b45f33; }
.ch.premium .k { color: var(--lapis-950); background: var(--gold); border-color: var(--gold); }
.ch.premium .k .ico { width: 16px; height: 16px; }
.ch.premium .t { color: #fff6dc; }
.ch.premium .why { color: var(--gold-hi); font-size: 14.5px; }
.ch .ch-tag { display: inline-block; margin-inline-end: 8px; padding: 0 8px; border-radius: 4px; background: var(--gold); color: var(--lapis-950); font-size: 12.5px; font-weight: 700; line-height: 22px; vertical-align: 2px; }
.ch.premium.afford .cost { box-shadow: 0 0 0 2px #2b220c, 0 0 0 3px var(--gold-hi); }
.ch.premium.short { background: #221c0c; }
.ch.premium.short .cost { background: #d8b45fcc; }
.ch.premium:hover:not([disabled]) { border-color: var(--gold-hi); box-shadow: 0 0 0 1px #0a1126, 0 12px 34px #d8b45f55; }

/* ---------- پایان قسمت: دکمهٔ «قسمت بعد» همیشه دیده می‌شود ---------- */
.wait-box { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 14px; border-radius: var(--radius); background: var(--lapis-900); border: 1px dashed #d8b45f55; }
.wait-box p { color: var(--ivory-dim); }

/* ---------- پیشنهاد بستهٔ کامل ---------- */
.offer { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; padding: 12px 14px; margin-top: 12px; border-radius: 10px; background: #2b220c; border: 1px solid var(--gold); text-align: start; }
.offer .of-ico { grid-row: span 2; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #070c1f; color: var(--gold); }
.offer .of-ico .ico { width: 26px; height: 26px; }
.offer .of-body { display: grid; gap: 2px; }
.offer .of-body b { color: var(--gold-hi); font-size: 16px; line-height: 1.7; }
.offer .of-body span { color: var(--ivory-dim); font-size: 14px; line-height: 1.7; }
.offer .btn { grid-column: 2; justify-self: start; margin: 0; }
.btn.gold { background: var(--gold); color: var(--lapis-950); border-color: var(--gold); font-weight: 700; }
.pack.focus { border-color: var(--gold-hi); box-shadow: 0 0 0 2px #d8b45f55; }

/* ---------- داستان اصلی (بی‌انتخاب) ---------- */
.canon-card { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; align-items: start; padding: 16px; border-radius: 10px; background: var(--lapis-900); border: 1px solid #d8b45f33; }
.canon-card .cc-ico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #d8b45f1f; color: var(--gold); }
.canon-card .cc-ico .ico { width: 24px; height: 24px; }
.canon-card h2 { margin: 0; font-size: 18px; color: var(--gold-hi); }
.canon-card p { margin: 2px 0 0; font-size: 15px; color: var(--ivory-dim); line-height: 1.85; }
.canon-card .cc-prog { color: var(--gold); font-size: 14px; }
.canon-card .btn { grid-column: 1 / -1; margin: 0; }
@media (min-width: 620px) { .canon-card { grid-template-columns: auto 1fr auto; align-items: center; } .canon-card .btn { grid-column: auto; } }
.st-mode { position: absolute; z-index: 6; top: calc(62px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); display: inline-flex; gap: 6px; align-items: center; padding: 2px 12px; border-radius: 999px; background: #070c1fcc; border: 1px solid #d8b45f55; color: var(--gold-hi); font-size: 13px; pointer-events: none; }
.st-mode .ico { width: 15px; height: 15px; }
.st-box.pick .plate { display: inline-flex; gap: 6px; align-items: center; background: #070c1f; color: var(--gold-hi); box-shadow: 0 0 0 1px var(--gold); font-weight: 500; }
.st-box.pick .plate .ico { width: 16px; height: 16px; }
.st-box.pick .txt { color: var(--gold-hi); }
.canon-cta { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 14px; border-radius: var(--radius); background: #d8b45f12; border: 1px solid #d8b45f44; }
.canon-cta p { color: var(--ivory-dim); }
.canon-cta.big b { font-size: 18px; color: var(--gold-hi); }
.lib-canon .count { margin: -6px 0 12px; }
.canon-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.canon-tile { font: inherit; color: inherit; flex: 0 0 auto; width: 240px; display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; padding: 8px; text-align: start; border-radius: 10px; background: var(--lapis-900); border: 1px solid #d8b45f26; cursor: pointer; scroll-snap-align: start; }
.canon-tile:hover, .canon-tile:focus-visible { border-color: var(--gold); outline: none; }
.ct-art { position: relative; width: 64px; height: 80px; border-radius: 6px; overflow: hidden; background: var(--lapis-950); }
.ct-art img, .ct-art svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ct-t { display: grid; gap: 2px; min-width: 0; }
.ct-t b { font-size: 16px; line-height: 1.6; }
.ct-t span { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; color: var(--gold); }
.ct-t .ico { width: 15px; height: 15px; }

/* ---------- کتابخانه: «ادامه بده» با تصویر آخرین صحنه ---------- */

/* ---------- پیش‌نمایش نخستین دوراهی ---------- */
.tz-stage { position: relative; overflow: hidden; border-radius: 12px; min-height: 360px; border: 1px solid #d8b45f33; background: var(--lapis-950); cursor: pointer; }
.tz-stage > .art { position: absolute; inset: 0; }
.tz-stage > .art img, .tz-stage > .art svg { width: 100%; height: 100%; object-fit: cover; }
.tz-shade { position: absolute; inset: 0; background: linear-gradient(180deg, #070c1f33, #070c1fdd 60%, #070c1ff5); }
.tz-lines { position: absolute; left: 16px; right: 16px; top: 16px; display: grid; gap: 8px; }
.tz-l { margin: 0; padding: 8px 12px; border-radius: 8px; background: #0a1126dd; border: 1px solid #d8b45f26; font-size: 15.5px; line-height: 1.9; animation: rise .4s ease; }
.tz-l b { display: block; font-size: 13px; }
.tz-l.think span { color: #d6cba8; }
.tz-l.verse { text-align: center; font-family: var(--f-display); font-size: 20px; color: var(--gold-hi); }
.tz-choices { position: absolute; left: 16px; right: 16px; bottom: 26px; display: grid; gap: 8px; opacity: 0; transition: opacity .4s; }
.tz-choices.in { opacity: 1; }
.tz-fork { display: flex; gap: 6px; align-items: center; justify-content: center; color: var(--gold-hi); font-family: var(--f-display); font-size: 22px; }
.tz-ch { font: inherit; color: var(--ivory); display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; text-align: start; padding: 9px 12px; border-radius: var(--radius); background: #0a1126ee; border: 1px solid var(--gold-soft); font-size: 15px; line-height: 1.7; cursor: pointer; opacity: 0; animation: rise .45s ease forwards; animation-delay: calc(var(--d) * .12s); }
.tz-ch .k { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--gold-soft); color: var(--gold); font-size: 13px; }
.tz-ch.premium { border: 2px solid var(--gold); background: #2b220c; }
.tz-ch .cost { display: inline-flex; gap: 3px; align-items: center; padding: 0 8px; border-radius: 999px; background: var(--gold); color: var(--lapis-950); font-size: 13px; font-weight: 700; }
.tz-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #ffffff14; }
.tz-bar i { display: block; height: 100%; width: 0; background: var(--gold); }

/* ---------- کارت استوری و اشتراک ---------- */
.share-box { display: grid; gap: 6px; padding: 14px; border-radius: var(--radius); background: var(--lapis-900); border: 1px solid #d8b45f33; }
.share-box b { color: var(--gold-hi); }
.share-box p { color: var(--ivory-dim); font-size: 15px; }
.card-prev { display: block; width: min(240px, 60vw); margin: 10px auto; border-radius: 10px; box-shadow: 0 10px 30px #000a; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
/* راهنما (از منو): دکمه‌ها زیر هم، بی‌هم‌پوشانی */
.onb .btn { display: block; width: 100%; margin: 14px 0 0; }
.onb .linkish { display: block; width: 100%; margin-top: 8px; min-height: 40px; }
/* اعلان کوتاه بالای نوار ثابت پایین صفحه */
/* بخش‌های کتابخانه در شبکه نباید از عرض صفحه بیرون بزنند (ردیف افقی «داستان اصلی») */
/* صفحهٔ داستان: دو حالت هر داستان (تعاملی / داستان اصلی) */
/* کتابخانه: نیمه‌تمام‌ها پس از فهرست اصلی */

/* Stage 4: opt-in light pipeline. The legacy dim is never applied twice. */
.vd-grade,.vd-spot { position:absolute;inset:0;z-index:1;pointer-events:none;opacity:1;will-change:auto; }
.stage.vd-lit .st-fx,.stage.vd-lit .st-vig { z-index:2; }
.stage.vd-lit .st-cast { z-index:3; }
.stage.vd-themed { background:var(--lapis-950);color:var(--ivory); }
.stage.vd-themed .st-box { background:var(--vd-dialogue-bg);color:var(--vd-dialogue-text);box-shadow:inset 0 0 0 1px var(--gold),0 12px 40px #0005; }
.stage.vd-themed .st-box .txt,.stage.vd-themed .st-box.think .txt {color:var(--vd-dialogue-text);}
.stage.vd-themed .ch { background:var(--vd-choice-bg);color:var(--vd-choice-text);border-color:var(--gold); }
.stage.vd-themed .ch .why,.stage.vd-themed .ch.locked {color:var(--vd-choice-text);}
.stage.vd-themed .ch.locked { border-style:dashed;opacity:1; }
.stage.vd-themed .ch.premium {background:var(--vd-choice-bg);border-color:var(--gold);}
.stage.vd-themed .ch .cost {background:var(--gold);color:var(--vd-cost-text);}
.stage.vd-themed .ch .cost .ico {color:var(--vd-cost-text);}
.stage.vd-themed .st-box .plate { color:var(--vd-cost-text); }
.stage.vd-themed .st-center p {text-shadow:0 2px 12px #000,0 0 2px #000;color:#fff;}
@media (prefers-reduced-motion:reduce) {
 .vd-grade,.vd-spot,.stage.vd-lit .st-bg,.stage.vd-lit .st-cast {transition:none!important;animation:none!important;}
}
@media (forced-colors: active) {
 .stage.vd-themed .st-box,.stage.vd-themed .ch { background:Canvas!important;color:CanvasText!important;border:1px solid CanvasText!important; }
 .vd-grade,.vd-spot {display:none!important;}
}

html.vd-page-theme .reward {background:var(--lapis-900);color:var(--ivory);}
html.vd-page-theme .ep.locked .meta b,html.vd-page-theme .ep.locked .meta span {color:var(--ivory-dim);}
html.vd-page-theme .acc .err {color:var(--ivory);text-decoration:underline;text-decoration-color:var(--vermilion);}
.stage.vd-themed .hud-b,.stage.vd-themed .st-skip {background:var(--vd-choice-bg);color:var(--vd-choice-text);border-color:var(--gold);}
.stage.vd-themed .ch .k {color:var(--vd-choice-text);border-color:var(--gold);}
.stage.vd-themed .st-box .plate {background:var(--gold);}
html.vd-page-theme .ep[disabled] {opacity:1;border-style:dashed;}
.stage.vd-themed .st-box .txt {font-size:calc(var(--fs, 18px) * var(--vd-font-scale, 1));line-height:var(--vd-line-height, 2.05);}
.stage.vd-themed .ch {font-size:calc((var(--fs, 18px) - 1px) * var(--vd-font-scale, 1));}
.stage.vd-themed[data-vd-dialogue="flat"] .st-box,.stage.vd-themed[data-vd-choices="flat"] .ch {border-radius:0;backdrop-filter:none;}
.stage.vd-themed[data-vd-dialogue="outline"] .st-box,.stage.vd-themed[data-vd-choices="outline"] .ch {outline:2px solid var(--gold);outline-offset:-2px;}
.stage.vd-themed[data-vd-dialogue="glass"] .st-box,.stage.vd-themed[data-vd-choices="glass"] .ch {backdrop-filter:blur(6px);}
@media (prefers-reduced-motion:reduce) {.stage.vd-themed .ch,.stage.vd-themed .st-box .more {animation:none!important;transition:none!important;}}

/* ==============================================================
   Stage 6 — Genre-neutral dialogue, choices and micro-interactions.
   New looks are opt-in (.vd-themed / .vd-page-theme); old stories retain
   their authoring appearance and routing. Only GPU-friendly properties
   animate. Screen-reader announcements do not track each typed word.
   ============================================================== */
.st-sr-status { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.hud-b, .iconbtn, .linkish, .st-skip, .seg button { min-width:44px; min-height:44px; }
:focus-visible { outline:3px solid var(--gold); outline-offset:3px; }
.stage .st-hud { isolation:isolate; }
.stage .st-skip { min-height:44px; }
.stage .st-choices .ch { min-height:48px; }
.stage .ch.locked .why { display:block; }
.stage .st-choices.picked { pointer-events:none; }
.stage .st-choices .ch:focus-visible { outline:3px solid var(--gold-hi); outline-offset:2px; }
.stage .st-choices .ch:active:not([disabled]) { transform:scale(.992); }
.st-choices .ch[disabled] { cursor:default; }
.st-ov.verse, .st-ov.letter, .st-ov.pic { overflow-y:auto; padding-block:max(15px,env(safe-area-inset-top,0px)) max(15px,env(safe-area-inset-bottom,0px)); }
.st-ov.verse > *, .st-ov.letter > *, .st-ov.pic > * { max-height:calc(100svh - 36px); overflow-y:auto; overscroll-behavior:contain; }

/* Story-level tokens are set on this stage only, never on studio or other stories. */
.stage.vd-themed .st-box {
  width:min(var(--vd-dialogue-max,820px),calc(100% - 24px));
  min-height:0; max-height:min(48svh,550px); overflow-y:auto; overscroll-behavior:contain;
  padding:var(--vd-dialogue-pad,22px);
  padding-top:max(28px,var(--vd-dialogue-pad,22px));
  padding-bottom:max(24px,var(--vd-dialogue-pad,22px));
  border-radius:var(--vd-dialogue-radius,10px);
  border:var(--vd-dialogue-border-width,1px) solid var(--vd-dialogue-border-color,var(--gold));
  background:rgba(var(--vd-dialogue-rgb,8,13,34),var(--box-a,.82));
  color:var(--vd-dialogue-text,var(--ivory));
  box-shadow:0 14px 42px #0008;
  -webkit-backdrop-filter:blur(var(--vd-dialogue-blur,3px));
  backdrop-filter:blur(var(--vd-dialogue-blur,3px));
}
.stage.vd-themed .st-box .txt { font-size:var(--vd-dialogue-font-size,var(--fs,18px)); line-height:var(--vd-line-height,2.05); overflow-wrap:anywhere; }
.stage.vd-themed .st-box .plate { border-radius:var(--vd-dialogue-radius,10px); }
.stage.vd-themed[data-vd-nameplate="compact"] .st-box .plate { font-size:13px; min-height:24px; line-height:24px; padding-inline:10px; }
.stage.vd-themed[data-vd-nameplate="inline"] .st-box .plate { position:relative; display:inline-flex; align-items:center; top:auto; right:auto; margin-block:-12px 12px; }
.stage.vd-themed .st-choices .ch {
  background:rgba(var(--vd-choice-rgb,8,13,34),var(--vd-choice-opacity,.97));
  color:var(--vd-choice-text,var(--ivory));
  border:var(--vd-choice-border-width,1px) solid var(--vd-choice-border-color,var(--gold-soft));
  border-radius:var(--vd-choice-radius,10px);
  padding:var(--vd-choice-pad,14px);
  font-size:var(--vd-choice-font-size,var(--fs,18px));
  -webkit-backdrop-filter:blur(var(--vd-choice-blur,3px));
  backdrop-filter:blur(var(--vd-choice-blur,3px));
}
.stage.vd-themed .st-choices .ch .t,.stage.vd-themed .st-choices .ch .why { color:inherit; }
.stage.vd-themed .st-choices .ch .why { opacity:.88; }
.stage.vd-themed .st-choices .ch .cost { color:var(--vd-cost-text,var(--lapis-950)); }
.stage.vd-themed .st-choices .ch.locked { border-style:dashed; opacity:.82; }
.stage.vd-themed .st-choices .ch.premium { border-width:2px; }
.stage.vd-themed .st-choices { width:min(var(--vd-choice-max,720px),calc(100% - 20px)); }
.stage.ui-deciding .st-box { opacity:.14; pointer-events:none; }
.stage.ui-deciding .st-choices {
  top:calc(72px + env(safe-area-inset-top,0px));
  bottom:max(10px,env(safe-area-inset-bottom,0px));
  height:auto; max-height:none; display:flex; flex-direction:column;
  overflow:hidden; padding:8px 6px 6px; gap:10px;
  background:linear-gradient(0deg,#03050fe0,#03050f22); border-radius:14px;
}
.stage.ui-deciding .st-choices .fork-head,
.stage.ui-deciding .st-choices .ch-wallet,
.stage.ui-deciding .st-choices .ch-timer { flex:none; }
.stage.ui-deciding .st-choices .ch-list { min-height:0; flex:1 1 auto; overflow-y:auto; overscroll-behavior:contain; padding:3px 3px 8px; }
.stage.ui-decision-none .st-choices .ch { animation:none; opacity:1; }
html.ui-readable-high .stage.vd-themed .st-box { background:rgb(var(--vd-dialogue-rgb,8,13,34)); backdrop-filter:none; }
html.ui-readable-high .stage.vd-themed .st-choices .ch { background:rgb(var(--vd-choice-rgb,8,13,34)); backdrop-filter:none; }
html.ui-readable-high .stage .st-center p { text-shadow:0 2px 3px #000,0 2px 18px #000; }

/* Decorative entrance micro-interactions. Disabled for old story data. */
@keyframes ui-enter { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
html.vd-page-theme .ep { animation:ui-enter var(--ui-episodes-duration,250ms) ease backwards; }
html.vd-page-theme .ep:nth-child(2) { animation-delay:40ms; }
html.vd-page-theme .ep:nth-child(3) { animation-delay:80ms; }
html.vd-page-theme .ep:nth-child(n+4) { animation-delay:110ms; }
html.vd-page-theme .seal.got { animation:ui-enter var(--ui-ending-duration,320ms) ease backwards; }
html.vd-page-theme .st-choices .ch { animation-duration:var(--ui-choices-duration,350ms); }
html.vd-page-theme .btn:not(:disabled),html.vd-page-theme .ep:not(:disabled) { transition:transform .16s ease,filter .16s ease,border-color .16s ease; }
html.vd-page-theme .btn:active:not(:disabled),html.vd-page-theme .ep:active:not(:disabled) { transform:scale(.99); }
html.vd-page-theme .lib-card,html.vd-page-theme .story-card { animation:ui-enter var(--ui-library-duration,280ms) ease backwards; }
html.vd-page-theme[data-vd-micro="none"] .ep,
html.vd-page-theme[data-vd-micro="none"] .seal.got,
html.vd-page-theme[data-vd-micro="none"] .lib-card,
html.vd-page-theme[data-vd-micro="none"] .story-card,
html.vd-page-theme[data-vd-micro="none"] .st-choices .ch { animation:none; opacity:1; transform:none; }

@media (max-width:460px) {
  .stage.vd-themed .st-box { bottom:max(10px,env(safe-area-inset-bottom,0px)); padding-inline:16px; max-height:48svh; }
  .stage.vd-themed .st-box .txt { line-height:1.8; }
  .stage.vd-themed .st-box .plate { max-width:85%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .stage.ui-deciding .st-choices { top:calc(66px + env(safe-area-inset-top,0px)); }
  .stage.ui-deciding .st-choices .fork-t { font-size:clamp(22px,8vw,36px); }
  .stage.ui-deciding .st-choices .fork-head .ico { width:22px; height:22px; }
  .stage.ui-deciding .st-choices .ch { padding:11px; line-height:1.6; }
}
@media (max-height:480px) and (orientation:landscape) {
  .stage.vd-themed .st-box { max-height:35svh; }
  .stage.ui-deciding .st-choices { top:calc(52px + env(safe-area-inset-top,0px)); }
  .stage.ui-deciding .st-choices .fork-head .ico { display:none; }
}
@media (prefers-reduced-transparency:reduce) {
  .stage.vd-themed .st-box { background:rgb(var(--vd-dialogue-rgb,8,13,34)); backdrop-filter:none; }
  .stage.vd-themed .st-choices .ch { background:rgb(var(--vd-choice-rgb,8,13,34)); backdrop-filter:none; }
}
@media (forced-colors:active) {
  .stage.vd-themed .st-box,.stage.vd-themed .st-choices .ch { color:CanvasText!important; background:Canvas!important; border:1px solid CanvasText!important; }
  .stage.vd-themed .st-choices .ch:focus-visible { outline:3px solid Highlight!important; }
}
@media (prefers-reduced-motion:reduce) {
  html.vd-page-theme .ep,html.vd-page-theme .lib-card,html.vd-page-theme .story-card,html.vd-page-theme .seal.got,
  .stage .st-choices .ch,.st-ov.anim * { animation:none!important; transition:none!important; opacity:1!important; transform:none!important; }
}
html.ui-motion-none .ep,html.ui-motion-none .lib-card,html.ui-motion-none .story-card,html.ui-motion-none .seal.got,
html.ui-motion-none .stage .st-choices .ch,html.ui-motion-none .st-ov.anim * { animation:none!important; transition:none!important; opacity:1!important; transform:none!important; }
/* کادر متن در حالت «بی‌حرکت» فقط بی‌انیمیشن می‌شود؛ جای خود (وسط) و پنهان‌شدنش در صحنه‌های سینمایی دست نمی‌خورد */
html.ui-motion-none .stage .st-box { animation:none!important; transition:none!important; }
/* The speaker badge must remain outside the clipped text scroller. */
.stage.vd-themed .st-box { overflow:visible; }
.stage.vd-themed .st-box .txt { max-height:calc(min(48svh,550px) - 78px); overflow-y:auto; overscroll-behavior:contain; }
.stage .st-choices:not(.picked) { display:flex; flex-direction:column; overflow:hidden; }
.stage .st-choices:not(.picked) .ch-list { overflow-y:auto; min-height:0; flex:1 1 auto; overscroll-behavior:contain; padding:2px 4px 5px; }
.stage .st-choices:not(.picked) .fork-head,.stage .st-choices:not(.picked) .ch-timer { flex:none; }
.stage .ch-timer i { animation:none; transition:width .15s linear; }
html:not(.vd-page-theme):not(.ui-motion-none) .library .story-card { animation:ui-enter 260ms cubic-bezier(.2,.7,.2,1) backwards; animation-delay:calc(var(--i,0) * 60ms); }
@media (prefers-reduced-motion:reduce) {
  html:not(.vd-page-theme) .library .story-card { animation:none!important; opacity:1!important; transform:none!important; }
}
.stage.vd-themed[data-vd-contrast="high"] .st-box { background:rgb(var(--vd-dialogue-rgb,8,13,34)); backdrop-filter:none; }
.stage.vd-themed[data-vd-contrast="high"] .st-choices .ch { background:rgb(var(--vd-choice-rgb,8,13,34)); backdrop-filter:none; }
/* Light page changes, chapter opening and discovery feedback — no layout animation. */
html.vd-page-theme .home,html.vd-page-theme .library,html.vd-page-theme .end-page,
html.vd-page-theme .ep-end,html.vd-page-theme .ending-page { animation:ui-enter var(--ui-page-duration,180ms) ease both; }
html.vd-page-theme .st-prog i { transition:width var(--ui-prog-duration,600ms) ease; }
html.ui-motion-none .home,html.ui-motion-none .library,html.ui-motion-none .end-page,
html.ui-motion-none .ep-end,html.ui-motion-none .ending-page,
html.ui-motion-none .st-prog i { animation:none!important;transition:none!important;opacity:1!important;transform:none!important; }
@media (prefers-reduced-motion:reduce) {
  html.vd-page-theme .home,html.vd-page-theme .library,html.vd-page-theme .end-page,
  html.vd-page-theme .ep-end,html.vd-page-theme .ending-page,html.vd-page-theme .st-prog i { animation:none!important;transition:none!important;opacity:1!important;transform:none!important; }
}
/* Personal no-motion preference also affects visual layers and runtime FX. */
html.ui-motion-none .stage *,html.ui-motion-none .stage *::before,html.ui-motion-none .stage *::after { animation:none!important; transition:none!important; }

/* Editor-only paused preview status; never displayed in published play. */
.app.preview-paused::after{content:"⏸ پیش‌نمایش مکث شده";pointer-events:none;position:fixed;z-index:250;top:max(10px,env(safe-area-inset-top));inset-inline:10px auto;background:rgba(14,23,29,.88);color:#fff;border:1px solid #a0b8c4;border-radius:9px;padding:8px 12px;font-size:13px}

/* ---------- قاب افقی روی گوشی ---------- */
/* پیام «گوشی را افقی بگیر» (روی همهٔ صفحه‌ها) */
.rotate-hint { display: none; position: fixed; inset: 0; z-index: 1000; background: #03050ff2; color: var(--ivory); flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px; cursor: default; }
.rotate-hint .ico { width: 72px; height: 72px; color: var(--gold); transform-origin: 50% 50%; animation: rot-tilt 2.6s ease-in-out infinite; }
@keyframes rot-tilt { 0%, 25% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
.rotate-hint b { font-size: 21px; color: var(--gold-hi); }
.rotate-hint p { margin: 0 0 6px; max-width: 300px; color: var(--ivory-dim); line-height: 1.9; }
.rotate-hint .btn { min-width: 240px; }
/* برنامه همیشه افقی است: گوشی یا تبلتِ لمسیِ عمودی پیام چرخش را روی همهٔ صفحه‌ها می‌بیند */
@media (orientation: portrait) and (max-width: 1100px) and (pointer: coarse) {
  .rotate-hint { display: flex; }
  body { overflow: hidden; }
}
/* صفحهٔ خواندن در گوشیِ افقی (ارتفاع کم): نوار بالا کوچک‌تر، گزینه‌ها در نیمهٔ راست و متن در نیمهٔ چپ.
   «.stage.stage» برای اولویت بر قاعده‌های پوسته (vd-themed / ui-deciding) است. */
@media (orientation: landscape) and (max-height: 520px) {
  .stage.stage .st-hud { padding: calc(4px + env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) 4px max(10px, env(safe-area-inset-left, 0px)); }
  .stage.stage .hud-b { width: 36px; height: 36px; }
  .stage.stage .hud-b .ico { width: 18px; height: 18px; }
  .stage.stage .st-skip, .stage.stage .st-mode { top: calc(46px + env(safe-area-inset-top, 0px)); }
  .stage.stage .st-box { min-height: 0; max-height: 46svh; padding: 16px 20px 14px; bottom: max(8px, env(safe-area-inset-bottom, 0px)); width: min(820px, calc(100% - 2 * max(14px, env(safe-area-inset-left, 0px)))); }
  .stage.stage .st-box .txt { line-height: 1.85; max-height: calc(46svh - 40px); }
  .stage.stage .st-box .plate { top: -14px; }
  .stage.stage .bust { width: 21vw; bottom: 30svh; }
  .stage.stage .st-center { inset: 12svh 14vw; }
  .stage.stage .st-choices .fork-head { display: none; }
  .stage.stage.deciding .st-box { width: 43%; left: max(12px, env(safe-area-inset-left, 0px)); right: auto; transform: none; opacity: 1; }
  .stage.stage .st-choices { left: auto; right: max(12px, env(safe-area-inset-right, 0px)); transform: none; width: 53%; top: auto; bottom: max(8px, env(safe-area-inset-bottom, 0px)); max-height: calc(100% - 56px - env(safe-area-inset-top, 0px)); justify-content: flex-end; gap: 6px; }
  .stage.stage .st-choices .ch-list { flex: 0 1 auto; align-content: end; gap: 7px; }
  .stage.stage .st-choices .ch { padding: 9px 12px; line-height: 1.7; gap: 10px; min-height: 44px; }
  .stage.stage .st-choices .ch .k { width: 24px; height: 24px; font-size: 13px; margin-top: 2px; }
}

/* ---------- صفحهٔ داستان: انتخاب حالت خواندن همان ابتدا ---------- */
/* لپ‌تاپ و تبلت افقی: نام داستان یک سو، دو حالت خواندن سوی دیگر */
/* گوشی افقی (ارتفاع کم): عنوان کوچک‌تر، دو حالت کنار هم */

/* ---------- دانلود کامل داستان ---------- */
.dl-card { display: flex; align-items: center; gap: 14px; margin: 18px 0 6px; padding: 14px 16px; border-radius: 16px; background: var(--lapis-900, #0c1430); border: 1px solid #d8b45f40; }
.dl-card.ok { border-color: #6fbf8a66; }
.dl-ic { flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: #d8b45f1f; color: var(--gold); }
.dl-ic .ico { width: 24px; height: 24px; }
.dl-card.ok .dl-ic { background: #6fbf8a22; color: #8fd6a6; }
.dl-body { flex: 1; min-width: 0; }
.dl-body b { color: var(--gold-hi); font-size: 16px; }
.dl-text { margin: 2px 0 6px; color: var(--ivory-dim); font-size: 13.5px; line-height: 1.8; }
.dl-st { margin: 0; color: var(--ivory); font-size: 13.5px; display: flex; gap: 6px; align-items: center; }
.dl-st .ico { width: 16px; height: 16px; color: #8fd6a6; }
.dl-bar { height: 6px; border-radius: 3px; background: #ffffff1a; overflow: hidden; margin: 6px 0; }
.dl-bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s ease; }
.dl-acts { flex: 0 0 auto; }
.dl-acts .btn .ico { width: 18px; height: 18px; }
/* تصویرهای داستان فقط داخل برنامه: بدون ذخیره با لمس طولانی یا کشیدن */
.stage img, .art img, .story-card img, .ep img, .cont-hero img, .cont-row img, .bust img, .vl-layer img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* گوشی افقی: صفحهٔ داستان و کتابخانه فشرده‌تر تا انتخاب‌ها و داستان‌ها بالای صفحه دیده شوند */
/* تبلت و لپ‌تاپ افقی: داستان‌ها در ردیف‌های پهن‌تر */
/* پنجره‌ها در قاب افقی: پهن‌تر و کم‌ارتفاع‌تر؛ منو دو ستونه */
@media (orientation: landscape) and (max-height: 560px) {
  .scrim { place-items: center; padding: 8px; }
  .sheet { width: min(100%, 760px); max-height: calc(100svh - 16px); padding: 14px 18px; }
  .sheet h3 { font-size: 18px; }
  .sheet p { font-size: 14.5px; margin: 6px 0; }
  .menu-list { grid-template-columns: 1fr 1fr; gap: 6px; }
  .menu-list button { padding: 9px 12px; font-size: 15px; }
  .sheet .seg button, .sheet .segs button { min-height: 40px; }
}
/* نوار بالای صفحهٔ داستان همیشه روی محتوا (بازگشت، منو، ورود، کیف پول) */

/* ==============================================================
   نسخهٔ ۸ — صفحه‌های برنامه
   مبنا: گوشیِ افقی. هر صفحه دقیقاً یک صفحهٔ نمایش است و خودِ صفحه هرگز اسکرول نمی‌شود؛
   فقط فهرست‌ها درون پنل‌ها می‌لغزند. تبلت و لپ‌تاپ همین ساختار را بزرگ‌تر می‌بینند.
   ============================================================== */
:root {
  --tb-h: 56px;
  --pad: clamp(12px, 2.4vw, 36px);
  --gap: clamp(10px, 1.8vw, 28px);
  --r-lg: 18px;
  --r-md: 12px;
  --surface: #0a1230ee;
  --hair: #d8b45f2e;
  --lift: 0 24px 48px -24px #000e, 0 2px 8px -2px #0009;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
body { overflow: hidden; overscroll-behavior: none; }
::selection { background: #d8b45f59; color: #fff; }
.scr {
  position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden; isolation: isolate;
  background: radial-gradient(120% 100% at 100% 0%, #18244f 0%, var(--lapis-950) 58%);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.scr ::-webkit-scrollbar { width: 6px; height: 6px; }
.scr ::-webkit-scrollbar-thumb { background: #d8b45f45; border-radius: 3px; }
.scr ::-webkit-scrollbar-track { background: transparent; }
.scr-bg { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.scr-bg .art img, .scr-bg .art svg { object-position: 50% 40%; }
/* سایه از سوی آغاز (راست) پررنگ است تا نوشته روی هر نقاشی خوانا بماند */
.scr-shade { position: absolute; inset: 0; z-index: -1; background:
  linear-gradient(to left, #070c1ff5 0%, #070c1fcc 32%, #070c1f55 60%, #070c1fa6 100%),
  linear-gradient(to bottom, #070c1fb3 0%, #070c1f00 20%, #070c1f00 60%, #070c1fe6 100%); }

/* نوار بالا */
.tb { flex: none; position: relative; z-index: 3; display: flex; align-items: center; gap: 8px; height: var(--tb-h); width: 100%; max-width: 1680px; margin-inline: auto; padding-inline: var(--pad); }
.tb .iconbtn { width: 40px; height: 40px; background: #070c1fa6; border-color: #ffffff21; backdrop-filter: none; transition: color .18s, border-color .18s, background .18s; }
.tb .iconbtn:hover { border-color: var(--gold-soft); background: #0a1230; }
.tb-brand { flex: none; display: flex; align-items: center; font-family: var(--f-display); font-size: 28px; line-height: 1; color: var(--gold-hi); white-space: nowrap; text-shadow: 0 2px 10px #0009; padding-inline: 4px; }
.tb-brand b { font-family: var(--f-body); font-size: 17px; font-weight: 700; color: var(--ivory); text-shadow: none; }
.tb-brand .brandlink { font-size: 28px; line-height: 1.3; padding: 0; color: var(--gold-hi); }
.tb-brand .lib-logo { max-height: 36px; max-width: 150px; }
.tb-sp { flex: 1 1 0; min-width: 0; }
.tb .wallet { gap: 6px; flex: none; }
.tb .chip { min-height: 36px; padding: 2px 12px; background: #070c1fbf; backdrop-filter: none; transition: border-color .18s; }
.tb button.chip:hover { border-color: var(--gold); }
.tb .acc-chip .nm { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-filter { display: flex; gap: 6px; min-width: 0; flex: 0 1 auto; overflow-x: auto; scrollbar-width: none; padding: 2px; margin-inline-start: 6px; }
.tb-filter::-webkit-scrollbar { display: none; }
.fchip { flex: none; font: inherit; font-size: 14px; min-height: 34px; padding: 2px 14px; border-radius: 999px; border: 1px solid #d8b45f45; background: #070c1f99; color: var(--ivory-dim); cursor: pointer; transition: background .18s, color .18s, border-color .18s; }
.fchip:hover { border-color: var(--gold); color: var(--ivory); }
.fchip.on { background: var(--gold); color: var(--lapis-950); border-color: var(--gold); font-weight: 700; }

/* بدنه: ستون اصلی (سوی آغاز) + پنل */
.scr-body { flex: 1 1 auto; min-height: 0; position: relative; z-index: 2; width: 100%; max-width: 1680px; margin-inline: auto; display: grid; grid-template-columns: minmax(0, 1fr) clamp(280px, 40%, 480px); gap: var(--gap); padding: 0 var(--pad) var(--pad); }
.scr.solo .scr-body { grid-template-columns: minmax(0, 1fr); }
.panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-lg); box-shadow: var(--lift); }
.panel-h { margin: 0; font-size: 15px; font-weight: 700; color: var(--gold-hi); line-height: 1.6; }
.panel > .panel-h { flex: none; padding: 12px 16px 2px; }
.panel-h small { color: var(--ivory-dim); font-weight: 400; margin-inline-start: 4px; }
.panel-scroll, .pt-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #d8b45f45 transparent; padding: 12px 14px 14px; display: grid; align-content: start; gap: 10px; }
.pt-note { margin: 0; font-size: 13.5px; color: var(--ivory-dim); line-height: 1.85; }
.panel .foot { margin: 4px 0 0; text-align: start; font-size: 12.5px; line-height: 1.9; white-space: pre-line; color: #948d79; }
.btn.wide { width: 100%; }
.scr .btn { transition: transform .12s ease, filter .18s ease, background .18s ease, border-color .18s ease; }
.scr .btn:disabled { opacity: .5; cursor: default; filter: none; }

/* ---------- صفحهٔ داستان ---------- */
.sh-main, .mo-main { min-width: 0; min-height: 0; overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; padding-block: 6px 2px; }
.sh-main::-webkit-scrollbar, .mo-main::-webkit-scrollbar { display: none; }
.sh-main > *, .mo-main > * { flex: none; }
.sh-main > :first-child, .mo-main > :first-child { margin-top: auto; }
.sh-title, .mo-title { margin: 0; font-family: var(--f-display); font-weight: 400; color: var(--gold-hi); font-size: clamp(38px, min(6.4vw, 12vh), 108px); line-height: 1.45; text-shadow: 0 4px 30px #000c, 0 0 2px #0008; text-wrap: balance; }
.sh-tag { margin: 0; max-width: 34em; font-size: clamp(15px, min(1.5vw, 2.8vh), 22px); font-weight: 500; color: var(--ivory); line-height: 1.75; text-shadow: 0 1px 10px #000; }
.sh-facts, .mo-chips { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sh-facts li, .mo-chips li { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; line-height: 1; padding: 7px 11px; border-radius: 999px; background: #070c1fc7; border: 1px solid #ffffff1f; color: var(--ivory-dim); }
.mo-chips li { color: var(--ivory); font-size: 13.5px; }
.mo-chips li.gold { color: var(--gold-hi); border-color: var(--gold-soft); }
.mo-chips li.tone { margin: 0; border-color: currentColor; }
.mo-chips .ico { width: 16px; height: 16px; }
.mode { margin-top: clamp(10px, 3vh, 30px); max-width: 560px; }
.mode-q { margin: 0 0 8px; font-size: 14.5px; font-weight: 700; color: var(--ivory); text-shadow: 0 1px 8px #000; }
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: #050915e0; border: 1px solid var(--hair); }
.mode-tabs button { font: inherit; display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 6px 12px; border: 0; border-radius: 12px; background: transparent; color: var(--ivory-dim); text-align: start; cursor: pointer; transition: background .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease); }
.mode-tabs button .ico { width: 22px; height: 22px; flex: none; }
.mode-tabs button span { display: grid; line-height: 1.4; min-width: 0; }
.mode-tabs button b { font-size: 16px; font-weight: 700; color: var(--ivory); }
.mode-tabs button small { font-size: 12.5px; }
.mode-tabs button:hover:not(.on) { background: #ffffff10; color: var(--ivory); }
.mode-tabs button.on { background: var(--gold); color: var(--lapis-950); box-shadow: 0 8px 22px -10px #d8b45fcc; }
.mode-tabs button.on b { color: var(--lapis-950); }
.mode-tabs button:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.mode-card { padding-top: 12px; }
.mc-text { margin: 0 0 12px; max-width: 34em; color: var(--ivory); font-size: 14.5px; line-height: 1.85; text-shadow: 0 1px 8px #000; }
.mc-prog { margin: 0; color: var(--gold-hi); font-size: 15px; font-weight: 500; text-shadow: 0 1px 8px #000; }
.mc-bar { display: block; height: 4px; max-width: 300px; margin: 8px 0 12px; border-radius: 2px; background: #ffffff26; overflow: hidden; }
.mc-bar i { display: block; height: 100%; border-radius: inherit; background: var(--gold); }
.mc-acts, .cta-row, .scr .cta-dock { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mc-acts .btn:first-child { min-width: min(100%, 220px); }
.mc-acts .btn.ghost { color: var(--ivory); border-color: #ffffff38; background: #070c1f80; }
.mc-acts .btn.ghost:hover { border-color: var(--gold); color: var(--gold-hi); }

/* پنل زبانه‌دار */
.pt { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.pt-tabs { flex: none; display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--hair); overflow-x: auto; scrollbar-width: none; }
.pt-tabs::-webkit-scrollbar { display: none; }
.pt-tabs button { font: inherit; position: relative; flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 4px 10px 6px; border: 0; border-radius: 10px 10px 0 0; background: none; color: var(--ivory-dim); font-size: 14.5px; cursor: pointer; transition: color .18s, background .18s; }
.pt-tabs button small { font-size: 12px; color: var(--gold-dim); font-variant-numeric: tabular-nums; }
.pt-tabs button:hover { color: var(--ivory); background: #ffffff08; }
.pt-tabs button.on { color: var(--gold-hi); font-weight: 700; }
.pt-tabs button.on::after { content: ""; position: absolute; inset: auto 12px -1px; height: 2px; border-radius: 2px; background: var(--gold); }
.pt-tabs button:focus-visible { outline-offset: -2px; }
.pt-body.flush { padding: 0; display: flex; }
.scr .eps { display: grid; gap: 6px; }
.scr .ep { grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; padding: 6px; padding-inline-end: 12px; background: #ffffff07; border: 1px solid #ffffff14; border-radius: var(--r-md); transition: border-color .18s, background .18s; }
.scr .ep:hover:not([disabled]) { border-color: var(--gold-soft); background: #ffffff0f; }
.scr .ep .thumb { width: 72px; height: 46px; border-radius: 8px; box-shadow: none; }
.scr .ep .num { width: 22px; height: 22px; font-size: 12.5px; bottom: 3px; right: 3px; }
.scr .ep .meta b { font-size: 15.5px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scr .ep .meta span { font-size: 12.5px; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.scr .ep .state { font-size: 12.5px; }
.scr .ep .state .ico { width: 16px; height: 16px; }
.scr .ep.done .state { color: #8fd6a6; }
.scr .ep.locked .state { color: var(--gold); }
.end-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.end-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-md); background: #ffffff07; min-height: 46px; }
.end-list .seal { width: 34px; height: 34px; flex: none; font-size: 14px; }
.end-list b { display: block; font-size: 14.5px; font-weight: 500; line-height: 1.5; color: var(--ivory-dim); }
.end-list li.got b { color: var(--ivory); }
.end-list .tone { font-size: 11.5px; line-height: 1.6; padding: 0 8px; margin-top: 2px; }
.about-text { margin: 0; font-size: 15px; line-height: 2; color: var(--ivory); text-wrap: pretty; }
/* پیش‌نمایش درون پنل: همهٔ ارتفاع پنل */
.scr .teaser-box { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.scr .tz-stage { flex: 1 1 auto; min-height: 0; border: 0; border-radius: 0; }
.scr .tz-lines { left: 12px; right: 12px; top: 10px; gap: 6px; }
.scr .tz-l { padding: 6px 10px; font-size: 13.5px; line-height: 1.75; }
.scr .tz-choices { left: 12px; right: 12px; bottom: 12px; gap: 6px; }
.scr .tz-fork { font-size: 18px; }
.scr .tz-ch { padding: 6px 10px; font-size: 13.5px; line-height: 1.6; }
.tz-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--hair); font-size: 12.5px; color: var(--ivory-dim); }
.tz-foot .btn { margin: 0; min-height: 38px; font-size: 14px; padding: 2px 14px; }
/* دانلود: نوار باریک پایین پنل */
.sh-side .dl-card { flex: none; margin: 0; padding: 8px 12px; gap: 10px; border: 0; border-top: 1px solid var(--hair); border-radius: 0; background: #050915b3; box-shadow: none; }
.sh-side .dl-ic { width: 34px; height: 34px; border-radius: 10px; }
.sh-side .dl-ic .ico { width: 19px; height: 19px; }
.sh-side .dl-body b { display: block; font-size: 13.5px; line-height: 1.5; }
.sh-side .dl-text { display: none; }
.sh-side .dl-st { font-size: 12px; line-height: 1.6; color: var(--ivory-dim); }
.sh-side .dl-bar { height: 4px; margin: 4px 0 2px; }
.sh-side .dl-acts .btn { min-height: 36px; font-size: 13.5px; padding: 2px 12px; }

/* ---------- کتابخانه ---------- */
.scr-body.library { grid-template-columns: minmax(0, 1fr) clamp(260px, 31%, 400px); }
.lib-shelf { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.shelf-h { flex: none; margin: 0 0 8px; font-size: 15px; font-weight: 700; color: var(--ivory); line-height: 1.6; }
.shelf-h small { color: var(--gold-dim); font-weight: 400; margin-inline-start: 2px; }
.shelf { flex: 1 1 auto; min-height: 0; display: flex; gap: clamp(10px, 1.6vw, 22px); overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; padding: 2px 2px 10px; scrollbar-width: thin; scrollbar-color: #d8b45f45 transparent; }
.shelf .story-card { flex: none; position: relative; display: block; height: 100%; max-height: 640px; aspect-ratio: 3 / 4; padding: 0; overflow: hidden; scroll-snap-align: start; border-radius: var(--r-lg); border: 1px solid #ffffff21; background: var(--lapis-900); box-shadow: var(--lift); color: inherit; font: inherit; text-align: start; cursor: pointer; transition: transform .22s var(--ease), border-color .22s, box-shadow .22s; }
.shelf .story-card:hover, .shelf .story-card:focus-visible { transform: translateY(-4px); border-color: var(--gold); box-shadow: 0 28px 50px -24px #000, 0 0 0 1px var(--gold); outline: none; }
.shelf .story-card:active { transform: translateY(-1px); }
.story-card .sc-art { position: absolute; inset: 0; display: block; background: var(--lapis-950); }
.story-card .sc-art img, .story-card .sc-art svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.shelf .story-card:hover .sc-art img, .shelf .story-card:hover .sc-art svg { transform: scale(1.04); }
.story-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, #070c1f80 0%, #070c1f00 22%, #070c1f00 40%, #070c1fe6 76%, #070c1f 100%); }
.sc-badges { position: absolute; z-index: 2; top: 10px; inset-inline: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.sc-badge { font-size: 12px; line-height: 1.5; padding: 2px 10px; border-radius: 999px; background: #070c1fd9; border: 1px solid #d8b45f59; color: var(--ivory); }
.sc-badge.reading, .sc-badge.between { background: var(--gold); color: var(--lapis-950); border-color: var(--gold); font-weight: 700; }
.sc-badge.fresh { background: var(--vermilion); border-color: var(--vermilion); color: var(--ivory); }
.story-card .sc-body { position: absolute; z-index: 2; inset: auto 0 0 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 16px 16px; }
.sc-title { font-family: var(--f-display); font-weight: 400; font-size: clamp(26px, min(3.2vw, 6.4vh), 46px); line-height: 1.5; color: var(--gold-hi); text-shadow: 0 2px 14px #000; }
.sc-tag { font-size: 13.5px; line-height: 1.75; color: var(--ivory); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sc-meta { margin-top: 4px; font-size: 12px; color: var(--ivory-dim); }
.sc-prog { display: block; height: 3px; margin-top: 8px; border-radius: 2px; background: #ffffff21; overflow: hidden; }
.sc-prog i { display: block; height: 100%; background: var(--gold); }
.empty { color: var(--ivory-dim); text-align: center; padding: 30px 0; }
.lib-side { min-height: 0; }
.welcome-h { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: clamp(26px, min(3vw, 6vh), 40px); line-height: 1.7; color: var(--gold-hi); text-wrap: balance; }
.lib-welcome p { margin: 0; font-size: 14.5px; line-height: 1.95; color: var(--ivory-dim); }
.lib-welcome .panel-scroll { align-content: end; }
.ch-card { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; padding: 0; overflow: hidden; border-radius: var(--r-md); border: 1px solid #d8b45f59; background: var(--lapis-950); color: inherit; font: inherit; text-align: start; cursor: pointer; transition: border-color .2s, transform .2s var(--ease); }
.ch-card:hover, .ch-card:focus-visible { border-color: var(--gold); transform: translateY(-2px); outline: none; }
.ch-art { position: absolute; inset: 0; }
.ch-art img, .ch-art svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.ch-shade { position: absolute; inset: 0; background: linear-gradient(to bottom, #070c1f14 0%, #070c1fb3 52%, #070c1ff7 100%); }
.ch-body { position: absolute; inset: auto 0 0 0; display: grid; gap: 1px; justify-items: start; padding: 10px 14px 12px; }
.ch-body b { font-size: 19px; line-height: 1.5; text-shadow: 0 2px 10px #000; }
.ch-sub { font-size: 13px; color: var(--gold-hi); }
.ch-line { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 1.8; color: var(--ivory-dim); quotes: "«" "»"; }
.ch-line i { color: var(--gold-hi); }
.ch-body .btn { margin-top: 6px; min-height: 36px; font-size: 14px; padding: 2px 16px; pointer-events: none; }
.cont-row { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; padding: 6px; padding-inline-end: 10px; border-radius: var(--r-md); border: 1px solid #ffffff14; background: #ffffff07; color: inherit; font: inherit; text-align: start; cursor: pointer; transition: border-color .18s, background .18s; }
.cont-row:hover, .cont-row:focus-visible { border-color: var(--gold-soft); background: #ffffff0f; outline: none; }
.cr-art { position: relative; width: 60px; height: 42px; border-radius: 8px; overflow: hidden; background: var(--lapis-950); }
.cr-art img, .cr-art svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cr-body { min-width: 0; }
.cr-body b { display: block; font-size: 14.5px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-body small { font-size: 12px; color: var(--gold); }
.cont-row > .ico { color: var(--gold); }

/* ---------- پایان قسمت، پایان داستان، گالری ---------- */
.mo-main { gap: 0; }
.mo-teaser { margin: 14px 0 0; max-width: 36em; font-size: 15px; line-height: 1.95; color: var(--ivory); text-shadow: 0 1px 10px #000; }
.mo-count { margin: 14px 0 0; font-size: 14.5px; color: var(--ivory); text-shadow: 0 1px 8px #000; }
.mo-main .cta-dock, .mo-main .cta-row { margin-top: clamp(12px, 3vh, 26px); }
.cta-row.col { display: grid; grid-template-columns: 1fr 1fr; max-width: 560px; }
.cta-row.col .btn:first-child { grid-column: 1 / -1; }
.mo-main .canon-cta { margin-top: 14px; justify-items: start; text-align: start; max-width: 520px; background: #070c1fcc; }
.epi .epilogue { margin: 0 0 12px; font-size: var(--fs, 18px); line-height: 2.05; color: var(--ivory); text-wrap: pretty; }
.epi .epilogue:first-child::first-letter { color: var(--gold); }
.epi .coda { color: var(--ivory-dim); padding-inline-start: 12px; border-inline-start: 2px solid #d8b45f40; }
.mo-side .recap li { background: #ffffff08; font-size: 14.5px; }
.mo-side .recap-box .panel-h { margin-bottom: 8px; }
.mo-side .offer { margin: 0; }
.mo-side .share-box { background: #ffffff07; border-color: var(--hair); }
.mo-side .fb-block { padding: 4px 2px; }
.mo-side .stars { justify-content: flex-start; }
.mo-side textarea.fb { min-height: 64px; }
.gal-panel { height: 100%; }
.gal-panel > .pt-note { flex: none; padding: 12px 16px 0; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.scr .gcard { background: #ffffff07; border-color: #ffffff14; border-radius: var(--r-md); }
.scr .gcard.got { border-color: var(--hair); }

/* ---------- گوشی افقی (ارتفاع کم) ---------- */
@media (max-height: 520px) {
  :root { --tb-h: 48px; --pad: clamp(10px, 2vw, 20px); --gap: 10px; --r-lg: 14px; }
  .tb .iconbtn { width: 36px; height: 36px; }
  .tb .iconbtn .ico { width: 18px; height: 18px; }
  .tb-brand, .tb-brand .brandlink { font-size: 24px; }
  .tb .chip { min-height: 32px; font-size: 14px; padding: 2px 10px; }
  .fchip { min-height: 30px; font-size: 13px; padding: 1px 11px; }
  .sh-title, .mo-title { font-size: clamp(32px, 10.5vh, 46px); line-height: 1.35; }
  .sh-tag { font-size: 14px; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sh-facts, .mo-chips { margin-top: 6px; }
  .sh-facts li, .mo-chips li { font-size: 12px; padding: 5px 9px; }
  .mode { margin-top: 10px; }
  .mode-q { display: none; }
  .mode-tabs button { min-height: 46px; padding: 4px 10px; gap: 8px; }
  .mode-tabs button b { font-size: 15px; }
  .mode-tabs button small { font-size: 11.5px; }
  .mode-card { padding-top: 8px; }
  .mc-text { font-size: 13px; line-height: 1.75; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .mc-bar { margin: 5px 0 8px; }
  .scr .btn { min-height: 44px; font-size: 16px; padding: 4px 16px; }
  .scr .btn.small { min-height: 38px; font-size: 14px; padding: 2px 12px; }
  .pt-tabs { padding: 4px 6px 0; }
  .pt-tabs button { min-height: 38px; font-size: 13.5px; padding: 2px 8px 4px; }
  .panel-scroll, .pt-body { padding: 8px 10px 10px; gap: 8px; }
  .scr .ep { grid-template-columns: 60px minmax(0, 1fr) auto; gap: 10px; padding: 5px; }
  .scr .ep .thumb { width: 60px; height: 38px; }
  .scr .ep .meta b { font-size: 14px; }
  .scr .ep .meta span { font-size: 12px; }
  .scr .ep .state span { display: none; }
  .scr .tz-l { font-size: 12.5px; padding: 4px 8px; }
  .scr .tz-ch { font-size: 12.5px; padding: 4px 8px; }
  .scr .tz-fork { font-size: 16px; }
  .sh-side .dl-card { padding: 6px 10px; }
  .sh-side .dl-ic { width: 30px; height: 30px; }
  .shelf-h { font-size: 13.5px; margin-bottom: 6px; }
  .story-card .sc-body { padding: 10px 12px 12px; }
  .sc-tag { -webkit-line-clamp: 1; font-size: 12.5px; }
  .ch-line { display: none; }
  .ch-body b { font-size: 16px; }
  .mo-teaser { font-size: 13.5px; line-height: 1.8; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .mo-count { font-size: 13.5px; margin-top: 8px; }
  .epi .epilogue { font-size: 15.5px; line-height: 1.95; }
  .mo-side .recap li { font-size: 13.5px; padding: 8px 10px; }
}
@media (max-height: 360px) {
  .sh-tag, .mode-tabs button small { display: none; }
  .mc-text { -webkit-line-clamp: 1; }
}
/* ارتفاع بیشتر: توضیح دانلود هم دیده شود */
@media (min-height: 640px) {
  .sh-side .dl-text { display: block; margin: 0; font-size: 12px; line-height: 1.7; }
}
/* پنجرهٔ باریک یا عمودیِ مرورگر رومیزی: ستون‌ها روی هم، باز هم بی‌اسکرولِ صفحه */
@media (max-aspect-ratio: 1/1) {
  .scr-body, .scr-body.library { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .scr-body.library { grid-template-rows: minmax(0, 1fr) minmax(0, 40%); }
  .scr.solo .scr-body { grid-template-rows: minmax(0, 1fr); }
  .sh-main > :first-child, .mo-main > :first-child { margin-top: 0; }
}
@media (max-width: 560px) {
  .tb .acc-chip .nm { display: none; }
  .tb-filter { display: none; }
}
/* اعلان کوتاه زیر نوار بالا، تا هرگز روی دکمهٔ اصلی صفحه نیفتد */
body:has(.scr) .toast { top: calc(var(--tb-h) + 6px + env(safe-area-inset-top, 0px)); bottom: auto; }
/* خوشامد کتابخانه: متن روی پس‌زمینه، بی‌جعبه */
.lib-welcome { background: none; border: 0; box-shadow: none; }
.lib-welcome .panel-scroll { padding-inline: 4px; }
.shelf .story-card { max-height: min(100%, 560px); }
@media (min-width: 1100px) { .scr-body.library { grid-template-columns: minmax(0, 1fr) clamp(260px, 27%, 380px); } }
/* انتخاب‌های من: شماره و متن در یک سطر */
.mo-side .recap li { grid-template-columns: auto minmax(0, 1fr); gap: 4px 8px; padding: 8px 12px; line-height: 1.85; }
.mo-side .recap li::before { line-height: inherit; }
.mo-side .recap li .pct { grid-column: 1 / -1; }
/* پیش‌نمایش در پنل کوچک: سطرها بالا، گزینه‌ها پایین، و وقتی گزینه‌ها آمدند جای سطرها را می‌گیرند */
.scr .tz-stage { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; padding: 10px 12px 14px; }
.scr .tz-lines, .scr .tz-choices { position: relative; inset: auto; z-index: 1; }
.scr .tz-lines { overflow: hidden; min-height: 0; }
.scr .tz-choices { flex: none; }
@media (max-height: 640px) { .scr .tz-stage:has(.tz-choices.in) .tz-lines { display: none; } .scr .tz-stage { justify-content: flex-end; } .scr .tz-stage:not(:has(.tz-choices.in)) { justify-content: flex-start; } }
@media (max-height: 520px) {
  .sh-side .dl-ic { display: none; }
  .sh-side .dl-body b { white-space: nowrap; }
  .sh-side .dl-st { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sh-side .dl-acts .btn { font-size: 13px; padding: 2px 10px; }
}
/* پنل کناری صفحه‌های پایان به اندازهٔ محتوایش، کنار عنوان */
.mo-side.panel { align-self: end; max-height: 100%; }
@media (max-aspect-ratio: 1/1) { .mo-side.panel { align-self: stretch; } }

/* ---------- نسخهٔ ۹: مرور به عقب ---------- */
.stage.reviewing .st-choices, .stage.reviewing .st-skip { display: none !important; }
.stage.reviewing .st-bg { filter: sepia(.28) saturate(.8) brightness(.92); transition: filter .25s ease; }
.stage.reviewing .st-box { box-shadow: 0 0 0 1px #d8b45f73, 0 12px 30px -12px #000; }
.st-rev { position: absolute; z-index: 40; top: calc(env(safe-area-inset-top, 0px) + 58px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: calc(100% - 24px); padding: 5px 5px 5px 14px; padding-inline-start: 14px; border-radius: 999px; background: #070c1fe8; border: 1px solid #d8b45f66; color: var(--ivory); font-size: 13.5px; white-space: nowrap; box-shadow: 0 10px 30px -10px #000; animation: ui-enter .2s ease; }
.st-rev > .ico { width: 17px; height: 17px; color: var(--gold); flex: none; }
.st-rev small { color: var(--ivory-dim); margin-inline-start: 4px; }
.st-rev .btn { min-height: 34px; font-size: 13px; padding: 2px 14px; margin: 0; }
.st-box.rev-pick #plate { color: var(--gold-hi); }
@media (max-height: 520px) { .st-rev { top: calc(env(safe-area-inset-top, 0px) + 48px); font-size: 12.5px; } }
/* دانلودشده */
.sh-facts li.ok { color: #9fe0b4; border-color: #6fbf8a66; }
.sh-facts li.ok .ico, .sc-badge.dl .ico { width: 14px; height: 14px; }
.sh-facts li[hidden] { display: none; }
.sc-badge.dl { display: inline-flex; align-items: center; gap: 4px; background: #0f2a1ee6; border-color: #6fbf8a80; color: #b9f0cb; }
.sh-side .dl-card.ok { background: #0f2a1e99; border-top-color: #6fbf8a55; }
.sh-side .dl-card.ok .dl-body b { color: #b9f0cb; }
.sh-side .dl-card.ok .dl-st { color: #cfe9d7; }
.dl-card[hidden] { display: none !important; }

/* ================= نسخهٔ ۱۳ — نهرا: صفحهٔ نخست و کتابخانه ================= */
:root { --c-original: #e2c27a; --c-familiar: #e8957a; --c-historical: #7fcab5; --ok: #6fc9a3; --ivory-2: #d9d0bb; --hair2: #ffffff17; }
.c-original { --cc: var(--c-original); } .c-familiar { --cc: var(--c-familiar); } .c-historical { --cc: var(--c-historical); }
.scr.nh { background: radial-gradient(110% 120% at 100% 0%, #17234d 0%, var(--lapis-950) 60%); }
.nh .ico { width: 18px; height: 18px; flex: none; }
.nh .tb-brand { color: var(--gold); }
/* نوار بالا: جست‌وجو، کیف و حساب */
.nh-wallet { position: relative; flex: none; }
.nh-wb { display: flex; align-items: center; height: 40px; border-radius: 999px; border: 1px solid var(--hair2); background: #ffffff09; color: var(--ivory); font: inherit; font-weight: 700; font-size: 15px; padding: 0; cursor: pointer; transition: border-color .18s; }
.nh-wb:hover, .nh-wb[aria-expanded="true"] { border-color: var(--gold-soft); }
.nh-wb > span { display: flex; align-items: center; gap: 6px; padding: 0 13px; font-variant-numeric: tabular-nums; }
.nh-wb > span + span { border-inline-start: 1px solid var(--hair2); }
.nh-wb .ico { color: var(--gold); width: 18px; height: 18px; }
.nh-pop { position: absolute; top: calc(100% + 10px); inset-inline-end: -8px; width: min(330px, 80vw); z-index: 30; background: #111b40f7; border: 1px solid var(--hair); border-radius: 16px; padding: 14px 16px; box-shadow: 0 30px 60px -20px #000; font-size: 13.5px; line-height: 1.8; animation: ui-enter .18s ease; }
.nh-pop .it { display: flex; gap: 12px; align-items: flex-start; }
.nh-pop .it + .it { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hair2); }
.nh-pop .bub { width: 34px; height: 34px; flex: none; border-radius: 50%; background: #d8b45f1f; display: grid; place-items: center; color: var(--gold); }
.nh-pop b { display: block; font-size: 14px; color: var(--ivory); }
.nh-pop p { margin: 0; color: var(--ivory-2); }
.nh-pop .tm { color: var(--gold-hi); font-weight: 700; font-variant-numeric: tabular-nums; }
.nh-save { flex: none; display: flex; align-items: center; gap: 8px; height: 40px; border-radius: 999px; border: 1px solid var(--gold-dim); background: transparent; color: var(--gold-hi); font: inherit; font-weight: 700; font-size: 13.5px; padding: 0 15px; cursor: pointer; white-space: nowrap; transition: background .18s; }
.nh-save:hover { background: #d8b45f14; }
/* ردیف مجموعه‌ها */
.nh-row { flex: none; display: flex; align-items: center; gap: 6px; width: 100%; max-width: 1680px; margin-inline: auto; padding: 0 var(--pad); height: 46px; overflow-x: auto; scrollbar-width: none; }
.nh-row::-webkit-scrollbar { display: none; }
.nh-chip { flex: none; display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid transparent; background: none; color: var(--ivory-dim); font: inherit; font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: color .18s, background .18s, border-color .18s; }
.nh-chip:hover { color: var(--ivory); }
.nh-chip .n { font-size: 12px; line-height: 20px; padding: 0 7px; border-radius: 999px; background: #ffffff10; color: var(--ivory-dim); font-variant-numeric: tabular-nums; }
.nh-chip.on { color: var(--ivory); background: var(--lapis-700); border-color: var(--hair); }
.nh-chip.on .n { background: #d8b45f26; color: var(--gold-hi); }
.nh-chip.col .ico { color: var(--cc); width: 16px; height: 16px; }
.nh-chip.col.on { background: color-mix(in srgb, var(--cc) 16%, var(--lapis-800)); border-color: color-mix(in srgb, var(--cc) 45%, transparent); }
.nh-chip.col.on .n { background: color-mix(in srgb, var(--cc) 25%, transparent); color: var(--ivory); }
.nh-vsep { flex: none; width: 1px; height: 22px; background: var(--hair2); margin: 0 6px; }
.nh-all { flex: none; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px; border: 0; background: none; color: var(--ivory-2); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.nh-all .ico:last-child { color: var(--gold); width: 16px; height: 16px; }
.nh-all:hover { color: var(--ivory); }
/* قفسه */
.nh-main { flex: 1 1 auto; min-height: 0; width: 100%; max-width: 1680px; margin-inline: auto; display: flex; flex-direction: column; }
.nh-main > .empty { margin: auto; color: var(--ivory-dim); }
.nh-shelf { flex: 1 1 auto; min-height: 0; container-type: size; display: flex; align-items: stretch; gap: clamp(10px, 1.4vw, 18px); padding: 4px var(--pad) clamp(10px, 2.2vh, 20px); overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scroll-padding-inline: var(--pad); overscroll-behavior-x: contain; scrollbar-width: none; }
.nh-shelf::-webkit-scrollbar { display: none; }
.nh-shelf > * { scroll-snap-align: start; animation: nh-in .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes nh-in { from { opacity: 0; transform: translateY(10px); } }
/* کارت داستان */
.nh-card { flex: none; width: 236px; width: clamp(170px, 52cqh, 300px); height: 100%; max-height: 620px; position: relative; display: flex; flex-direction: column; padding: 0; overflow: hidden; border-radius: 16px; border: 1px solid var(--hair2); background: var(--lapis-900); box-shadow: 0 20px 40px -24px #000c; color: inherit; font: inherit; text-align: start; cursor: pointer; transition: transform .22s var(--ease), border-color .22s, box-shadow .22s; }
.nh-card:hover, .nh-card:focus-visible { transform: translateY(-3px); border-color: var(--gold-soft); box-shadow: 0 26px 50px -24px #000; outline: none; }
.nh-card:focus-visible { box-shadow: 0 0 0 2px var(--gold); }
.nh-art { position: relative; flex: 1 1 auto; min-height: 0; display: block; overflow: hidden; background: var(--lapis-950); }
.nh-art img, .nh-art svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.nh-card:hover .nh-art img, .nh-card:hover .nh-art svg { transform: scale(1.04); }
.nh-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--lapis-900) 0%, #0c1430cc 18%, transparent 55%); pointer-events: none; }
.nh-title { position: absolute; z-index: 2; inset-inline: 14px; bottom: 6px; font-family: var(--f-display); font-weight: 400; font-size: clamp(26px, 9cqh, 36px); line-height: 1.35; color: var(--ivory); text-shadow: 0 2px 12px #000c; }
.nh-bar { position: absolute; z-index: 3; inset-inline: 0; bottom: 0; height: 3px; background: #ffffff1a; }
.nh-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--gold); }
.nh-new { position: absolute; z-index: 3; top: 10px; inset-inline-start: 10px; font-size: 11.5px; font-weight: 700; line-height: 1.6; padding: 1px 9px; border-radius: 999px; background: var(--ivory); color: var(--lapis-950); }
.nh-dl { position: absolute; z-index: 3; top: 10px; inset-inline-end: 10px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #070c1fb8; color: var(--ivory-2); }
.nh-dl .ico { width: 14px; height: 14px; }
.nh-body { flex: none; display: flex; flex-direction: column; gap: 4px; padding: 9px 14px 12px; min-width: 0; }
.nh-col { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--cc); line-height: 1.5; }
.nh-col .ico { width: 14px; height: 14px; }
.nh-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ivory-dim); white-space: nowrap; overflow: hidden; line-height: 1.6; }
.nh-meta .dot { width: 3px; height: 3px; flex: none; border-radius: 50%; background: currentColor; opacity: .55; }
.nh-meta .br { display: flex; align-items: center; gap: 4px; color: var(--ivory-2); }
.nh-meta .br .ico { width: 13px; height: 13px; color: var(--gold); }
.nh-meta .src { display: flex; color: var(--c-familiar); }
.nh-meta .src .ico { width: 14px; height: 14px; }
.nh-blurb { font-size: 13.5px; line-height: 1.75; color: var(--ivory-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 3.5em; }
.nh-snip { font-size: 12px; line-height: 1.65; color: var(--ivory-dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nh-snip mark { background: #d8b45f40; color: var(--ivory); border-radius: 3px; padding: 0 2px; }
.nh-foot { display: flex; align-items: center; gap: 8px; min-height: 26px; margin-top: 2px; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; }
.nh-free { border: 1px solid #d8b45f80; color: var(--gold-hi); border-radius: 999px; padding: 0 10px; line-height: 22px; }
.nh-st { display: flex; align-items: center; gap: 6px; color: var(--ivory-2); }
.nh-st .ico { width: 15px; height: 15px; color: var(--gold); }
.nh-st.ok { color: var(--ok); }
.nh-st .pip { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.nh-ends { display: flex; gap: 3px; flex: none; }
.nh-ends i { width: 8px; height: 8px; border-radius: 2px; transform: rotate(45deg); border: 1px solid var(--gold-dim); }
.nh-ends i.f { background: var(--gold); border-color: var(--gold); }
.nh-lnk { margin-inline-start: auto; color: var(--gold-hi); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
/* کارت پهن «ادامهٔ ماجرا» و «پیشنهاد شروع» */
.nh-feature { flex: none; width: clamp(420px, 135cqh, 640px); height: 100%; max-height: 620px; position: relative; overflow: hidden; border-radius: 18px; border: 1px solid var(--hair2); background: var(--lapis-900); box-shadow: 0 20px 40px -24px #000c; }
.nh-fimg { position: absolute; inset: 0; }
.nh-fimg img, .nh-fimg svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.nh-feature::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to left, #070c1ffa 0%, #070c1fee 38%, #070c1f99 58%, transparent 80%), linear-gradient(to top, #070c1fcc, transparent 40%); }
.nh-fin { position: absolute; z-index: 2; inset-block: 0; inset-inline-start: 0; width: min(340px, 58%); display: flex; flex-direction: column; padding: clamp(16px, 6cqh, 30px) clamp(16px, 5cqh, 28px); }
.nh-eye { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--gold); }
.nh-eye::before { content: ""; width: 18px; height: 1px; background: currentColor; }
.nh-ftitle { font-family: var(--f-display); font-weight: 400; font-size: clamp(36px, 12.5cqh, 58px); line-height: 1.5; margin-top: clamp(8px, 4cqh, 22px); color: var(--ivory); text-shadow: 0 2px 18px #000; }
.nh-fsub { font-size: 14.5px; color: var(--ivory-2); }
.nh-segs { display: flex; gap: 5px; margin-top: clamp(8px, 3cqh, 16px); }
.nh-segs i { flex: 1; height: 5px; border-radius: 3px; background: #ffffff1f; position: relative; overflow: hidden; }
.nh-segs i.f { background: var(--gold); }
.nh-segs i.p::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 42%; background: var(--gold); }
.nh-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: clamp(8px, 3cqh, 16px); font-size: 13px; color: var(--ivory-2); }
.nh-facts span { display: flex; align-items: center; gap: 6px; }
.nh-facts .ico { color: var(--gold); width: 15px; height: 15px; }
.nh-quote { display: block; margin-top: clamp(8px, 3.4cqh, 16px); font-size: 13.5px; line-height: 1.8; color: var(--ivory-2); border-inline-start: 2px solid var(--gold-dim); padding-inline-start: 12px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.nh-quote.plain { quotes: none; }
.nh-quote small { display: block; font-size: 12px; color: var(--ivory-dim); }
.nh-quote i { color: var(--gold-hi); font-style: normal; }
.nh-cta { margin-top: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nh-btn { flex: none; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 24px 0 26px; border: 0; border-radius: 999px; background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: #1b1407; font: inherit; font-weight: 800; font-size: 16px; white-space: nowrap; cursor: pointer; box-shadow: 0 10px 24px -10px #d8b45faa; transition: transform .15s, filter .15s; }
.nh-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.nh-btn .ico { width: 15px; height: 15px; }
.nh-sec { border: 0; background: none; padding: 4px 0; color: var(--ivory-2); font: inherit; font-size: 13.5px; white-space: nowrap; cursor: pointer; border-bottom: 1px solid #ffffff40; }
.nh-sec:hover { color: var(--ivory); border-color: var(--gold-soft); }
/* کارت معرفی مجموعه */
.nh-intro { flex: none; width: clamp(260px, 72cqh, 340px); height: 100%; max-height: 620px; position: relative; overflow: hidden; display: flex; flex-direction: column; padding: clamp(16px, 5cqh, 26px); border-radius: 18px; border: 1px solid color-mix(in srgb, var(--cc) 30%, transparent); background: linear-gradient(165deg, color-mix(in srgb, var(--cc) 22%, #101a3c) 0%, var(--lapis-900) 62%); }
.nh-big { position: absolute; inset-inline-end: -40px; bottom: -30px; color: var(--cc); opacity: .07; }
.nh-big .ico { width: 230px; height: 230px; }
.nh-iic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--cc); background: color-mix(in srgb, var(--cc) 16%, transparent); flex: none; }
.nh-iic .ico { width: 22px; height: 22px; }
.nh-ititle { font-family: var(--f-display); font-weight: 400; font-size: clamp(32px, 10cqh, 44px); line-height: 1.55; margin-top: clamp(4px, 3cqh, 16px); color: var(--ivory); }
.nh-itag { margin: 2px 0 0; font-size: 14px; line-height: 1.85; color: var(--ivory-2); }
.nh-intro ul { list-style: none; margin: clamp(6px, 3cqh, 16px) 0 0; padding: 0; display: grid; gap: 8px; }
.nh-intro li { display: flex; gap: 10px; align-items: center; font-size: 13.5px; line-height: 1.6; color: var(--ivory); }
.nh-intro li .ico { color: var(--cc); width: 16px; height: 16px; }
.nh-facets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; position: relative; }
.nh-fc { font: inherit; font-size: 12.5px; border: 1px solid var(--hair2); border-radius: 999px; padding: 2px 11px; background: #ffffff06; color: var(--ivory-2); cursor: pointer; }
.nh-fc:hover { border-color: color-mix(in srgb, var(--cc) 55%, transparent); }
.nh-fc b { color: var(--cc); font-weight: 700; }
.nh-icount { font-size: 12.5px; color: var(--ivory-dim); margin-top: 10px; position: relative; }
.nh-intro:not(:has(.nh-facets)) .nh-icount { margin-top: auto; }
/* کاشی پایانی «همهٔ داستان‌ها» */
.nh-end { flex: none; width: clamp(170px, 46cqh, 220px); height: 100%; max-height: 620px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; border-radius: 16px; border: 1px solid var(--hair2); background: linear-gradient(160deg, #16224a, var(--lapis-900)); color: var(--ivory); font: inherit; cursor: pointer; transition: border-color .2s; }
.nh-end:hover { border-color: var(--gold-soft); }
.nh-stack { position: relative; width: 120px; height: 112px; }
.nh-stack > span { position: absolute; top: 10px; width: 70px; height: 92px; border-radius: 10px; overflow: hidden; border: 2px solid var(--lapis-900); box-shadow: 0 8px 20px -8px #000; background: var(--lapis-950); }
.nh-stack > span img, .nh-stack > span svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.nh-stack .s0 { right: 0; transform: rotate(7deg); } .nh-stack .s1 { left: 0; transform: rotate(-7deg); } .nh-stack .s2 { left: 25px; top: 0; }
.nh-end b { font-size: 15px; padding: 0 10px; }
.nh-end small { display: block; color: var(--ivory-dim); font-size: 12.5px; margin-top: -8px; }
.nh-go { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--gold-dim); display: grid; place-items: center; color: var(--gold); }
/* قفسهٔ کوتاه (گوشی افقی) */
@container (max-height: 360px) {
  .nh-blurb { display: none; }
  .nh-quote { -webkit-line-clamp: 2; font-size: 12.5px; }
  .nh-quote small { display: none; }
  .nh-itag { font-size: 13px; line-height: 1.7; }
  .nh-intro ul { gap: 4px; }
  .nh-intro li { font-size: 12.5px; }
  .nh-btn { height: 42px; font-size: 15px; padding: 0 18px 0 20px; }
}
@container (max-height: 300px) {
  .nh-intro ul, .nh-quote, .nh-facts { display: none; }
  .nh-col { display: none; }
}
/* ---------- کتابخانهٔ کامل ---------- */
.nh-all-scr .nh-tb { gap: 12px; border-bottom: 1px solid var(--hair2); height: calc(var(--tb-h) + 8px); }
.nh-lt { flex: none; font-size: 19px; font-weight: 800; color: var(--ivory); white-space: nowrap; }
.nh-lt small { font-size: 13px; font-weight: 500; color: var(--ivory-dim); margin-inline-start: 8px; }
.nh-search { flex: 0 1 440px; min-width: 120px; height: 42px; margin-inline-start: auto; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 999px; background: #ffffff0b; border: 1px solid var(--hair2); color: var(--ivory-dim); transition: border-color .18s, background .18s; }
.nh-search:focus-within { border-color: var(--gold-dim); background: #ffffff10; color: var(--ivory); }
.nh-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--ivory); font: inherit; font-size: 14.5px; }
.nh-search input::-webkit-search-cancel-button { display: none; }
.nh-search input::placeholder { color: var(--ivory-dim); opacity: .85; }
.nh-clr { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 0; background: #ffffff14; color: var(--ivory-2); display: grid; place-items: center; cursor: pointer; padding: 0; }
.nh-clr .ico { width: 12px; height: 12px; }
.nh-clr[hidden] { display: none; }
.nh-sort select { height: 40px; border-radius: 999px; border: 1px solid var(--hair2); background: #ffffff09; color: var(--ivory-2); font: inherit; font-size: 13.5px; padding: 0 14px; cursor: pointer; }
.nh-sort select option { background: var(--lapis-900); color: var(--ivory); }
.nh-lbody { flex: 1 1 auto; min-height: 0; width: 100%; max-width: 1680px; margin-inline: auto; display: grid; grid-template-columns: clamp(170px, 17vw, 220px) minmax(0, 1fr); }
.nh-lbody.noside { grid-template-columns: minmax(0, 1fr); }
.nh-side { min-height: 0; overflow-y: auto; scrollbar-width: none; padding: 12px 10px 14px; padding-inline-start: var(--pad); border-inline-end: 1px solid var(--hair2); display: flex; flex-direction: column; gap: 2px; }
.nh-side::-webkit-scrollbar { display: none; }
.nh-side .h { font-size: 12px; font-weight: 700; color: var(--ivory-dim); padding: 0 12px 6px; }
.nh-side .h:not(:first-child) { margin-top: 14px; }
.nh-g { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 10px; border: 0; background: none; color: var(--ivory-2); font: inherit; font-size: 14px; font-weight: 500; text-align: start; cursor: pointer; transition: background .15s; }
.nh-g:hover { background: #ffffff08; }
.nh-g .n { margin-inline-start: auto; font-size: 12.5px; color: var(--ivory-dim); font-variant-numeric: tabular-nums; }
.nh-g.on { background: var(--lapis-700); color: var(--ivory); box-shadow: inset -3px 0 0 var(--gold); }
.nh-g.on .n { color: var(--gold-hi); }
.nh-g.col .ico { color: var(--cc); width: 16px; height: 16px; }
.nh-g.col.on { background: color-mix(in srgb, var(--cc) 14%, var(--lapis-800)); box-shadow: inset -3px 0 0 var(--cc); }
.nh-g.col.on .n { color: var(--cc); }
.nh-g.z { opacity: .4; }
.nh-lmain { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.nh-filters { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px var(--pad) 10px 20px; overflow-x: auto; scrollbar-width: none; }
.nh-filters::-webkit-scrollbar { display: none; }
.nh-flab { flex: none; font-size: 12.5px; color: var(--ivory-dim); }
.nh-tg { flex: none; display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--hair2); background: none; color: var(--ivory-2); font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; transition: border-color .15s, background .15s; }
.nh-tg .bx { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--ivory-dim); }
.nh-tg.on { border-color: var(--gold-dim); color: var(--ivory); }
.nh-tg.on .bx { background: var(--gold); border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--lapis-900); }
.nh-tg.pill b { color: var(--ivory-dim); }
.nh-tg.pill.on { background: #ffffff0c; }
.nh-tg.pill.on b { color: var(--gold-hi); }
.nh-res { flex: none; margin-inline-start: auto; font-size: 13px; color: var(--ivory-dim); white-space: nowrap; padding-inline-start: 10px; }
.nh-res b { color: var(--ivory); font-weight: 700; }
.nh-gridwrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px var(--pad) 20px 20px; scrollbar-width: thin; scrollbar-color: #d8b45f45 transparent; -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); }
.nh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(140px, 13vw, 190px), 1fr)); gap: 14px; align-items: start; }
.nh-card.mini { width: auto; height: auto; max-height: none; border-radius: 12px; }
.nh-card.mini .nh-art { flex: none; aspect-ratio: 4 / 5; }
.nh-card.mini .nh-title { font-size: clamp(22px, 2vw, 27px); inset-inline: 10px; bottom: 4px; }
.nh-card.mini .nh-body { padding: 7px 10px 9px; gap: 3px; }
.nh-card.mini .nh-meta, .nh-card.mini .nh-foot { font-size: 11.5px; }
.nh-card.mini .nh-free { padding: 0 8px; line-height: 20px; }
.nh-card.mini .nh-new { top: 8px; inset-inline-start: 8px; font-size: 10.5px; }
.nh-card.mini .nh-dl { top: 8px; inset-inline-end: 8px; width: 24px; height: 24px; }
.nh-none { margin: 40px auto; text-align: center; color: var(--ivory-dim); max-width: 340px; }
.nh-none b { display: block; color: var(--ivory); font-size: 17px; margin-bottom: 6px; }
/* ارتفاع کم */
@media (max-height: 520px) {
  .nh-row { height: 40px; }
  .nh-chip, .nh-all { height: 30px; font-size: 13px; padding: 0 11px; }
  .nh-wb { height: 36px; font-size: 14px; } .nh-wb > span { padding: 0 10px; }
  .nh-save { height: 36px; font-size: 12.5px; padding: 0 12px; }
  .nh-search { height: 36px; } .nh-sort select { height: 36px; }
  .nh-lt { font-size: 17px; } .nh-lt small { display: none; }
  .nh-filters { padding-block: 6px; }
}
@media (max-width: 760px) {
  .nh-save span { display: none; } .nh-save { padding: 0 10px; }
  .nh-all span { display: none; }
  .nh-lbody { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .nh-side { flex-direction: row; overflow-x: auto; border: 0; padding: 6px var(--pad) 0; gap: 6px; }
  .nh-side .h { display: none; } .nh-g { flex: none; min-height: 32px; border: 1px solid var(--hair2); border-radius: 999px; white-space: nowrap; } .nh-g.on { box-shadow: none; }
  .nh-sort { display: none; }
}
@media (prefers-reduced-motion: reduce) { .nh-shelf > * { animation: none; } .nh-card, .nh-card .nh-art img { transition: none; } }
.hist-box { margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid #7fcab555; background: #7fcab512; }
.hist-box b { display: block; font-size: 14px; color: var(--c-historical); margin-bottom: 4px; }
.hist-box p { margin: 0; font-size: 14px; line-height: 1.95; color: var(--ivory); white-space: pre-line; }
.nh .sn { display: none; }
.nh-g .fn, .nh-g .sn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) { .nh .fn { display: none; } .nh .sn { display: inline; } }
@container (max-height: 360px) { .nh-meta .eps { display: none; } }
.nh-feature .nh-dl { z-index: 3; top: 14px; inset-inline-end: 14px; }

/* Explicit stacking only while the new renderer is active; legacy stays untouched. */
.stage.has-visual-layers .st-bg {z-index:0;isolation:isolate;}
.stage.has-visual-layers .st-fx {z-index:1;}
.stage.has-visual-layers .st-vig {z-index:2;}
.stage.has-visual-layers .st-cast {z-index:3;}
.stage.has-visual-layers .st-center,.stage.has-visual-layers .st-box {z-index:4;}
.stage.has-visual-layers .st-hud {z-index:5;}
/* Stage 2: visual layers live strictly within .st-bg (behind FX/cast/text/HUD). */
.st-bg .vl-scene { position:absolute; inset:0; overflow:hidden; pointer-events:none; z-index:1; opacity:0;
  transition:opacity 280ms ease; contain:paint; }
.st-bg .vl-scene.vl-ready { opacity:1; }
.st-bg .vl-layer { position:absolute; inset:-12%; overflow:hidden; pointer-events:none;
  will-change:transform, opacity; backface-visibility:hidden; }
.st-bg .vl-motion { position:absolute; inset:0; transform:translateZ(0); }
.st-bg .vl-layer img { display:block; width:100%; height:100%; object-fit:cover; max-width:none; }
.st-bg .vl-layer.vl-missing { opacity:0 !important; }
.st-bg .vl-layer.vl-loaded img { animation: vl-appear 200ms ease both; }
@keyframes vl-appear { from {opacity:0} to {opacity:1} }
@keyframes vl-sway { 0%,100% {transform:rotate(var(--vl-neg-angle))} 50% {transform:rotate(var(--vl-angle))} }
@keyframes vl-drift { 0%,100% {transform:translate3d(var(--vl-neg-offset),0,0)} 50% {transform:translate3d(var(--vl-offset),0,0)} }
@keyframes vl-float { 0%,100% {transform:translate3d(0,var(--vl-offset),0)} 50% {transform:translate3d(0,var(--vl-neg-offset),0)} }
@keyframes vl-breathe {0%,100% {transform:scale(1)} 50% {transform:scale(var(--vl-breathe))} }
@keyframes vl-pulse {0%,100% {opacity:1} 50% {opacity:var(--vl-pulse-opacity)} }
@keyframes vl-pan {0% {transform:translate3d(var(--vl-neg-offset),0,0)} 100% {transform:translate3d(var(--vl-offset),0,0)} }
@keyframes vl-shake {0%,100% {transform:translate3d(0,0,0)} 25% {transform:translate3d(var(--vl-shake),0,0)} 75% {transform:translate3d(calc(-1 * var(--vl-shake)),0,0)} }
.st-bg .vl-motion[data-motion="sway"] {animation:vl-sway var(--vl-period) ease-in-out var(--vl-phase) infinite;}
.st-bg .vl-motion[data-motion="drift"] {animation:vl-drift var(--vl-period) ease-in-out var(--vl-phase) infinite;}
.st-bg .vl-motion[data-motion="float"] {animation:vl-float var(--vl-period) ease-in-out var(--vl-phase) infinite;}
.st-bg .vl-motion[data-motion="breathe"] {animation:vl-breathe var(--vl-period) ease-in-out var(--vl-phase) infinite;}
.st-bg .vl-motion[data-motion="pulse"] {animation:vl-pulse var(--vl-period) ease-in-out var(--vl-phase) infinite;}
.st-bg .vl-motion[data-motion="pan"] {animation:vl-pan var(--vl-period) linear var(--vl-phase) infinite alternate;}
.st-bg .vl-motion[data-motion="shake"] {animation:vl-shake var(--vl-period) ease-in-out var(--vl-phase) infinite;}
.st-bg.vl-paused .vl-motion {animation-play-state:paused !important;}
.st-bg.vl-reduced .vl-motion, .st-bg.vl-reduced .vl-layer img {animation:none !important; transition:none !important;}
.st-bg.vl-reduced .vl-scene {transition:none !important;}
@media (prefers-reduced-motion:reduce) {
  .st-bg .vl-motion,.st-bg .vl-layer img {animation:none !important;transition:none !important;}
  .st-bg .vl-scene {transition:none !important;}
}

/* Stage 3: camera state uses GPU transforms; never applies to text/HUD. */
.st-bg.directed-single > .art { animation:none !important; will-change:transform; }
.st-bg .vl-layer { will-change:transform; }
@media (prefers-reduced-motion:reduce) { .st-bg .vl-layer,.st-bg.directed-single > .art {transition:none !important;} }

@keyframes director-shake { 0%,100% {transform:translate3d(0,0,0)} 20% {transform:translate3d(var(--dsh),0,0)} 45% {transform:translate3d(calc(-1 * var(--dsh)),0,0)} 70% {transform:translate3d(var(--dsh),0,0)} }
@media (prefers-reduced-motion:reduce) { .st-bg .vl-scene,.st-bg .art img,.st-bg .art svg {animation:none !important;} }

/* Visual FX between environment and characters; text/HUD are always above. */
.stage .director-fx-layer { position:absolute;inset:0;z-index:2;pointer-events:none;opacity:0;contain:paint; }
@media (prefers-reduced-motion:reduce){.stage .director-fx-layer{opacity:0!important;backdrop-filter:none!important;}}

.stage .director-preview-trigger { position:absolute;z-index:50;top:calc(60px + env(safe-area-inset-top, 0px));left:12px;border:1px solid #fff8;border-radius:8px;background:#112433;color:#fff;font:inherit;padding:9px 12px;cursor:pointer;box-shadow:0 2px 8px #0005; }
.stage .director-preview-trigger:focus-visible {outline:3px solid #e4ac5d;outline-offset:2px;}
