* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #d4b78f;
  --secondary-color: #8f9db4;
  --text-color: #333;
  --light-color: #f9f7f5;
  --dark-color: #333;
  --shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  --transition: all 0.3s ease;
}

html, body {
  height: 100%;
  width: 100%;
}

body {
  font-family: "Montserrat", sans-serif;
  color: var(--text-color);
  background-color: var(--light-color);
  line-height: 1.6;
  min-height: 100vh;
  min-width: 100vw;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flipbook-container {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  position: relative;
  background: var(--light-color);
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#flipbook {
  position: relative;
  
  max-width: 1200px;
  
  min-width: 320px;
  min-height: 320px;
  margin: 0 auto;
  perspective: 1200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flipbook-page {
  width: 100%;
  height: 100%;
  background: white;
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transform: rotateY(0deg) scale(0.98);
  transition: opacity 0.6s, transform 0.6s;
  z-index: 1;
  overflow: hidden;
}

.flipbook-page.active {
  opacity: 1;
  z-index: 2;
  transform: rotateY(0deg) scale(1);
  display: flex;
}

/* Flipbook page visibility */
.flipbook-page {
  display: none;
}
.flipbook-page.active {
  display: flex;
}

.flipbook-page .flipbook-left, .flipbook-page .flipbook-right {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4vw 2vw;
  min-width: 0;
  min-height: 0;
}

.flipbook-page .flipbook-left {
  border-right: 1px solid #f0e6d6;
  background: linear-gradient(120deg, #f9f7f5 80%, #f3e9d2 100%);
}

.flipbook-page .flipbook-right {
  background: linear-gradient(120deg, #f9f7f5 80%, #e6eaf3 100%);
}

.flipbook-photo {
  width: 100%;
  max-width: 400px;
  max-height: 60vh;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  object-fit: cover;
}

h1, h2, h3, h4 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  word-break: break-word;
}

.flipbook-left h2 {
  font-size: 2.8vw;
  min-font-size: 1.5rem;
  text-align: left;
  margin-bottom: 2vw;
}

.flipbook-date {
  font-size: 1.5vw;
  min-font-size: 1.1rem;
  color: var(--primary-color);
  margin-top: 2vw;
  font-family: 'Cormorant Garamond', serif;
}

.program-page {
  flex-direction: row;
  background: #fffaf7;
}

.flipbook-program {
  flex: 1 1 60%;
  padding: 3vw 2vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.flipbook-program h3 {
  color: var(--primary-color);
  font-size: 2vw;
  margin-bottom: 1vw;
}

.flipbook-program ul {
  margin-bottom: 1vw;
  font-size: 1.1vw;
  list-style: none;
  padding-left: 0;
}

.flipbook-program li {
  margin-bottom: 0.5vw;
}

.flipbook-program h4 {
  margin-top: 0.5vw;
  color: var(--secondary-color);
  font-size: 1.1vw;
}

.flipbook-bg {
  flex: 1 1 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
}

.flipbook-bg img {
  width: 100%;
  max-width: 220px;
  max-height: 40vh;
  border-radius: 10px;
  opacity: 0.85;
  object-fit: cover;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.wishes-page {
  flex-direction: column;
  background: linear-gradient(120deg, #f9f7f5 80%, #e6eaf3 100%);
  align-items: center;
  justify-content: center;
}

.flipbook-wishes {
  text-align: center;
  padding: 3vw 2vw 1vw 2vw;
}

.flipbook-wishes h3 {
  color: var(--primary-color);
  font-size: 2vw;
  margin-bottom: 1vw;
}

.flipbook-gallery {
  display: flex;
  gap: 1.5vw;
  justify-content: center;
  margin-top: 2vw;
  flex-wrap: wrap;
  max-width: 100%;
}
.flipbook-gallery img {
  width: 6vw;
  height: 6vw;
  min-width: 50px;
  min-height: 50px;
  max-width: 80px;
  max-height: 80px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
@media (max-width: 900px) {
  .flipbook-gallery {
    gap: 2vw;
  }
  .flipbook-gallery img {
    width: 10vw;
    height: 10vw;
    max-width: 70px;
    max-height: 70px;
  }
}
@media (max-width: 700px) {
  .flipbook-gallery {
    gap: 3vw;
    margin-top: 4vw;
  }
  .flipbook-gallery img {
    width: 15vw;
    height: 15vw;
    max-width: 60px;
    max-height: 60px;
  }
}

.flipbook-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 54px;
  height: 54px;
  font-size: 2.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  cursor: pointer;
  z-index: 20;
  transition: background 0.2s, transform 0.2s;
  opacity: 0.96;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  border: 2px solid #e6e6e6;
}
.flipbook-btn span {
  display: none;
  font-size: 1rem;
  margin-left: 8px;
  margin-right: 8px;
}
@media (min-width: 701px) {
  .flipbook-btn.prev span {
    display: inline;
    margin-left: 0;
    margin-right: 8px;
  }
  .flipbook-btn.next span {
    display: inline;
    margin-right: 0;
    margin-left: 8px;
  }
}
.flipbook-btn.prev {
  left: 2vw;
}
.flipbook-btn.next {
  right: 2vw;
}
.flipbook-btn:hover, .flipbook-btn:focus {
  background: var(--secondary-color);
  transform: translateY(-50%) scale(1.08);
}

/* Первая страница с фоном */
.cover-page {
  background-size: cover !important;
  background-position: center !important;
  position: relative;
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  min-width: 100%;
}
.cover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.cover-text {
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 16px rgba(0,0,0,0.45);
  width: 100vw;
  max-width: 90vw;
  padding: 0 4vw;
}
.cover-text h2 {
  font-size: 2.8vw;
  font-weight: 600;
  margin-bottom: 2vw;
  letter-spacing: 0.04em;
}
.cover-text .flipbook-date {
  font-size: 1.5vw;
  color: #ffe6b0;
  margin-top: 2vw;
  font-family: 'Cormorant Garamond', serif;
  text-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
@media (max-width: 900px) {
  .cover-text h2 {
    font-size: 2rem;
  }
  .cover-text .flipbook-date {
    font-size: 1.1rem;
  }
}
@media (max-width: 700px) {
  .cover-text {
    max-width: 98vw;
    padding: 0 2vw;
    height: 80%;
  }
  .cover-text h2 {
    font-size: 1.7rem;
    margin-bottom: 4vw;
  }
  .cover-text .flipbook-date {
    font-size: 1.5rem;
    margin-top: 2vw;
  }
}
/* Кнопки всегда внизу по бокам */
.flipbook-btn {
  position: fixed !important;
  bottom: 32px !important;
  top: unset !important;
  transform: none !important;
  width: 54px;
  height: 54px;
  font-size: 2.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  cursor: pointer;
  z-index: 100;
  outline: none;
  border: 2px solid #e6e6e6;
  background: var(--primary-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.96;
}
.flipbook-btn.prev {
  left: 32px !important;
  right: unset !important;
}
.flipbook-btn.next {
  right: 32px !important;
  left: unset !important;
}
@media (max-width: 700px) {
  .flipbook-btn {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    bottom: 16px !important;
  }
  .flipbook-btn.prev {
    left: 12px !important;
  }
  .flipbook-btn.next {
    right: 12px !important;
  }
}

/* Универсальный стиль для всех страниц flipbook */
.flipbook-page {
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: #fffaf7;
  min-height: 100%;
  min-width: 100%;
  box-sizing: border-box;
}
.flipbook-program, .flipbook-wishes {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 4vw 5vw;
  box-sizing: border-box;
}
.flipbook-program h3, .flipbook-wishes h3 {
  color: var(--primary-color);
  font-size: 2.5vw;
  margin-bottom: 2vw;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
}
.flipbook-program ul {
  margin-bottom: 2vw;
  font-size: 1.3vw;
  list-style: none;
  padding-left: 0;
}
.flipbook-program li {
  margin-bottom: 1vw;
  font-size: 1.3vw;
}
.flipbook-program li b {
  font-size: 1.3vw;
}
.flipbook-program h4 {
  margin-top: 1vw;
  color: var(--secondary-color);
  font-size: 1.2vw;
}
.flipbook-bg, .flipbook-gallery {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 2vw;
}
.flipbook-bg img, .flipbook-gallery img {
  width: 320px;
  max-width: 90vw;
  height: auto;
  max-height: 340px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
}
.flipbook-gallery {
  gap: 2vw;
}
@media (max-width: 900px) {
  .flipbook-program, .flipbook-wishes {
    max-width: 98vw;
    padding: 6vw 2vw;
  }
  .flipbook-program h3, .flipbook-wishes h3 {
    font-size: 2rem;
    margin-bottom: 4vw;
  }
  .flipbook-program ul, .flipbook-program li, .flipbook-program li b {
    font-size: 1.1rem;
  }
  .flipbook-program h4 {
    font-size: 1rem;
  }
  .flipbook-bg img, .flipbook-gallery img {
    width: 90vw;
    max-width: 98vw;
    max-height: 220px;
    border-radius: 14px;
  }
  .flipbook-gallery {
    gap: 3vw;
  }
}
@media (max-width: 700px) {
  .flipbook-page {
    flex-direction: column !important;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    min-width: 100vw;
    min-height: 100vh;
    background: #fffaf7;
  }
  .flipbook-program, .flipbook-wishes {
    width: 100vw;
    max-width: 100vw;
    padding: 8vw 2vw 2vw 2vw;
    align-items: center;
    text-align: center;
  }
  .flipbook-program h3, .flipbook-wishes h3 {
    font-size: 1.5rem;
    margin-bottom: 5vw;
  }
  .flipbook-program ul, .flipbook-program li, .flipbook-program li b {
    font-size: 1.1rem;
  }
  .flipbook-program h4 {
    font-size: 1rem;
  }
  .flipbook-bg, .flipbook-gallery {
    width: 100vw;
    margin-top: 6vw;
    justify-content: center;
    align-items: center;
  }
  .flipbook-bg img, .flipbook-gallery img {
    width: 90vw;
    max-width: 98vw;
    max-height: 220px;
    border-radius: 14px;
  }
  .flipbook-gallery {
    gap: 4vw;
  }
}

.program-text {
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 16px rgba(0,0,0,0.45);
  width: 100vw;
  max-width: 90vw;
  padding: 0 4vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.program-text h3 {
  font-size: 3.2vw;
  font-weight: 600;
  margin-bottom: 2.5vw;
  letter-spacing: 0.04em;
  color: #ffe6b0;
}
.program-text ul {
  list-style: none;
  margin: 0 0 2.5vw 0;
  padding: 0;
  font-size: 2vw;
  font-weight: 500;
}
.program-text ul li {
  margin-bottom: 1.2vw;
  font-size: 2vw;
  font-weight: 500;
}
.program-text h4 {
  margin-top: 2.5vw;
  color: #b8c6e6;
  font-size: 1.6vw;
  font-weight: 500;
}
.program-text p {
  font-size: 1.5vw;
  margin-top: 0.8vw;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.program-text p b {
  font-size: 1.5vw;
  color: #ffe6b0;
  font-weight: 600;
}
@media (max-width: 900px) {
  .program-text h3 {
    font-size: 2.2rem;
  }
  .program-text ul, .program-text ul li {
    font-size: 1.4rem;
  }
  .program-text h4 {
    font-size: 1.2rem;
  }
  .program-text p, .program-text p b {
    font-size: 1.1rem;
  }
}
@media (max-width: 700px) {
  .program-text {
    max-width: 98vw;
    padding: 0 2vw;
  }
  .program-text h3 {
    font-size: 1.5rem;
    margin-bottom: 5vw;
  }
  .program-text ul, .program-text ul li {
    font-size: 1.2rem;
  }
  .program-text h4 {
    font-size: 1.1rem;
  }
  .program-text p, .program-text p b {
    font-size: 1rem;
  }
}

.wishes-text {
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 16px rgba(0,0,0,0.45);
  width: 100vw;
  max-width: 90vw;
  padding: 0 4vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.wishes-text h3 {
  font-size: 3.2vw;
  font-weight: 600;
  margin-bottom: 2.5vw;
  letter-spacing: 0.04em;
  color: #ffe6b0;
}
.wishes-text p {
  font-size: 1.8vw;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.25);
  line-height: 1.4;
}
@media (max-width: 900px) {
  .wishes-text h3 {
    font-size: 2.2rem;
  }
  .wishes-text p {
    font-size: 1.2rem;
  }
}
@media (max-width: 700px) {
  .wishes-text {
    max-width: 98vw;
    padding: 0 2vw;
  }
  .wishes-text h3 {
    font-size: 1.5rem;
    margin-bottom: 4vw;
  }
  .wishes-text p {
    font-size: 1.1rem;
  }
}

/* Music control button */
.music-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.music-btn:hover {
  background: var(--secondary-color);
  transform: scale(1.1);
}

.music-btn.playing {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(212, 183, 143, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(212, 183, 143, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(212, 183, 143, 0);
  }
}

@media (max-width: 700px) {
  .music-btn {
    top: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
    font-size: 1rem;
  }
}

.invitation-text {
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 16px rgba(0,0,0,0.45);
  width: 100vw;
  max-width: 90vw;
  padding: 0 4vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.invitation-text h3 {
  font-size: 3.2vw;
  font-weight: 600;
  margin-bottom: 2.5vw;
  letter-spacing: 0.04em;
  color: #ffe6b0;
}
.invitation-text p {
  font-size: 1.8vw;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.25);
  line-height: 1.6;
  margin-bottom: 1.5vw;
}
@media (max-width: 900px) {
  .invitation-text h3 {
    font-size: 2.2rem;
  }
  .invitation-text p {
    font-size: 1.2rem;
  }
}
@media (max-width: 700px) {
  .invitation-text {
    max-width: 98vw;
    padding: 0 2vw;
  }
  .invitation-text h3 {
    font-size: 3.5rem;
    margin-bottom: 4vw;
  }
  .invitation-text p {
    font-size: 1.7rem;
    margin-bottom: 2vw;
  }
}
