body {
    background: radial-gradient(ellipse at top, #e5e0f9 0%, #b6aeea 100%);
    min-height: 100vh;
    margin: 0;
    font-family: 'Alegreya', 'Georgia', serif;
    color: #2d1d3a;
    font-size: 1.22em;
    line-height: 1.9;
    letter-spacing: 0.01em;
    transition: background 0.4s, color 0.4s;
    overflow-x: hidden;
  }
  
  /* Вертикальный переключатель тем */
  #theme-switcher-floating {
    position: fixed;
    top: 32px;
    left: 32px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.7em;
    background: rgba(255,255,255,0.82);
    border-radius: 14px;
    box-shadow: 0 2px 12px #7a5fff22;
    padding: 0.7em 0.8em;
    align-items: stretch;
  }
  #theme-switcher-floating button {
    padding: 0.6em 1.2em;
    font-size: 1em;
    border-radius: 7px;
    background: #e1d4f2;
    color: #4d2e8c;
    border: 1.5px solid #7a5fff;
    transition: background 0.2s, color 0.2s;
    font-family: 'Montserrat', 'Arial', sans-serif;
    text-align: left;
  }
  #theme-switcher-floating button.active {
    background: #7a5fff;
    color: #fff;
  }
  
  /* Кнопки навигации справа вверху + меню глав */
  #nav-panel-floating {
    position: fixed;
    top: 32px;
    right: 32px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5em;
    background: rgba(255,255,255,0.82);
    border-radius: 12px;
    box-shadow: 0 2px 12px #7a5fff22;
    padding: 0.5em 0.8em 0.7em 0.8em;
  }
  #nav-panel-floating .nav-buttons {
    display: flex;
    gap: 0.7em;
  }
  #nav-panel-floating button {
    background: #a085ff;
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 0.4em 1.2em;
    font-size: 1.22em;
    font-family: 'Montserrat', 'Arial', sans-serif;
    font-weight: bold;
    box-shadow: 0 2px 8px #7a5fff22;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    letter-spacing: 0.06em;
    border-bottom: 2.5px solid #5e3a9d44;
  }
  #nav-panel-floating button:disabled {
    background: #b6aeea;
    cursor: default;
  }
  #nav-panel-floating button:hover:not(:disabled) {
    background: #5e3a9d;
    transform: translateY(-2px) scale(1.04);
  }
  
  /* Кнопка и выпадающий список глав */
  #chapter-jump {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-top: 0.4em;
  }
  #openChapterList {
    background: #7a5fff;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 1.3em;
    padding: 0.3em 0.8em;
    cursor: pointer;
    box-shadow: 0 2px 8px #7a5fff22;
    transition: background 0.2s;
  }
  #openChapterList:hover {
    background: #5e3a9d;
  }
  .chapter-list-dropdown {
    display: none;
    position: absolute;
    top: 2.5em;
    right: 0;
    min-width: 230px;
    max-height: 350px;
    overflow-y: auto;
    background: #fff;
    border: 2px solid #7a5fff;
    border-radius: 10px;
    box-shadow: 0 4px 24px #7a5fff33;
    z-index: 100;
    padding: 0.5em 0.2em;
  }
  .chapter-list-dropdown.open {
    display: block;
  }
  .chapter-list-dropdown button {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #5e3a9d;
    text-align: left;
    font-family: 'Alegreya', 'Georgia', serif;
    font-size: 1em;
    padding: 0.45em 1em;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
  }
  .chapter-list-dropdown button:hover {
    background: #e1d4f2;
    color: #7a5fff;
  }
  
  @media (max-width: 900px) {
    #theme-switcher-floating, #nav-panel-floating { 
      position: static; 
      display: flex; 
      flex-direction: row;
      justify-content: center; 
      margin: 1em 0; 
      box-shadow: none; 
      background: none; 
      border-radius: 0;
      padding: 0;
      gap: 0.7em;
    }
    #theme-switcher-floating { flex-direction: row; }
    #nav-panel-floating { flex-direction: row; align-items: center; }
    #chapter-jump { margin-top: 0; }
    .chapter-list-dropdown { right: auto; left: 0; }
  }
  
  /* Остальной стиль (main-container, заголовки, монологи, боковые ссылки, темы и т.д.) — как в предыдущих версиях! */
  #main-container {
    max-width: 860px;
    margin: 48px auto 32px auto;
    background: rgba(255,255,255,0.96);
    border-radius: 28px;
    box-shadow: 0 12px 48px #7a5fff44, 0 0 0 8px #d1c6f7bb inset;
    padding: 2.9em 2.6em 2.5em 2.6em;
    position: relative;
    min-height: 60vh;
    border: 4px double #7a5fff;
    border-top: none;
    border-bottom: none;
    overflow: hidden;
    z-index: 2;
  }
  #magic-border-top, #magic-border-bottom {
    width: 100%;
    height: 36px;
    background: url('data:image/svg+xml;utf8,<svg width="400" height="36" xmlns="http://www.w3.org/2000/svg"><path d="M0,18 Q40,0 80,18 T160,18 T240,18 T320,18 T400,18" fill="none" stroke="%237a5fff" stroke-width="2"/><text x="20" y="28" font-size="24" fill="%239c7be6" font-family="serif">&#x16B1;&#x16B7;&#x16B9;&#x16B1;</text><text x="340" y="28" font-size="24" fill="%239c7be6" font-family="serif">&#x16B1;&#x16B7;&#x16B9;&#x16B1;</text></svg>') repeat-x center;
    opacity: 0.27;
    pointer-events: none;
  }
  #magic-border-top { position: absolute; left: 0; top: 0; }
  #magic-border-bottom { position: absolute; left: 0; bottom: 0; }
  #site-title {
    text-align: center;
    margin-bottom: 1.1em;
    position: relative;
  }
  #site-title h1 {
    font-family: 'UnifrakturCook', 'Alegreya', serif;
    color: #5e3a9d;
    font-size: 2.7em;
    letter-spacing: 0.09em;
    margin: 0.1em 0 0.15em 0;
    text-shadow: 0 2px 14px #b6aeea66, 0 0 2px #fff;
    line-height: 1.1;
    position: relative;
  }
  #site-title h1:before, #site-title h1:after {
    content: 'ᚠᛇᚻ';
    font-family: 'UnifrakturCook', serif;
    font-size: 0.7em;
    color: #a085ff;
    opacity: 0.7;
    margin: 0 0.3em;
    vertical-align: middle;
    letter-spacing: 0.08em;
    text-shadow: 0 2px 8px #b6aeea88;
    animation: rune-glow 3s infinite alternate;
  }
  #site-title h1:before { margin-right: 0.5em; }
  #site-title h1:after { margin-left: 0.5em; animation-delay: 1.5s; }
  @keyframes rune-glow {
    from { text-shadow: 0 0 6px #b6aeea, 0 2px 8px #7a5fff44; color: #a085ff; }
    to   { text-shadow: 0 0 16px #ffd700, 0 2px 8px #7a5fff99; color: #ffd700; }
  }
  /* Боковые ссылки */
  .side-links {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 1.3em;
    pointer-events: none;
  }
  #side-links-left { left: 0.7em; }
  #side-links-right { right: 0.7em; }
  .side-links a {
    pointer-events: auto;
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, #7a5fff 60%, #b6aeea 100%);
    color: #fff;
    font-family: 'UnifrakturCook', 'Alegreya', serif;
    text-decoration: none;
    font-size: 1.18em;
    padding: 0.45em 1.35em;
    border-radius: 0 14px 14px 0;
    box-shadow: 0 2px 10px #7a5fff33;
    transition: background 0.2s, color 0.2s, transform 0.15s, box-shadow 0.2s;
    border-left: 4px solid #5e3a9d;
    position: relative;
    letter-spacing: 0.07em;
    filter: drop-shadow(0 0 6px #a085ff44);
    opacity: 0.93;
  }
  #side-links-right a {
    border-radius: 14px 0 0 14px;
    border-left: none;
    border-right: 4px solid #5e3a9d;
    background: linear-gradient(270deg, #7a5fff 60%, #b6aeea 100%);
  }
  .side-links a:hover {
    background: #5e3a9d;
    color: #ffd700;
    transform: scale(1.07) translateX(7px);
    box-shadow: 0 4px 18px #7a5fff55, 0 0 16px #ffd70088;
    filter: drop-shadow(0 0 12px #ffd70088);
  }
  #side-links-right a:hover {
    transform: scale(1.07) translateX(-7px);
  }
  .side-links span {
    font-family: 'UnifrakturCook', 'Alegreya', serif;
    font-size: 1.18em;
    letter-spacing: 0.09em;
    font-weight: bold;
    text-shadow: 0 2px 8px #b6aeea88;
  }
  @media (max-width: 1100px) {
    #side-links-left, #side-links-right { display: none; }
  }
  
  /* --- Заголовки глав и частей --- */
  .chapter, .part {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0.5em;
    font-family: 'UnifrakturCook', 'Alegreya', serif;
    font-size: 1.35em;
    border-bottom: 2px dashed #a085ff44;
    padding-bottom: 0.2em;
    margin-top: 2.5em;
    margin-bottom: 1.2em;
    color: #5e3a9d;
    text-shadow: 0 2px 12px #b6aeea66;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .chapter-label, .part-label {
    white-space: nowrap;
    font-weight: bold;
    font-size: 1.05em;
    letter-spacing: 0.04em;
  }
  .chapter-title, .part-title {
    word-break: break-word;
    font-weight: normal;
    font-size: 0.93em;
    color: #7a5fff;
    font-family: 'Alegreya', serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70vw;
  }
  
  /* --- Пролог --- */
  .prologue, h2.prologue {
    font-family: 'UnifrakturCook', 'Alegreya', serif;
    font-size: 1.3em;
    color: #5e3a9d;
    margin-top: 2.5em;
    margin-bottom: 1.2em;
    border-bottom: 2px dashed #a085ff44;
    padding-bottom: 0.2em;
  }
  
  /* --- Монологи --- */
  .monologue {
    display: block;
    font-style: italic;
    color: #563a7d;
    margin: 1.7em 0 1.7em 0;
    border-left: 7px solid #a085ff;
    padding-left: 1.4em;
    background: linear-gradient(90deg, #f3f0fa 70%, #e1d4f2 100%);
    border-radius: 0 18px 18px 0;
    box-shadow: 0 2px 18px #7a5fff22;
    font-size: 1.19em;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    animation: fadeInMonologue 0.9s;
    line-height: 2.02;
    letter-spacing: 0.02em;
    position: relative;
    overflow: visible;
  }
  .monologue:before {
    content: "ᚱ";
    color: #a085ff;
    font-size: 1.3em;
    position: absolute;
    left: -1.3em;
    top: 0.1em;
    opacity: 0.5;
    animation: rune-float 3s infinite alternate;
  }
  @keyframes fadeInMonologue {
    from { opacity: 0; transform: translateX(-30px);}
    to { opacity: 1; transform: translateX(0);}
  }
  @keyframes rune-float {
    from { top: 0.1em; opacity: 0.45; }
    to   { top: -0.4em; opacity: 0.7; }
  }
  .monologue-thinker, .monologue-author {
    font-weight: bold;
    color: #01cfff;
    margin-right: 0.7em;
    font-style: normal;
    font-size: 1.09em;
    letter-spacing: 0.03em;
  }
  
  /* --- Прямая речь --- */
  .speech {
    color: #5b3ad6;
    font-style: normal;
    font-weight: 600;
    padding-left: 0.8em;
    display: block;
    margin: 1.1em 0;
    font-size: 1.13em;
    letter-spacing: 0.01em;
    font-family: 'Alegreya', serif;
  }
  
  /* --- Обычный текст --- */
  p {
    margin: 1.3em 0;
    font-size: 1.16em;
    line-height: 2.05;
    font-family: 'Alegreya', 'Georgia', serif;
    letter-spacing: 0.01em;
  }
  
  /* --- Тёмная тема --- */
  body.theme-dark {
    background: radial-gradient(ellipse at top, #1e1930 0%, #2a2443 100%);
    color: #e5e3f7;
  }
  body.theme-dark #main-container {
    background: #231f33;
    box-shadow: 0 8px 48px #00000044;
    border-color: #5e3a9d;
  }
  body.theme-dark .monologue {
    background: linear-gradient(90deg, #231f33 70%, #2e2850 100%);
    color: #c2b1ff;
    border-left-color: #01cfff;
    box-shadow: 0 2px 16px #01cfff22;
  }
  body.theme-dark .monologue:before {
    color: #01cfff;
    opacity: 0.45;
  }
  body.theme-dark .monologue-thinker, 
  body.theme-dark .monologue-author {
    color: #01cfff;
  }
  body.theme-dark h2, 
  body.theme-dark .chapter, 
  body.theme-dark .part, 
  body.theme-dark .prologue {
    color: #01cfff;
    text-shadow: 0 2px 12px #23203a;
    border-bottom: 2px dashed #01cfff44;
  }
  body.theme-dark .speech {
    color: #01cfff;
  }
  body.theme-dark p {
    color: #e5e3f7;
  }
  
  /* --- Слабовидящий (высокая контрастность) --- */
  body.theme-accessible {
    background: #fff !important;
    color: #000 !important;
    font-size: 1.22em !important;
    font-family: 'Arial Rounded MT Bold', 'Arial', 'Verdana', 'Tahoma', sans-serif !important;
    letter-spacing: 0.03em;
    line-height: 1.8;
  }
  body.theme-accessible #main-container {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    border: 3px solid #000 !important;
    padding: 2.2em 1.2em 1.2em 1.2em;
    max-width: 900px;
  }
  body.theme-accessible .monologue {
    background: #fff !important;
    color: #000 !important;
    border-left: 8px solid #000 !important;
    box-shadow: none !important;
    font-size: 1.07em !important;
    border-radius: 0 !important;
    letter-spacing: 0.05em;
    font-weight: normal !important;
    padding-left: 1em !important;
  }
  body.theme-accessible .monologue:before { display: none; }
  body.theme-accessible .monologue-thinker, 
  body.theme-accessible .monologue-author {
    color: #000 !important;
    font-weight: bold !important;
    text-decoration: underline;
    font-size: 1em !important;
  }
  body.theme-accessible .chapter, 
  body.theme-accessible .part, 
  body.theme-accessible .prologue {
    color: #000 !important;
    text-shadow: none !important;
    font-size: 1.18em !important;
    font-weight: bold !important;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #000 !important;
    padding-bottom: 0.1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body.theme-accessible .chapter-title, 
  body.theme-accessible .part-title {
    font-size: 0.93em !important;
    color: #000 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70vw;
  }
  body.theme-accessible .speech {
    color: #000 !important;
    font-weight: bold !important;
    font-size: 1.07em !important;
  }
  body.theme-accessible p {
    font-size: 1.07em !important;
    font-weight: normal !important;
    font-family: 'Arial Rounded MT Bold', 'Arial', 'Verdana', 'Tahoma', sans-serif !important;
    line-height: 1.8 !important;
  }
  body.theme-accessible button, 
  body.theme-accessible #theme-switcher-floating button {
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #000 !important;
    font-size: 1.08em !important;
    font-weight: bold !important;
    box-shadow: none !important;
    font-family: 'Arial Rounded MT Bold', 'Arial', 'Verdana', 'Tahoma', sans-serif !important;
    padding: 0.5em 1em !important;
  }
  body.theme-accessible #theme-switcher-floating button.active {
    background: #000 !important;
    color: #fff !important;
  }
  
  /* Адаптация для планшетов */
@media (max-width: 1024px) {
    body {
      font-size: 1.1em;
    }
    #main-container {
      max-width: 90%;
      margin: 30px auto;
      padding: 2em 1.5em;
    }
    #site-title h1 {
      font-size: 2.2em;
    }
    #theme-switcher-floating, #nav-panel-floating {
      position: static;
      display: flex;
      flex-direction: row;
      justify-content: center;
      margin: 1em auto;
      box-shadow: none;
      background: none;
      border-radius: 0;
      padding: 0;
      gap: 0.7em;
    }
    #theme-switcher-floating {
      margin-bottom: 0.5em;
    }
    #nav-panel-floating {
      margin-top: 0.5em;
    }
  }
  
  /* Адаптация для мобильных телефонов */
  @media (max-width: 640px) {
    body {
      font-size: 1em;
    }
    #main-container {
      max-width: 95%;
      margin: 15px auto;
      padding: 1.5em 1em;
      border-radius: 15px;
    }
    #site-title h1 {
      font-size: 1.8em;
    }
    #site-title h1:before, #site-title h1:after {
      display: none;
    }
    #theme-switcher-floating button {
      padding: 0.4em 0.8em;
      font-size: 0.9em;
    }
    #nav-panel-floating button {
      padding: 0.3em 0.9em;
      font-size: 1.1em;
    }
    .chapter, .part {
      font-size: 1.2em;
    }
    .chapter-title, .part-title {
      max-width: 60vw;
    }
    .monologue {
      font-size: 1.05em;
      padding-left: 1em;
    }
    .monologue:before {
      display: none;
    }
    p {
      font-size: 1.05em;
      line-height: 1.8;
    }
    .chapter-list-dropdown {
      min-width: 180px;
      max-height: 250px;
    }
  }
  
  /* Адаптация для маленьких экранов */
  @media (max-width: 400px) {
    #theme-switcher-floating, #nav-panel-floating {
      flex-wrap: wrap;
    }
    #site-title h1 {
      font-size: 1.5em;
    }
    .chapter-title, .part-title {
      max-width: 50vw;
    }
  }
  