* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  overflow-x: hidden;
}

/* Disable native animations when using JavaScript fallback */
.animation-timeline-fallback #hoa1,
.animation-timeline-fallback #chim1,
.animation-timeline-fallback #nguoi21,
.animation-timeline-fallback #nguoi22,
.animation-timeline-fallback #nguoi23,
.animation-timeline-fallback #nguoi24,
.animation-timeline-fallback #nguoi25,
.animation-timeline-fallback #nguoi31,
.animation-timeline-fallback #nguoi32,
.animation-timeline-fallback #nguoi33,
.animation-timeline-fallback #nguoi34,
.animation-timeline-fallback #nguoi35,
.animation-timeline-fallback #nguoi36,
.animation-timeline-fallback #ngua3,
.animation-timeline-fallback #sun42,
.animation-timeline-fallback #khoi5,
.animation-timeline-fallback #hoa6,
.animation-timeline-fallback #ngua7,
.animation-timeline-fallback #khoi7,
.animation-timeline-fallback #mo10,
.animation-timeline-fallback #sam,
.animation-timeline-fallback #vui,
.animation-timeline-fallback #trai,
.animation-timeline-fallback #ay,
.animation-timeline-fallback .progress-bar {
  animation: none !important;
}

/* Alternative: Use @supports to conditionally apply animations only when supported */
@supports (animation-timeline: view()) {
  /* All your existing animation rules will work here */
}

/* Fallback animations for browsers that don't support animation-timeline */
@supports not (animation-timeline: view()) {
  /* Disable all timeline-based animations and let JavaScript handle them */
  #hoa1,
  #chim1,
  #nguoi21,
  #nguoi22,
  #nguoi23,
  #nguoi24,
  #nguoi25,
  #nguoi31,
  #nguoi32,
  #nguoi33,
  #nguoi34,
  #nguoi35,
  #nguoi36,
  #ngua3,
  #sun42,
  #khoi5,
  #hoa6,
  #ngua7,
  #khoi7,
  #mo10,
  #sam,
  #vui,
  #trai,
  #ay,
  .progress-bar {
    animation: none !important;
  }
}

.hover-text {
  z-index: 2000 !important;
  transition: all 0.3s ease;
  color: #765050;
  cursor: default;
}

.hover-text:hover {
  color: #820000;
  transform: scale(1.05);
  cursor: default;
}

/* Individual word hover effects */
.hoverable-word {
  display: inline-block;
  transition: all 0.2s ease;
  cursor: default;
  border-radius: 3px;
  padding: 1px 2px;
}

.hoverable-word:hover {
  color: #820000;
  background-color: rgba(130, 0, 0, 0.1);
  transform: scale(1.1);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

img {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: #000000;
}

body {
  color: #765050;
  line-height: 1.6;
  max-width: 100dvw;
  overflow-x: hidden;
}

.progress-container {
  position: fixed;
  top: 0;
  z-index: 1000;
  width: 100%;
  height: 8px;
  background: transparent;
}

.progress-bar {
  height: 8px;
  background: rgba(192, 53, 15, 0.8);

  animation: progressBarFill linear;
  animation-timeline: scroll(root);
  animation-range: 0 100%;
}

@keyframes progressBarFill {
  from {
    width: 0%;
  }

  to {
    width: 100%;
  }
}

.background {
  height: fit-content;
  background: #fbaf7d;
  background: linear-gradient(
    rgba(251, 175, 125, 1) 0%,
    rgba(167, 141, 170, 1) 100%
  );
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

.scene {
  font-family: "Cormorant", sans-serif;
  font-weight: 900;
  font-style: italic;
  font-size: 2.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  position: relative;
  padding: 1rem;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  .scene {
    font-size: 1.8rem;
    padding: 0.5rem;
    min-height: 100vh;
  }
}

@media (max-width: 480px) {
  .scene {
    font-size: 1.4rem;
    padding: 0.5rem;
  }
}

#scene0 {
  background-image: url(/images/homepage.png);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;

  align-items: center;
  justify-content: flex-end;
  padding: 60px;
  padding-right: 320px;
}

#scene0 h1 {
  font-family: "Water Brush", cursive;
  font-weight: 400;
  font-style: normal;
  font-size: 106px;
  text-shadow: 3px 1px #765050;
}

#scene0 h2 {
  text-shadow: 3px 1px rgba(0, 0, 0, 0.2);
}

/* Mobile styles for scene0 */
@media (max-width: 768px) {
  #scene0 {
    justify-content: center;
    text-align: center;
    padding: 2rem;
    background-attachment: scroll !important;
  }

  #scene0 h1 {
    font-size: 4rem;
  }

  #scene0 h2 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  #scene0 h1 {
    font-size: 3rem;
  }

  #scene0 h2 {
    font-size: 1.2rem;
  }
}

#scene1 {
  background-image: url(/images/s1.png);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

#hoa1 {
  animation-name: hoa1;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 25% exit 75%;
  position: absolute;
  top: 0%;
  z-index: 20;
}

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

#chim1 {
  animation-name: chim1;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 50% exit 100%;
  position: absolute;
  top: 0%;
  z-index: 20;
}

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

#scene2 {
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

#nguoi21 {
  animation-name: nguoi21;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 80% exit 200%;
  position: absolute;
  left: 1%;
  z-index: 20;
}

@keyframes nguoi21 {
  0% {
    top: 35%;
    left: -80%;
  }

  100% {
    top: 35%;
    left: 10%;
  }
}

#nguoi22 {
  animation-name: nguoi22;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 10% exit 40%;
  position: absolute;
  left: 1%;
  z-index: 30;
}

@keyframes nguoi22 {
  0% {
    top: -10%;
    left: -30%;
  }

  100% {
    top: -10%;
    left: 2%;
  }
}

#nguoi23 {
  animation-name: nguoi23;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 20% exit 50%;
  position: absolute;
  z-index: 20;
}

@keyframes nguoi23 {
  0% {
    top: 10%;
    right: -45%;
  }

  100% {
    top: 10%;
    right: 100%;
  }
}

#nguoi24 {
  animation-name: nguoi24;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 30% exit 60%;
  position: absolute;
  z-index: 20;
}

@keyframes nguoi24 {
  0% {
    top: 10%;
    right: 0%;
  }

  100% {
    top: 10%;
    right: 100%;
  }
}

#nguoi25 {
  animation-name: nguoi25;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 40% exit 70%;
  position: absolute;
  z-index: 20;
}

@keyframes nguoi25 {
  0% {
    top: 50%;
    left: -20%;
  }

  100% {
    top: 50%;
    left: 100%;
  }
}

#thanh {
  position: absolute;
  top: 0%;
  left: 5%;
  z-index: 30;
}

#le {
  position: absolute;
  top: 10%;
  left: 15%;
  z-index: 30;
}

#gan {
  position: absolute;
  top: 35%;
  left: 50%;
  z-index: 30;
}

#chi {
  position: absolute;
  top: 45%;
  left: 60%;
  z-index: 30;
}

#scene3 {
  background-image: url(/images/s3.png);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  z-index: 30;
}

.scene3-text {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

#dap {
  z-index: 20;
}

#ngon {
  z-index: 20;
}

#scene3 img {
  top: 0%;
}

#nguoi31 {
  animation-name: nguoi31;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 0% exit 25%;
  position: absolute;
  left: 1%;
  z-index: 20;
}

@keyframes nguoi31 {
  0% {
    top: 2%;
    left: -20%;
  }

  100% {
    top: 2%;
    left: 100%;
  }
}

#nguoi32 {
  animation-name: nguoi32;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 15% exit 40%;
  position: absolute;
  right: 1%;
  z-index: 20;
}

@keyframes nguoi32 {
  0% {
    top: 1%;
    right: -50%;
  }

  100% {
    top: 3%;
    right: 100%;
  }
}

#nguoi33 {
  animation-name: nguoi33;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 30% exit 55%;
  position: absolute;
  z-index: 21;
}

@keyframes nguoi33 {
  0% {
    top: 0%;
    right: -30%;
  }

  100% {
    top: 0%;
    right: 30%;
  }
}

#nguoi34 {
  animation-name: nguoi34;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 45% exit 70%;
  position: absolute;
  z-index: 21;
}

@keyframes nguoi34 {
  0% {
    top: 0%;
    right: -100%;
  }

  100% {
    top: 0%;
    right: 75%;
  }
}

#nguoi35 {
  animation-name: nguoi35;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 60% exit 85%;
  position: absolute;
  z-index: 21;
}

@keyframes nguoi35 {
  0% {
    top: 5%;
    right: -20%;
  }

  100% {
    top: 5%;
    right: 0%;
  }
}

#nguoi36 {
  animation-name: nguoi36;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 75% exit 100%;
  position: absolute;
  z-index: 21;
}

@keyframes nguoi36 {
  0% {
    top: 2%;
    left: -10%;
  }

  100% {
    top: 2%;
    left: 100%;
  }
}

#ngua3 {
  animation-name: ngua3;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 80% exit 170%;
  position: absolute;
  top: -15%;
  z-index: 20;
}

@keyframes ngua3 {
  0% {
    top: 2%;
    right: -10%;
  }

  100% {
    top: 2%;
    right: 100%;
  }
}

#scene4 {
  background-image: url(/images/s4.png);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

#ta {
  position: absolute;
  top: 30%;
  left: 5%;
  z-index: 30;
}

#dat4 {
  position: absolute;
  bottom: 0;
  z-index: 30;
}

#sun42 {
  animation-name: sun42;
  animation-timeline: view();
  animation-range: entry 20% exit 140%;
  position: absolute;
  top: 30%;
  left: 0%;
  z-index: 10;
}

@keyframes sun42 {
  0% {
    top: -30%;
    left: -70%;
  }

  25% {
    top: -27%;
    left: -40%;
  }

  50% {
    top: 20;
    left: -10;
  }

  100% {
    top: 30%;
    left: 20%;
  }
}

#scene5 {
  background-image: url(/images/s5.png);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  z-index: 50;
}

#nao {
  position: absolute;
  top: 20%;
  right: 15%;
  z-index: 30;
}

#se {
  position: absolute;
  top: 50%;
  left: 2%;
  z-index: 30;
}

#rang {
  position: absolute;
  top: 80%;
  right: 5%;
  z-index: 30;
}

#khoi5 {
  animation-name: khoi5;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 25% exit 75%;
  position: absolute;
  top: 0%;
  z-index: 20;
}

@keyframes khoi5 {
  from {
    opacity: 0.25;
  }
  to {
    opacity: 1;
  }
}

#scene6 {
  background-image: url(/images/s6.png);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

#vuong {
  position: absolute;
  top: 10%;
  left: 5%;
  z-index: 30;
}

#dam {
  position: absolute;
  top: 20%;
  left: 10%;
  z-index: 30;
}

#noi {
  position: absolute;
  top: 40%;
  left: 5%;
  z-index: 30;
}

#xon {
  position: absolute;
  top: 50%;
  left: 10%;
  z-index: 30;
}

#kiep {
  position: absolute;
  top: 70%;
  left: 5%;
  z-index: 30;
}

#nua {
  position: absolute;
  top: 80%;
  left: 10%;
  z-index: 30;
}

#hoa6 {
  animation-name: hoa6;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 30% exit 70%;
  position: absolute;
  top: 600%;
  z-index: 40;
}

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

#scene7 {
  background-image: url(/images/s7.png);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

#phong {
  position: absolute;
  top: 10%;
  left: 5%;
  z-index: 30;
}

#khoc {
  position: absolute;
  top: 40%;
  left: 30%;
  z-index: 30;
}

#da {
  position: absolute;
  top: 70%;
  left: 55%;
  z-index: 30;
}

#ngua7 {
  animation-name: ngua7;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 60% exit 160%;
  position: absolute;
  top: -17%;
  z-index: 20;
}

@keyframes ngua7 {
  0% {
    top: -17%;
    right: -30%;
  }

  100% {
    top: -17%;
    right: 71%;
  }
}

#khoi7 {
  animation-name: khoi7;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 40% exit 80%;
  position: absolute;
  top: 0%;
  z-index: 20;
}

@keyframes khoi7 {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.5;
  }
}

#scene8 {
  background-image: url(/images/s81.png);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  display: flex;
  justify-content: center;
}

#phong {
  position: absolute;
  top: 15%;
  left: 30%;
  z-index: 30;
}

#dau {
  position: absolute;
  top: 40%;
  left: 10%;
  z-index: 30;
}

#khoc {
  position: absolute;
  top: 85%;
  left: 30%;
  z-index: 30;
}

#scene9 {
  background-image: url(/images/s81.png);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
}

#kheo {
  position: absolute;
  top: 10%;
  left: 55%;
  z-index: 30;
}

#da {
  position: absolute;
  top: 35%;
  left: 30%;
  z-index: 30;
}

#thi {
  position: absolute;
  top: 60%;
  left: 10%;
  z-index: 30;
}

#scene10 {
  background-image: url(/images/s81.png);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
}

#mo10 {
  animation-name: mo10;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 20% exit 80%;
  position: absolute;
  top: 0%;
  left: 5%;
  z-index: 30;
}

@keyframes mo10 {
  from {
    scale: 1;
  }
  to {
    scale: 0.9;
  }
}

#sam {
  position: absolute;
  top: 0%;
  left: 10%;
  z-index: 30;
  animation-name: sam;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 0% exit 30%;
}

@keyframes sam {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

#vui {
  position: absolute;
  top: 25%;
  left: 30%;
  z-index: 30;
  animation-name: vui;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 25% exit 55%;
}

@keyframes vui {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

#trai {
  position: absolute;
  top: 50%;
  left: 60%;
  z-index: 30;
  animation-name: trai;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 50% exit 80%;
}

@keyframes trai {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

#ay {
  position: absolute;
  top: 75%;
  left: 30%;
  z-index: 30;
  animation-name: ay;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-timeline: view();
  animation-range: entry 75% exit 100%;
}

@keyframes ay {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

#scene11 {
  background-image: url(/images/s9.png);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

#scene12 {
  font-family: "Cormorant Unicase", serif;
  font-weight: 500;
  font-style: normal;
  font-size: 28px;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  /* Fix background-attachment for all elements on mobile */
  * {
    background-attachment: scroll !important;
  }

  .scene3-text {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
  }

  /* Mobile responsive for hover text elements */
  .hover-text {
    font-size: 1.2rem;
    line-height: 1.4;
    margin: 0.5rem 0;
  }

  .hover-text p {
    margin: 0.5rem 0;
  }

  /* Mobile responsive for images */
  img {
    max-width: 100%;
    height: auto;
  }

  /* Mobile responsive for images with animations - keep absolute positioning */
  #hoa1,
  #chim1,
  #nguoi21,
  #nguoi22,
  #nguoi23,
  #nguoi24,
  #nguoi25,
  #nguoi31,
  #nguoi32,
  #nguoi33,
  #nguoi34,
  #nguoi35,
  #nguoi36,
  #ngua3,
  #ngua7,
  #dat4,
  #sun42,
  #khoi7,
  #hoa6,
  #mo10 {
    max-width: 100% !important;
    height: auto !important;
    /* Keep original positioning for animations to work */
  }

  /* Hide khoi5 on mobile */
  #khoi5 {
    display: none !important;
  }

  /* Mobile responsive for text elements WITHOUT animations - convert to relative */
  /* Only apply relative positioning to text elements that don't have animations */
  #thanh,
  #le,
  #gan,
  #chi,
  #ta,
  #nao,
  #se,
  #rang,
  #vuong,
  #dam,
  #noi,
  #xon,
  #kiep,
  #nua {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    margin: 1rem 0;
    text-align: center;
  }

  /* Text elements in scenes 7-9 that don't have JavaScript animations */
  #scene7 #phong,
  #scene7 #khoc,
  #scene7 #da,
  #scene8 #phong,
  #scene8 #dau,
  #scene8 #khoc,
  #scene9 #kheo,
  #scene9 #da,
  #scene9 #thi {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    margin: 1rem 0;
    text-align: center;
  }

  /* Keep absolute positioning for text elements WITH animations */
  #sam,
  #vui,
  #trai,
  #ay {
    /* Keep original positioning for animations to work */
    font-size: 1.2rem;
    /* Scale down for mobile but maintain absolute positioning */
    transform-origin: center;
  }

  /* Specific mobile adjustments for scenes */
  #scene0,
  #scene8,
  #scene9,
  #scene10,
  #scene11 {
    background-attachment: scroll !important;
  }

  .scene3-text {
    padding: 0 1rem;
  }

  /* Mobile responsive for individual word hover */
  .hoverable-word {
    padding: 2px 3px;
    margin: 1px;
  }

  .hoverable-word:hover {
    transform: scale(1.05);
  }
}

@media (max-width: 480px) {
  /* Fix background-attachment for all elements on small mobile */
  * {
    background-attachment: scroll !important;
  }

  .hover-text {
    font-size: 1rem;
    line-height: 1.3;
  }

  img {
    max-width: 100%;
  }

  #scene12 {
    font-size: 20px;
  }

  /* Fix background attachment for all scenes on small mobile */
  #scene0,
  #scene8,
  #scene9,
  #scene10,
  #scene11 {
    background-attachment: scroll !important;
  }

  /* Further scale down animated images for very small screens */
  #hoa1,
  #chim1,
  #nguoi21,
  #nguoi22,
  #nguoi23,
  #nguoi24,
  #nguoi25,
  #nguoi31,
  #nguoi32,
  #nguoi33,
  #nguoi34,
  #nguoi35,
  #nguoi36,
  #ngua3,
  #ngua7,
  #dat4,
  #sun42,
  #khoi7,
  #hoa6,
  #mo10 {
    max-width: 100% !important;
  }

  /* Keep khoi5 hidden on small mobile screens too */
  #khoi5 {
    display: none !important;
  }

  /* Scale down animated text for mobile */
  #sam,
  #vui,
  #trai,
  #ay {
    font-size: 1rem;
  }
}
