/* ---- CÀI ĐẶT CHUNG & NỀN ---- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

#container {
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #0a0a1f 0%, #000000 100%);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
}

canvas {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 11;
}

/* ---- MÀN HÌNH CẢNH BÁO XOAY NGANG ---- */
#landscape-warning {
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center, #1c1a3a 0%, #0c0a1f 100%);
  color: #e0eaff;
  display: none;
  justify-content: center;
  align-items: center;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease-in-out;
}

body.portrait #landscape-warning {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

/* Nội dung cảnh báo - Nâng cấp lớn ở đây! */
#landscape-warning .warning-content {
  position: relative;
  z-index: 2;
  padding: 2rem 2.5rem;
  border-radius: 20px;
  background: rgba(28, 26, 58, 0.6);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(173, 216, 230, 0.3);
  box-shadow: 0 0 40px rgba(78, 88, 216, 0.5), 0 0 15px rgba(255, 255, 255, 0.1),
    inset 0 0 8px rgba(173, 216, 230, 0.2);
  transform: scale(0.95);
  opacity: 0;
  animation: fadeInContent 0.6s 0.2s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
@keyframes fadeInContent {
  to {
    transform: scale(1);
    opacity: 1;
  }
}

#landscape-warning h1 {
  font-family: "Orbitron", "Montserrat", sans-serif;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  letter-spacing: 1.5px;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(230, 230, 255, 0.8), 0 0 4px rgba(255, 255, 255, 1);
}
#landscape-warning h1:nth-of-type(2) {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  opacity: 0.8;
}

#landscape-warning p {
  font-size: 1.1rem;
  color: #c0c8ff;
  line-height: 1.5;
  text-shadow: 0 0 6px rgba(192, 200, 255, 0.7);
}
#landscape-warning p:last-of-type {
  margin-top: 1rem;
  font-weight: bold;
  letter-spacing: 1px;
}

/* Nền sao động */
#landscape-warning .stars-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  pointer-events: none;
  background: transparent;
  overflow: hidden;
}
#landscape-warning .stars-bg::before,
#landscape-warning .stars-bg::after {
  content: "";
  position: absolute;
  width: 200%;
  height: 200%;
  top: -50%;
  left: -50%;
  background-image: radial-gradient(circle, #fff 1px, transparent 1px),
    radial-gradient(circle, #c0c8ff 1px, transparent 1px),
    radial-gradient(circle, #fff 0.5px, transparent 0.5px);
  background-size: 100px 100px, 150px 150px, 60px 60px;
  background-position: 0 0, 50px 50px, 30px 30px;
  opacity: 0;
  animation: stars-move 30s linear infinite, fadeInStars 1s ease-out forwards;
}
#landscape-warning .stars-bg::after {
  background-size: 150px 150px, 80px 80px, 120px 120px;
  background-position: 75px 75px, 40px 40px, 10px 10px;
  animation-duration: 45s;
}
@keyframes fadeInStars {
  to {
    opacity: 0.6;
  }
}
@keyframes stars-move {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-50%);
  }
}

/* ---- HIỆU ỨNG BLUR VÀ OVERLAY ---- */
#dark-overlay {
  position: fixed;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 5, 0.95);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.8s ease-in-out;
}
body.intro-started #dark-overlay {
  opacity: 0;
  transition-duration: 1.5s;
}
body.portrait #dark-overlay {
  display: none !important;
}

/* Hiệu ứng làm mờ canvas nền */
body.portrait #container canvas {
  filter: blur(10px) brightness(0.6);
  opacity: 0.4;
  transition: filter 0.8s ease-out, opacity 0.8s ease-out;
}
body:not(.portrait) #container canvas {
  filter: blur(0) brightness(1);
  opacity: 1;
  transition: filter 1.2s ease-in, opacity 1.2s ease-in;
}

/* ---- ICON XOAY ĐIỆN THOẠI ---- */
.rotate-icon {
  width: 50px;
  height: 50px;
  margin: 0 auto 1.2rem auto;
  background: url('data:image/svg+xml;utf8,<svg width="56" height="56" viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="18" y="8" width="20" height="40" rx="6" stroke="%236a5acd" stroke-width="3" fill="%23e0e3ff"/><circle cx="28" cy="45" r="2" fill="%236a5acd"/></svg>') center/contain no-repeat;
  animation: rotate-phone 1.8s infinite cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes rotate-phone {
  0% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(-25deg) scale(1.1);
  }
  50% {
    transform: rotate(0deg) scale(1);
  }
  75% {
    transform: rotate(25deg) scale(1.1);
  }
  100% {
    transform: rotate(0deg) scale(1);
  }
}

@media (orientation: landscape) {
  .rotate-icon {
    animation: none;
    transform: rotate(90deg);
  }
}
.text-white {
  color: white !important;
}

.btn-audio-toggle {
  background-color: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.music-status {
  display: flex;
  position: fixed;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  z-index: 9999;
  align-items: center;
  font-family: sans-serif;
  font-size: 14px;
}

.music-status .spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #a259f7;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

#audio-icon {
  font-size: 20px;
}

body.portrait-mode #landscape-warning {
  display: flex;
  opacity: 1;
}

#image-input-container {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 10000;
  background: rgba(216, 205, 205, 0.308);
  padding: 15px 20px;
  border-radius: 12px;
  color: white;
  text-align: center;
   font-family: "Orbitron", "Montserrat", sans-serif;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  width: 320px;
}

#image-input-container label {
  font-weight:bold;
  font-size: 14px;
  user-select: none;
}

#image-links {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  border-radius: 8px;
  border: none;
  resize: vertical;
  font-family: monospace;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.1);
  transition: background-color 0.3s ease;
}

#image-links:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 8px #3f4a57;
}

#generate-link {
  margin-top: 12px;
  width: 100%;
  padding: 10px 0;
  background-color: #103663;
  border: none;
  border-radius: 10px;
  color: white;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 3px 10px rgba(71, 135, 255, 0.6);
}

#generate-link:hover {
  background-color: #203885;
  box-shadow: 0 6px 15px rgba(232, 65, 24, 0.8);
}
