/* Cave scene styles */

#cave {
  position: fixed;
  width: 2000px;
  height: 1200px;
  transform: scale(3, 3);
  transform-origin: top left;
  overflow: visible;
  left: 0;
  top: 0;
  background: url(../images/tiles/rocks.png) repeat;
  background-size: 16px;
  z-index: 9999;
  filter: brightness(0.8);
}

/* Tent scene styles */

#tent1 {
  position: fixed;
  width: 416px;
  height: 188px;
  transform: scale(3, 3);
  transform-origin: top left;
  overflow: visible;
  left: 0;
  top: 0;
  background: #414756;
  z-index: 9999;
}

.cave-hall {
  position: absolute;
  left: 940px;
  width: 120px;
  height: 1200px;
  background: url(../images/tiles/tile_0109.png) repeat;
  background-size: 16px;
  z-index: 1;
  filter: brightness(0.3);
  box-shadow: inset 0 0 0px -2px rgba(0, 0, 0, 0.55) inset;
}

.cave-hall::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 16px;
  height: 100%;
  background: url(../images/tiles/tile_0108.png) repeat-y;
  background-size: 16px;
  box-shadow: inset 0 0 0px -2px rgba(0, 0, 0, 0.55);
}

.cave-hall::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 16px;
  height: 100%;
  background: url(../images/tiles/tile_0110.png) repeat-y;
  background-size: 16px;
}

.cave-side-rocks-left {
  position: absolute;
  left: 924px;
  top: 0;
  width: 16px;
  height: 1172px;
  background: url(../images/tiles/rocks.jpg);
  background-size: 16px;
  z-index: 3;
  filter: brightness(0.2);
  box-shadow: 
    inset -3px 0 6px rgba(0, 0, 0, 0.01),
    inset -2px 0 3px rgba(0, 0, 0, 0.1);
}

.cave-side-rocks-left::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  pointer-events: none;
}

.cave-side-rocks-right {
  position: absolute;
  left: 1060px;
  top: 0;
  width: 16px;
  height: 1172px;
  background: url(../images/tiles/rocks.jpg);
  background-size: 16px;
  z-index: 3;
  filter: brightness(0.2);
}

.cave-side-rocks-right::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.1), transparent);
  pointer-events: none;
}

.cave-dark {
  position: absolute;
  top: 0;
  width: 940px;
  height: 1200px;
  background: rgba(0, 0, 0, 0.8);
  pointer-events: none;
  z-index: 2;
}

.cave-dark.right {
  left: 1060px;
  transform: scaleX(-1);
}

.cave-dark.left {
  left: 0;
}

.cave-sign {
  position: absolute;
  width: 260px;
  padding: 12px 14px;
  background: rgba(20, 20, 20, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  color: #fdf6e3;
  font-family: "Press Start 2P", cursive;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.cave-sign.left {
  left: 620px;
}

.cave-sign.left::after {
  content: "";
  position: absolute;
  right: -78px;
  top: 0%;
  width: 90px;
  height: 1px;
  background: repeating-linear-gradient(
    to right,
    rgba(255, 255, 255, 0.4) 0px,
    rgba(255, 255, 255, 0.4) 4px,
    transparent 4px,
    transparent 8px
  );
  opacity: 0.3;
  transform: translateY(-50%);
  box-shadow: 0 0 2px rgba(255, 255, 255, 0.2);
}

.cave-sign.right {
  left: 1120px;
}

.cave-sign.right::after {
  content: "";
  position: absolute;
  left: -78px;
  top: 0%;
  width: 90px;
  height: 1px;
  background: repeating-linear-gradient(
    to left,
    rgba(255, 255, 255, 0.4) 0px,
    rgba(255, 255, 255, 0.4) 4px,
    transparent 4px,
    transparent 8px
  );
  opacity: 0.3;
  transform: translateY(-50%);
  box-shadow: 0 0 2px rgba(255, 255, 255, 0.2);
}

.cave-sign .year {
  font-size: 6px;
  margin-bottom: 6px;
  color: #ffde89;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.cave-sign .title {
  font-size: 10px;
  margin-bottom: 6px;
  color: #ffffff;
  line-height: 1.3;
}

.cave-sign .desc {
  font-size: 5px;
  line-height: 1.5;
  color: #d2c2b2;
  opacity: 0.9;
}

.cave-sign .img {
  width: 100%;
  height: 80px;
  margin-bottom: 8px;
  background-size: cover;
  background-position: center;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}


/* Responsive: Make interactive signs larger on small screens */
@media (max-width: 900px) {
  .cave-timeline-sign-interact {
    width: 40px;
    height: 40px;
    background-size: 40px 40px;
  }
}

/* Interactive signs for timeline entries */
.cave-timeline-sign-interact {
  position: absolute;
  width: 32px;
  height: 32px;
  background-image: url("../images/sign.png");
  background-size: 32px 32px;
  background-repeat: no-repeat;
  z-index: 15;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25)) brightness(0.6);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%); /* Center vertically on the Y position */
}

.cave-timeline-sign-interact::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 4px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  filter: blur(3px);
  z-index: -1;
}

.cave-timeline-sign-text {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  color: #fdf6e3;
  font-family: "Press Start 2P", cursive;
  font-size: 6px;
  white-space: nowrap;
  text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
  pointer-events: none;
  z-index: 16;
}

/* Timeline Modal */
.timeline-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100000;
  display: none;
  pointer-events: none;
}

.timeline-modal.active {
  display: block;
  pointer-events: all;
}

.timeline-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  z-index: 1;
}

.timeline-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  background: rgba(20, 20, 20, 0.98);
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.8), 0 0 0 4px rgba(0, 0, 0, 0.5);
  padding: 40px 20px 20px 20px;
  overflow-y: auto;
  transform: translate(-50%, -50%) scale(0.9);
  transition: transform 0.3s ease;
  z-index: 2;
  box-sizing: border-box;
}

.timeline-modal.active .timeline-modal-content {
  transform: translate(-50%, -50%) scale(1);
}

.timeline-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzElEQVRYR+2X0Q6AIAhF5f8/2jYXZkwEjNSVvVUjDpcrGgT7FUkI2D9xRfQETwNIiWO85wfINfQUEyxBG2ArsLwC0jioGt5zFcwF4OYDPi/mBYKm4t0U8ATgRm3ThFoAqkhNgWkA0jJLvaOVSs7j3qMnSgXWBMiWPXe94QqMBMBc1VZIvaTu5u5pQewq0EqNZvIEMCmxAawK0DNkay9QmfFNAJUXfgGgUkLaE7j/h8fnASkxHTz0DGIBMCnBeeM7AArpUd3mz2x3C7wADglA8BcWMZhZAAAAAElFTkSuQmCC)
      14 0,
    pointer !important;
  z-index: 3;
  color: #fdf6e3;
  font-size: 24px;
  padding: 8px;
  line-height: 1;
}

.timeline-modal-close:hover {
  opacity: 0.7;
}

.timeline-modal-entry-content {
  color: #fdf6e3;
  font-family: "Press Start 2P", cursive;
}

.timeline-entry-content {
  margin-top: 60px;
  color: #fdf6e3;
  font-family: "Press Start 2P", cursive;
}

.timeline-modal-img,
.timeline-entry-img {
  width: 100%;
  height: 200px;
  margin-bottom: 20px;
  background-size: cover;
  background-position: center;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.timeline-modal-year,
.timeline-entry-year {
  font-size: 12px;
  margin-bottom: 12px;
  color: #ffde89;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.timeline-modal-title,
.timeline-entry-title {
  font-size: 16px;
  margin-bottom: 16px;
  color: #ffffff;
  line-height: 1.4;
}

.timeline-modal-desc,
.timeline-entry-desc {
  font-size: 14px;
  line-height: 1.6;
  color: #d2c2b2;
  opacity: 0.9;
  font-family: "Courier New", Courier, monospace;
}

/* Responsive: Make modal full screen on small devices */
@media (max-width: 900px) {
  .timeline-modal-content {
    width: 95%;
    max-width: 95%;
    max-height: 90vh;
  }
  
  .cave-timeline-sign-interact {
    width: 40px;
    height: 40px;
    background-size: 40px 40px;
  }
}

.cave-exit {
  position: absolute;
  left: 972px;
  top: 1172px;
  width: 56px;
  height: 16px;
  background-color: #21211a;
  border-radius: 0px 0px 4px 4px;
  z-index: 6;
  box-shadow: -6px 0px 12px rgba(0, 0, 0, 0.5) inset,
              6px 0px 12px rgba(0, 0, 0, 0.5) inset;
}

.cave-exit::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 150%;
  background: radial-gradient(ellipse at bottom, rgba(255, 244, 200, 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: -1;
}

.cave-exit-light-beam {
    position: absolute;
    left: 968px;
    top: 1150px;
    width: 64px;
    height: 32px;
    background: linear-gradient(to bottom, transparent 0%, rgba(255, 244, 200, 1) 70%, rgba(255, 244, 200, 1) 100%);
    filter: blur(10px);
    pointer-events: none;
    z-index: 4;
    border-radius: 0px 0px 4px 4px;
    opacity: 0.8;
    animation: exit-light-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 244, 200, 0.6),
                0 0 40px rgba(255, 220, 150, 0.4);
}

@keyframes exit-light-pulse {
  0%, 100% {
    opacity: 0.8;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

.cave-exit-rocks-left {
  position: absolute;
  left: 0px;
  top: 1172px;
  width: 2000px;
  height: 16px;
  background: url(../images/tiles/rocks.jpg);
  background-size: 16px;
  z-index: 5;
  filter: brightness(0.3);
  box-shadow: 
    inset 0 4px 8px rgba(0, 0, 0, 0.1),
    inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.cave-exit-rocks-left::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1), transparent);
  pointer-events: none;
}

.cave-exit-rocks-left::after {
  content: "";
  position: absolute;
  top: 0;
  left: 976px;
  width: 48px;
  height: 100%;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.3), transparent);
  pointer-events: none;
}

.cave-exit-rocks-top {
  position: absolute;
  left: 0px;
  top: 1188px;
  width: 2000px;
  height: 12px;
  background: url(../images/tiles/rocks.jpg);
  background-size: 16px;
  z-index: 700;
  filter: brightness(0.3);
  box-shadow: 
    inset 0 3px 6px rgba(0, 0, 0, 0.01),
    inset 0 2px 3px rgba(0, 0, 0, 0.1);
}

.cave-exit-rocks-top::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent);
  pointer-events: none;
}

