*,
*::before,
*::after {
  box-sizing: border-box;
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
}

ul[class],
ol[class] {
  padding: 0;
}

body,
h1,
h2,
h3,
h4,
p,
ul[class],
ol[class],
li,
figure,
figcaption,
blockquote,
dl,
dd {
  margin: 0;
}

body {
  min-height: 100vh;
  scroll-behavior: smooth;
  text-rendering: optimizeSpeed;
}

ul[class],
ol[class] {
  list-style: none;
}

a:not([class]) {
  text-decoration-skip-ink: auto;
}

img {
  max-width: 100%;
  display: block;
}

article > * + * {
  margin-top: 1em;
}

input,
button,
textarea,
select {
  font: inherit;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  background: #917333;
  border: 10px solid #623e1a;
  border-radius: 10px;
  overflow: hidden;
  user-select: none;
  display: flex;
  justify-content: center;
}

header {
  display: flex;
  background-color: #623e1a;
  padding: 0 12px 6px 12px;
  align-items: center;
  justify-content: space-between;
  -webkit-user-select: none;
  -webkit-app-region: drag;
  pointer-events: auto;
}
.window-controls,
.window-btn,
#music-off,
#music-on,
.music-toggle,
.book-controls,
.book-controls-item {
  -webkit-app-region: no-drag;
}

.book-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.book-controls-item {
  cursor: pointer;
  background-color: #513315;
  border-radius: 12px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flipbook {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.flipbook.loaded {
  opacity: 1;
}

.window-controls {
  display: flex;
  gap: 4px;
  align-items: center;
  cursor: pointer;
}

.flipbook .page {
  -webkit-box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  -moz-box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  -ms-box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  -o-box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  width: 393px;
  height: 591px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.flipbook > div {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  position: relative;
}

.video-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  -webkit-app-region: no-drag;
}

.video-modal.active {
  display: flex;
  opacity: 1;
  pointer-events: all;
}

.video-content {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-app-region: no-drag;
}

.video-content video {
  max-width: 393px;
  max-height: 400px;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
  -webkit-app-region: no-drag;
}

.close-video {
  position: absolute;
  top: -20px;
  right: -40px;
  font-size: 48px;
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s;
  -webkit-app-region: no-drag;
}
.close-video:hover {
  transform: scale(1.2);
}

.page-buttons {
  position: absolute;
  bottom: 30px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.play-btn {
  background: rgba(0, 0, 0, 0.6);
  color: #cba34b;
  border: none;
  border-radius: 50%;
  font-size: 32px;
  width: 60px;
  height: 60px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.3s ease;
  z-index: 20;
}

.play-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

.audio-btn {
  background: rgba(0, 0, 0, 0.6);
  color: #cba34b;
  border: none;
  border-radius: 50%;
  font-size: 32px;
  width: 60px;
  height: 60px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.3s ease;
  z-index: 20;
}

.audio-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

.music-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 45px;
}

.music-toggle svg {
  position: absolute;
  transition: opacity 0.3s ease;
}

#music-off {
  opacity: 0;
} /* по умолчанию видно "включён" */
.music-muted #music-on {
  opacity: 0;
}
.music-muted #music-off {
  opacity: 1;
}
