/* === WRAPPER + BACKGROUND === */
#trapdoors-wrapper {
  position: relative;
  overflow: hidden;
  max-width: 600px;
  margin: 0 auto;
  border-radius: 12px;
  background: url('https://triplesevens.com/wp-content/uploads/2025/05/castle-texture.png') no-repeat center center;
  background-size: cover;
  box-shadow: 0 0 12px rgba(0,0,0,0.3);
}

/* 🔒 Tint overlay */
#trapdoors-wrapper::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
}

/* 🔒 Hide everything except loader until loaded */
#trapdoors-wrapper.loading > *:not(#trapdoors-loading) {
  display: none;
}

/* Ensure content sits above tint */
#trapdoors-wrapper > * {
  position: relative;
  z-index: 2;
}

/* === ORIENTATION WARNING === */
#orientation-warning {
  background: #000000dd;
  color: white;
  padding: 20px 15px;
  text-align: center;
  font-size: 1em;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}


/* === HEADER === */
#trapdoors-title {
  text-align: center;
  margin: 10px auto;
}

#trapdoors-logo {
  max-width: 450px;
  width: 100%;
  height: auto;
}

#ticket-balance {
  font-weight: bold;
  color: #fff;
  text-align: center;
  margin: 10px auto;
  font-size: 1.1em;
}

#trapdoors-start {
  background-color: #8e44ad;
  color: white;
  padding: 14px 28px;
  font-size: 1.2em;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: block;
  margin: 0 auto 10px;
}

#mute-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: #fff;
  z-index: 10003;
  padding: 4px;
}

#fullscreen-buttons {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10003;
}

#fullscreen-buttons button {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  font-size: 1.2em;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
  margin-left: 5px;
}

/* === LOADING === */
#trapdoors-loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

#loading-bar {
  width: 80%;
  max-width: 400px;
  height: 20px;
  background-color: #eee;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
  z-index: 1001;
}

#loading-progress {
  width: 0%;
  height: 100%;
  background-color: #8e44ad;
  transition: width 0.3s ease;
  z-index: 1001;
}

#loading-status-text {
  font-weight: bold;
  color: black;
  z-index: 1001;
}

/* === GAME TOWER === */
#trapdoors-tower {
  position: relative;
  padding: 10px;
  text-align: center;
}

#trapdoors-tower.hidden {
  display: none;
}

#trapdoors-status {
  font-size: 1.3em;
  font-weight: bold;
  color: white;
  margin-bottom: 10px;
}

#trapdoors-cards {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
  padding: 0;
  margin-top: 10px;
  height: 60vh; /* 🔧 cap vertical space */
}

#trapdoors-cards img.card {
  max-height: 100%;
  width: auto;
  max-width: 30%;
  object-fit: contain;
}

#trapdoors-cards img.card:active {
  transform: scale(0.95);
}

#trapdoors-timestamp {
  font-size: 0.9em;
  color: #fff;
  background: rgba(0,0,0,0.5);
  padding: 2px 8px;
  border-radius: 5px;
  margin: 10px auto;
  display: block;
  width: fit-content;
}

/* === VICTORY / GAME OVER OVERLAY === */
#victory-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-align: center;
  padding: 20px;
}

.victory-content {
  position: relative;
  z-index: 10001;
}

.victory-content h1 {
  color: #fff;
  font-size: 2em;
  margin-bottom: 10px;
}

.victory-content p {
  color: #fff;
  font-size: 1.2em;
  margin-bottom: 10px;
}

.end-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.end-buttons button {
  background: #8e44ad;
  border: none;
  color: #fff;
  padding: 10px 20px;
  font-size: 1em;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.end-buttons button:hover {
  background: #732d91;
}

.overlay-time,
.overlay-tickets {
  color: #fff;
  font-size: 0.95em;
  margin-top: 12px;
  text-align: center;
}

#trapdoors-whiteout {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: white;
  z-index: 1000; /* LOWER than loading bar */
}

#trapdoors-mission {
	position: relative;
    margin: 0 auto 4px;
    font-size: 1em;
    font-weight: bold;
    color: white;
    text-align: center;
    padding: 0;
	z-index: 10009;
  }

@media screen and (max-width: 900px) and (orientation: landscape) {
  #trapdoors-wrapper {
    height: 100vh;
  }

  #trapdoors-header {
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
  }

  #trapdoors-title {
    position: absolute;
    top: 10px;
    left: 45px;
    max-width: 120px;
    z-index: 10000;
  }

  #trapdoors-logo {
    max-width: 120px;
    height: auto;
  }

  #mute-toggle,
  #fullscreen-buttons,
  #ticket-balance {
    pointer-events: auto;
    z-index: 10003;
  }

  #fullscreen-buttons {
    top: 10px;
    right: 10px;
  }

  #ticket-balance {
    position: absolute;
    top: 10px;
    left: 180px;
    margin: 0;
    color: white;
    font-size: 1.1em;
  }

  #trapdoors-mission {
  position: relative; /* ✅ ensure z-index is applied */
  margin: 0 auto 4px;
  font-size: 1em;
  font-weight: bold;
  color: white;
  text-align: center;
  padding: 0;
  z-index: 10009;
}

  #trapdoors-status {
    margin: 2px auto 8px;
    font-size: 1em;
    font-weight: bold;
    color: white;
    text-align: center;
  }

  #trapdoors-cards {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 10px;
  }

  #trapdoors-cards img.card {
    max-height: 60vh;
    max-width: 30%;
    width: auto;
    object-fit: contain;
  }

  #trapdoors-start {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10010;
  pointer-events: auto;
}
}
#show-instructions {
  background-color: #8e44ad;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  display: block;
  margin: 0 auto 10px;
  z-index: 1000;
}

#intro-modal,
#instructions-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 20000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  padding: 20px;
  background: #fff;
}

#instructions-modal .modal-content {
background: #222;
  color: #fff;
  padding: 20px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  text-align: center;
}

#instructions-modal .modal-content h2 {
  font-size: 1.5em;
  margin-bottom: 15px;
  color: #fff;
}

#instructions-modal .modal-content ul {
  text-align: left;
  padding-left: 20px;
  margin-bottom: 20px;
  font-size: 0.95em;
}

#instructions-modal .modal-content button {
  padding: 10px 20px;
  background: #8e44ad;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
}

#instructions-modal .modal-content button:hover {
  background: #732d91;
}
