body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #ff9a9e, #fad0c4, #ffecd2);
  color: #330000;
  text-align: center;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

.img {
  width: 400px;
  height: 400px;
  object-fit: cover;
}

/* Language selector */
/* Оновлений селектор мов */
.language-selector {
  position: absolute; /* Змінюємо на absolute, щоб не перекривати модалки */
  top: 15px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: flex-end; /* Центруємо на мобільних за замовчуванням */
  gap: 8px;
  z-index: 1000; /* Достатньо, щоб бути над шапкою, але під модалкою */
  padding: 0 10px;
}

.lang-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #ff4d6d;
  color: #ff4d6d;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: bold;
  transition: all 0.3s;
  white-space: nowrap;
}

/* На великих екранах зміщуємо в кут */
@media (min-width: 769px) {
  .language-selector {
    justify-content: flex-end;
    right: 20px;
    left: auto;
    top: 20px;
  }
}

.lang-btn:hover {
  background: #ff4d6d;
  color: white;
  transform: scale(1.05);
}

.lang-btn.active {
  background: #ff4d6d;
  color: white;
}

header {
  padding: 60px 20px;
  position: relative;
  z-index: 10;
}
header h1 {
  font-size: 3rem;
  margin-bottom: 10px;
}
header p {
  font-size: 1.3rem;
}
.heart {
  font-size: 2rem;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}
.message {
  background: rgba(255, 255, 255, 0.85);
  margin: 40px auto;
  padding: 30px;
  max-width: 700px;
  border-radius: 25px;
  font-size: 1.2rem;
  line-height: 1.6;
  color: #330000;
  position: relative;
  z-index: 100;
  pointer-events: none;
}
footer {
  padding: 30px;
  font-size: 1rem;
  opacity: 0.9;
  color: #330000;
  position: relative;
  z-index: 100;
  pointer-events: none;
}

/* Falling hearts - за модальним вікном */
.falling-heart {
  position: fixed;
  top: -10px;
  font-size: 24px;
  animation: fall linear forwards;
  pointer-events: none;
  user-select: none;
  z-index: 14999;
  color: #ff4d6d;
  text-shadow: 0 0 5px #ff4d6d;
}

/* Falling hearts в модальному вікні - на задньому фоні */
.modal-heart {
  position: fixed;
  top: -10px;
  font-size: 24px;
  animation: fall linear forwards;
  pointer-events: none;
  user-select: none;
  z-index: 14999;
  color: #ff4d6d;
  text-shadow: 0 0 5px #ff4d6d;
  opacity: 0.6;
}

@keyframes fall {
  to {
    transform: translateY(110vh);
    opacity: 0;
  }
}

/* Love button */
.love-btn,
.runaway-btn {
  border: none;
  color: white;
  padding: 15px 30px;
  font-size: 1.2rem;
  border-radius: 50px;
  cursor: pointer;
  margin-top: 20px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
  transition:
    transform 0.2s,
    background 0.3s;
  user-select: none;
}
.love-btn {
  background: #ff4d6d;
  margin-right: 15px;
}
.love-btn:hover {
  transform: scale(1.1);
}

/* Runaway button */
.runaway-btn {
  background: #555555;
  position: relative;
  z-index: 50;
}

/* Shake animation */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 15000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  animation: fadeIn 0.5s;
  overflow-y: auto;
}

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

.modal-content {
  position: relative;
  margin: auto;
  padding: 70px 10px 20px 10px;
  width: 90%;
  max-width: 800px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: auto;
  z-index: 16000;
}

.slide {
  display: none;
  position: relative;
  text-align: center;
  animation: slideIn 0.5s;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.slide.active {
  display: block;
}

.slide img {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  /* border-radius: 20px; */
  border-radius: 5%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.slide-text {
  background: rgba(255, 255, 255, 0.95);
  margin: 20px auto;
  padding: 20px 30px;
  border-radius: 20px;
  font-size: 2rem;
  color: #ff4d6d;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
  max-width: 800px;
}

.close {
  position: fixed;
  top: 20px;
  right: 20px;
  margin-top: 30px;
  color: #fff;
  font-size: 45px;
  font-weight: bold;
  cursor: pointer;
  z-index: 20001;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: auto;
  transition: all 0.3s;
}

.close:hover {
  color: #ff4d6d;
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

/* .prev,
.next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  width: auto;
  margin-top: -30px;
  padding: 16px;
  color: white;
  font-weight: bold;
  font-size: 30px;
  transition: 0.3s;
  border-radius: 0 5px 5px 0;
  user-select: none;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 16001;
  pointer-events: auto;
}

.next {
  right: 0;
  border-radius: 5px 0 0 5px;
} */

.prev:hover,
.next:hover {
  background-color: rgba(255, 77, 109, 0.8);
}

.slide-counter {
  color: #fff;
  font-size: 1.2rem;
  padding: 10px;
  text-align: center;
  margin-top: 10px;
}

/* Sad modal styles */
.sad-modal {
  display: none;
  position: fixed;
  z-index: 15000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  animation: fadeIn 0.5s;
  overflow-y: auto;
}

.sad-modal-content {
  position: relative;
  margin: auto;
  padding: 40px 20px;
  width: 90%;
  max-width: 600px;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  pointer-events: auto;
  z-index: 16000;
}

.big-heart {
  font-size: 150px;
  animation: heartbeat 1.2s infinite;
  display: block;
  margin: 20px auto;
}

@keyframes heartbeat {
  0%,
  100% {
    transform: scale(1);
  }
  10%,
  30% {
    transform: scale(0.9);
  }
  20%,
  40%,
  60%,
  80% {
    transform: scale(1.1);
  }
  50%,
  70% {
    transform: scale(1.05);
  }
}

.sad-text {
  color: #fff;
  font-size: 1.8rem;
  line-height: 1.8;
  margin: 30px 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.sad-text p {
  margin: 20px 0;
}

.sad-close {
  background: #555;
  color: white;
  border: none;
  padding: 15px 40px;
  font-size: 1.2rem;
  border-radius: 50px;
  cursor: pointer;
  margin-top: 30px;
  transition: background 0.3s;
  pointer-events: auto;
}

.sad-close:hover {
  background: #777;
}

/* Mobile optimization */
@media (max-width: 768px) {
  header h1 {
    font-size: 2rem;
  }

  header p {
    font-size: 1rem;
  }

  .language-selector {
    top: 10px;
    right: 10px;
    gap: 5px;
  }

  .lang-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .love-btn,
  .runaway-btn {
    padding: 12px 25px;
    font-size: 1rem;
    margin: 10px 5px;
  }

  .message {
    margin: 20px auto;
    padding: 20px;
    font-size: 1rem;
  }

  footer {
    padding: 20px;
    font-size: 0.9rem;
  }

  /* Modal mobile optimization */
  .modal-content {
    width: 95%;
    padding: 60px 10px 10px 10px;
    top: 0;
    transform: none;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .slide img {
    max-height: 50vh;
    border-radius: 15px;
  }

  .slide-text {
    margin: 15px auto;
    padding: 15px 20px;
    font-size: 1.1rem;
    max-width: 90%;
  }

  .close {
    top: 10px;
    right: 10px;
    font-size: 35px;
    width: 45px;
    height: 45px;
  }

  .prev,
  .next {
    padding: 12px;
    font-size: 24px;
    margin-top: -25px;
  }

  .slide-counter {
    font-size: 1rem;
    padding: 8px;
    margin-top: 15px;
  }

  /* Sad modal mobile */
  .sad-modal-content {
    width: 90%;
    padding: 30px 15px;
    top: 0;
    transform: none;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .big-heart {
    font-size: 100px;
    margin: 15px auto;
  }

  .sad-text {
    font-size: 1.3rem;
    line-height: 1.6;
    margin: 20px 0;
  }

  .sad-text p {
    margin: 15px 0;
  }

  .sad-close {
    padding: 12px 30px;
    font-size: 1rem;
    margin-top: 20px;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  header h1 {
    font-size: 1.5rem;
  }

  header p {
    font-size: 0.9rem;
  }

  .lang-btn {
    padding: 5px 8px;
    font-size: 0.7rem;
  }

  .love-btn,
  .runaway-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  .slide-text {
    font-size: 1rem;
    padding: 12px 15px;
  }

  .big-heart {
    font-size: 80px;
  }

  .sad-text {
    font-size: 1.1rem;
  }

  .close {
    width: 40px;
    height: 40px;
    font-size: 30px;
  }
}

/* Landscape mobile */
@media (max-height: 600px) and (orientation: landscape) {
  .modal-content {
    padding: 80px 10px 10px 10px;
  }

  .slide img {
    max-height: 40vh;
  }

  .slide-text {
    font-size: 0.9rem;
    padding: 10px 15px;
    margin: 10px auto;
  }

  .big-heart {
    font-size: 60px;
    margin: 10px auto;
  }

  .sad-text {
    font-size: 1rem;
    margin: 15px 0;
  }

  .sad-text p {
    margin: 10px 0;
  }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
  .love-btn:active,
  .runaway-btn:active {
    transform: scale(0.95);
  }

  .lang-btn:active {
    transform: scale(0.95);
  }

  .prev:active,
  .next:active {
    background-color: rgba(255, 77, 109, 0.8);
  }

  .sad-close:active {
    background: #777;
  }
}
