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

body, html {
  width: 100%;
  height: 100%;
  font-family: "Georgia", serif;
  font-size: 1.2em;
  color: #f4f4f4;
  overflow-y: auto;   /* allow scrolling between sections */
}

.scene {
  position: relative;   /* make buttons/overlays stick within this section */
  width: 100%;
  height: 100vh;        /* each scene fills full viewport */
  overflow: hidden;

  /* Flexbox center widgets */
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Layer that holds both bg and overlays */
.scene-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.scene-layer img {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* both bg and ruins scale identically */
}

/* Background & Overlays */
.bg { z-index: 0; }
.overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.1s, transform 0.1s;
  z-index: 1;
}
.overlay.glow {
  filter: drop-shadow(0 0 12px #ffd369) drop-shadow(0 0 24px #ffd369);
}
.overlay.hidden {
  display: none !important;
}
.overlay[data-action="seal"] {
  opacity: 0;
  pointer-events: none; /* seal is non-interactive initially */
  transition: opacity 0.1s ease;
}

/* Widget as tablet */
.widget {
  position: relative;
  z-index: 2; /* widgets above overlays */
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 211, 105, 0.4);
  border-radius: 12px;
  padding: 20px 30px;
  text-align: center;
  max-width: 600px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.7),
              0 0 12px rgba(255, 211, 105, 0.2);
  animation: fadeIn 2s ease;
  margin: 0;
}
.widget h2 {
  font-size: 1.8em;
  color: #ffd369;
  text-shadow: 0 0 8px #ffae42, 0 0 16px #ff8c00;
  margin-bottom: 10px;
}
.widget p {
  font-size: 1.1em;
  line-height: 1.5em;
  color: #e0e0e0;
  text-shadow: 0 0 6px #00ffff, 0 0 12px #00ced1;
}
.inscriptions {
  font-size: 1.5em;
  line-height: 1.8em;
}
.hidden { display: none; }

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

/* Floating Intro Button (scoped to beach scene only) */
#beach-scene #intro-btn {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 5;
  display: none;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #ffd369;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.9em;
  color: #ffd369;
  cursor: pointer;
  text-shadow: 0 0 6px #ffae42, 0 0 12px #ff8c00;
  transition: 0.3s;
}
#beach-scene #intro-btn:hover {
  background: rgba(255, 211, 105, 0.1);
  transform: scale(1.05);
}

/* Button */
button,
a.button-link {
  background: transparent;
  border: 2px solid #ffd369;
  border-radius: 6px;
  padding: 8px 18px;
  margin-top: 15px;
  font-size: 1em;
  color: #ffd369;
  cursor: pointer;
  text-shadow: 0 0 6px #ffae42, 0 0 12px #ff8c00;
  transition: 0.3s;
  display: inline-block;
  text-decoration: none;
}
button:hover,
a.button-link:hover {
  background: rgba(255, 211, 105, 0.1);
  transform: scale(1.05);
}


/* Rune puzzle */
#runes {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 20px;
}
.rune {
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 2px solid #ffd369;
  border-radius: 8px;
  cursor: pointer;
  font-size: 2em;
  color: #ffd369;
  text-shadow: 0 0 6px #ffae42, 0 0 12px #ff8c00;
  background: rgba(0,0,0,0.5);
  transition: 0.3s;
}
.rune:hover { transform: scale(1.1); }
.rune.active {
  background: #ffd369;
  color: #000;
  text-shadow: none;
}
.rune.wrong {
  border-color: #ff4444;
  color: #ff4444;
  text-shadow: 0 0 6px #ff0000;
}
#rune-hint {
  margin-top: 10px;
  font-size: 1em;
  color: #ffd369;
  text-shadow: 0 0 6px #ffae42, 0 0 12px #ff8c00;
}
#rune-feedback {
  margin-top: 10px;
}

/* Seal puzzle */
#puzzle-container {
  position: relative;
  width: 70%;
  max-width: 70%;
  aspect-ratio: 1 / 1;   /* square */
  margin: 20px auto 0;
}
#puzzle {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 2px;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 12px rgba(255, 211, 105, 0.4);
}
#puzzle.fade-out {
  opacity: 0;
  transition: opacity 0.8s ease;
}
#puzzle-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("images/puzzle.webp") center/cover no-repeat;
  pointer-events: none;
  z-index: 2;
}
#puzzle-overlay.glow {
  filter: drop-shadow(0 0 20px #ffd369) drop-shadow(0 0 40px #ffae42);
  transition: filter 1.2s ease;
}

.tile {
  background-image: url("images/puzzle.webp");
  background-size: 400% 400%;
  cursor: pointer;
}
.tile.empty {
  background: transparent;
  cursor: default;
}
.tile.wrong {
  filter: grayscale(100%);
}
