/* -------------------- Fonts & Cursor -------------------- */
/* Import Pixel Font */
@import url('04b03.css');

/* Custom Cursor */
body, a, a:hover { 
   cursor: url('/images/cursor2.png'), auto;
}

/* Global reset */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 24px;
  font-family: "04b03", Verdana;
  font-size: 16px;
  line-height: 15px;
  text-align: center;
  color: #3a2f3f;
  background-color: #dfcbf1;
  cursor: url("images/cursor.png"), auto;
  border: 0;
}

/* -------------------- Title -------------------- */
.page-title {
  background-image: url("images/bg3.png");
  background-repeat: repeat;
  background-position: top center;
  color: #ff0044;
  text-align: center;
  padding: 55px 0;
  width: 100%;
  margin: 0 auto;
  font-weight: normal;
  font-size: 1.5rem;
  text-shadow:
     -2px -2px 0 #fff,
     -2px  0px 0 #fff,
     -2px  2px 0 #fff,
      0px -2px 0 #fff,
      0px  2px 0 #fff,
      2px -2px 0 #fff,
      2px  0px 0 #fff,
      2px  2px 0 #fff,
      0 0 4px #fff,
      0 0 6px #fff,
      0 0 8px #fff;
}

/* -------------------- Builder & Scene -------------------- */
.builder {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 40px 0;
  position: relative;
  transform-origin: top left;
}

.scene {
  position: relative;
  width: 600px;
  height: 600px;
  z-index: 1;
  

}

.layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  pointer-events: none;
}

/* -------------------- Controls -------------------- */
.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  max-width: 620px;
  width: 100%;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  padding: 14px;
  z-index: 2;
}

.controls > div {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  padding: 2px;
  font-size: 0.9rem;
}

.controls button {
  background: #e8dff0;
  font-family: "04b03", Verdana;
  border: none;
  border-radius: 8px;
  padding: 4px 8px;
  margin: 2px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.controls button:hover {
  background: #d8cbe6;
}

.controls .reset {
  background: #d6c4e8;
}

.controls .reset:hover {
  background: #c7b1dd;
}

/* Make Riddle Book button bigger */
#riddle-book {
  font-size: 30px;       /* emoji size */
  padding: 12px 16px;    /* extra clickable area */
  cursor: pointer;       /* pointer on hover */
  display: inline-block; /* keep it inline-block */
}


/* -------------------- Export Buttons -------------------- */
.export-buttons {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.export-buttons button {
  background: #e8dff0;
  font-family: "04b03", Verdana;
  border: none;
  border-radius: 8px;
  padding: 4px 8px;
  margin: 2px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.export-buttons button:hover {
  color: #8b63b5;
}

/* -------------------- Secret Message -------------------- */
#secret-message {
  position: absolute;
  top: 150px; 
  left: 60%;
  width: 140px;
  max-width: 140px;
  height: 80px;
  background: url("images/secretmessagebg.png");
  padding: 10px;
  font-family: "04b03", Verdana;
  font-size: 12px;
  color: #3a2f3f;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1200; /* above house */
}

/* Secret button & icon */
.secret-button{
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-block;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

.secret-button.unlocked {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.secret-icon-wrapper {
  display: inline-block;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.secret-icon-wrapper img {
  width: 38px;
  height: 36px;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.secret-button.unlocked:hover .secret-icon-wrapper {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.secret-button.unlocked:hover .secret-icon-wrapper img {
  opacity: 0.7;
}


/* -------------------- Floating Help Button -------------------- */
.floating-help {
  position: fixed; 
  top: 20px; 
  right: 20px; 
  width: 40px; 
  height: 40px; 
  font-size: 24px; 
  border: none; 
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer; 
  z-index: 1500; 
  transition: transform 0.2s ease, opacity 0.2s ease;
  image-rendering: pixelated; /* make it feel pixel-art style */
}

.floating-help:hover {
  transform: scale(1.2);
  opacity: 0.9;
}

/* Help Modal */
.modal {
  display: none;
  position: fixed; 
  top: 50%; 
  left: 50%; 
  width: 400px;
  height: 400px;
  background: url('images/infomessage.png') no-repeat center/cover;
  transform: translate(-50%, -50%);
  padding: 20px;
  border-radius: 6px;
  z-index: 2000;
  font-family: "04b03", Verdana;
  color: #3a2f3f;
  text-align: center;
  line-height: 1.4;
  overflow: hidden;
  image-rendering: pixelated;
}

/* Scrollable content inside modal */
.modal-content {
  width: 100%;
  height: 100%;
  overflow-y: auto;      /* allow vertical scroll */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  padding: 5px;
  box-sizing: border-box;
  font-size: 14px;
}

/* Optional: hide scrollbar but still scrollable */
.modal-content::-webkit-scrollbar {
  width: 6px;
}
.modal-content::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.3);
  border-radius: 3px;
}

.how-to-play {
  text-align: left;
  padding-left: 10px;
  margin: 10px 0;
  
}
/* Close Button */
.close {
  position: absolute;
  top: 8px;
  right: 8px;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  user-select: none;
}

/* Responsive for mobile */
@media (max-width: 480px) {
  .modal {
    width: 90%;
    height: auto;
    max-height: 80%;
  }
}


/* -------------------- Riddle Book -------------------- */
#riddle-book-window {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 410px;
  height: 200px;
  background-image: url('images/recipebook.png');
  background-size: cover;
  transform: translate(-50%, -50%);
  z-index: 5; 
  font-family: "04b03", Verdana;
  color: #000;
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(0,0,0,0.4);
  overflow: hidden;
}

#riddle-page-left, #riddle-page-right {
  position: absolute;
  top: 20px;
  width: 165px;
  height: 160px;
  padding: 10px;
  box-sizing: border-box;
  font-family: "04b03", Verdana;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

#riddle-page-left { 
  left: 18px;
  }

#riddle-page-right { 
right: 18px;
}

#riddle-book {
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: scale(0.8);
}

#riddle-book.unlocked {
  opacity: 1;
  transform: scale(1);
}


/* -------------------- Arrows & Close -------------------- */

#riddle-book-close {
  top: 20px;
  right: 14px;
  cursor: pointer;
  font-weight: bold;
  font-size: 18px;
}

#riddle-left-arrow, #riddle-right-arrow, #riddle-book-close {
  position: absolute;
  cursor: pointer;
  font-weight: bold;
  font-family: "040b3", Verdana;
  font-size: 26px;
  user-select: none;
  text-shadow: 
    1px 1px 0 #fff,
   -1px -1px 0 #fff;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

#riddle-left-arrow { bottom: -10px;
left: 14px; }
#riddle-right-arrow { bottom: -10px;
right: 14px; }

#riddle-left-arrow,
#riddle-right-arrow,
#riddle-book-close {
  filter: none;
}

/* Hover */
#riddle-left-arrow:hover,
#riddle-right-arrow:hover,
#riddle-book-close:hover {
  filter: brightness(1.2);
  opacity: 0.85;
}

/* Active */
#riddle-left-arrow:active,
#riddle-right-arrow:active {
  transform: scale(0.95);
}

/* -------------------- Secret and Riddle Buttons -------------------- */

/* Hide background for secret & riddle buttons initially */
#toggle-secret,
#riddle-book {
  background: transparent;
  border: none;
  padding: 0;
}

#toggle-secret.unlocked,
#riddle-book.unlocked {
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}


/* -------------------- Sparkles -------------------- */
.sparkle {
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
  background: #fff;
  clip-path: polygon(
    50% 0%, 54% 46%, 100% 50%, 54% 54%, 50% 100%, 46% 54%, 0% 50%, 46% 46%
  );
  image-rendering: pixelated;
  filter: none;
  animation: sparklePop 0.8s ease-out forwards;
}

@keyframes sparklePop {
  0% { transform: scale(0) translateY(0); opacity: 1; }
  50% { transform: scale(1.5) translateY(-6px); opacity: 1; }
  100% { transform: scale(2) translateY(-15px); opacity: 0; }
}

/* -------------------- Mobile-Friendly -------------------- */
@media (max-width: 480px) {
  .scene { width: 240px; height: 240px; }

  .controls { grid-template-columns: 1fr; }

  #secret-message {
    position: relative;
    top: 320px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    width: 90%;
    max-width: none;
  }

  #riddle-book-window {
    width: 90%;
    height: auto;
    top: auto;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding-bottom: 10px;
  }

  #riddle-page-left, #riddle-page-right {
    position: relative;
    width: 100%;
    height: auto;
    left: 0;
    top: 0;
    padding: 8px;
  }

  #riddle-left-arrow, #riddle-right-arrow, #riddle-book-close {
    font-size: 14px;
  }
}
