.az-book-dialog { --az-paper: light-dark(#fbfaf7,#1d1d1b); --az-ink: light-dark(#2b2b26,#ece9e1); --az-muted: light-dark(#706e66,#b0ada3); --az-line: light-dark(#dedbd2,#3a3932); color-scheme: light dark; color: var(--az-ink); background: var(--az-paper); font-family: var(--az-book-font,Georgia,serif); width: min(1120px,calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--az-line); border-radius: 8px; overflow: hidden; }
.az-book-dialog::backdrop { background: #0009; }
.az-book-dialog *, .az-book-dialog *::before, .az-book-dialog *::after { box-sizing: border-box; }
.az-book-dialog button { font: inherit; color: inherit; background: transparent; border: 1px solid var(--az-line); border-radius: 6px; min-height: 44px; padding: 7px 12px; cursor: pointer; }
.az-book-dialog button:disabled { opacity: .4; cursor: default; }
.az-book-dialog button:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.az-book-shell { display: flex; flex-direction: column; max-height: calc(100dvh - 26px); }
.az-book-toolbar { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--az-line); }
.az-book-toolbar h2 { font-size: 20px; line-height: 1.3; font-weight: 400; margin: 0; }
.az-book-en, .az-book-ru { display: block; }
.az-book-en { font-size: 13px; font-weight: 700; }
.az-book-ru { font-size: 11px; line-height: 1.4; margin-top: 3px; font-weight: 400; }
.az-book-workspace { overflow: auto; padding: 16px; position: relative; flex: 1 1 auto; min-height: 0; }
.az-book-stage { height: clamp(390px,calc(100dvh - 180px),680px); position: relative; perspective: 1800px; isolation: isolate; }
.az-book-spread { display: grid; grid-template-columns: minmax(0,1fr); height: 100%; }
.az-book-stage[data-spread="two"] .az-book-spread { grid-template-columns: repeat(2,minmax(0,1fr)); }
.az-book-stage[data-spread="two"]::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--az-line); z-index: 2; pointer-events: none; }
.az-book-leaf { position: relative; min-width: 0; height: 100%; background: var(--az-paper); color: var(--az-ink); border: 1px solid var(--az-line); overflow: hidden; box-shadow: 0 4px 12px #00000012; }
.az-book-empty { visibility: hidden; }
.az-book-page-content { height: 100%; padding: 28px 30px; overflow: hidden; }
.az-book-page-title { font: 700 22px/1.28 var(--az-book-font,Georgia,serif); overflow-wrap: anywhere; margin: 0; }
.az-book-page-content[data-continued="true"] .az-book-page-title { font-size: 17px; line-height: 1.35; }
.az-book-page-meta { font-size: 11px; line-height: 1.5; color: var(--az-muted); margin: 12px 0 18px; }
.az-book-text { font-size: 18px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; hyphens: none; margin: 0; }
.az-book-cover { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.az-book-cover img { display: block; width: min(44%,180px); height: auto; aspect-ratio: 1; }
.az-book-cover h3 { font-size: 24px; line-height: 1.25; font-weight: 400; margin: 0; }
.az-book-cover-name { font-size: 22px; line-height: 1.35; font-weight: 700; overflow-wrap: anywhere; }
.az-book-cover-name span { display: block; }
.az-book-cover-name [lang="ru"] { font-size: .72em; font-weight: 400; margin-top: 6px; }
.az-book-cover-dates { font-size: 12px; line-height: 1.5; margin: 0; }
.az-book-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--az-line); }
.az-book-indicator { text-align: center; font-size: 12px; line-height: 1.5; }
.az-book-preparing { position: absolute; inset: 16px; display: flex; align-items: center; justify-content: center; background: var(--az-paper); font-size: 15px; z-index: 6; }
.az-book-dialog [hidden] { display: none !important; }
.az-book-measure { position: absolute; top: 0; left: 0; visibility: hidden; pointer-events: none; z-index: -1; }
.az-book-reveal { position: absolute; top: 0; bottom: 0; left: 50%; width: 50%; background: var(--az-paper); z-index: 1; pointer-events: none; }
.az-book-reveal[data-direction="back"] { left: 0; }
.az-book-stage[data-spread="one"] .az-book-reveal { left: 0; width: 100%; }
.az-book-turn { position: absolute; top: 0; bottom: 0; left: 50%; width: 50%; transform-origin: left center; transform-style: preserve-3d; z-index: 4; animation: az-book-forward .7s ease-in-out both; pointer-events: none; }
.az-book-turn[data-direction="back"] { left: 0; transform-origin: right center; animation-name: az-book-back; }
.az-book-stage[data-spread="one"] .az-book-turn { left: 0; width: 100%; }
.az-book-face { position: absolute; inset: 0; backface-visibility: hidden; }
.az-book-face-back { transform: rotateY(180deg); }
.az-book-fallback { max-width: 680px; margin: auto; }
.az-book-fallback section + section { border-top: 1px solid var(--az-line); margin-top: 40px; padding-top: 30px; }
.az-book-fallback h3 { margin: 0; }
.az-book-fallback .az-book-text { margin-top: 18px; }
@keyframes az-book-forward { from { transform: rotateY(0); } to { transform: rotateY(-180deg); } }
@keyframes az-book-back { from { transform: rotateY(0); } to { transform: rotateY(180deg); } }
@media (max-width: 899px) {
  .az-book-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .az-book-shell { max-height: calc(100dvh - 18px); }
  .az-book-toolbar, .az-book-controls { padding: 10px 12px; }
  .az-book-workspace { padding: 10px; }
  .az-book-page-content { padding: 20px 18px; }
  .az-book-text { font-size: 16px; }
  .az-book-page-title { font-size: 20px; }
  .az-book-cover-name { font-size: 20px; }
  .az-book-cover { gap: 12px; }
  .az-book-cover h3 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { .az-book-turn { animation: none; } }

.az-book-toolbar-actions { display: flex; gap: 8px; align-items: center; }
.az-book-contents-open { overflow: hidden; }
.az-book-contents-open > .az-book-stage, .az-book-contents-open > .az-book-fallback, .az-book-contents-open > .az-book-preparing { visibility: hidden; }
.az-book-contents-panel { position: absolute; inset: 16px; z-index: 8; display: flex; flex-direction: column; min-height: 0; background: var(--az-paper); color: var(--az-ink); }
.az-book-contents-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--az-line); }
.az-book-contents-header h3 { margin: 0; font-size: 20px; line-height: 1.3; }
.az-book-contents-list { overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; padding: 8px 2px; }
.az-book-contents-item { padding: 12px 8px; border-bottom: 1px solid var(--az-line); }
.az-book-contents-item[data-current="true"] { background: color-mix(in srgb,var(--az-ink) 8%,var(--az-paper)); border-radius: 6px; }
.az-book-dialog .az-book-contents-entry { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: baseline; gap: 12px; width: 100%; border: 0; padding: 5px 0; text-align: left; }
.az-book-contents-name { min-width: 0; overflow-wrap: anywhere; text-decoration: underline; text-underline-offset: 3px; font-size: 15px; line-height: 1.45; font-weight: 700; }
.az-book-contents-name[lang="ru"] { font-size: 13px; font-weight: 400; color: var(--az-muted); }
.az-book-contents-number { font-size: 11px; white-space: nowrap; color: var(--az-muted); }
@media (max-width: 599px) {
  .az-book-toolbar { flex-wrap: wrap; gap: 10px; }
  .az-book-toolbar-actions { margin-left: auto; }
  .az-book-contents-panel { inset: 10px; }
  .az-book-contents-header h3 { font-size: 18px; }
  .az-book-contents-entry { gap: 8px; }
}

/* Editorial concept skin: preserves the existing reader mechanics and pagination. */
.az-book-dialog {
  --az-paper: light-dark(#f6f3ec,#1b1b18);
  --az-ink: light-dark(#1b1b19,#f0ede5);
  --az-muted: light-dark(#69675f,#aaa69b);
  --az-line: light-dark(#d6d0c4,#3d3b34);
  --az-accent: light-dark(#75382f,#d09386);
  width: min(1180px, calc(100vw - 32px));
  border-radius: 2px;
  box-shadow: 0 24px 70px #0006;
}
.az-book-dialog::backdrop { background: #14120fc7; backdrop-filter: blur(3px); }
.az-book-dialog button { border-radius: 2px; }
.az-book-toolbar { padding: 14px 18px; border-top: 3px solid var(--az-accent); }
.az-book-toolbar h2 { font-size: 22px; letter-spacing: -.025em; }
.az-book-workspace { padding: 20px; }
.az-book-leaf { box-shadow: 0 8px 24px #00000016; }
.az-book-page-content { padding: 34px 38px; }
.az-book-page-title { font-size: 25px; line-height: 1.15; letter-spacing: -.035em; }
.az-book-page-meta { color: var(--az-accent); letter-spacing: .06em; text-transform: uppercase; }
.az-book-text { line-height: 1.72; }
.az-book-cover img { border: 1px solid var(--az-line); filter: saturate(.85); }
.az-book-cover h3 { color: var(--az-accent); }
.az-book-cover-name { font-size: 27px; letter-spacing: -.035em; }
.az-book-controls { padding: 14px 18px; }
.az-book-contents-item[data-current="true"] { box-shadow: inset 3px 0 0 var(--az-accent); border-radius: 0; }
@media (max-width: 899px) {
  .az-book-dialog { width: calc(100vw - 12px); }
  .az-book-page-content { padding: 24px 20px; }
}
