/* ========================================================
   NOTION-STYLE SPEED READER (MAXIMAL MINIMALISM)
   Modern, calm, distraction-free typography and aesthetics
   ======================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, sans-serif;
  --font-serif: 'Literata', 'Newsreader', 'Lora', Georgia, serif;
  --font-mono: 'Fira Code', monospace;
  --font-rsvp: var(--font-sans);
  --font-rsvp-letter-spacing: -0.012em;
  --font-rsvp-weight: 500;
  --font-size-word: 46px;

  /* Notion Light Theme (Default) */
  --bg-app: #ffffff;
  --bg-subtle: #f7f6f5;
  --bg-card: #ffffff;
  --bg-hover: rgba(55, 53, 47, 0.06);
  --bg-active: rgba(55, 53, 47, 0.12);
  --bg-dock: rgba(255, 255, 255, 0.88);
  --bg-modal: #ffffff;

  --text-primary: #37352f;
  --text-secondary: rgba(55, 53, 47, 0.65);
  --text-tertiary: rgba(55, 53, 47, 0.40);
  --text-context: rgba(55, 53, 47, 0.38);

  --border-subtle: rgba(55, 53, 47, 0.09);
  --border-strong: rgba(55, 53, 47, 0.16);

  --accent-orp: #eb5757; /* Notion Red */
  --accent-primary: #2383e2; /* Notion Blue */
  --accent-play-bg: #37352f;
  --accent-play-text: #ffffff;
  --accent-play-hover: #1f1e1a;

  --guide-color: rgba(55, 53, 47, 0.35);
  --dock-shadow: 0 8px 30px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(55, 53, 47, 0.08);
  --modal-shadow: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 9px 24px;

  /* Adaptive Foveal Mask Scrim & Vignette Variables */
  --ambient-vignette-opacity: 0.88;
  --ambient-vignette-center-stop: 28%;
  --ambient-vignette-mid-stop: 62%;
  --ambient-vignette-mid-alpha: 0.65;
  --ambient-mask-scrim: rgba(255, 255, 255, var(--ambient-vignette-mid-alpha, 0.70));
}

/* Notion Light Theme (Explicit) */
html.theme-notion-light,
body.theme-notion-light {
  --bg-app: #ffffff;
  --bg-subtle: #f7f6f5;
  --bg-card: #ffffff;
  --bg-hover: rgba(55, 53, 47, 0.06);
  --bg-active: rgba(55, 53, 47, 0.12);
  --bg-dock: rgba(255, 255, 255, 0.88);
  --bg-modal: #ffffff;

  --text-primary: #37352f;
  --text-secondary: rgba(55, 53, 47, 0.65);
  --text-tertiary: rgba(55, 53, 47, 0.40);
  --text-context: rgba(55, 53, 47, 0.38);

  --border-subtle: rgba(55, 53, 47, 0.09);
  --border-strong: rgba(55, 53, 47, 0.16);

  --accent-orp: #eb5757;
  --accent-primary: #2383e2;
  --accent-play-bg: #37352f;
  --accent-play-text: #ffffff;
  --accent-play-hover: #1f1e1a;

  --guide-color: rgba(55, 53, 47, 0.35);
  --dock-shadow: 0 8px 30px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(55, 53, 47, 0.08);
  --modal-shadow: rgba(15, 15, 15, 0.05) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px, rgba(15, 15, 15, 0.2) 0px 9px 24px;
}

/* Notion Dark Theme */
html.theme-notion-dark,
body.theme-notion-dark {
  --bg-app: #191919;
  --bg-subtle: #202020;
  --bg-card: #252525;
  --bg-hover: rgba(255, 255, 255, 0.055);
  --bg-active: rgba(255, 255, 255, 0.1);
  --bg-dock: rgba(25, 25, 25, 0.88);
  --bg-modal: #202020;
  --ambient-mask-scrim: rgba(20, 20, 20, var(--ambient-vignette-mid-alpha, 0.65));

  --text-primary: #e3e2e0;
  --text-secondary: rgba(235, 235, 235, 0.7);
  --text-tertiary: rgba(235, 235, 235, 0.45);
  --text-context: rgba(240, 240, 240, 0.65);

  --border-subtle: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);

  --accent-orp: #eb5757;
  --accent-primary: #ffffff;
  --accent-play-bg: #e3e2e0;
  --accent-play-text: #191919;
  --accent-play-hover: #ffffff;

  --guide-color: rgba(255, 255, 255, 0.3);
  --dock-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --modal-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Notion Warm Theme */
html.theme-notion-warm,
body.theme-notion-warm {
  --bg-app: #fbfaf8;
  --bg-subtle: #f1eee7;
  --bg-card: #ffffff;
  --bg-hover: rgba(61, 55, 48, 0.06);
  --bg-active: rgba(61, 55, 48, 0.12);
  --bg-dock: rgba(251, 250, 248, 0.9);
  --bg-modal: #fbfaf8;
  --ambient-mask-scrim: rgba(251, 250, 248, var(--ambient-vignette-mid-alpha, 0.70));

  --text-primary: #3d3730;
  --text-secondary: rgba(61, 55, 48, 0.68);
  --text-tertiary: rgba(61, 55, 48, 0.42);
  --text-context: rgba(61, 55, 48, 0.38);

  --border-subtle: rgba(61, 55, 48, 0.1);
  --border-strong: rgba(61, 55, 48, 0.18);

  --accent-orp: #d9730d;
  --accent-primary: #b87b32;
  --accent-play-bg: #3d3730;
  --accent-play-text: #fbfaf8;
  --accent-play-hover: #26211c;

  --guide-color: rgba(61, 55, 48, 0.35);
  --dock-shadow: 0 8px 30px rgba(61, 55, 48, 0.08), 0 0 0 1px rgba(61, 55, 48, 0.08);
  --modal-shadow: 0 16px 36px rgba(61, 55, 48, 0.12), 0 0 0 1px rgba(61, 55, 48, 0.1);
}

/* Notion OLED Black */
html.theme-notion-oled,
body.theme-notion-oled {
  --bg-app: #000000;
  --bg-subtle: #121212;
  --bg-card: #141414;
  --bg-hover: rgba(255, 255, 255, 0.08);
  --bg-active: rgba(255, 255, 255, 0.15);
  --bg-dock: rgba(0, 0, 0, 0.9);
  --bg-modal: #111111;
  --ambient-mask-scrim: rgba(0, 0, 0, var(--ambient-vignette-mid-alpha, 0.75));

  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-tertiary: #666666;
  --text-context: #666666;

  --border-subtle: #222222;
  --border-strong: #333333;

  --accent-orp: #eb5757;
  --accent-primary: #ffffff;
  --accent-play-bg: #ffffff;
  --accent-play-text: #000000;
  --accent-play-hover: #e5e5e5;

  --guide-color: #444444;
  --dock-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 0 1px #222222;
  --modal-shadow: 0 16px 40px rgba(0, 0, 0, 0.9), 0 0 0 1px #2a2a2a;
}

/* ========================================================
   GLOBAL RESET & TYPOGRAPHY
   ======================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input, textarea, select, [contenteditable="true"] {
  user-select: text !important;
  -webkit-user-select: text !important;
}

button, .notion-btn, .notion-icon-btn, .notion-pill-btn, .notion-slider, .ab-nav-item, .ab-book-card, .catalog-tab {
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-overscroll-behavior: none;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  letter-spacing: -0.011em;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Container: transparent full-bleed overlay above the edge-to-edge backdrop */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: -webkit-fill-available;
  max-height: 100dvh;
  max-width: 100%;
  margin: 0;
  position: relative;
  overflow: hidden;
  background: transparent;
  z-index: 1;
}

/* ========================================================
   TRUE AI AMBIENT ART BACKDROP (PROCEDURAL & NEURAL ART)
   ======================================================== */
:root {
  --ambient-backdrop-opacity: 0.90;
  --ambient-brightness: 0.85;
  --ambient-saturate: 1.0;
  --ambient-blur: 7px;
}

.ambient-art-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -2;
  overflow: hidden;
  transition: opacity 1.2s ease;
  opacity: var(--ambient-backdrop-opacity, 0.95);
}

.ambient-art-layer {
  position: absolute;
  top: -4%;
  left: -4%;
  width: 108%;
  height: 108%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 2.8s cubic-bezier(0.4, 0, 0.2, 1);
  filter: blur(var(--ambient-blur, 7px)) brightness(calc(var(--ambient-brightness, 1) * 0.78)) saturate(var(--ambient-saturate, 1.0));
  transform: scale(1.02);
  will-change: opacity, filter;
}

.ambient-art-vignette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Gentle depth contrast preserving illustration clarity and RSVP focus */
  background: radial-gradient(
    circle at 50% 50%,
    rgba(14, 14, 14, 0.38) 0%,
    rgba(14, 14, 14, 0.28) 45%,
    rgba(14, 14, 14, 0.68) 100%
  );
  opacity: var(--ambient-vignette-opacity, 0.65);
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.8s ease, background 0.8s ease;
  will-change: opacity, background;
}

/* Light / Dawn Theme: background is luminous, high-key, airy, with crisp recognizable art */
body.theme-notion-light .ambient-art-backdrop,
.theme-dawn .ambient-art-backdrop {
  opacity: var(--ambient-backdrop-opacity, 0.95);
}

body.theme-notion-light .ambient-art-layer,
.theme-dawn .ambient-art-layer {
  filter: blur(var(--ambient-blur, 4px)) brightness(calc(var(--ambient-brightness, 1) * 1.05)) saturate(0.80);
}

body.theme-notion-light .ambient-art-vignette,
.theme-dawn .ambient-art-vignette {
  background: radial-gradient(
    circle at 50% 50%,
    rgba(255, 255, 255, 0.45) 0%,
    rgba(255, 255, 255, 0.25) 50%,
    rgba(255, 255, 255, 0.60) 100%
  );
  opacity: 0.45;
}

/* Warm / Paper Theme: soft warm ivory parchment tone */
body.theme-notion-warm .ambient-art-backdrop,
.theme-paper .ambient-art-backdrop {
  opacity: var(--ambient-backdrop-opacity, 0.85);
}

body.theme-notion-warm .ambient-art-layer,
.theme-paper .ambient-art-layer {
  opacity: 0 !important;
}

body.theme-notion-warm .ambient-art-vignette,
.theme-paper .ambient-art-vignette {
  background: radial-gradient(
    circle at 50% 50%,
    rgba(251, 250, 248, 0.50) 0%,
    rgba(251, 250, 248, 0.30) 50%,
    rgba(251, 250, 248, 0.65) 100%
  );
  opacity: 0.45;
}

body.theme-notion-dark .ambient-art-backdrop,
.theme-night .ambient-art-backdrop {
  opacity: var(--ambient-backdrop-opacity, 0.88);
}

body.theme-notion-oled .ambient-art-backdrop {
  opacity: calc(var(--ambient-backdrop-opacity, 0.88) * 0.90);
}

body.theme-notion-dark .ambient-art-layer,
body.theme-notion-oled .ambient-art-layer,
.theme-night .ambient-art-layer {
  filter: blur(var(--ambient-blur, 7px)) brightness(calc(var(--ambient-brightness, 1) * 0.72)) saturate(var(--ambient-saturate, 1.0));
}

body.theme-notion-dark .ambient-art-vignette,
body.theme-notion-oled .ambient-art-vignette,
.theme-night .ambient-art-vignette {
  background: radial-gradient(
    circle at 50% 50%,
    rgba(24, 23, 22, 0.88) 0%,
    rgba(24, 23, 22, 0.62) 42%,
    rgba(24, 23, 22, 0.18) 100%
  );
  opacity: var(--ambient-vignette-opacity, 0.88);
}

.ambient-scene-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: 9999px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.16) 0%,
    rgba(255, 255, 255, 0.05) 40%,
    rgba(20, 20, 20, 0.40) 100%
  );
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.40);
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.45),
    0 4px 16px rgba(0, 0, 0, 0.35);
  color: rgba(240, 240, 240, 0.85);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ambient-scene-pill:hover {
  background: rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 255, 255, 0.55);
  color: #ffffff;
  transform: translateY(-1px);
}

/* ========================================================
   NOTION TOP NAVIGATION BAR (REFINED APPLE LIQUID GLASS)
   ======================================================== */
.notion-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  min-height: 44px;
  margin: 14px 20px 0 20px;
  border-radius: 20px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.10) 0%,
    rgba(28, 28, 28, 0.58) 38%,
    rgba(16, 16, 16, 0.72) 100%
  );
  backdrop-filter: blur(44px) saturate(180%) contrast(104%);
  -webkit-backdrop-filter: blur(44px) saturate(180%) contrast(104%);
  border-top: 1px solid rgba(255, 255, 255, 0.20);
  border-left: 1px solid rgba(255, 255, 255, 0.09);
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 
    inset 0 0.5px 0 0 rgba(255, 255, 255, 0.22),
    inset 0 -0.5px 0 0 rgba(0, 0, 0, 0.28),
    0 14px 36px -10px rgba(0, 0, 0, 0.45),
    0 4px 14px -4px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
  z-index: 10;
  transition: all 0.2s ease;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  flex: 1;
}

.notion-icon {
  font-size: 16px;
  line-height: 1;
}

.btn-text {
  font-size: 12.5px;
  font-weight: 500;
}

.notion-breadcrumb-sep {
  color: rgba(255, 255, 255, 0.24);
  font-size: 13px;
}

.book-title-wrap {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-title {
  font-size: 13px;
  font-weight: 500;
  color: rgba(240, 240, 240, 0.82);
  cursor: pointer;
  transition: color 0.15s ease;
}

.book-title:hover {
  color: #ffffff;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Minimalist Serein Top Bar Language Switcher Capsule */
.language-switch,
.lang-switcher,
.notion-lang-capsule {
  display: inline-flex;
  align-items: center;
  gap: 1.5px;
  margin-right: 6px;
  padding: 2.5px;
  border-radius: 9999px;
  border: 1px solid var(--line-subtle, rgba(255, 250, 242, 0.10));
  background: rgba(0, 0, 0, 0.22);
  user-select: none;
}

body.theme-dawn .language-switch,
body.theme-dawn .lang-switcher,
body.theme-dawn .notion-lang-capsule,
body.theme-notion-light .language-switch,
body.theme-notion-light .lang-switcher,
body.theme-notion-light .notion-lang-capsule {
  background: rgba(0, 0, 0, 0.04) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

body.theme-paper .language-switch,
body.theme-paper .lang-switcher,
body.theme-paper .notion-lang-capsule,
body.theme-notion-warm .language-switch,
body.theme-notion-warm .lang-switcher,
body.theme-notion-warm .notion-lang-capsule {
  background: rgba(61, 55, 48, 0.05) !important;
  border-color: rgba(61, 55, 48, 0.08) !important;
}

body.theme-night .language-switch,
body.theme-night .lang-switcher,
body.theme-night .notion-lang-capsule,
body.theme-notion-dark .language-switch,
body.theme-notion-dark .lang-switcher,
body.theme-notion-dark .notion-lang-capsule,
body.theme-notion-oled .language-switch,
body.theme-notion-oled .lang-switcher,
body.theme-notion-oled .notion-lang-capsule {
  background: rgba(0, 0, 0, 0.25) !important;
  border-color: rgba(255, 250, 242, 0.12) !important;
}

.notion-lang-btn,
.lang-option,
.language-switch button {
  background: transparent !important;
  border: none !important;
  font-size: 10px !important;
  font-weight: 550 !important;
  letter-spacing: 0.03em !important;
  color: var(--muted, rgba(244, 237, 229, 0.55)) !important;
  min-width: 27px;
  height: 22px;
  padding: 0 6px !important;
  border-radius: 9999px !important;
  cursor: pointer;
  transition: all 0.14s ease;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notion-lang-btn:hover,
.lang-option:hover,
.language-switch button:hover {
  color: var(--ink) !important;
  background: rgba(255, 255, 255, 0.07) !important;
}

/* Active Language Option - Serein Frosted Glass Pill */
.notion-lang-btn.active,
.notion-lang-btn.is-active,
.notion-lang-btn.selected,
.lang-option.active,
.lang-option.is-active,
.lang-option.selected,
.language-switch button.active,
.language-switch button.is-active,
.language-switch button.selected {
  color: #f4ede5 !important;
  background: rgba(255, 250, 242, 0.15) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 0.5px 0 rgba(255, 255, 255, 0.1) !important;
  font-weight: 700 !important;
}

body.theme-dawn .notion-lang-btn.active,
body.theme-dawn .notion-lang-btn.is-active,
body.theme-dawn .notion-lang-btn.selected,
body.theme-dawn .lang-option.active,
body.theme-dawn .lang-option.is-active,
body.theme-dawn .lang-option.selected,
body.theme-dawn .language-switch button.active,
body.theme-dawn .language-switch button.is-active,
body.theme-dawn .language-switch button.selected,
body.theme-notion-light .notion-lang-btn.active,
body.theme-notion-light .notion-lang-btn.is-active,
body.theme-notion-light .notion-lang-btn.selected,
body.theme-notion-light .lang-option.active,
body.theme-notion-light .lang-option.is-active,
body.theme-notion-light .lang-option.selected,
body.theme-notion-light .language-switch button.active,
body.theme-notion-light .language-switch button.is-active,
body.theme-notion-light .language-switch button.selected {
  color: #24211e !important;
  background: rgba(255, 253, 248, 0.90) !important;
  box-shadow: 0 1px 3px rgba(53, 43, 34, 0.12) !important;
}

body.theme-paper .notion-lang-btn.active,
body.theme-paper .notion-lang-btn.is-active,
body.theme-paper .notion-lang-btn.selected,
body.theme-paper .lang-option.active,
body.theme-paper .lang-option.is-active,
body.theme-paper .lang-option.selected,
body.theme-paper .language-switch button.active,
body.theme-paper .language-switch button.is-active,
body.theme-paper .language-switch button.selected,
body.theme-notion-warm .notion-lang-btn.active,
body.theme-notion-warm .notion-lang-btn.is-active,
body.theme-notion-warm .notion-lang-btn.selected,
body.theme-notion-warm .lang-option.active,
body.theme-notion-warm .lang-option.is-active,
body.theme-notion-warm .lang-option.selected,
body.theme-notion-warm .language-switch button.active,
body.theme-notion-warm .language-switch button.is-active,
body.theme-notion-warm .language-switch button.selected {
  color: #2e2a24 !important;
  background: #ffffff !important;
  box-shadow: 0 1px 3px rgba(61, 55, 48, 0.10) !important;
}

body.theme-night .notion-lang-btn.active,
body.theme-night .notion-lang-btn.is-active,
body.theme-night .notion-lang-btn.selected,
body.theme-night .lang-option.active,
body.theme-night .lang-option.is-active,
body.theme-night .lang-option.selected,
body.theme-night .language-switch button.active,
body.theme-night .language-switch button.is-active,
body.theme-night .language-switch button.selected,
body.theme-notion-dark .notion-lang-btn.active,
body.theme-notion-dark .notion-lang-btn.is-active,
body.theme-notion-dark .notion-lang-btn.selected,
body.theme-notion-dark .lang-option.active,
body.theme-notion-dark .lang-option.is-active,
body.theme-notion-dark .lang-option.selected,
body.theme-notion-dark .language-switch button.active,
body.theme-notion-dark .language-switch button.is-active,
body.theme-notion-dark .language-switch button.selected,
body.theme-notion-oled .notion-lang-btn.active,
body.theme-notion-oled .notion-lang-btn.is-active,
body.theme-notion-oled .notion-lang-btn.selected,
body.theme-notion-oled .lang-option.active,
body.theme-notion-oled .lang-option.is-active,
body.theme-notion-oled .lang-option.selected,
body.theme-notion-oled .language-switch button.active,
body.theme-notion-oled .language-switch button.is-active,
body.theme-notion-oled .language-switch button.selected {
  color: #f4ede5 !important;
  background: rgba(255, 250, 242, 0.15) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 0.5px 0 rgba(255, 255, 255, 0.08) !important;
}

.notion-btn-subtle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.025) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.14);
  outline: none;
  padding: 5px 11px;
  border-radius: 11px;
  color: rgba(240, 240, 240, 0.86);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notion-btn-subtle:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.06) 100%);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.24), 0 2px 8px rgba(0, 0, 0, 0.2);
  color: #ffffff;
  transform: translateY(-0.5px);
}

.notion-btn-subtle:active {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(0);
}

.notion-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  outline: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 10px;
  color: rgba(240, 240, 240, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.notion-icon-btn:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11) 0%, rgba(255, 255, 255, 0.04) 100%);
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.notion-icon-btn:active {
  background: rgba(255, 255, 255, 0.15);
}

.icon {
  width: 17px;
  height: 17px;
}

/* ========================================================
   NOTION SUB-HEADER: SLEEK PILLS (HIDDEN: CHIPS REMOVED FOR CLEAN MINIMALISM)
   ======================================================== */
.notion-sub-header {
  display: none !important;
}

.notion-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  background: rgba(26, 26, 26, 0.55);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.20),
    0 4px 16px rgba(0, 0, 0, 0.35);
  color: rgba(240, 240, 240, 0.85);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notion-pill-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  transform: translateY(-1px);
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.pill-symbol {
  font-size: 12px;
  opacity: 0.7;
}

.pill-arrow {
  font-size: 10px;
  opacity: 0.6;
}

/* ========================================================
   RSVP CENTRAL VIEWPORT (NOTION MINIMALIST)
   ======================================================== */
.rsvp-stage {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  cursor: pointer;
  background: transparent !important;
}

/* Edge Vignette Darkening disabled on stage to prevent horizontal demarcation bands */
.rsvp-stage::before,
.rsvp-stage::after {
  display: none !important;
}

/* Container grouping the RSVP word and its framing alignment guide ticks */
.rsvp-viewport-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  flex-shrink: 0;
  transform: translateY(-50%);
}

/* Minimalist guide ticks (Canonical Serein design) */
.rsvp-guide {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 14px;
  pointer-events: none;
  z-index: 10;
}

.top-guide {
  margin-bottom: 8px;
}

.bottom-guide {
  margin-top: 8px;
  transition: opacity 0.2s ease;
}

.guide-tick {
  width: 2px;
  height: 12px;
  border-radius: 2px;
  background: var(--accent-orp, #eb5757);
  opacity: 0.85;
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

/* Anti-Troxler Micro-Pulse for guide ticks (Martinez-Conde et al. 2006 microsaccadic refreshing) */
.guide-tick.troxler-pulse {
  animation: guideTickBreathe 3.5s ease-in-out infinite;
}

@keyframes guideTickBreathe {
  0%, 100% {
    opacity: 0.70;
    transform: scaleY(1);
  }
  50% {
    opacity: 1;
    transform: scaleY(1.22);
  }
}

/* Conversational Perspective Shift (Never shift foveal fixation axis horizontally off the guide ticks) */
.rsvp-viewport.speaker-turn-left,
.rsvp-viewport.speaker-turn-right {
  transform: none;
}

.rsvp-viewport.turn-switch {
  animation: turnSwitchBreathe 0.25s ease-out;
}

@keyframes turnSwitchBreathe {
  0% { filter: brightness(1.22); }
  100% { filter: brightness(1.0); }
}

/* Micro-Regression feedback badge (Keith Rayner oculomotor regression feedback) */
.micro-regress-badge {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translate(-50%, 0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--bg-dock);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  opacity: 0;
  pointer-events: none;
  z-index: 25;
}

.micro-regress-badge.visible,
.micro-regress-badge.animate {
  animation: regressFade 0.4s ease-out;
}

@keyframes regressFade {
  0% {
    opacity: 0;
    transform: translate(-50%, 6px) scale(0.92);
  }
  20% {
    opacity: 0.95;
    transform: translate(-50%, 0) scale(1);
  }
  75% {
    opacity: 0.95;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -6px) scale(0.98);
  }
}

.micro-regress-badge .micro-regress-icon {
  font-size: 14px;
  line-height: 1;
}

/* Peripheral visual feedback wave / flash on micro-regression */
.rsvp-stage.micro-regress-flash {
  animation: rsvpMicroFlash 0.35s ease-out;
}

@keyframes rsvpMicroFlash {
  0% {
    box-shadow: inset 0 0 0 2px var(--accent-orp), inset 0 0 24px rgba(235, 87, 87, 0.15);
  }
  100% {
    box-shadow: inset 0 0 0 0 transparent, inset 0 0 0 transparent;
  }
}

/* RSVP Viewport: Strictly balanced two-half flexbox centered on ORP */
.rsvp-viewport {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  height: calc(var(--font-size-word) * 1.35);
  min-height: 52px;
  font-family: var(--font-rsvp);
  font-size: calc(var(--font-size-word) * var(--word-length-scale, 1));
  line-height: 1.15;
  white-space: nowrap;
  user-select: none;
  padding: 0 16px;
  overflow: hidden;
  transition: transform 0.25s ease-out;
}

/* Kinetic Track: hardware-accelerated glide container for micro-slide transitions */
.rsvp-track {
  display: flex;
  align-items: baseline;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  will-change: transform, opacity;
}

/* Anti-Troxler Micro-Oscillations (photoreceptor bleaching prevention) */
.rsvp-viewport.troxler-shift-right {
  transform: translateX(1.5px);
}

.rsvp-viewport.troxler-shift-left {
  transform: translateX(-1.5px);
}

/* Two halves ensure the ORP center slot is locked exactly at 50% */
.rsvp-half {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: baseline;
  overflow: hidden;
  white-space: nowrap;
}

.rsvp-left-half {
  justify-content: flex-end;
  text-align: right;
  mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.08) 30px, rgba(0, 0, 0, 0.4) min(140px, 25%), rgba(0, 0, 0, 0.8) min(240px, 40%), black min(340px, 55%));
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.08) 30px, rgba(0, 0, 0, 0.4) min(140px, 25%), rgba(0, 0, 0, 0.8) min(240px, 40%), black min(340px, 55%));
}

.rsvp-right-half {
  justify-content: flex-start;
  text-align: left;
  mask-image: linear-gradient(to left, transparent 0%, rgba(0, 0, 0, 0.08) 30px, rgba(0, 0, 0, 0.4) min(140px, 25%), rgba(0, 0, 0, 0.8) min(240px, 40%), black min(340px, 55%));
  -webkit-mask-image: linear-gradient(to left, transparent 0%, rgba(0, 0, 0, 0.08) 30px, rgba(0, 0, 0, 0.4) min(140px, 25%), rgba(0, 0, 0, 0.8) min(240px, 40%), black min(340px, 55%));
}

/* Center ORP pivot slot */
.orp-center-slot {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: center;
  text-align: center;
  min-width: 0.52em;
  padding: 0 1px;
  z-index: 2;
}

/* Word parts */
.word-part {
  display: inline-block;
  white-space: pre;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

body.theme-notion-dark .word-part:not(.word-orp),
body.theme-notion-oled .word-part:not(.word-orp),
body.theme-night .word-part:not(.word-orp),
html.theme-night .word-part:not(.word-orp),
.theme-night .word-part:not(.word-orp) {
  color: #f5f3ef !important;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.95);
}

body.theme-notion-light .word-part:not(.word-orp),
body.theme-dawn .word-part:not(.word-orp),
html.theme-dawn .word-part:not(.word-orp),
.theme-dawn .word-part:not(.word-orp) {
  color: #1a1a1e !important;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.95), 0 0 4px rgba(255, 255, 255, 0.90);
}

body.theme-notion-warm .word-part:not(.word-orp),
body.theme-paper .word-part:not(.word-orp),
html.theme-paper .word-part:not(.word-orp),
.theme-paper .word-part:not(.word-orp) {
  color: #2b251f !important;
  text-shadow: 0 0 14px rgba(251, 250, 248, 0.95), 0 0 4px rgba(251, 250, 248, 0.90);
}

.word-left {
  text-align: right;
}

#wordOrp,
.word-part.word-orp,
.word-orp,
body.theme-night #wordOrp,
body.theme-night .word-part.word-orp,
html.theme-night #wordOrp,
html.theme-night .word-part.word-orp,
.theme-night #wordOrp,
.theme-night .word-part.word-orp,
body.theme-dawn #wordOrp,
body.theme-dawn .word-part.word-orp,
.theme-dawn #wordOrp,
.theme-dawn .word-part.word-orp,
body.theme-paper #wordOrp,
body.theme-paper .word-part.word-orp,
.theme-paper #wordOrp,
.theme-paper .word-part.word-orp,
body.theme-notion-dark #wordOrp,
body.theme-notion-dark .word-part.word-orp,
body.theme-notion-oled #wordOrp,
body.theme-notion-oled .word-part.word-orp,
body.theme-notion-light #wordOrp,
body.theme-notion-light .word-part.word-orp,
body.theme-notion-warm #wordOrp,
body.theme-notion-warm .word-part.word-orp {
  color: var(--accent-orp, #eb5757) !important;
  font-weight: 700 !important;
  text-align: center;
}

body.theme-notion-dark #wordOrp,
body.theme-notion-oled #wordOrp,
body.theme-night #wordOrp,
html.theme-night #wordOrp,
.theme-night #wordOrp {
  text-shadow: 0 2px 14px rgba(235, 87, 87, 0.65) !important;
}

body.theme-notion-light #wordOrp,
body.theme-dawn #wordOrp,
body.theme-notion-warm #wordOrp,
body.theme-paper #wordOrp {
  text-shadow: none !important;
}

.word-orp * {
  color: var(--accent-orp, #eb5757) !important;
  font-weight: 700 !important;
}

.word-right {
  text-align: left;
}

/* Bionic Fixation Anchoring (Keith Rayner saccadic target fixation) */
.bionic-bold {
  font-weight: 800;
}

.bionic-normal {
  font-weight: 400;
}

/* Collocations & Multi-word Idioms visual styling */
.rsvp-viewport.is-collocation {
  letter-spacing: -0.01em;
}

.rsvp-viewport.is-collocation .word-part {
  font-weight: 600;
}

/* Peripheral Context Words (Never overlaps!) */
.context-words {
  display: inline-block;
  white-space: pre;
  font-weight: 400;
  font-size: 0.86em;
  color: var(--text-context);
  user-select: none;
  pointer-events: none;
  flex-shrink: 0;
  transition: opacity 0.2s ease, letter-spacing 0.2s ease, word-spacing 0.2s ease;
}

body.theme-notion-dark .context-words,
body.theme-notion-oled .context-words,
body.theme-night .context-words,
html.theme-night .context-words,
.theme-night .context-words {
  color: rgba(245, 243, 239, 0.45) !important;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.90);
}

body.theme-notion-light .context-words,
body.theme-dawn .context-words,
html.theme-dawn .context-words,
.theme-dawn .context-words {
  color: rgba(35, 33, 30, 0.45) !important;
  text-shadow: none;
}

body.theme-notion-warm .context-words,
body.theme-paper .context-words,
html.theme-paper .context-words,
.theme-paper .context-words {
  color: rgba(45, 38, 30, 0.42) !important;
  text-shadow: none;
}

.context-left {
  text-align: right;
}

.context-right {
  text-align: left;
}

/* Parafoveal Preview: Ghost Words (Keith Rayner 2006 parafoveal preview effect) */
.context-words.is-parafoveal-ghost {
  opacity: 0.78;
}

/* Key Concepts: subtle amber/gold narrative anchor dot */
.rsvp-viewport.is-key-concept .word-orp {
  position: relative;
}

.rsvp-viewport.is-key-concept .word-orp::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #d97706;
  box-shadow: 0 0 6px rgba(217, 119, 6, 0.55);
}

/* Rare Vocabulary / Archaic Word: Subtle cognitive breath indicator */
.rsvp-viewport.is-rare-word:not(.is-key-concept) .word-orp {
  position: relative;
}

.rsvp-viewport.is-rare-word:not(.is-key-concept) .word-orp::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #8b5cf6;
  box-shadow: 0 0 6px rgba(139, 92, 246, 0.6);
}

/* SOTA Neural NLP: Semantic Scene Shift (Event Boundary) */
.rsvp-viewport.is-scene-shift {
  animation: sceneShiftPulse 0.35s ease-out;
}

@keyframes sceneShiftPulse {
  0% { transform: scale(0.96); filter: brightness(1.15); }
  50% { transform: scale(1.02); filter: brightness(1.0); }
  100% { transform: scale(1.0); filter: brightness(1.0); }
}

/* Dialogue Attribution: sleeker, functional narrator pace (peripheral gliding) */
.rsvp-viewport.is-attribution .word-part {
  font-style: italic;
  font-weight: 480;
  opacity: 0.82;
  transition: opacity 0.15s ease;
}

/* Direct Speech: crisp, spoken vocal presence */
.rsvp-viewport.is-direct-speech .word-part {
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

body.theme-notion-dark .rsvp-viewport.is-direct-speech .word-part,
body.theme-notion-oled .rsvp-viewport.is-direct-speech .word-part,
body.theme-night .rsvp-viewport.is-direct-speech .word-part,
.theme-night .rsvp-viewport.is-direct-speech .word-part {
  color: #ffffff !important;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.95);
}

body.theme-notion-light .rsvp-viewport.is-direct-speech .word-part,
body.theme-dawn .rsvp-viewport.is-direct-speech .word-part,
.theme-dawn .rsvp-viewport.is-direct-speech .word-part {
  color: #121214 !important;
  text-shadow: none;
}

body.theme-notion-warm .rsvp-viewport.is-direct-speech .word-part,
body.theme-paper .rsvp-viewport.is-direct-speech .word-part,
.theme-paper .rsvp-viewport.is-direct-speech .word-part {
  color: #241c14 !important;
  text-shadow: none;
}

/* Chapter Key Concepts Pill in Sub-Header */
.chapter-concepts-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(240, 240, 240, 0.85);
  background: rgba(26, 26, 26, 0.55);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  padding: 5px 12px;
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.20),
    0 4px 16px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
  cursor: default;
  transition: all 0.15s ease;
}

.chapter-concepts-pill:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.chapter-concepts-icon {
  color: #d97706;
  font-size: 10px;
}

/* Cortical M-Scaling: reduces lateral crowding in peripheral receptive fields (Pelli & Tillman 2008) */
.rsvp-stage.m-scaling-active .context-words {
  letter-spacing: 0.045em;
  word-spacing: 0.15em;
}

/* Minimalist Meta Row under Word */
.rsvp-meta-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: fit-content;
  margin-top: 28px;
  padding: 0 8px;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-container.has-anchor-card .rsvp-meta-row {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
}

.notion-step-badge,
.session-timer,
#sessionTimerBadge,
.session-timer-pill {
  display: none !important;
}
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3.5px 11px;
  border-radius: 9999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(18, 18, 18, 0.36) 100%);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: rgba(240, 240, 240, 0.68);
  user-select: none;
}

.timer-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #10b981;
  opacity: 0.85;
}

/* AI Eye-Tracking Status Pill (Oculomotor attention tracker) */
.eye-tracker-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3.5px 11px;
  border-radius: 9999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(18, 18, 18, 0.36) 100%);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  font-size: 11.5px;
  font-weight: 500;
  color: rgba(240, 240, 240, 0.72);
  transition: all 0.2s ease;
  user-select: none;
}

.eye-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  transition: background 0.2s ease;
}

.eye-tracker-pill.gaze-lost {
  color: #eb5757;
  background: rgba(235, 87, 87, 0.12);
}

.eye-tracker-pill.gaze-lost .eye-dot {
  background: #eb5757;
}

.eye-tracker-pill.user-stopped {
  color: var(--text-secondary, #94a3b8);
  background: var(--bg-hover, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.eye-tracker-pill.user-stopped .eye-dot {
  background: #64748b;
  box-shadow: none;
}

.eye-tracker-pill.gaze-paused {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.eye-tracker-pill.gaze-paused .eye-dot {
  background: #f59e0b;
  animation: eye-dot-pulse 0.8s infinite alternate ease-in-out;
}

.eye-tracker-pill.gaze-focus {
  color: #10b981;
  background: rgba(16, 185, 129, 0.10);
  border: 1px solid rgba(16, 185, 129, 0.20);
}

.eye-tracker-pill.gaze-focus .eye-dot {
  background: #10b981;
}

.eye-tracker-pill.gaze-starting {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
}

.eye-tracker-pill.gaze-starting .eye-dot {
  background: #f59e0b;
  animation: eye-dot-pulse 0.4s infinite alternate ease-in-out;
}

@keyframes eye-dot-pulse {
  from { transform: scale(0.85); opacity: 0.7; }
  to { transform: scale(1.35); opacity: 1; }
}

@keyframes calibPulse {
  0% { transform: scale(0.85); opacity: 0.8; }
  50% { transform: scale(1.35); opacity: 0.3; }
  100% { transform: scale(0.85); opacity: 0.8; }
}

/* Syntagmatic Phrase-level RSVP styling */
.rsvp-viewport.is-syntagma {
  letter-spacing: -0.015em;
}

.rsvp-viewport.is-syntagma .word-part {
  font-weight: 600;
}

/* ========================================================
   NOTION DOCK (SINGLE-ROW LIQUID GLASS VISION-OS CAPSULE)
   ======================================================== */
.notion-dock {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.10) 0%,
    rgba(28, 28, 28, 0.65) 38%,
    rgba(16, 16, 16, 0.82) 100%
  );
  backdrop-filter: blur(44px) saturate(180%) contrast(104%);
  -webkit-backdrop-filter: blur(44px) saturate(180%) contrast(104%);
  border-top: 1px solid rgba(255, 255, 255, 0.21);
  border-left: 1px solid rgba(255, 255, 255, 0.09);
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 9999px;
  box-shadow: 
    inset 0 0.5px 0 0 rgba(255, 255, 255, 0.22),
    inset 0 -0.5px 0 0 rgba(0, 0, 0, 0.30),
    0 20px 50px -10px rgba(0, 0, 0, 0.58),
    0 6px 20px -4px rgba(0, 0, 0, 0.34);
  margin: 0 auto 20px auto;
  width: min(640px, calc(100vw - 32px));
  height: 54px;
  padding: 0 9px 0 8px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  z-index: 10;
  transition: all 0.2s ease;
}

/* Primary Play / Pause Trigger Pill */
.notion-play-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 18px;
  border-radius: 9999px;
  border: none;
  background: linear-gradient(180deg, #ffffff 0%, #eef0f5 100%);
  color: #0e1015;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 
    inset 0 1px 0 #ffffff,
    0 3px 12px rgba(0, 0, 0, 0.28);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.notion-play-pill:hover {
  background: #ffffff;
  transform: translateY(-0.5px) scale(1.015);
  box-shadow: 
    inset 0 1px 0 #ffffff,
    0 5px 18px rgba(0, 0, 0, 0.34),
    0 0 12px rgba(255, 255, 255, 0.18);
}

.notion-play-pill:active {
  transform: scale(0.97);
}

.play-icon-wrap {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-svg, .pause-svg {
  width: 100%;
  height: 100%;
}

.play-pill-text {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Center Scrubber & Progress Meta Column */
.dock-scrubber-col {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0 4px;
}

.dock-scrubber-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  overflow: hidden;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: rgba(240, 240, 240, 0.56);
  line-height: 1;
  user-select: none;
}

.dock-time-left {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
}

.dock-progress-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.dock-undo-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.18);
  color: rgba(240, 240, 240, 0.82);
  cursor: pointer;
  transition: all 0.14s ease;
}

.dock-undo-inline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.dock-undo-inline:disabled {
  opacity: 0;
  pointer-events: none;
  width: 0;
  margin-left: -6px;
  overflow: hidden;
}

/* Notion Timeline Slider with Dynamic Progress Fill */
.notion-timeline {
  width: 100%;
  display: flex;
  align-items: center;
  height: 10px;
}

.notion-slider {
  --slider-progress: 0%;
  --slider-fill-color: rgba(255, 255, 255, 0.88);
  --slider-track-color: rgba(255, 255, 255, 0.14);
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 9999px;
  background: linear-gradient(
    90deg,
    var(--slider-fill-color) 0%,
    var(--slider-fill-color) var(--slider-progress, 0%),
    var(--slider-track-color) var(--slider-progress, 0%),
    var(--slider-track-color) 100%
  );
  outline: none;
  cursor: pointer;
  transition: height 0.15s ease;
}

.notion-slider:hover {
  height: 4.5px;
}

.notion-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.12s cubic-bezier(0.16, 1, 0.3, 1);
}

.notion-slider:hover::-webkit-slider-thumb {
  transform: scale(1.3);
}

/* Right Speed Control Liquid Glass Capsule */
.wpm-control-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 38px;
  padding: 0 4px;
  border-radius: 9999px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.03) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.075);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.wpm-readout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 6px;
  user-select: none;
}

.benchmark-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
}

.wpm-benchmark-badge.is-super-fast .benchmark-dot {
  background: #10b981;
}

.wpm-benchmark-badge.is-hypersonic .benchmark-dot {
  background: #a78bfa;
}

.wpm-benchmark-badge.is-calm .benchmark-dot {
  background: rgba(240, 240, 240, 0.45);
}

.wpm-stepper-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  color: rgba(240, 240, 240, 0.65);
  transition: all 0.12s ease;
}

.wpm-stepper-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
}

.wpm-stepper-btn:active {
  transform: scale(0.92);
}

.wpm-badge-number {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  min-width: 26px;
  text-align: center;
}

.wpm-badge-label {
  font-size: 11px;
  color: rgba(240, 240, 240, 0.42);
}

/* ========================================================
   NOTION MODALS & POPUPS (MACOS FROSTED GLASS DIALOGS)
   ======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  background: rgba(10, 10, 10, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
  display: flex;
  animation: modalFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.notion-modal-content {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.09) 0%,
    rgba(28, 28, 28, 0.88) 38%,
    rgba(16, 16, 16, 0.95) 100%
  );
  backdrop-filter: blur(44px) saturate(180%) contrast(104%);
  -webkit-backdrop-filter: blur(44px) saturate(180%) contrast(104%);
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  border-left: 1px solid rgba(255, 255, 255, 0.09);
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 26px;
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.22),
    0 28px 75px rgba(0, 0, 0, 0.75);
  color: #ffffff;
  margin: auto;
  position: relative;
}

body.theme-notion-oled .notion-modal-content {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(16, 16, 16, 0.94) 38%,
    rgba(0, 0, 0, 0.98) 100%
  );
}

#pasteTitleInput,
#pasteContentTextarea {
  background: var(--bg-subtle, rgba(255, 255, 255, 0.06)) !important;
  border-color: var(--border-subtle, rgba(255, 255, 255, 0.12)) !important;
  color: var(--text-primary, #ffffff) !important;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

#pasteTitleInput:focus,
#pasteContentTextarea:focus {
  border-color: rgba(255, 255, 255, 0.40) !important;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08) !important;
}

.large-modal {
  max-width: 780px;
  max-height: 90vh;
}

.notion-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background: inherit;
}

.notion-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-emoji {
  display: none !important;
}

.notion-modal-title h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  transition: all 0.14s ease;
  flex-shrink: 0;
}

.close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.close-btn:active {
  transform: scale(0.92);
}

.notion-modal-subhead {
  padding: 8px 18px;
  background: var(--bg-subtle);
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

body.theme-notion-dark .notion-modal-subhead,
body.theme-notion-oled .notion-modal-subhead {
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.70);
}

.notion-modal-body {
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
}

/* Drop Zone */
.notion-drop-zone {
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-subtle);
  transition: all 0.15s ease;
}

.notion-drop-zone:hover, .notion-drop-zone.dragover {
  border-color: var(--accent-primary);
  background: rgba(35, 131, 226, 0.05);
}

body.theme-notion-dark .notion-drop-zone:hover,
body.theme-notion-dark .notion-drop-zone.dragover,
body.theme-notion-oled .notion-drop-zone:hover,
body.theme-notion-oled .notion-drop-zone.dragover {
  border-color: rgba(255, 255, 255, 0.40);
  background: rgba(255, 255, 255, 0.05);
}

.drop-icon {
  width: 36px;
  height: 36px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.drop-primary {
  font-size: 14px;
  color: var(--text-primary);
}

.drop-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 4px 0 14px 0;
}

.notion-primary-btn {
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

body.theme-notion-dark .notion-primary-btn,
body.theme-notion-oled .notion-primary-btn {
  background: #ffffff;
  color: #121212;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

body.theme-notion-dark .notion-primary-btn:hover,
body.theme-notion-oled .notion-primary-btn:hover {
  background: #f0f0f0;
  color: #000000;
}

.notion-primary-btn:hover {
  opacity: 0.9;
}

.notion-primary-btn:active {
  transform: scale(0.98);
}

.full-width {
  width: 100%;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.notion-list-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
}

.notion-list-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.card-icon {
  font-size: 22px;
}

.card-info {
  flex: 1;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-sub {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ================= NOTION BOOK CATALOG (GALLERY VIEW) ================= */
/* ========================================================
   APPLE BOOKS FULL-SCREEN CATALOG PAGE (MACOS REFERENCE)
   ======================================================== */
.modal-overlay.apple-books-overlay {
  padding: 0 !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 250;
}

.apple-books-page {
  width: 100vw;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  background: #ffffff;
  color: #1d1d1f;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Inter', sans-serif);
  animation: abPageFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

body.theme-notion-dark .apple-books-page {
  background: #161616;
  color: #f5f5f7;
}

body.theme-notion-oled .apple-books-page {
  background: #000000;
  color: #ffffff;
}

body.theme-notion-warm .apple-books-page {
  background: #fbfaf7;
  color: #2c2620;
}

@keyframes abPageFadeIn {
  from {
    opacity: 0;
    transform: scale(0.99);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Left Sidebar (macOS Apple Books Vibrancy Column) */
.ab-sidebar {
  width: 244px;
  flex-shrink: 0;
  height: 100%;
  background: #f2f2f4;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  padding: 16px 14px 16px 14px;
  box-sizing: border-box;
  user-select: none;
}

body.theme-notion-dark .ab-sidebar {
  background: rgba(24, 24, 24, 0.75);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-right-color: rgba(255, 255, 255, 0.08);
}

body.theme-notion-oled .ab-sidebar {
  background: #0d0d0d;
  border-right-color: rgba(255, 255, 255, 0.08);
}

body.theme-notion-warm .ab-sidebar {
  background: #f3efe8;
  border-right-color: rgba(61, 55, 48, 0.09);
}

.ab-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 4px;
}

.ab-back-to-reader-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px 6px 8px;
  border-radius: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.055);
  color: #1d1d1f;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.ab-back-to-reader-btn:hover {
  background: rgba(0, 0, 0, 0.10);
}

body.theme-notion-dark .ab-back-to-reader-btn,
body.theme-notion-oled .ab-back-to-reader-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #f5f5f7;
}

body.theme-notion-dark .ab-back-to-reader-btn:hover,
body.theme-notion-oled .ab-back-to-reader-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* Sidebar Search */
.ab-search-box {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.ab-search-icon {
  position: absolute;
  left: 10px;
  color: #86868b;
  pointer-events: none;
}

.ab-search-input {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 32px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.07);
  background: rgba(255, 255, 255, 0.85);
  color: #1d1d1f;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: all 0.15s ease;
}

.ab-search-input::placeholder {
  color: #86868b;
}

.ab-search-input:focus {
  background: #ffffff;
  border-color: rgba(0, 122, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

body.theme-notion-dark .ab-search-input,
body.theme-notion-oled .ab-search-input {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  color: #f5f5f7;
}

body.theme-notion-dark .ab-search-input:focus,
body.theme-notion-oled .ab-search-input:focus {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.40);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

/* Sidebar Navigation */
.ab-nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ab-nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 14px;
}

.ab-nav-section-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #1d1d1f;
  padding: 6px 10px 4px 10px;
  letter-spacing: -0.01em;
}

body.theme-notion-dark .ab-nav-section-title,
body.theme-notion-oled .ab-nav-section-title {
  color: rgba(245, 245, 247, 0.88);
}

.ab-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #1d1d1f;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

body.theme-notion-dark .ab-nav-item,
body.theme-notion-oled .ab-nav-item {
  color: rgba(245, 245, 247, 0.82);
}

.ab-nav-item:hover {
  background: rgba(0, 0, 0, 0.045);
}

body.theme-notion-dark .ab-nav-item:hover,
body.theme-notion-oled .ab-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.ab-nav-item.active {
  background: rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

body.theme-notion-dark .ab-nav-item.active,
body.theme-notion-oled .ab-nav-item.active {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
}

.ab-nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.80;
}

.ab-nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  color: #86868b;
  font-variant-numeric: tabular-nums;
}

/* Sidebar User Profile Footer */
.ab-sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px 2px 6px;
  margin-top: auto;
}

.ab-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dfd1b8 0%, #c8b493 100%);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.ab-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #1d1d1f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.theme-notion-dark .ab-user-name,
body.theme-notion-oled .ab-user-name {
  color: #f5f5f7;
}

/* Right Main Editorial Canvas */
.ab-main {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.ab-main.drag-over::after {
  content: 'Отпустите файл .fb2 для добавления в библиотеку';
  position: absolute;
  inset: 16px;
  border-radius: 16px;
  border: 2px dashed #007aff;
  background: rgba(0, 122, 255, 0.08);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #007aff;
  z-index: 30;
  pointer-events: none;
}

body.theme-notion-dark .ab-main.drag-over::after,
body.theme-notion-oled .ab-main.drag-over::after {
  border: 2px dashed rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

/* Top-Right Reading Goal Ring */
.ab-main-topbar {
  position: absolute;
  top: 16px;
  right: 28px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ab-reading-goal-ring {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.ab-goal-svg {
  width: 38px;
  height: 38px;
  transform: rotate(-90deg);
}

.ab-goal-bg {
  fill: none;
  stroke: rgba(0, 180, 216, 0.16);
  stroke-width: 3;
}

.ab-goal-fill {
  fill: none;
  stroke: #00b4d8;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s ease;
}

.ab-goal-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.ab-goal-current {
  font-size: 10.5px;
  font-weight: 700;
  color: #0096c7;
}

body.theme-notion-dark .ab-goal-bg,
body.theme-notion-oled .ab-goal-bg {
  stroke: rgba(255, 255, 255, 0.12);
}

body.theme-notion-dark .ab-goal-fill,
body.theme-notion-oled .ab-goal-fill {
  stroke: #10b981;
}

body.theme-notion-dark .ab-goal-current,
body.theme-notion-oled .ab-goal-current {
  color: #ffffff;
}

.ab-goal-target {
  font-size: 8px;
  font-weight: 700;
  color: #6e6e73;
  margin-top: 1px;
}

/* Scrollable Canvas */
.ab-scroll-canvas {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 56px;
}

.ab-page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 36px 48px 18px 48px;
  gap: 16px;
}

.ab-page-title {
  font-family: 'Newsreader', 'Lora', Georgia, serif;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
  color: inherit;
}

.ab-upload-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 9999px;
  border: 1px solid rgba(0, 0, 0, 0.10);
  background: rgba(0, 0, 0, 0.03);
  color: inherit;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  margin-right: 48px;
  transition: all 0.14s ease;
}

.ab-upload-pill-btn:hover {
  background: rgba(0, 0, 0, 0.07);
}

body.theme-notion-dark .ab-upload-pill-btn,
body.theme-notion-oled .ab-upload-pill-btn {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

body.theme-notion-dark .ab-upload-pill-btn:hover,
body.theme-notion-oled .ab-upload-pill-btn:hover {
  background: rgba(255, 255, 255, 0.11);
}

/* Horizontal Shelves (Apple Books "Главная") */
.ab-shelf-section {
  padding: 18px 0 32px 0;
  position: relative;
}

.ab-shelf-section.is-tinted-band {
  background: #f5f5f7;
  padding-top: 26px;
  padding-bottom: 34px;
}

body.theme-notion-dark .ab-shelf-section.is-tinted-band,
body.theme-notion-oled .ab-shelf-section.is-tinted-band {
  background: rgba(255, 255, 255, 0.025);
}

body.theme-notion-warm .ab-shelf-section.is-tinted-band {
  background: #f4f0e8;
}

.ab-shelf-header {
  padding: 0 48px 16px 48px;
}

.ab-shelf-title-row {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.ab-shelf-title {
  font-family: 'Newsreader', 'Lora', Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
  color: inherit;
}

.ab-shelf-chevron {
  font-size: 22px;
  font-weight: 600;
  color: #86868b;
  line-height: 1;
}

.ab-shelf-subtitle {
  margin: 3px 0 0 0;
  font-size: 13.5px;
  color: #86868b;
  font-weight: 400;
}

/* Shelf Carousel Track & Paddles */
.ab-shelf-carousel-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ab-shelf-track {
  display: flex;
  align-items: flex-start;
  gap: 26px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 8px 48px 18px 48px;
  scrollbar-width: none;
}

.ab-shelf-track::-webkit-scrollbar {
  display: none;
}

.ab-carousel-paddle {
  position: absolute;
  top: 44%;
  transform: translateY(-50%);
  width: 28px;
  height: 54px;
  border-radius: 14px;
  border: none;
  background: rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
  color: #1d1d1f;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 6;
  opacity: 0;
  transition: opacity 0.16s ease, background 0.16s ease;
}

.ab-shelf-carousel-wrap:hover .ab-carousel-paddle {
  opacity: 1;
}

.ab-carousel-paddle:hover {
  background: rgba(0, 0, 0, 0.22);
}

body.theme-notion-dark .ab-carousel-paddle,
body.theme-notion-oled .ab-carousel-paddle {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.ab-carousel-paddle.prev {
  left: 12px;
}

.ab-carousel-paddle.next {
  right: 12px;
}

/* Apple Books 3D Book Card */
.ab-book-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  flex-shrink: 0;
  width: 154px;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.ab-book-card:hover {
  transform: translateY(-5px);
}

.ab-book-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.48;
  border-radius: 3px 6px 6px 3px;
  overflow: hidden;
  box-shadow: 
    0 12px 24px -4px rgba(0, 0, 0, 0.26),
    0 3px 8px -2px rgba(0, 0, 0, 0.16),
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.12);
  background: #1a1a1a;
}

.ab-book-card.is-active-book .ab-book-cover-wrap {
  box-shadow: 
    0 0 0 2.5px #007aff,
    0 14px 28px -4px rgba(0, 122, 255, 0.32);
}

body.theme-notion-dark .ab-book-card.is-active-book .ab-book-cover-wrap,
body.theme-notion-oled .ab-book-card.is-active-book .ab-book-cover-wrap {
  box-shadow: 
    0 0 0 2.5px #ffffff,
    0 14px 28px -4px rgba(0, 0, 0, 0.65),
    0 0 16px rgba(255, 255, 255, 0.25);
}

/* Realistic Book Spine Crease */
.cover-spine-effect {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 14px;
  pointer-events: none;
  z-index: 4;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.32) 0%,
    rgba(0, 0, 0, 0.22) 28%,
    rgba(255, 255, 255, 0.18) 52%,
    transparent 100%
  );
}

.catalog-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ab-cover-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  background: rgba(16, 16, 16, 0.85);
  color: #ffffff;
  backdrop-filter: blur(6px);
}

.ab-cover-badge.is-done {
  background: #10b981;
  color: #ffffff;
}

.ab-book-caption {
  padding: 8px 2px 0 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ab-book-caption-title {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ab-book-caption-author {
  font-size: 11px;
  color: #86868b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ab-shelf-card .ab-book-caption {
  display: none;
}

/* Grid Section (for "Все книги", "Хочу прочесть", etc.) */
.ab-grid-section {
  padding: 12px 48px 40px 48px;
}

.ab-books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 28px 24px;
}

.ab-books-grid .ab-book-card {
  width: 100%;
}

/* Minimalist Apple Books Default Cloth Cover (When book has no coverUrl) */
.ab-minimal-cover {
  width: 100%;
  height: 100%;
  position: relative;
  box-sizing: border-box;
  padding: 20px 16px 20px 22px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  user-select: none;
}

.ab-minimal-cover-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ab-minimal-author {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.25;
}

.ab-minimal-rule {
  width: 24px;
  height: 1px;
}

.ab-minimal-title {
  font-family: 'Newsreader', 'Lora', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.catalog-delete-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 6;
  background: rgba(16, 16, 16, 0.85);
  border: none;
  cursor: pointer;
  width: 20px;
  height: 20px;
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.14s ease;
}

.ab-book-card:hover .catalog-delete-btn {
  opacity: 1;
}

.catalog-delete-btn:hover {
  background: #ef4444;
}

.catalog-empty-state {
  padding: 48px 20px;
  text-align: center;
  color: #86868b;
  font-size: 14px;
}

@media (max-width: 760px) {
  .ab-sidebar {
    width: 190px;
    padding: 12px 10px;
  }
  .ab-page-header,
  .ab-shelf-header,
  .ab-shelf-track,
  .ab-grid-section {
    padding-left: 20px;
    padding-right: 20px;
  }
  .ab-page-title {
    font-size: 28px;
  }
}

/* Items List (Chapters / Bookmarks / Search) */
.notion-items-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notion-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s ease;
}

.notion-item-row:hover {
  background: var(--bg-hover);
}

.notion-item-row.active {
  background: var(--bg-hover);
  font-weight: 600;
  color: var(--accent-primary);
}

/* Full Text Reader View */
.fulltext-body {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.75;
  user-select: text;
}

.fulltext-paragraph {
  margin-bottom: 16px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.fulltext-paragraph:hover {
  background: var(--bg-hover);
}

.fulltext-paragraph.active-paragraph {
  background: rgba(35, 131, 226, 0.08);
  border-left: 2px solid var(--accent-primary);
}

body.theme-notion-dark .fulltext-paragraph.active-paragraph,
body.theme-notion-oled .fulltext-paragraph.active-paragraph {
  background: rgba(255, 255, 255, 0.08);
  border-left: 2px solid #ffffff;
}

.fulltext-word {
  cursor: pointer;
  border-radius: 2px;
}

.fulltext-word:hover {
  text-decoration: underline;
}

.fulltext-word.current-word-highlight {
  background-color: rgba(235, 87, 87, 0.2);
  color: var(--accent-orp);
  font-weight: 600;
  padding: 0 2px;
}

/* Settings Rows */
.settings-body {
  gap: 16px;
}

.notion-setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 4px 0;
}

.notion-setting-row.column-layout {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.setting-row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.setting-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.setting-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.notion-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
}

.notion-toggle-group {
  display: inline-flex;
  background: var(--bg-hover);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.notion-toggle-opt {
  padding: 4px 10px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
}

.notion-toggle-opt.active {
  background: var(--bg-app);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.ambient-style-opt,
.ambient-blur-opt {
  font-size: 11px;
  padding: 3px 8px;
}

/* Ambient Art Preview Card in Settings */
.ambient-art-preview-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--bg-hover, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.ambient-art-preview-card:hover {
  background: var(--bg-active, rgba(255, 255, 255, 0.09));
  border-color: var(--accent, #ed8d91);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.art-preview-thumb-wrap {
  position: relative;
  width: 64px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background: #111;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.art-preview-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.art-preview-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  opacity: 0.6;
}

.art-preview-info {
  flex: 1;
  min-width: 0;
}

.art-preview-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.art-preview-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.art-preview-action-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--accent, #eb5757);
}

.art-preview-style-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(235, 87, 87, 0.12);
  color: var(--accent, #eb5757);
  border: 1px solid rgba(235, 87, 87, 0.22);
}

/* Lightbox Modal & Actions */
.ambient-art-modal-card {
  max-width: min(920px, calc(100vw - 32px)) !important;
  width: 100%;
  border-radius: 20px !important;
}

.art-modal-frame {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #0a0a0c;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}

.art-modal-frame img {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  display: block;
  transition: transform 0.25s ease;
}

.art-modal-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(12, 12, 14, 0.85);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  z-index: 10;
}

.art-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent, #eb5757);
  border-radius: 50%;
  animation: artSpin 0.8s linear infinite;
}

@keyframes artSpin {
  to { transform: rotate(360deg); }
}

.art-modal-prompt {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--bg-hover, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  font-size: 11.5px;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  line-height: 1.5;
  user-select: text;
}

.art-header-action {
  font-size: 11px !important;
  padding: 3px 9px !important;
  text-decoration: none !important;
  gap: 4px !important;
  cursor: pointer;
}

.header-art-btn {
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.header-art-btn:hover {
  color: var(--accent, #eb5757);
  background: var(--bg-hover, rgba(255, 255, 255, 0.08));
}

.notion-color-picker {
  display: flex;
  gap: 8px;
}

.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.color-dot:hover {
  transform: scale(1.15);
}

.color-dot.active {
  border-color: var(--text-primary);
  transform: scale(1.2);
}

.notion-select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  cursor: pointer;
  max-width: 280px;
}

#fontFamilySelect optgroup {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 4px 6px;
}

#fontFamilySelect option {
  font-size: 13px;
  padding: 4px 8px;
  color: var(--text-primary);
}

#fontFamilySelect option[value*="Inter"] { font-family: 'Inter', sans-serif; }
#fontFamilySelect option[value*="Lexend"] { font-family: 'Lexend', sans-serif; }
#fontFamilySelect option[value*="Manrope"] { font-family: 'Manrope', sans-serif; }
#fontFamilySelect option[value*="PT Sans"] { font-family: 'PT Sans', sans-serif; }
#fontFamilySelect option[value*="Literata"] { font-family: 'Literata', Georgia, serif; }
#fontFamilySelect option[value*="Newsreader"] { font-family: 'Newsreader', Georgia, serif; }
#fontFamilySelect option[value*="Lora"] { font-family: 'Lora', Georgia, serif; }
#fontFamilySelect option[value*="Merriweather"] { font-family: 'Merriweather', Georgia, serif; }
#fontFamilySelect option[value*="EB Garamond"] { font-family: 'EB Garamond', Georgia, serif; }
#fontFamilySelect option[value*="PT Serif"] { font-family: 'PT Serif', Georgia, serif; }
#fontFamilySelect option[value*="Bitter"] { font-family: 'Bitter', Georgia, serif; }
#fontFamilySelect option[value*="Fira Code"] { font-family: 'Fira Code', monospace; }

/* Notion Switch */
.notion-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.notion-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-strong);
  transition: 0.2s;
  border-radius: 20px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  transition: 0.2s;
  border-radius: 50%;
}

input:checked + .switch-slider {
  background-color: var(--accent-primary);
}

body.theme-notion-dark input:checked + .switch-slider,
body.theme-notion-oled input:checked + .switch-slider {
  background-color: #34c759;
}

input:checked + .switch-slider:before {
  transform: translateX(16px);
}

/* Notion Shortcuts Box */
.notion-shortcuts-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 10px 14px;
}

body.theme-notion-dark .notion-shortcuts-box,
body.theme-notion-oled .notion-shortcuts-box {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.shortcuts-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shortcut-item kbd {
  font-family: inherit;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

body.theme-notion-dark .shortcut-item kbd,
body.theme-notion-oled .shortcut-item kbd {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

/* Search Bar */
.notion-search-bar {
  display: flex;
  gap: 6px;
}

.notion-search-bar input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.notion-search-bar input:focus {
  border-color: var(--accent-primary);
  background: var(--bg-app);
}

body.theme-notion-dark .notion-search-bar input:focus,
body.theme-notion-oled .notion-search-bar input:focus,
body.theme-notion-dark .notion-select:focus,
body.theme-notion-oled .notion-select:focus {
  border-color: rgba(255, 255, 255, 0.40);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.search-result-snippet {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.search-match-highlight {
  color: var(--accent-orp);
  font-weight: 600;
}

.empty-state {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  padding: 24px 0;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* ========================================================
   COGNITIVE FEATURES (ANCHOR CARD, DICTIONARY, ANALYTICS)
   ======================================================== */
.anchor-card-slot {
  position: absolute;
  bottom: 114px;
  left: 50%;
  transform: translateX(-50%);
  width: min(660px, calc(100vw - 32px));
  z-index: 40;
  pointer-events: none;
}

.anchor-card-slot > * {
  pointer-events: auto;
}

/* Dictionary Card in RSVP Canvas */
.dictionary-card-slot {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 520px;
}

.dictionary-card-slot:not(:empty) {
  min-height: 48px;
  margin-top: 14px;
}

.notion-dict-card {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  font-size: 13px;
  line-height: 1.4;
  animation: modalFadeIn 0.15s ease-out;
}

.dict-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(35, 131, 226, 0.12);
  color: var(--accent-primary);
  text-transform: uppercase;
}

body.theme-notion-dark .dict-badge,
body.theme-notion-oled .dict-badge {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.dict-word {
  font-weight: 600;
  color: var(--text-primary);
}

.dict-def {
  color: var(--text-secondary);
}

/* Analytics Dashboard */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.analytics-stat-card:last-child:nth-child(odd) {
  grid-column: span 2;
}

.analytics-stat-card {
  padding: 16px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body.theme-notion-dark .analytics-stat-card,
body.theme-notion-oled .analytics-stat-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-number {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}

.eye-break-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  margin-top: 14px;
}

.eye-break-icon {
  font-size: 26px;
}

/* ========================================================
   RESPONSIVE DESIGN
   ======================================================== */
@media (max-width: 600px) {
  :root {
    --font-size-word: 36px;
  }

  .notion-top-bar {
    margin: 6px 8px 0 8px;
    padding: 6px 12px;
  }

  .notion-dock {
    margin: 0 auto 10px auto;
    width: calc(100% - 16px);
    height: 48px;
    padding: 0 8px 0 6px;
    gap: 10px;
  }

  .notion-play-pill {
    height: 34px;
    padding: 0 14px;
  }

  .shortcuts-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================================
   ACTIVE RECALL (CLOZE TESTING EFFECT) NOTION CARD
   Roediger & Karpicke (2006)
   ======================================================== */
.cloze-recall-card {
  box-sizing: border-box;
  width: 100%;
  margin: 0 auto;
  padding: 16px 22px 14px 22px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.09) 0%,
    rgba(28, 28, 28, 0.88) 38%,
    rgba(16, 16, 16, 0.95) 100%
  );
  backdrop-filter: blur(44px) saturate(180%) contrast(104%);
  -webkit-backdrop-filter: blur(44px) saturate(180%) contrast(104%);
  color: #ffffff;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  border-left: 1px solid rgba(255, 255, 255, 0.09);
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 24px;
  box-shadow: 
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.22),
    0 24px 64px rgba(0, 0, 0, 0.75);
  font-family: var(--font-sans);
  animation: contextAnchorFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transition: background 0.2s ease, border-color 0.2s ease;
  position: relative;
  z-index: 40;
}

.cloze-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  user-select: none;
}

.cloze-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.cloze-icon {
  font-size: 14px;
}

.cloze-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 10px;
}

.cloze-sentence {
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-primary);
  margin-bottom: 14px;
  word-break: break-word;
}

.cloze-blank {
  display: inline-block;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-orp, #eb5757);
  border-bottom: 2px dashed var(--accent-orp, #eb5757);
  padding: 0 4px;
}

.cloze-options {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.cloze-opt-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.14s ease;
  user-select: none;
}

.cloze-opt-btn:hover:not(:disabled) {
  background: var(--bg-active);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.cloze-opt-btn kbd {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.cloze-opt-btn.is-correct {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: #10b981 !important;
  color: #059669 !important;
}

.cloze-opt-btn.is-wrong {
  background: rgba(235, 87, 87, 0.12) !important;
  border-color: #eb5757 !important;
  color: #dc2626 !important;
  opacity: 0.75;
}

.cloze-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
}

.cloze-feedback {
  color: var(--text-tertiary);
  font-size: 12px;
}

.cloze-feedback .feedback-success {
  color: #10b981;
  font-weight: 600;
}

.cloze-feedback .feedback-fail {
  color: var(--accent-orp, #eb5757);
  font-weight: 500;
}

.cloze-skip-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 5px;
  transition: all 0.12s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cloze-skip-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.cloze-skip-btn kbd {
  font-family: inherit;
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
}

/* ========================================================
   LIGHT & WARM THEMES: MACOS FROSTED GLASS SURFACES
   ======================================================== */
body.theme-notion-light,
body.theme-notion-warm {
  --guide-color: rgba(55, 53, 47, 0.35);
}

/* Light Theme macOS Frosted Glass: Top Bar */
body.theme-notion-light .notion-top-bar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.64) 100%);
  backdrop-filter: blur(42px) saturate(200%);
  -webkit-backdrop-filter: blur(42px) saturate(200%);
  border-top: 1px solid rgba(255, 255, 255, 0.85);
  border-left: 1px solid rgba(0, 0, 0, 0.055);
  border-right: 1px solid rgba(0, 0, 0, 0.055);
  border-bottom: 1px solid rgba(0, 0, 0, 0.065);
  box-shadow: 
    inset 0 0.5px 0 0 #ffffff,
    0 12px 34px -10px rgba(0, 0, 0, 0.07),
    0 4px 12px -4px rgba(0, 0, 0, 0.03);
}

body.theme-notion-warm .notion-top-bar {
  background: linear-gradient(180deg, rgba(253, 252, 250, 0.84) 0%, rgba(248, 246, 242, 0.66) 100%);
  backdrop-filter: blur(42px) saturate(200%);
  -webkit-backdrop-filter: blur(42px) saturate(200%);
  border-top: 1px solid rgba(255, 255, 255, 0.85);
  border-left: 1px solid rgba(61, 55, 48, 0.065);
  border-right: 1px solid rgba(61, 55, 48, 0.065);
  border-bottom: 1px solid rgba(61, 55, 48, 0.075);
  box-shadow: 
    inset 0 0.5px 0 0 #ffffff,
    0 12px 34px -10px rgba(61, 55, 48, 0.07),
    0 4px 12px -4px rgba(61, 55, 48, 0.03);
}

body.theme-notion-light .book-title,
body.theme-notion-warm .book-title {
  color: var(--text-primary);
}

body.theme-notion-light .notion-breadcrumb-sep,
body.theme-notion-warm .notion-breadcrumb-sep {
  color: var(--text-tertiary);
}

body.theme-notion-light .notion-btn-subtle {
  background: rgba(0, 0, 0, 0.035);
  border: 1px solid rgba(0, 0, 0, 0.055);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.8);
  color: var(--text-primary);
}

body.theme-notion-light .notion-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  color: var(--text-secondary);
}

body.theme-notion-light .notion-btn-subtle:hover,
body.theme-notion-light .notion-icon-btn:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 0.5px 0 #ffffff, 0 2px 6px rgba(0, 0, 0, 0.04);
  color: #111111;
}

body.theme-notion-warm .notion-btn-subtle {
  background: rgba(61, 55, 48, 0.04);
  border: 1px solid rgba(61, 55, 48, 0.065);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.8);
  color: var(--text-primary);
}

body.theme-notion-warm .notion-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  color: var(--text-secondary);
}

body.theme-notion-warm .notion-btn-subtle:hover,
body.theme-notion-warm .notion-icon-btn:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(61, 55, 48, 0.09);
  box-shadow: inset 0 0.5px 0 #ffffff, 0 2px 6px rgba(61, 55, 48, 0.04);
  color: #111111;
}

/* Light Theme macOS Frosted Glass: Sub-header Pills */
body.theme-notion-light .notion-pill-btn,
body.theme-notion-light .chapter-concepts-pill,
body.theme-notion-light .ambient-scene-pill,
body.theme-notion-light .session-timer-pill,
body.theme-notion-light .eye-tracker-pill {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.80) 0%, rgba(255, 255, 255, 0.62) 100%);
  border: 1px solid rgba(0, 0, 0, 0.055);
  box-shadow: inset 0 0.5px 0 #ffffff, 0 4px 12px rgba(0, 0, 0, 0.04);
  color: var(--text-secondary);
}

body.theme-notion-warm .notion-pill-btn,
body.theme-notion-warm .chapter-concepts-pill,
body.theme-notion-warm .ambient-scene-pill,
body.theme-notion-warm .session-timer-pill,
body.theme-notion-warm .eye-tracker-pill {
  background: linear-gradient(180deg, rgba(253, 252, 250, 0.82) 0%, rgba(248, 246, 242, 0.65) 100%);
  border: 1px solid rgba(61, 55, 48, 0.065);
  box-shadow: inset 0 0.5px 0 #ffffff, 0 4px 12px rgba(61, 55, 48, 0.04);
  color: var(--text-secondary);
}

/* Light Theme macOS Frosted Glass: Dock */
body.theme-notion-light .notion-dock {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84) 0%, rgba(255, 255, 255, 0.68) 100%);
  backdrop-filter: blur(44px) saturate(200%);
  -webkit-backdrop-filter: blur(44px) saturate(200%);
  border-top: 1px solid rgba(255, 255, 255, 0.88);
  border-left: 1px solid rgba(0, 0, 0, 0.06);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid rgba(0, 0, 0, 0.075);
  box-shadow: 
    inset 0 0.5px 0 0 #ffffff,
    0 20px 50px -12px rgba(0, 0, 0, 0.11),
    0 6px 20px -4px rgba(0, 0, 0, 0.05);
}

body.theme-notion-warm .notion-dock {
  background: linear-gradient(180deg, rgba(253, 252, 250, 0.86) 0%, rgba(248, 246, 242, 0.70) 100%);
  backdrop-filter: blur(44px) saturate(200%);
  -webkit-backdrop-filter: blur(44px) saturate(200%);
  border-top: 1px solid rgba(255, 255, 255, 0.88);
  border-left: 1px solid rgba(61, 55, 48, 0.065);
  border-right: 1px solid rgba(61, 55, 48, 0.065);
  border-bottom: 1px solid rgba(61, 55, 48, 0.08);
  box-shadow: 
    inset 0 0.5px 0 0 #ffffff,
    0 20px 50px -12px rgba(61, 55, 48, 0.11),
    0 6px 20px -4px rgba(61, 55, 48, 0.05);
}

body.theme-notion-light .notion-play-pill {
  background: #18191c;
  color: #ffffff;
  border: none;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.16);
}

body.theme-notion-light .notion-play-pill:hover {
  background: #000000;
  color: #ffffff;
  transform: scale(1.02);
}

body.theme-notion-warm .notion-play-pill {
  background: #322b24;
  color: #ffffff;
  border: none;
  box-shadow: 0 3px 12px rgba(50, 43, 36, 0.16);
}

body.theme-notion-warm .notion-play-pill:hover {
  background: #1e1914;
  color: #ffffff;
  transform: scale(1.02);
}

body.theme-notion-light .dock-scrubber-meta,
body.theme-notion-warm .dock-scrubber-meta {
  color: var(--text-tertiary);
}

body.theme-notion-light .dock-undo-inline,
body.theme-notion-warm .dock-undo-inline {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
}

body.theme-notion-light .wpm-control-badge {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(0, 0, 0, 0.03) 100%);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: inset 0 0.5px 0 #ffffff;
}

body.theme-notion-warm .wpm-control-badge {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(61, 55, 48, 0.04) 100%);
  border: 1px solid rgba(61, 55, 48, 0.07);
  box-shadow: inset 0 0.5px 0 #ffffff;
}

body.theme-notion-light .wpm-badge-number,
body.theme-notion-warm .wpm-badge-number {
  color: var(--text-primary);
}

body.theme-notion-light .wpm-badge-label,
body.theme-notion-warm .wpm-badge-label {
  color: var(--text-tertiary);
}

body.theme-notion-light .wpm-stepper-btn,
body.theme-notion-warm .wpm-stepper-btn {
  background: transparent;
  color: var(--text-secondary);
}

body.theme-notion-light .wpm-stepper-btn:hover {
  background: rgba(0, 0, 0, 0.07);
  color: #111111;
}

body.theme-notion-warm .wpm-stepper-btn:hover {
  background: rgba(61, 55, 48, 0.08);
  color: #111111;
}

body.theme-notion-light .notion-slider {
  --slider-fill-color: #18191c;
  --slider-track-color: rgba(0, 0, 0, 0.10);
}

body.theme-notion-warm .notion-slider {
  --slider-fill-color: #322b24;
  --slider-track-color: rgba(61, 55, 48, 0.12);
}

body.theme-notion-light .notion-slider::-webkit-slider-thumb {
  background: #18191c;
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

body.theme-notion-warm .notion-slider::-webkit-slider-thumb {
  background: #322b24;
  border: none;
  box-shadow: 0 1px 4px rgba(61, 55, 48, 0.22);
}

/* Light Theme Modals */
body.theme-notion-light .notion-modal-content {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.86) 100%);
  border: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow: inset 0 0.5px 0 #ffffff, 0 24px 60px rgba(0, 0, 0, 0.14);
  color: #37352f;
}

body.theme-notion-light .notion-modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

body.theme-notion-light .close-btn {
  color: var(--text-tertiary);
}

body.theme-notion-light .close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Warm Theme Modals */
body.theme-notion-warm .notion-modal-content {
  background: linear-gradient(180deg, rgba(251, 250, 248, 0.96) 0%, rgba(244, 241, 235, 0.90) 100%);
  border: 1px solid rgba(61, 55, 48, 0.08);
  box-shadow: inset 0 0.5px 0 #ffffff, 0 24px 60px rgba(61, 55, 48, 0.14);
  color: #3d3730;
}

body.theme-notion-warm .notion-modal-header {
  border-bottom: 1px solid rgba(61, 55, 48, 0.08);
}

body.theme-notion-warm .close-btn {
  color: var(--text-tertiary);
}

body.theme-notion-warm .close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ========================================================
   CONTEXT ANCHOR & CLOZE CARDS: SEREIN FROSTED GLASS CAPSULE
   Sleek, atmospheric, optical focus with high-contrast text
   ======================================================== */
.context-anchor-card,
.cloze-recall-card {
  box-sizing: border-box;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px 14px 20px;
  background: var(--glass-solid, rgba(251, 247, 241, 0.94));
  border: 1px solid var(--line, rgba(255, 255, 255, 0.6));
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.05);
  -webkit-backdrop-filter: blur(32px) saturate(1.25);
  backdrop-filter: blur(32px) saturate(1.25);
  color: var(--ink, #24211e);
  font-family: var(--reader-font, "Manrope", "Inter", sans-serif);
  animation: contextAnchorFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  z-index: 40;
}

.theme-night .context-anchor-card,
body.theme-night .context-anchor-card,
body.theme-notion-dark .context-anchor-card,
body.theme-notion-oled .context-anchor-card,
.theme-night .cloze-recall-card,
body.theme-night .cloze-recall-card,
body.theme-notion-dark .cloze-recall-card,
body.theme-notion-oled .cloze-recall-card {
  background: rgba(31, 30, 30, 0.92) !important;
  border: 1px solid rgba(255, 250, 242, 0.12) !important;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  color: #f4ede5 !important;
}

.theme-dawn .context-anchor-card,
body.theme-dawn .context-anchor-card,
body.theme-notion-light .context-anchor-card,
.theme-dawn .cloze-recall-card,
body.theme-dawn .cloze-recall-card,
body.theme-notion-light .cloze-recall-card {
  background: rgba(251, 247, 241, 0.94) !important;
  border: 1px solid rgba(255, 255, 255, 0.7) !important;
  box-shadow: 0 20px 60px rgba(57, 43, 31, 0.18), 0 2px 8px rgba(57, 43, 31, 0.05) !important;
  color: #24211e !important;
}

.theme-paper .context-anchor-card,
body.theme-paper .context-anchor-card,
body.theme-notion-warm .context-anchor-card,
.theme-paper .cloze-recall-card,
body.theme-paper .cloze-recall-card,
body.theme-notion-warm .cloze-recall-card {
  background: rgba(249, 242, 230, 0.94) !important;
  border: 1px solid rgba(255, 252, 243, 0.65) !important;
  box-shadow: 0 20px 60px rgba(67, 53, 40, 0.15) !important;
  color: #2b251f !important;
}

@keyframes contextAnchorFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.context-anchor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  user-select: none;
  gap: 8px;
}

.context-anchor-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint, var(--muted, #7b7770));
}

.theme-night .context-anchor-title,
body.theme-night .context-anchor-title {
  color: rgba(244, 237, 229, 0.55) !important;
}

.context-anchor-title-icon {
  width: 14px;
  height: 14px;
  color: var(--accent, #db6750);
  opacity: 0.9;
  flex-shrink: 0;
}

.context-anchor-meta {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink-soft, var(--muted, #7b7770));
  background: var(--hover, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--line-subtle, rgba(0, 0, 0, 0.06));
  padding: 2px 8px;
  border-radius: 999px;
}

.theme-night .context-anchor-meta,
body.theme-night .context-anchor-meta {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: rgba(244, 237, 229, 0.7) !important;
}

.context-anchor-header-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.context-anchor-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 25px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft, var(--muted, #7b7770));
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.context-anchor-nav-btn:hover {
  background: var(--hover, rgba(0, 0, 0, 0.06));
  color: var(--ink, #24211e);
  border-color: var(--line-subtle, rgba(0, 0, 0, 0.08));
}

.theme-night .context-anchor-nav-btn,
body.theme-night .context-anchor-nav-btn {
  color: rgba(244, 237, 229, 0.65) !important;
}

.theme-night .context-anchor-nav-btn:hover,
body.theme-night .context-anchor-nav-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #f4ede5 !important;
}

.context-anchor-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink-soft, var(--muted, #7b7770));
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.context-anchor-close-btn:hover {
  background: var(--hover, rgba(0, 0, 0, 0.06));
  color: var(--ink, #24211e);
  border-color: var(--line-subtle, rgba(0, 0, 0, 0.08));
}

.theme-night .context-anchor-close-btn,
body.theme-night .context-anchor-close-btn {
  color: rgba(244, 237, 229, 0.6) !important;
}

.theme-night .context-anchor-close-btn:hover,
body.theme-night .context-anchor-close-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #f4ede5 !important;
}

.context-anchor-body {
  font-family: var(--reader-font, "Manrope", "Inter", sans-serif);
  font-size: 16px;
  line-height: 1.68;
  letter-spacing: -0.01em;
  color: var(--ink, #24211e);
  word-break: break-word;
  padding: 2px 0 12px 0;
}

.theme-night .context-anchor-body,
body.theme-night .context-anchor-body {
  color: #f4ede5 !important;
}

.theme-paper .context-anchor-body,
body.theme-paper .context-anchor-body {
  color: #2b251f !important;
}

.context-anchor-word {
  display: inline;
  cursor: pointer;
  padding: 2px 4px;
  margin: 0 -2px;
  border-radius: 6px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.context-anchor-word:hover {
  background: var(--hover, rgba(0, 0, 0, 0.07));
  color: var(--ink, #24211e);
}

.theme-night .context-anchor-word:hover,
body.theme-night .context-anchor-word:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

/* Serein Accent Focus Highlight for Current Word */
.context-anchor-word.context-anchor-current-word {
  background: rgba(219, 103, 80, 0.14) !important;
  color: var(--accent, #db6750) !important;
  font-weight: 600 !important;
  padding: 2px 6px !important;
  margin: 0 -1px;
  border-radius: 6px !important;
  border: 1px solid rgba(219, 103, 80, 0.35) !important;
  box-shadow: 0 1px 4px rgba(219, 103, 80, 0.12) !important;
}

.theme-night .context-anchor-word.context-anchor-current-word,
body.theme-night .context-anchor-word.context-anchor-current-word {
  background: rgba(237, 141, 145, 0.18) !important;
  color: #ed8d91 !important;
  border-color: rgba(237, 141, 145, 0.4) !important;
  box-shadow: 0 1px 6px rgba(237, 141, 145, 0.25) !important;
}

.context-anchor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-subtle, rgba(0, 0, 0, 0.07));
  user-select: none;
}

.theme-night .context-anchor-footer,
body.theme-night .context-anchor-footer {
  border-top-color: rgba(255, 250, 242, 0.09) !important;
}

.context-anchor-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-faint, var(--muted, #7b7770));
}

.theme-night .context-anchor-hint,
body.theme-night .context-anchor-hint {
  color: rgba(244, 237, 229, 0.5) !important;
}

.context-anchor-hint-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green, #4ca57c);
  flex-shrink: 0;
}

.context-anchor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.context-anchor-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 29px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--contrast, #1d1b19);
  color: var(--contrast-ink, #fffdf8);
  border: 1px solid transparent;
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, background 0.15s ease;
}

.context-anchor-action-btn:hover {
  transform: scale(1.02);
}

.theme-night .context-anchor-action-btn,
body.theme-night .context-anchor-action-btn {
  background: #e7e0eb !important;
  color: #2b2933 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
}

.context-anchor-kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 9.5px;
  font-family: inherit;
  font-weight: 500;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
}

.theme-night .context-anchor-kbd,
body.theme-night .context-anchor-kbd {
  background: rgba(0, 0, 0, 0.12) !important;
}

/* Cloze Active Recall Cards in Serein Style */
.cloze-sentence {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 14px;
  word-break: break-word;
}

.theme-night .cloze-sentence,
body.theme-night .cloze-sentence {
  color: #f4ede5 !important;
}

.cloze-title {
  color: var(--ink-faint, var(--muted));
}

.theme-night .cloze-title,
body.theme-night .cloze-title {
  color: rgba(244, 237, 229, 0.6) !important;
}

.cloze-opt-btn {
  background: var(--hover, rgba(0, 0, 0, 0.05)) !important;
  border: 1px solid var(--line-subtle, rgba(0, 0, 0, 0.08)) !important;
  color: var(--ink) !important;
  border-radius: 10px !important;
  font-family: inherit;
  font-size: 13px;
  transition: all 0.14s ease;
}

.cloze-opt-btn:hover:not(:disabled) {
  background: var(--contrast) !important;
  color: var(--contrast-ink) !important;
  border-color: transparent !important;
}

.theme-night .cloze-opt-btn,
body.theme-night .cloze-opt-btn {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #f4ede5 !important;
}

.theme-night .cloze-opt-btn:hover:not(:disabled),
body.theme-night .cloze-opt-btn:hover:not(:disabled) {
  background: #e7e0eb !important;
  color: #2b2933 !important;
}

.cloze-opt-btn kbd {
  background: rgba(0, 0, 0, 0.07) !important;
  border: 1px solid rgba(0, 0, 0, 0.10) !important;
  color: inherit !important;
  border-radius: 4px;
  font-size: 10px;
}

.theme-night .cloze-opt-btn kbd,
body.theme-night .cloze-opt-btn kbd {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #f4ede5 !important;
}

.cloze-footer {
  border-top: 1px solid var(--line-subtle, rgba(0, 0, 0, 0.07)) !important;
  color: var(--ink-faint, var(--muted)) !important;
}

.theme-night .cloze-footer,
body.theme-night .cloze-footer {
  border-top-color: rgba(255, 250, 242, 0.09) !important;
  color: rgba(244, 237, 229, 0.55) !important;
}

.cloze-skip-btn {
  color: var(--ink-faint, var(--muted)) !important;
  font-size: 11px;
}

.theme-night .cloze-skip-btn,
body.theme-night .cloze-skip-btn {
  color: rgba(244, 237, 229, 0.6) !important;
}

/* ================= BOOK LOADING PRELOADER ================= */
.book-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: loadingFadeIn 0.18s ease-out;
  transition: opacity 0.22s ease;
}

.book-loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.book-loading-card {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.09) 0%,
    rgba(28, 28, 28, 0.88) 38%,
    rgba(16, 16, 16, 0.95) 100%
  );
  backdrop-filter: blur(44px) saturate(180%) contrast(104%);
  -webkit-backdrop-filter: blur(44px) saturate(180%) contrast(104%);
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  border-left: 1px solid rgba(255, 255, 255, 0.09);
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 26px;
  padding: 28px 36px;
  width: 90%;
  max-width: 380px;
  text-align: center;
  box-shadow: 
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.22),
    0 24px 64px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: loadingScaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.book-loading-spinner-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.book-loading-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: #ffffff;
  border-right-color: rgba(255, 255, 255, 0.45);
  animation: spinRing 0.75s linear infinite;
}

.book-loading-pulse {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, transparent 70%);
  animation: pulseGlow 1.5s ease-in-out infinite;
}

.book-loading-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.01em;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-loading-status {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  min-height: 16px;
  line-height: 1.35;
}

.book-loading-bar-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.book-loading-bar-fill {
  height: 100%;
  width: 35%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.4), #ffffff);
  border-radius: 2px;
  animation: indeterminateBar 1.4s ease-in-out infinite;
}

/* Light Theme Book Loading Preloader */
body.theme-notion-light .book-loading-overlay {
  background: rgba(255, 255, 255, 0.65);
}

body.theme-notion-light .book-loading-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 248, 248, 0.90) 100%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 1px 0 #ffffff, 0 20px 48px rgba(0, 0, 0, 0.15);
  color: #1d1d1f;
}

body.theme-notion-light .book-loading-spinner {
  border-color: rgba(0, 0, 0, 0.12);
  border-top-color: #1d1d1f;
  border-right-color: rgba(0, 0, 0, 0.45);
}

body.theme-notion-light .book-loading-pulse {
  background: radial-gradient(circle, rgba(0, 0, 0, 0.08) 0%, transparent 70%);
}

body.theme-notion-light .book-loading-title {
  color: #1d1d1f;
}

body.theme-notion-light .book-loading-status {
  color: rgba(0, 0, 0, 0.65);
}

body.theme-notion-light .book-loading-bar-track {
  background: rgba(0, 0, 0, 0.08);
}

body.theme-notion-light .book-loading-bar-fill {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.3), #1d1d1f);
}

/* Warm Theme Book Loading Preloader */
body.theme-notion-warm .book-loading-overlay {
  background: rgba(251, 250, 248, 0.70);
}

body.theme-notion-warm .book-loading-card {
  background: linear-gradient(180deg, rgba(251, 250, 248, 0.96) 0%, rgba(244, 241, 235, 0.92) 100%);
  border: 1px solid rgba(61, 55, 48, 0.10);
  border-top: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 1px 0 #ffffff, 0 20px 48px rgba(61, 55, 48, 0.15);
  color: #3d3730;
}

body.theme-notion-warm .book-loading-spinner {
  border-color: rgba(61, 55, 48, 0.12);
  border-top-color: #3d3730;
  border-right-color: rgba(61, 55, 48, 0.45);
}

body.theme-notion-warm .book-loading-pulse {
  background: radial-gradient(circle, rgba(61, 55, 48, 0.08) 0%, transparent 70%);
}

body.theme-notion-warm .book-loading-title {
  color: #3d3730;
}

body.theme-notion-warm .book-loading-status {
  color: rgba(61, 55, 48, 0.65);
}

body.theme-notion-warm .book-loading-bar-track {
  background: rgba(61, 55, 48, 0.08);
}

body.theme-notion-warm .book-loading-bar-fill {
  background: linear-gradient(90deg, rgba(61, 55, 48, 0.3), #3d3730);
}

@keyframes spinRing {
  to { transform: rotate(360deg); }
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(0.85); opacity: 0.35; }
  50% { transform: scale(1.25); opacity: 0.85; }
}

@keyframes indeterminateBar {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(120%); }
  100% { transform: translateX(300%); }
}

@keyframes loadingFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes loadingScaleUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ========================================================
   ONLINE PUBLIC DOMAIN LIBRARY (WIKISOURCE & OPEN REPO)
   ======================================================== */
.ab-online-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 8px 36px 48px;
  animation: loadingFadeIn 0.22s ease-out;
}

.ab-online-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.ab-online-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 5px 8px 5px 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ab-online-search-wrap:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.15);
}

body.theme-notion-dark .ab-online-search-wrap:focus-within,
body.theme-notion-oled .ab-online-search-wrap:focus-within {
  border-color: rgba(255, 255, 255, 0.40);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.ab-online-search-icon {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.ab-online-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 14.5px;
  color: var(--text-primary);
}

.ab-online-search-input::placeholder {
  color: var(--text-tertiary);
}

.ab-online-search-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 16px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  color: #ffffff;
  background: var(--accent-primary);
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: opacity 0.16s ease, transform 0.16s ease;
  flex-shrink: 0;
}

.ab-online-search-submit:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.ab-online-search-submit:active {
  transform: translateY(0);
}

body.theme-notion-dark .ab-online-search-submit,
body.theme-notion-oled .ab-online-search-submit {
  background: #ffffff;
  color: #121212;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

body.theme-notion-dark .ab-online-search-submit:hover,
body.theme-notion-oled .ab-online-search-submit:hover {
  background: #f0f0f0;
}

.ab-online-lang-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ab-lang-pill {
  padding: 4px 12px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.16s ease;
}

.ab-lang-pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ab-lang-pill.active {
  background: rgba(35, 131, 226, 0.12);
  border-color: rgba(35, 131, 226, 0.4);
  color: var(--accent-primary);
  font-weight: 600;
}

body.theme-notion-dark .ab-lang-pill.active,
body.theme-notion-oled .ab-lang-pill.active {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

.ab-author-chips-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ab-chips-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.ab-author-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ab-author-chip {
  padding: 4px 11px;
  font-size: 12px;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.ab-author-chip:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
  background: rgba(35, 131, 226, 0.08);
  transform: translateY(-1px);
}

.ab-author-chip.active {
  color: #ffffff;
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(35, 131, 226, 0.35);
}

body.theme-notion-dark .ab-author-chip:hover,
body.theme-notion-oled .ab-author-chip:hover {
  border-color: rgba(255, 255, 255, 0.30);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

body.theme-notion-dark .ab-author-chip.active,
body.theme-notion-oled .ab-author-chip.active {
  color: #121212;
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.ab-online-status {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ab-online-status.is-loading {
  color: var(--accent-primary);
}

body.theme-notion-dark .ab-online-status.is-loading,
body.theme-notion-oled .ab-online-status.is-loading {
  color: #ffffff;
}

.ab-online-bridge-banner {
  margin-top: 18px;
  padding: 16px 20px;
  border-radius: 10px;
  background: rgba(35, 131, 226, 0.07);
  border: 1px solid rgba(35, 131, 226, 0.22);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

body.theme-notion-dark .ab-online-bridge-banner,
body.theme-notion-oled .ab-online-bridge-banner {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.ab-online-bridge-text {
  font-size: 13.5px;
  color: var(--text-primary);
}

.ab-online-bridge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  background: var(--accent-primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

body.theme-notion-dark .ab-online-bridge-btn,
body.theme-notion-oled .ab-online-bridge-btn {
  background: #ffffff;
  color: #121212;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

body.theme-notion-dark .ab-online-bridge-btn:hover,
body.theme-notion-oled .ab-online-bridge-btn:hover {
  background: #f0f0f0;
}

.ab-online-bridge-btn:hover {
  opacity: 0.9;
}

/* ========================================================
   DYNAMIC WORD LENGTH SCALING & MOBILE / PWA UX
   ======================================================== */
.rsvp-viewport {
  --word-length-scale: 1;
}

.ab-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ab-secondary-pill-btn {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: var(--text-primary) !important;
}

.ab-secondary-pill-btn:hover {
  background: rgba(255, 255, 255, 0.12) !important;
}

.mobile-gesture-toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translate(-50%, -10px);
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(22, 22, 22, 0.90);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  z-index: 99999;
  transition: opacity 0.18s ease, transform 0.18s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.mobile-gesture-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

body.theme-notion-light .mobile-gesture-toast {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.10);
  color: #1d1d1f;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

body.theme-notion-warm .mobile-gesture-toast {
  background: rgba(251, 250, 248, 0.94);
  border: 1px solid rgba(61, 55, 48, 0.12);
  color: #3d3730;
  box-shadow: 0 8px 24px rgba(61, 55, 48, 0.10);
}

@media (max-width: 768px) {
  /* Prevent iOS Safari viewport auto-zoom when tapping inputs */
  input, textarea, select {
    font-size: 16px !important;
  }

  .notion-top-bar {
    width: calc(100vw - 16px) !important;
    margin: calc(8px + env(safe-area-inset-top, 0px)) auto 0 auto !important;
    padding: 0 8px !important;
    height: 46px !important;
    gap: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .top-bar-left {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    overflow: hidden !important;
  }

  .notion-breadcrumb-sep {
    display: inline-block !important;
    opacity: 0.35 !important;
    font-size: 11px !important;
    flex-shrink: 0 !important;
  }

  .book-title-wrap {
    display: flex !important;
    align-items: center !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .book-title {
    display: block !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    letter-spacing: -0.01em !important;
  }

  .notion-btn-subtle {
    padding: 5px 7px !important;
    font-size: 11.5px !important;
    flex-shrink: 0 !important;
  }

  .top-bar-right {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
  }

  .notion-icon-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
  }

  /* On narrow phone screens, prioritize essential controls and maximize book title width */
  @media (max-width: 520px) {
    #btnAnalytics,
    #btnFullText {
      display: none !important;
    }
    .notion-lang-capsule {
      padding: 1px !important;
      gap: 1px !important;
      margin-right: 2px !important;
    }
    .notion-lang-btn {
      font-size: 10px !important;
      padding: 2px 5px !important;
    }
  }

  @media (max-width: 380px) {
    #btnOpenFile .btn-text {
      display: none !important;
    }
    #btnOpenFile svg {
      margin-right: 0 !important;
    }
    #btnBookmarks {
      display: none !important;
    }
    .notion-lang-btn {
      font-size: 9px !important;
      padding: 2px 4px !important;
    }
  }

  .notion-sub-header {
    padding: 6px 12px;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .notion-sub-header::-webkit-scrollbar {
    display: none;
  }

  .notion-pill-btn,
  .chapter-concepts-pill {
    flex-shrink: 0;
    font-size: 11.5px;
    padding: 4px 9px;
  }

  /* RSVP Stage & Viewport on Mobile: proportional edge fade so side context words stay visible & natural */
  .rsvp-viewport {
    padding: 0 8px !important;
  }

  .rsvp-left-half {
    mask-image: linear-gradient(to right, transparent 0px, rgba(0, 0, 0, 0.25) 14px, rgba(0, 0, 0, 0.75) 32px, black 48px) !important;
    -webkit-mask-image: linear-gradient(to right, transparent 0px, rgba(0, 0, 0, 0.25) 14px, rgba(0, 0, 0, 0.75) 32px, black 48px) !important;
  }

  .rsvp-right-half {
    mask-image: linear-gradient(to left, transparent 0px, rgba(0, 0, 0, 0.25) 14px, rgba(0, 0, 0, 0.75) 32px, black 48px) !important;
    -webkit-mask-image: linear-gradient(to left, transparent 0px, rgba(0, 0, 0, 0.25) 14px, rgba(0, 0, 0, 0.75) 32px, black 48px) !important;
  }

  .rsvp-meta-row {
    margin-top: 18px !important;
    gap: 8px !important;
  }

  .session-timer-pill,
  .eye-tracker-pill {
    font-size: 11px !important;
    padding: 3px 9px !important;
  }

  /* Anchor Card Slot & Cloze Card above Mobile Dock */
  .anchor-card-slot {
    bottom: calc(66px + env(safe-area-inset-bottom, 0px)) !important;
    width: calc(100vw - 16px) !important;
  }

  .cloze-recall-card {
    padding: 12px 14px 10px 14px !important;
    border-radius: 18px !important;
  }

  /* Floating Liquid Glass Dock optimized for iOS/Android thumb zone & safe area */
  .notion-dock {
    width: calc(100vw - 16px) !important;
    max-width: 500px;
    height: 50px !important;
    margin: 0 auto calc(10px + env(safe-area-inset-bottom, 0px)) auto !important;
    padding: 0 8px !important;
    gap: 8px !important;
    border-radius: 9999px !important;
  }

  .notion-play-pill {
    height: 36px !important;
    padding: 0 12px !important;
    min-width: 42px !important;
  }

  .play-pill-text {
    display: none;
  }

  .dock-scrubber-col {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    padding: 0 2px !important;
    gap: 4px !important;
  }

  .dock-scrubber-meta {
    font-size: 10px !important;
    gap: 6px !important;
  }

  .notion-slider {
    height: 6px !important;
  }

  .notion-slider::-webkit-slider-thumb {
    width: 20px !important;
    height: 20px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45) !important;
  }

  .notion-slider::-moz-range-thumb {
    width: 20px !important;
    height: 20px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45) !important;
  }

  .wpm-control-badge {
    height: 36px !important;
    padding: 0 4px !important;
    gap: 1px !important;
  }

  .wpm-stepper-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 16px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .wpm-readout {
    padding: 0 4px !important;
    gap: 4px !important;
  }

  .wpm-badge-number {
    font-size: 12px !important;
    min-width: 24px !important;
  }

  .wpm-badge-label {
    display: none;
  }

  /* Apple Books Fullscreen Catalog Mobile Layout */
  .apple-books-page {
    flex-direction: column !important;
  }

  .ab-sidebar {
    width: 100% !important;
    min-width: 100% !important;
    height: auto !important;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 8px !important;
    border-right: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 8px !important;
  }

  .ab-sidebar-footer,
  .ab-nav-section-title {
    display: none !important;
  }

  .ab-nav {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    gap: 6px !important;
    padding-bottom: 4px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .ab-nav::-webkit-scrollbar {
    display: none;
  }

  .ab-nav-group {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    margin: 0 !important;
  }

  .ab-nav-item {
    white-space: nowrap !important;
    padding: 6px 12px !important;
    border-radius: 999px !important;
    font-size: 12.5px !important;
    flex-shrink: 0;
  }

  .ab-scroll-canvas {
    padding: 16px 16px 90px !important;
  }

  .ab-page-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
    padding: 0 0 14px !important;
  }

  .ab-page-title {
    font-size: 24px !important;
  }

  .ab-books-grid,
  .ab-shelf-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px 12px !important;
  }

  .ab-online-section {
    padding: 8px 0 40px !important;
  }

  /* Mobile Bottom-Sheet Architecture for All Modals */
  .modal-overlay:not(.apple-books-overlay) {
    padding: 0 !important;
    align-items: flex-end !important;
    justify-content: center !important;
  }

  .notion-modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - env(safe-area-inset-top, 20px) - 16px) !important;
    border-radius: 24px 24px 0 0 !important;
    margin: 0 !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: 0 -10px 48px rgba(0, 0, 0, 0.85), inset 0 1px 1px 0 rgba(255, 255, 255, 0.25) !important;
    animation: modalSheetSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .notion-modal-content::before {
    content: '';
    display: block;
    width: 38px;
    height: 4.5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.32);
    margin: 10px auto 2px auto;
    flex-shrink: 0;
  }

  body.theme-notion-light .notion-modal-content {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 248, 248, 0.96) 100%) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.16), inset 0 1px 0 #ffffff !important;
    color: #1d1d1f !important;
  }

  body.theme-notion-light .notion-modal-content::before {
    background: rgba(0, 0, 0, 0.22) !important;
  }

  body.theme-notion-warm .notion-modal-content {
    background: linear-gradient(180deg, rgba(251, 250, 248, 0.98) 0%, rgba(244, 241, 235, 0.96) 100%) !important;
    border-top: 1px solid rgba(61, 55, 48, 0.10) !important;
    box-shadow: 0 -10px 40px rgba(61, 55, 48, 0.16), inset 0 1px 0 #ffffff !important;
    color: #3d3730 !important;
  }

  body.theme-notion-warm .notion-modal-content::before {
    background: rgba(61, 55, 48, 0.22) !important;
  }

  .ambient-art-layer {
    filter: blur(var(--ambient-blur, 3.5px)) brightness(calc(var(--ambient-brightness, 1) * 0.42)) saturate(var(--ambient-saturate, 0.85)) !important;
  }
  body.theme-notion-light .ambient-art-layer,
  .theme-dawn .ambient-art-layer {
    filter: blur(var(--ambient-blur, 3.5px)) brightness(calc(var(--ambient-brightness, 1) * 1.05)) saturate(0.80) !important;
  }
  body.theme-notion-warm .ambient-art-layer,
  .theme-paper .ambient-art-layer {
    opacity: 0 !important;
  }

  .notion-modal-header {
    padding: 6px 16px 12px 16px !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background: rgba(24, 24, 24, 0.96) !important;
    backdrop-filter: blur(24px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  }

  body.theme-notion-light .notion-modal-header {
    background: rgba(255, 255, 255, 0.96) !important;
  }

  body.theme-notion-warm .notion-modal-header {
    background: rgba(251, 250, 248, 0.96) !important;
  }

  .notion-modal-header .close-btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    font-size: 22px !important;
  }

  body.theme-notion-light .notion-modal-header .close-btn {
    background: rgba(0, 0, 0, 0.08) !important;
    color: #1d1d1f !important;
  }

  body.theme-notion-warm .notion-modal-header .close-btn {
    background: rgba(61, 55, 48, 0.08) !important;
    color: #3d3730 !important;
  }

  .notion-modal-body {
    padding: 14px 16px calc(28px + env(safe-area-inset-bottom, 20px)) 16px !important;
    gap: 14px !important;
  }

  .large-modal {
    max-height: calc(100dvh - env(safe-area-inset-top, 20px) - 16px) !important;
  }

  /* Touch target expansions for settings controls */
  .notion-setting-row {
    min-height: 44px !important;
    padding: 6px 0 !important;
  }

  .color-dot {
    width: 28px !important;
    height: 28px !important;
  }

  .notion-switch {
    width: 44px !important;
    height: 26px !important;
  }

  .switch-slider:before {
    height: 20px !important;
    width: 20px !important;
    left: 3px !important;
    bottom: 3px !important;
  }

  input:checked + .switch-slider:before {
    transform: translateX(18px) !important;
  }

  .notion-item-row {
    min-height: 44px !important;
    padding: 10px 14px !important;
  }

  /* Catalog touch optimizations */
  .catalog-delete-btn {
    opacity: 0.9 !important;
    width: 28px !important;
    height: 28px !important;
    top: 8px !important;
    left: 8px !important;
  }

  .ab-carousel-paddle {
    display: none !important;
  }

  .ab-back-to-reader-btn {
    height: 34px !important;
    padding: 0 12px !important;
    font-size: 13px !important;
  }
}

/* Landscape Mode on Mobile Handsets (Screens with height <= 520px) */
@media (max-height: 520px) and (orientation: landscape) {
  .notion-top-bar {
    height: 38px !important;
    margin-top: calc(4px + env(safe-area-inset-top, 0px)) !important;
  }

  .notion-dock {
    height: 42px !important;
    margin-bottom: calc(6px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .notion-play-pill {
    height: 32px !important;
  }

  .wpm-control-badge {
    height: 32px !important;
  }

  .rsvp-meta-row {
    margin-top: 8px !important;
  }

  .anchor-card-slot {
    bottom: calc(52px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@keyframes modalSheetSlideUp {
  from {
    opacity: 0;
    transform: translateY(48px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}



/* ========================================================
   AUTHENTIC MINIMALIST SPEEDREADER UI FROM minimalist-speedreader-ui-design
   ======================================================== */

:root {
  font-family: var(--font-sans);
  color: #262629;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
}
button,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  color: inherit;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}
button,
input,
textarea {
  outline: none;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus-ring, #8a7c98);
  outline-offset: 4px;
}
::selection {
  background: #e6c1c5;
  color: #28252b;
}
.reader-app {
  --ink: #262629;
  --muted: #77717a;
  --faint: #918b96;
  --accent: #e9696c;
  --green: #45b89a;
  --line: rgba(71, 58, 78, 0.1);
  --glass: rgba(255, 253, 252, 0.65);
  --glass-edge: rgba(255, 255, 255, 0.76);
  --panel: rgba(250, 248, 249, 0.94);
  --hover: rgba(111, 99, 122, 0.075);
  --selected: rgba(255, 255, 255, 0.94);
  --control: #29292b;
  --control-ink: #fff;
  --focus-ring: #8a7c98;
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 480px;
  overflow: hidden;
  isolation: isolate;
  color: var(--ink);
  background: #c8c4d3;
  transition:
    color 0.4s,
    background 0.4s;
}
.atmosphere,
.landscape,
.atmosphere-wash,
.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.atmosphere {
  z-index: -2;
  overflow: hidden;
}
.landscape {
  inset: -14px;
  background: url("images/winter-dawn.jpg") center 57% / cover no-repeat;
  filter: blur(var(--ambient-blur, 4px)) saturate(var(--ambient-saturate, 0.79)) brightness(var(--ambient-brightness, 1));
  opacity: var(--ambient-landscape-opacity, var(--ambient-backdrop-opacity, 1));
  transform: scale(1.035);
  transition:
    opacity 0.8s,
    filter 0.8s;
}
.atmosphere-wash {
  background:
    radial-gradient(
      ellipse at 63% -4%,
      rgba(255, 255, 224, 0.4),
      transparent 37%
    ),
    linear-gradient(
      180deg,
      rgba(255, 213, 203, 0.35) 0%,
      rgba(215, 196, 216, 0.34) 30%,
      rgba(181, 179, 205, 0.53) 100%
    );
  transition:
    background 0.8s,
    opacity 0.8s;
}
.grain {
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.7' filter='url(%23noise)'/%3E%3C/svg%3E");
}
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 8px 28px rgba(73, 61, 88, 0.045);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.topbar {
  position: absolute;
  z-index: 40;
  top: 20px;
  left: 22px;
  right: 22px;
  height: 60px;
  border-radius: 23px;
  padding: 0 17px 0 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.navigation-left {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}
.brand-logo-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(8, 23, 25, 0.55);
  border: 1px solid rgba(184, 243, 76, 0.22);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
}
.brand-logo-pill:hover {
  transform: scale(1.06);
  border-color: rgba(184, 243, 76, 0.55);
  box-shadow: 0 4px 14px rgba(184, 243, 76, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.brand-logo-img {
  width: 20px;
  height: 20px;
  display: block;
  border-radius: 4px;
}
.catalog-button {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(224, 211, 213, 0.11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  height: 35px;
  padding: 0 13px;
  font-size: 14px;
  font-weight: 550;
  transition:
    background 0.2s,
    transform 0.2s;
}
.catalog-button:hover,
.catalog-button.is-active {
  background: var(--selected);
}
.catalog-button:active {
  transform: scale(0.97);
}
.breadcrumb-separator {
  color: #aaa1a5;
  font-size: 20px;
  font-weight: 400;
}
.book-breadcrumb {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 14px;
  letter-spacing: -0.25px;
}
.breadcrumb-author {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: #575054;
  font-weight: 450;
}
.title-separator {
  margin: 0 9px;
  color: #a39a9f;
  font-size: 15px;
}
.book-breadcrumb h1 {
  font-size: inherit;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}
.reader-tools,
.tool-group {
  display: flex;
  align-items: center;
}
.reader-tools {
  gap: 14px;
  flex-shrink: 0;
}
.tool-group {
  gap: 7px;
}
.toolbar-divider {
  height: 18px;
  width: 1px;
  background: var(--line);
}
.icon-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 34px;
  flex-shrink: 0;
  padding: 0;
  color: var(--muted);
  border: 0;
  border-radius: 9px;
  background: transparent;
  transition:
    color 0.2s,
    background 0.2s,
    transform 0.2s;
}
.icon-button:hover {
  color: var(--ink);
  background: var(--hover);
}
.icon-button:active {
  transform: scale(0.93);
}
.icon-button.is-active {
  color: var(--ink);
  background: var(--hover);
}
.icon-button.has-bookmark svg {
  fill: currentColor;
}
.icon-button[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 15px);
  left: 50%;
  transform: translate(-50%, -3px);
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
  padding: 7px 10px;
  border-radius: 7px;
  background: var(--control);
  color: var(--control-ink);
  font-size: 10px;
  font-weight: 450;
  box-shadow: 0 3px 10px #0000000c;
  transition:
    opacity 0.16s,
    transform 0.16s;
}
.icon-button[data-tooltip]:hover::after,
.icon-button[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: 0.4s;
}
.appearance-tools .icon-button:last-child::after {
  left: auto;
  right: -4px;
  transform: translate(0, -3px);
}
.appearance-tools .icon-button:last-child:hover::after {
  transform: translate(0, 0);
}
.segmented-control {
  display: flex;
  align-items: center;
  padding: 3px;
  background: rgba(120, 105, 113, 0.065);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.segmented-control button {
  background: transparent;
  border: none;
  border-radius: 15px;
  color: var(--muted);
  transition:
    background 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}
.segmented-control button:hover {
  color: var(--ink);
}
.segmented-control button.selected {
  color: var(--ink);
  background: var(--selected);
  box-shadow: 0 1px 4px rgba(67, 50, 62, 0.14);
}
.reading-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.reading-composition {
  position: absolute;
  top: 46.2%;
  left: 0;
  width: 100%;
  height: 0;
}
.word-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.4em;
  font-size: calc(clamp(48px, 4.5vw, 86px) * var(--font-scale));
  line-height: 1.15;
  transform: translateY(-50%);
  letter-spacing: -0.025em;
}
.word-stream {
  position: absolute;
  display: flex;
  align-items: baseline;
  top: 50%;
  left: calc(50% - 0.29em);
  transform: translateY(-50%);
  white-space: nowrap;
  font-weight: 550;
}
.word-before {
  position: absolute;
  right: 100%;
}
.word-before,
.word-after {
  text-shadow: 0 0 23px rgba(255, 255, 255, 0.65);
}
.focal-letter {
  display: inline-block;
  width: 0.58em;
  text-align: center;
  transition: color 0.3s;
}
.highlight-letter {
  color: var(--accent);
}
.upcoming-words {
  margin-left: 0.32em;
  width: 64vw;
  overflow: hidden;
  font-weight: 400;
  color: rgba(75, 65, 78, 0.48);
  letter-spacing: 0.005em;
  mask-image: linear-gradient(
    to right,
    black 0%,
    rgba(0, 0, 0, 0.75) 30%,
    transparent 72%
  );
  -webkit-mask-image: linear-gradient(
    to right,
    black 0%,
    rgba(0, 0, 0, 0.75) 30%,
    transparent 72%
  );
  transition: opacity 0.3s;
}
.context-hidden {
  opacity: 0;
}
.guides-hidden .rsvp-guide {
  opacity: 0;
}
.session-timer {
  display: none !important;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  left: 50%;
  top: calc(92px * var(--font-scale));
  transform: translateX(-50%);
  height: 28px;
  border-radius: 16px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  background: rgba(250, 248, 255, 0.66);
}
.status-dot {
  display: inline-block;
  flex-shrink: 0;
  width: 5px;
  height: 5px;
  background: var(--green);
  border-radius: 50%;
}
.timer-playing .status-dot {
  animation: breathe 2s ease-in-out infinite;
}
@keyframes breathe {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 #45b89a00;
  }
  50% {
    opacity: 0.55;
    box-shadow: 0 0 0 4px #45b89a13;
  }
}
.serif-reader .word-track {
  font-family: Georgia, "Times New Roman", serif;
}
.exit-focus {
  position: absolute;
  right: 25px;
  top: 22px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 12px;
}
.exit-focus:hover {
  color: var(--ink);
}
.exit-focus kbd {
  font-size: 9px;
  margin-left: 5px;
  opacity: 0.6;
}
.reader-footer {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 34px;
  margin: 0 auto;
  width: min(760px, calc(100% - 48px));
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 0 !important;
  height: auto !important;
}
.control-dock {
  width: 100%;
  height: 69px;
  border-radius: 37px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px;
  background: rgba(249, 248, 255, 0.76);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 10px 26px rgba(61, 51, 80, 0.1);
}
.play-button {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 103px;
  height: 51px;
  border: none;
  border-radius: 28px;
  background: var(--control);
  color: var(--control-ink);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
  box-shadow: 0 4px 9px rgba(37, 29, 46, 0.12);
  transition:
    transform 0.2s,
    background 0.2s,
    box-shadow 0.2s;
}
.play-button:hover {
  background: #414045;
  box-shadow: 0 5px 13px rgba(37, 29, 46, 0.18);
  transform: translateY(-1px);
}
.play-button:active {
  transform: scale(0.97);
}
.play-button svg {
  margin-left: -2px;
}
.reading-progress {
  flex: 1;
  min-width: 0;
  padding: 2px 0 0;
}
.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 10.5px;
  font-weight: 450;
  color: var(--faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.remaining-time > span,
.word-count > span {
  margin: 0 2px;
}
.progress-slider {
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 3px;
  margin: 12px 0 5px;
  background: linear-gradient(
    to right,
    var(--ink) var(--progress),
    rgba(117, 106, 133, 0.18) var(--progress)
  );
  border-radius: 5px;
  cursor: pointer;
}
.progress-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink);
  border: none;
  box-shadow: 0 2px 4px rgba(40, 36, 48, 0.13);
  transition:
    box-shadow 0.2s,
    transform 0.2s;
}
.progress-slider::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink);
  border: none;
}
.progress-slider:hover::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(117, 106, 133, 0.1);
  transform: scale(1.15);
}
.speed-control {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 49px;
  width: 166px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.56),
    rgba(210, 206, 224, 0.23)
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.speed-control button {
  border: none;
  width: 28px;
  height: 30px;
  padding: 0;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background 0.2s;
}
.speed-control button:hover:not(:disabled) {
  color: var(--ink);
  background: var(--hover);
}
.pace-label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pace-label strong {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.wpm-label {
  font-size: 11px;
  color: var(--faint);
  font-weight: 500;
}
.keyboard-hint {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  height: 16px;
  font-size: 10px;
  font-weight: 450;
  color: rgba(75, 66, 91, 0.48);
}
.keyboard-hint kbd {
  font-family: inherit;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(86, 71, 103, 0.16);
  line-height: 13px;
}
.hint-divider {
  margin: 0 4px;
  opacity: 0.6;
}
.arrow-keys {
  display: flex;
  gap: 3px;
  font-size: 12px;
}
.preview-label {
  opacity: 0.8;
}
.dialog-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  display: flex;
}
.dialog-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  background: rgba(41, 34, 50, 0.12);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
.utility-layer {
  align-items: flex-start;
  justify-content: flex-end;
  padding: 94px 24px 24px;
}
.utility-layer .dialog-backdrop {
  top: 85px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.modal-layer {
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.dialog-panel {
  position: relative;
  pointer-events: auto;
  width: 352px;
  max-width: 100%;
  max-height: calc(100svh - 120px);
  padding: 25px;
  border: 1px solid var(--glass-edge);
  border-radius: 21px;
  background: var(--panel);
  color: var(--ink);
  box-shadow:
    0 18px 65px rgba(48, 34, 64, 0.13),
    0 1px 3px rgba(51, 40, 65, 0.04);
  backdrop-filter: blur(35px);
  -webkit-backdrop-filter: blur(35px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 109, 136, 0.25) transparent;
}
.dialog-panel:focus {
  outline: none;
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 25px;
}
.dialog-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 550;
  letter-spacing: -0.6px;
}
.dialog-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}
.close-button {
  width: 27px;
  height: 27px;
  margin: -2px -4px 0 0;
}
.catalog-panel {
  width: 530px;
  max-height: calc(100svh - 64px);
  padding: 30px;
  border-radius: 25px;
}
.catalog-panel .dialog-heading {
  margin-bottom: 24px;
}
.catalog-panel .dialog-heading h2 {
  font-size: 25px;
  letter-spacing: -1px;
}
.catalog-panel .dialog-heading p {
  font-size: 12px;
}
.search-field {
  height: 41px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--faint);
  background: rgba(255, 255, 255, 0.13);
  transition: border-color 0.2s;
}
.search-field:focus-within {
  border-color: rgba(128, 111, 142, 0.45);
}
.search-field input {
  border: none;
  background: none;
  color: var(--ink);
  font-size: 12px;
  width: 100%;
  min-width: 0;
  height: 100%;
  outline: none;
}
.search-field input::placeholder {
  color: var(--faint);
}
.search-field input:focus-visible {
  outline: none;
}
.search-field button {
  border: none;
  background: transparent;
  display: flex;
  padding: 2px;
  color: var(--muted);
}
.library-list {
  margin: 10px 0 18px;
  max-height: 370px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.library-book {
  display: flex;
  align-items: center;
  gap: 17px;
  width: 100%;
  padding: 17px 5px;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  background: none;
  transition: background 0.2s;
}
.library-book:hover {
  background: var(--hover);
}
.library-book:last-child {
  border-bottom: none;
}
.book-cover {
  width: 49px;
  height: 68px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 1px 4px 4px 1px;
  color: rgba(255, 255, 242, 0.9);
  box-shadow:
    inset 3px 0 0 #00000013,
    2px 3px 5px #44344213;
}
.cover-sage {
  background: #7f9286;
}
.cover-ochre {
  background: #b79a69;
}
.cover-lilac {
  background: #a093af;
}
.cover-rule {
  height: 1px;
  width: 24px;
  background: rgba(255, 255, 242, 0.45);
}
.book-details {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.book-details strong {
  font-size: 14px;
  font-weight: 550;
  letter-spacing: -0.3px;
  line-height: 1.4;
}
.book-details > span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}
.book-details small {
  color: var(--faint);
  font-size: 9px;
  margin-top: 8px;
}
.book-details small > span {
  margin: 0 4px;
}
.current-book-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #7d8a7f;
  font-size: 10px;
}
.book-arrow {
  color: var(--faint);
  margin-right: 4px;
}
.add-text-button {
  border: 1px dashed rgba(135, 118, 147, 0.26);
  background: transparent;
  width: 100%;
  border-radius: 12px;
  padding: 16px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  transition:
    background 0.2s,
    border-color 0.2s;
}
.add-text-button:hover {
  background: var(--hover);
  border-color: rgba(135, 118, 147, 0.5);
}
.add-text-button > span {
  display: flex;
  align-items: center;
  gap: 9px;
}
.add-text-hint {
  color: var(--faint);
  font-size: 10px;
}
.panel-footnote {
  margin: 21px 0 0;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.7;
  text-align: center;
}
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  border: 0;
  padding: 0;
  background: none;
  font-size: 11px;
  line-height: 1.5;
  transition: color 0.2s;
}
.text-button:hover {
  color: var(--ink);
}
.back-link {
  margin: -4px 0 22px;
}
.field-label {
  display: block;
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.text-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9px;
  font-size: 12px;
  margin-bottom: 20px;
}
.text-input::placeholder {
  color: var(--faint);
}
.text-area {
  resize: vertical;
  min-height: 170px;
  max-height: 300px;
  line-height: 1.8;
  margin-bottom: 11px;
}
.import-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.import-actions > span {
  font-size: 10px;
  color: var(--faint);
}
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: 20px;
  background: var(--control);
  color: var(--control-ink);
  padding: 11px 15px;
  font-size: 11px;
}
.primary-button:hover:not(:disabled) {
  opacity: 0.85;
}
.upload-link {
  margin-top: 23px;
}
.chapter-list {
  margin: -7px -5px 0;
}
.chapter-row {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 15px 9px;
  background: none;
  text-align: left;
  font-size: 12px;
  transition: background 0.2s;
}
.chapter-row > span:nth-child(2) {
  flex: 1;
}
.chapter-row:hover,
.selected-chapter {
  background: var(--hover);
}
.chapter-number {
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.chapter-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 3px;
}
.chapter-row > svg {
  color: var(--faint);
}
.panel-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 23px 8px 0;
  color: var(--faint);
  font-size: 10px;
}
.empty-state {
  text-align: center;
  padding: 38px 5px 24px;
  color: var(--faint);
}
.empty-state > svg {
  margin: 0 auto 15px;
  stroke-width: 1.2;
  opacity: 0.65;
}
.empty-state p {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 7px;
}
.empty-state > span {
  font-size: 10px;
  line-height: 1.7;
}
.section-label {
  color: var(--faint);
  letter-spacing: 1.5px;
  font-size: 9px;
  font-weight: 500;
}
.search-results {
  margin-top: 20px;
}
.search-results > .section-label {
  margin: 0 0 9px;
}
.search-result {
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 13px 2px;
  text-align: left;
  gap: 8px;
}
.search-result:hover {
  background: var(--hover);
}
.search-result > span {
  font-size: 12px;
  line-height: 1.8;
}
.search-result small {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 9px;
}
.wide-panel {
  width: 430px;
}
.source-text section {
  padding: 2px 0 22px;
}
.source-text h3 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 23px;
  line-height: 1.4;
  margin: 9px 0 15px;
  letter-spacing: -0.4px;
}
.source-text p {
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 15px;
  line-height: 1.95;
  margin: 0 0 17px;
}
.source-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 17px;
  color: var(--faint);
  font-size: 10px;
}
.save-place-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--hover);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px;
  text-align: left;
  color: var(--muted);
}
.save-place-button:hover {
  border-color: rgba(135, 118, 147, 0.3);
}
.save-place-button > span {
  flex: 1;
  color: var(--ink);
  font-size: 11px;
}
.save-place-button small {
  display: block;
  color: var(--faint);
  font-size: 9px;
  margin-top: 5px;
}
.bookmark-list {
  margin-top: 15px;
}
.bookmark-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.bookmark-row:last-child {
  border-bottom: none;
}
.bookmark-row > button:first-child {
  flex: 1;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
}
.bookmark-row > button:first-child:hover > span {
  color: var(--accent);
}
.bookmark-row > button > span {
  font-family: Georgia, serif;
  font-size: 15px;
  line-height: 1.6;
  transition: color 0.2s;
}
.bookmark-row small {
  display: block;
  color: var(--faint);
  font-size: 9px;
  margin-top: 7px;
}
.bookmark-row small > span {
  margin: 0 3px;
}
.progress-visual {
  width: 145px;
  height: 145px;
  position: relative;
  margin: 8px auto 27px;
}
.progress-visual svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.progress-visual circle {
  fill: none;
  stroke-width: 2;
}
.progress-circle-track {
  stroke: var(--line);
}
.progress-circle-value {
  stroke: var(--green);
  stroke-linecap: round;
}
.progress-visual > div {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.progress-visual strong {
  font-size: 36px;
  font-weight: 450;
  letter-spacing: -1.5px;
}
.progress-visual strong > span {
  font-size: 18px;
  color: var(--muted);
  margin-left: 2px;
}
.progress-visual small {
  color: var(--faint);
  font-size: 9px;
  margin-top: 6px;
}
.overview-list {
  margin: 0;
}
.overview-list > div {
  display: flex;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.overview-list > div:last-child {
  border: 0;
}
.overview-list dt {
  color: var(--muted);
  font-size: 11px;
}
.overview-list dd {
  font-size: 12px;
  font-weight: 500;
  margin: 0;
}
.overview-list dd span {
  color: var(--faint);
  font-size: 9px;
  font-weight: 400;
}
.settings-content {
  margin-top: -5px;
}
.setting-section {
  padding: 0 0 19px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.setting-section h3 {
  margin: 0 0 15px;
  font-size: 10px;
  letter-spacing: 0.3px;
  font-weight: 550;
  color: var(--faint);
}
.theme-options {
  display: flex;
  gap: 12px;
}
.theme-option {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  background: none;
  padding: 0;
  border: none;
  font-size: 10px;
  color: var(--muted);
}
.theme-swatch {
  display: flex;
  width: 100%;
  height: 43px;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  border-radius: 9px;
  background-clip: padding-box;
  transition: outline-color 0.2s;
  outline: 1px solid transparent;
  outline-offset: 2px;
  color: #63596b;
}
.swatch-dawn {
  background: linear-gradient(150deg, #f5d6c9, #ccc0d6 70%, #b5bed1);
}
.swatch-paper {
  background: #eae6df;
}
.swatch-night {
  background: linear-gradient(150deg, #363433, #181716);
  color: #f4ede5;
  border: 1px solid rgba(255, 250, 242, 0.2);
}
.chosen-theme .theme-swatch {
  outline-color: #a49aa8;
}
.theme-option:hover .theme-swatch {
  outline-color: #b8adb9;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  min-height: 35px;
  margin-top: 7px;
  font-size: 11px;
  color: var(--muted);
}
.font-options button {
  width: 51px;
  height: 25px;
  font-size: 10px;
}
.serif-option {
  font-family: Georgia, serif;
}
.size-options button {
  width: 34px;
  height: 25px;
  font-size: 10px;
}
.toggle {
  width: 30px;
  height: 18px;
  padding: 3px;
  border: 0;
  border-radius: 15px;
  background: rgba(134, 120, 147, 0.2);
  transition: background 0.2s;
}
.toggle > span {
  display: block;
  background: #fff;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 1px 3px #00000010;
  transition: transform 0.2s;
}
.toggle.is-on {
  background: #8f9e91;
}
.toggle.is-on > span {
  transform: translateX(12px);
}
.reset-button {
  display: flex;
  margin: -1px auto 1px;
  font-size: 10px;
}
.toast {
  position: absolute;
  z-index: 80;
  bottom: 147px;
  left: 50%;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 17px;
  border-radius: 20px;
  font-size: 11px;
  white-space: nowrap;
  color: var(--muted);
  box-shadow: 0 5px 20px #3f324a0d;
}
.toast > svg {
  color: var(--green);
}
.theme-paper,
body.theme-paper,
html.theme-paper {
  background: #ebe8e1;
  color: #2b251f;
  --glass: rgba(250, 249, 245, 0.76);
  --panel: rgba(250, 249, 245, 0.97);
  --muted: #7b7770;
  --faint: #969189;
  --line: rgba(93, 84, 69, 0.12);
  --accent: #bd6d59;
  --ink: #2b251f;
  --text-primary: #2b251f;
  --text-secondary: rgba(43, 37, 31, 0.72);
  --text-tertiary: rgba(43, 37, 31, 0.45);
  --text-context: rgba(43, 37, 31, 0.38);
}
.theme-paper .book-breadcrumb h1 {
  color: #2b251f !important;
}
.theme-paper .catalog-button {
  color: #2b251f !important;
}
.theme-paper .pace-label strong {
  color: #2b251f !important;
}
.theme-paper .landscape {
  opacity: 0 !important;
}
.theme-paper .ambient-art-layer {
  opacity: 0 !important;
}
.theme-paper .atmosphere-wash {
  background: radial-gradient(ellipse at 60% 20%, #faf8f0 0%, #e6e3da 100%);
}
.theme-paper .control-dock,
.theme-paper .session-timer {
  background: rgba(253, 251, 245, 0.8);
}
.theme-paper .upcoming-words {
  color: rgba(90, 83, 70, 0.43);
}

.theme-dawn,
body.theme-dawn,
html.theme-dawn {
  --ink: #262629;
  --muted: #575054;
  --faint: #918b96;
  --text-primary: #262629;
  --text-secondary: rgba(38, 38, 41, 0.72);
  --text-tertiary: rgba(38, 38, 41, 0.45);
  --text-context: rgba(38, 38, 41, 0.40);
  --accent-orp: #eb5757;
}
.theme-dawn .book-breadcrumb h1 {
  color: #262629 !important;
}
.theme-dawn .catalog-button {
  color: #262629 !important;
}
.theme-dawn .pace-label strong {
  color: #262629 !important;
}

.theme-night,
body.theme-night,
html.theme-night {
  --ink: #f4ede5;
  --muted: rgba(244, 237, 229, 0.65);
  --faint: rgba(244, 237, 229, 0.42);
  --accent: #ed8d91;
  --accent-orp: #eb5757;
  --green: #4ca57c;
  --line: rgba(255, 250, 242, 0.12);
  --glass: rgba(31, 30, 30, 0.88);
  --glass-solid: rgba(31, 30, 30, 0.94);
  --glass-edge: rgba(255, 250, 242, 0.12);
  --panel: rgba(31, 30, 30, 0.96);
  --hover: rgba(255, 255, 255, 0.08);
  --selected: rgba(237, 141, 145, 0.22);
  --control: #f4ede5;
  --control-ink: #1f1e1e;
  --focus-ring: #ed8d91;
  --text-primary: #f4ede5;
  --text-secondary: rgba(244, 237, 229, 0.72);
  --text-tertiary: rgba(244, 237, 229, 0.48);
  --text-context: rgba(244, 237, 229, 0.38);
  --bg-app: #181716;
  --bg-dock: rgba(31, 30, 30, 0.88);
  background: #181716;
  color: #f4ede5;
}
.theme-night .topbar,
body.theme-night .topbar {
  background: rgba(28, 27, 27, 0.85);
  border-bottom: 1px solid rgba(255, 250, 242, 0.10);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.40);
}
.theme-night .book-breadcrumb h1,
body.theme-night .book-breadcrumb h1,
body.theme-notion-dark .book-breadcrumb h1,
body.theme-notion-oled .book-breadcrumb h1 {
  color: #f4ede5 !important;
}
.theme-night .catalog-button,
body.theme-night .catalog-button,
body.theme-notion-dark .catalog-button,
body.theme-notion-oled .catalog-button {
  color: #f4ede5 !important;
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: rgba(255, 250, 242, 0.12) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}
.theme-night .catalog-button:hover,
body.theme-night .catalog-button:hover {
  background: rgba(255, 255, 255, 0.12) !important;
}
.theme-night .icon-btn,
body.theme-night .icon-btn {
  color: rgba(244, 237, 229, 0.75);
}
.theme-night .icon-btn:hover,
body.theme-night .icon-btn:hover {
  color: #f4ede5;
  background: rgba(255, 255, 255, 0.09);
}
.theme-night .landscape {
  filter: blur(var(--ambient-blur, 7px)) saturate(0.95) brightness(calc(var(--ambient-brightness, 1) * 0.72)) !important;
  opacity: var(--ambient-landscape-opacity, var(--ambient-backdrop-opacity, 0.88));
}
.theme-night .atmosphere-wash {
  background: linear-gradient(
    180deg,
    rgba(24, 23, 23, 0.55),
    rgba(16, 15, 15, 0.88)
  ) !important;
}
.theme-night .breadcrumb-author {
  color: rgba(244, 237, 229, 0.60);
}
.theme-night .upcoming-words {
  color: rgba(244, 237, 229, 0.35);
}
.theme-night .word-before,
.theme-night .word-after {
  text-shadow: none;
}
.theme-night .guide-top,
.theme-night .guide-bottom {
  background: rgba(255, 250, 242, 0.25) !important;
}
.theme-night .control-dock {
  background: rgba(31, 30, 30, 0.88) !important;
  border: 1px solid rgba(255, 250, 242, 0.12) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 24px 60px rgba(0, 0, 0, 0.50),
    0 2px 8px rgba(0, 0, 0, 0.25) !important;
  backdrop-filter: blur(32px) saturate(1.25) !important;
  -webkit-backdrop-filter: blur(32px) saturate(1.25) !important;
}
.theme-night .session-timer {
  display: none !important;
}
.theme-night .speed-control,
body.theme-night .speed-control {
  background: rgba(42, 40, 40, 0.80) !important;
  border-color: rgba(255, 250, 242, 0.12) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}
.theme-night .pace-label strong,
body.theme-night .pace-label strong {
  color: #f4ede5 !important;
}
.theme-night .wpm-label,
body.theme-night .wpm-label {
  color: rgba(244, 237, 229, 0.55) !important;
}
.theme-night .speed-control button,
body.theme-night .speed-control button {
  color: rgba(244, 237, 229, 0.75) !important;
}
.theme-night .speed-control button:hover:not(:disabled),
body.theme-night .speed-control button:hover:not(:disabled) {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.10) !important;
}
.theme-night .progress-meta,
body.theme-night .progress-meta {
  color: rgba(244, 237, 229, 0.55) !important;
}
.theme-night .dock-time-left,
.theme-night .word-count,
body.theme-night .dock-time-left,
body.theme-night .word-count {
  color: rgba(244, 237, 229, 0.72) !important;
}
.theme-night .progress-slider,
body.theme-night .progress-slider {
  background: linear-gradient(
    to right,
    #f4ede5 var(--progress),
    rgba(255, 250, 242, 0.16) var(--progress)
  ) !important;
}
.theme-night .progress-slider::-webkit-slider-thumb,
body.theme-night .progress-slider::-webkit-slider-thumb {
  background: #f4ede5 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4) !important;
}
.theme-night .progress-slider::-moz-range-thumb,
body.theme-night .progress-slider::-moz-range-thumb {
  background: #f4ede5 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4) !important;
}
.theme-night .play-button,
body.theme-night .play-button {
  background: #f4ede5 !important;
  color: #1f1e1e !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}
.theme-night .play-button:hover,
body.theme-night .play-button:hover {
  background: #ffffff !important;
  color: #141312 !important;
  transform: scale(1.04);
}
.theme-night .keyboard-hint,
body.theme-night .keyboard-hint {
  color: rgba(244, 237, 229, 0.50) !important;
}
.theme-night .keyboard-hint kbd,
body.theme-night .keyboard-hint kbd {
  background: rgba(42, 40, 40, 0.85) !important;
  color: #f4ede5 !important;
  border: 1px solid rgba(255, 250, 242, 0.12) !important;
}
@media (min-width: 1800px) {
  .topbar {
    top: 24px;
    left: 28px;
    right: 28px;
    height: 66px;
    padding-inline: 17px 20px;
  }
  .navigation-left {
    gap: 20px;
  }
  .catalog-button {
    height: 38px;
    font-size: 15px;
  }
  .book-breadcrumb {
    font-size: 16px;
  }
  .reader-tools {
    gap: 20px;
  }
  .tool-group {
    gap: 12px;
  }
  .reader-footer {
    width: 820px;
    bottom: 36px;
  }
  .control-dock {
    height: 75px;
  }
  .play-button {
    height: 57px;
    min-width: 112px;
  }
  .speed-control {
    height: 55px;
    width: 175px;
  }
  .progress-meta {
    font-size: 12px;
  }
  .guide-top {
    bottom: calc(60px * var(--font-scale));
  }
  .guide-bottom {
    top: calc(60px * var(--font-scale));
  }
  .focal-dot {
    top: calc(52px * var(--font-scale));
  }
  .session-timer {
    top: calc(108px * var(--font-scale));
  }
}
@media (max-width: 1180px) {
  .topbar {
    gap: 15px;
    padding-right: 12px;
  }
  .reader-tools {
    gap: 10px;
  }
  .tool-group {
    gap: 3px;
  }
  .navigation-left {
    gap: 12px;
  }
  .breadcrumb-author {
    display: none;
  }
  .book-breadcrumb {
    font-size: 13px;
  }
  .secondary-divider {
    display: none;
  }
}
@media (max-width: 800px) {
  .topbar {
    top: 16px;
    left: 16px;
    right: 16px;
    padding: 10px 12px;
    height: auto;
    min-height: 93px;
    border-radius: 22px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .navigation-left {
    flex: 1;
    min-width: calc(100% - 135px);
  }
  .catalog-button {
    font-size: 12px;
    height: 32px;
    padding: 0 10px;
    gap: 7px;
    border-radius: 11px;
  }
  .catalog-button svg {
    width: 16px;
  }
  .breadcrumb-separator {
    font-size: 18px;
  }
  .book-breadcrumb {
    font-size: 12px;
  }
  .breadcrumb-author {
    display: flex;
  }
  .reader-tools {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }
  .language-switch {
    position: absolute;
    right: 13px;
    top: 11px;
  }
  .language-switch button {
    min-width: 29px;
    height: 23px;
    font-size: 10px;
  }
  .toolbar-divider {
    display: none;
  }
  .tool-group {
    gap: 14px;
  }
  .appearance-tools {
    gap: 13px;
  }
  .icon-button {
    height: 28px;
    width: 29px;
  }
  .icon-button > svg {
    width: 17px;
  }
  .reading-composition {
    top: 45%;
  }
  .word-track {
    font-size: calc(53px * var(--font-scale));
  }
  .upcoming-words {
    width: 90vw;
    mask-image: linear-gradient(to right, #000, transparent 55%);
    -webkit-mask-image: linear-gradient(to right, #000, transparent 55%);
  }
  .reader-footer {
    width: calc(100% - 32px);
    bottom: 36px;
  }
  .control-dock {
    gap: 15px;
  }
  .play-button {
    min-width: 94px;
  }
  .speed-control {
    width: 151px;
  }
  .progress-meta {
    font-size: 9px;
  }
  .remaining-time {
    display: none;
  }
  .word-count {
    width: 100%;
    text-align: right;
  }
  .progress-slider {
    margin-top: 11px;
  }
  .utility-layer {
    padding: 122px 17px 20px;
  }
  .utility-layer .dialog-backdrop {
    top: 114px;
  }
  .dialog-panel {
    max-height: calc(100svh - 145px);
  }
  .catalog-panel {
    max-height: calc(100svh - 40px);
  }
  .keyboard-hint {
    margin-top: 13px;
    font-size: 9px;
  }
}
@media (max-width: 520px) {
  .topbar {
    left: 12px;
    right: 12px;
    top: 12px;
    padding: 11px 10px 9px;
    gap: 11px;
  }
  .navigation-left {
    gap: 10px;
    padding-right: 108px;
    min-width: 100%;
  }
  .book-breadcrumb {
    font-size: 11px;
  }
  .breadcrumb-author {
    display: none;
  }
  .catalog-button {
    padding: 0 9px;
    font-size: 11px;
    gap: 6px;
  }
  .catalog-button svg {
    width: 15px;
  }
  .language-switch {
    right: 10px;
    top: 13px;
  }
  .language-switch button {
    min-width: 26px;
    height: 21px;
    font-size: 9px;
    padding-inline: 4px;
  }
  .reader-tools {
    gap: 7px;
  }
  .tool-group {
    gap: 8px;
  }
  .appearance-tools {
    gap: 8px;
  }
  .icon-button {
    width: 26px;
  }
  .icon-button > svg {
    width: 16px;
  }
  .reading-composition {
    top: 44.5%;
  }
  .word-track {
    font-size: calc(47px * var(--font-scale));
  }
  .word-stream {
    font-weight: 550;
  }
  .upcoming-words {
    margin-left: 0.36em;
  }
  .guide-top {
    bottom: calc(41px * var(--font-scale));
  }
  .guide-bottom {
    top: calc(41px * var(--font-scale));
  }
  .focal-dot {
    top: calc(35px * var(--font-scale));
  }
  .session-timer {
    top: calc(82px * var(--font-scale));
    height: 26px;
    font-size: 11px;
    padding: 0 10px;
  }
  .reader-footer {
    width: calc(100% - 32px);
    bottom: 36px;
  }
  .control-dock {
    height: 109px;
    padding: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 48px 32px;
    column-gap: 20px;
    row-gap: 6px;
    border-radius: 27px;
  }
  .play-button {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    width: 104px;
    height: 45px;
    font-size: 13px;
    gap: 8px;
  }
  .speed-control {
    grid-column: 2;
    grid-row: 1;
    height: 45px;
    width: 153px;
    justify-self: end;
  }
  .pace-label strong {
    font-size: 15px;
  }
  .wpm-label {
    font-size: 10px;
  }
  .reading-progress {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 0 10px 5px;
  }
  .progress-meta {
    font-size: 9px;
  }
  .remaining-time {
    display: block;
  }
  .word-count {
    width: auto;
  }
  .progress-slider {
    margin-top: 9px;
    height: 2px;
  }
  .progress-slider::-webkit-slider-thumb {
    width: 7px;
    height: 7px;
  }
  .keyboard-hint {
    font-size: 9px;
    margin-top: 12px;
  }
  .keyboard-hint kbd {
    font-size: 8px;
  }
  .utility-layer {
    padding: 121px 12px 12px;
  }
  .dialog-panel {
    width: 100%;
    border-radius: 18px;
    padding: 24px;
    max-height: calc(100svh - 140px);
  }
  .modal-layer {
    padding: 16px;
  }
  .catalog-panel {
    max-height: calc(100svh - 32px);
    padding: 25px 22px;
  }
  .catalog-panel .dialog-heading h2 {
    font-size: 23px;
  }
  .current-book-label {
    font-size: 0;
    gap: 0;
  }
  .library-book {
    gap: 14px;
  }
  .book-details strong {
    font-size: 13px;
  }
  .add-text-hint {
    font-size: 0;
    gap: 0 !important;
  }
  .add-text-button {
    font-size: 11px;
  }
  .toast {
    bottom: 184px;
  }
  .exit-focus {
    right: 16px;
    top: 16px;
    font-size: 11px;
  }
}
@media (max-height: 600px) and (min-width: 801px) {
  .reading-composition {
    top: 44%;
  }
  .word-track {
    font-size: calc(48px * var(--font-scale));
  }
  .guide-top {
    bottom: 41px;
  }
  .guide-bottom {
    top: 41px;
  }
  .focal-dot {
    top: 34px;
  }
  .session-timer {
    top: 71px;
  }
  .reader-footer {
    bottom: 30px;
  }
}
@media (max-width: 360px) {
  .speed-control {
    width: 142px;
  }
  .play-button {
    width: 94px;
  }
  .tool-group,
  .appearance-tools {
    gap: 6px;
  }
  .remaining-time {
    font-size: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}


/* ========================================================
   BRIDGES & COMPATIBILITY LAYER FOR SUPER READER
   ======================================================== */
body {
  --ink: #262629;
  --muted: #77717a;
  --faint: #918b96;
  --accent: #e9696c;
  --green: #45b89a;
  --line: rgba(71, 58, 78, 0.1);
  --glass: rgba(255, 253, 252, 0.65);
  --glass-edge: rgba(255, 255, 255, 0.76);
  --panel: rgba(250, 248, 249, 0.94);
  --hover: rgba(111, 99, 122, 0.075);
  --selected: rgba(255, 255, 255, 0.94);
  --control: #29292b;
  --control-ink: #fff;
  --focus-ring: #8a7c98;
  position: relative;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: #c8c4d3;
  font-family: var(--font-sans, "Inter", sans-serif);
  overflow-x: hidden;
}

body.theme-notion-warm,
body.theme-paper {
  background: #ebe8e1 !important;
  --glass: rgba(250, 249, 245, 0.76);
  --panel: rgba(250, 249, 245, 0.97);
  --muted: #7b7770;
  --faint: #969189;
  --line: rgba(93, 84, 69, 0.12);
  --accent: #bd6d59;
}
body.theme-notion-warm .landscape,
body.theme-paper .landscape {
  opacity: 0 !important;
}
body.theme-notion-warm .ambient-art-layer,
body.theme-paper .ambient-art-layer {
  opacity: 0 !important;
}
body.theme-notion-warm .atmosphere-wash,
body.theme-paper .atmosphere-wash {
  background: radial-gradient(ellipse at 60% 20%, #faf8f0 0%, #e6e3da 100%) !important;
}

body.theme-notion-dark,
body.theme-notion-oled,
body.theme-night {
  --ink: #f4ede5 !important;
  --muted: rgba(244, 237, 229, 0.65) !important;
  --faint: rgba(244, 237, 229, 0.42) !important;
  --accent: #ed8d91 !important;
  --green: #4ca57c !important;
  --line: rgba(255, 250, 242, 0.12) !important;
  --glass: rgba(31, 30, 30, 0.88) !important;
  --glass-solid: rgba(31, 30, 30, 0.94) !important;
  --glass-edge: rgba(255, 250, 242, 0.12) !important;
  --panel: rgba(31, 30, 30, 0.96) !important;
  --hover: rgba(255, 255, 255, 0.08) !important;
  --selected: rgba(237, 141, 145, 0.22) !important;
  --control: #f4ede5 !important;
  --control-ink: #1f1e1e !important;
  --focus-ring: #ed8d91 !important;
  background: #181716 !important;
}
body.theme-notion-dark .landscape,
body.theme-notion-oled .landscape,
body.theme-night .landscape {
  filter: blur(var(--ambient-blur, 7px)) saturate(0.95) brightness(calc(var(--ambient-brightness, 1) * 0.72)) !important;
}
body.theme-notion-dark .atmosphere-wash,
body.theme-notion-oled .atmosphere-wash,
body.theme-night .atmosphere-wash {
  background: linear-gradient(180deg, rgba(24, 23, 23, 0.55), rgba(16, 15, 15, 0.88)) !important;
}

/* Modals mapping to dialog-layer */
.modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 60 !important;
  display: none;
}
.modal-overlay.active {
  display: flex !important;
}
.modal-overlay.dialog-layer.utility-layer {
  align-items: flex-start !important;
  justify-content: flex-end !important;
  padding: 94px 24px 24px !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.modal-overlay.dialog-layer.utility-layer.active {
  display: flex !important;
}
.modal-overlay.dialog-layer.utility-layer .dialog-backdrop {
  position: absolute !important;
  inset: 0 !important;
  top: 85px !important;
  background: transparent !important;
  pointer-events: auto !important;
}
.modal-overlay.dialog-layer.utility-layer .dialog-panel {
  position: relative !important;
  pointer-events: auto !important;
  margin: 0 !important;
  width: 420px !important;
  max-width: calc(100vw - 48px) !important;
  max-height: calc(100svh - 120px) !important;
  padding: 25px !important;
  border: 1px solid var(--glass-edge) !important;
  border-radius: 21px !important;
  background: var(--panel) !important;
  color: var(--ink) !important;
  box-shadow: 0 18px 65px rgba(48, 34, 64, 0.13), 0 1px 3px rgba(51, 40, 65, 0.04) !important;
  backdrop-filter: blur(35px) !important;
  -webkit-backdrop-filter: blur(35px) !important;
  overflow-y: auto !important;
  scrollbar-width: thin !important;
}

/* Modal Catalog / Library layer */
.modal-overlay#modalLibrary.active {
  display: flex !important;
}

/* Word presentation refinement: adaptive optical kerning, weight & ORP */
.word-part {
  font-family: var(--font-rsvp, "Inter", sans-serif) !important;
  font-weight: var(--font-rsvp-weight, 500) !important;
  letter-spacing: var(--font-rsvp-letter-spacing, -0.012em) !important;
  font-variant-ligatures: contextual !important;
}
.word-part.word-orp,
#wordOrp {
  font-weight: 700 !important;
  color: var(--accent-orp, var(--accent, #eb5757)) !important;
}
.context-words {
  font-family: var(--font-rsvp, "Inter", sans-serif) !important;
  font-weight: 400 !important;
  letter-spacing: var(--font-rsvp-letter-spacing, -0.012em) !important;
}

/* Switches & Rows in Settings */
.settings-content .setting-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 15px !important;
  min-height: 35px !important;
  margin-top: 7px !important;
  font-size: 11px !important;
  color: var(--muted) !important;
  border-bottom: 1px solid var(--line) !important;
  padding: 8px 0 !important;
}
.settings-content .setting-row .setting-title {
  color: var(--ink) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}
.settings-content .setting-row .setting-desc {
  color: var(--faint) !important;
  font-size: 10px !important;
  margin-top: 2px !important;
}
.settings-content .notion-switch {
  width: 30px !important;
  height: 18px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 15px !important;
  background: rgba(134, 120, 147, 0.2) !important;
  position: relative !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
}
.settings-content .notion-switch input {
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
}
.settings-content .notion-switch .switch-slider {
  position: absolute !important;
  inset: 0 !important;
  border-radius: 15px !important;
  background: transparent !important;
  cursor: pointer !important;
}
.settings-content .notion-switch .switch-slider:before {
  content: "" !important;
  position: absolute !important;
  top: 3px !important;
  left: 3px !important;
  width: 12px !important;
  height: 12px !important;
  border-radius: 50% !important;
  background: #fff !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15) !important;
  transition: transform 0.2s !important;
}
.settings-content .notion-switch input:checked + .switch-slider {
  background: #8f9e91 !important;
}
.settings-content .notion-switch input:checked + .switch-slider:before {
  transform: translateX(12px) !important;
}

/* Focus Mode & Auto-Hide UI Transitions (Distraction-Free Speed Reading) */
.reader-app.focus-mode:not(.ui-peek) .topbar,
body.focus-mode:not(.ui-peek) .topbar,
.reader-app.is-playing:not(.ui-peek) .topbar,
body.is-playing:not(.ui-peek) .topbar,
.reader-app.focus-mode:not(.ui-peek) .sub-header-pills,
body.focus-mode:not(.ui-peek) .sub-header-pills,
.reader-app.is-playing:not(.ui-peek) .sub-header-pills,
body.is-playing:not(.ui-peek) .sub-header-pills {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(-16px) !important;
}

.reader-app.focus-mode:not(.ui-peek) .reader-footer,
body.focus-mode:not(.ui-peek) .reader-footer,
.reader-app.is-playing:not(.ui-peek) .reader-footer,
body.is-playing:not(.ui-peek) .reader-footer {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(22px) !important;
}

/* Hide cursor when actively reading without mouse movement */
body.is-playing:not(.ui-peek),
body.is-playing:not(.ui-peek) * {
  cursor: none !important;
}

.topbar,
.reader-footer,
.sub-header-pills {
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
