/* ==========================================
   Refactored style.css with detailed comments
   Redundant or optional lines are marked with TODO
   ========================================== */

/* ========== RESET / BASICS ========== */
html, body {
  margin: 0;           /* Reset default browser margin */
  padding: 0;          /* Reset default browser padding */
  font-family: 'MedievalSharp', serif; /* Primary font */
  background-color: #000; /* Dark background for theme */
  color: #f0e6d2;      /* Off-white text color */
  line-height: 1.6;    /* Improve text readability */
  overflow-x: hidden;  /* Prevent horizontal scroll */
}

/* Spacer utility for vertical rhythm */
.spacer {
  height: 2rem;
}


/* ========== HEADER ========== */
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  height: 70px;
  width: 100%;
  background-color: #111;
  color: #f0e6d2;
  box-shadow: 0 2px 5px rgba(255, 255, 255, 0.1);
  z-index: 1001;
}

.header-inner {
  max-width: 1200px;
  margin: auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.main-nav {
  display: flex;
  gap: 1rem;
}

.main-nav a {
  color: #f0e6d2;
  text-decoration: none;
}

.main-nav a:hover {
  text-decoration: underline;
}

.menu-toggle {
  background: none;
  border: none;
  color: #f0e6d2;
  font-size: 2rem;
  display: none;
  cursor: pointer;
}

/* ========== RESPONSIVE NAVIGATION ========== */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  .main-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    background-color: #111;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(255, 255, 255, 0.05);
  }

  .main-nav.open {
    display: flex;
  }

  .main-nav a {
    padding: 0.5rem 0;
  }
}


/* ========== RESPONSIVE ADJUSTMENTS ========== */
@media (max-width: 600px) {
  h1 { font-size: 1.5rem; }
  .wrapper { padding: 1rem; }
  p { font-size: 1rem; }
}


/* ========== INHALT ========== */
.wrapper {
  max-width: 1200px;
  margin: auto;
  padding: 2rem;
  padding-top: 70px; /* Platz für den fixierten Header */
  width: 80%;
  padding-bottom: 80px;
}

.glow {
  box-shadow: 0 0 60px rgba(255, 255, 255, 0.05),
              inset 0 0 30px rgba(255, 255, 200, 0.05);
  border-radius: 20px;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.7);
}

/* Headings */
h1 {
  font-size: 2rem;
  margin: 0;
  padding: 1rem 0;
  text-align: center;
}

p {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.subline {
  text-align: center;
  font-size: 0.9rem;
  color: #aaa;
  margin-top: -1rem;
  margin-bottom: 2rem;
  font-style: italic;
}

.highlight {
  color: gold;
  font-weight: bold;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 0 4px;
  border-radius: 3px;
}

.highlight-link {
  color: gold;
  font-weight: bold;
  text-decoration: underline dotted;
  cursor: pointer;
}

.highlight-link:hover {
  color: lightgreen;
}


/* ========== IMAGE SIZING UTILITIES ========== */
/* Defines small-through-large image containers */

/* NEU HINZUGEFÜGT */

  .image_XS {
    width: 10%;
    min-width: 0;       /* nur nötig, wenn Wrapper ein Flex-Container ist, schadet aber nie */
    max-width: 100px;
    margin: 2rem auto;
    display: block;
  }
  .image_XS img {       /* Damit wird der div wirklich auf x % der übergeordneten Breite reduziert, und das <img> darin passt sich korrekt an diese 10 % an.*/
    display: block;
    width: 100%;
    height: auto;
  }

  .image_S {
    width: 20%;
    min-width: 0;       /* nur nötig, wenn Wrapper ein Flex-Container ist, schadet aber nie */
    margin: 2rem auto;
    display: block;
  }
  .image_S img {       /* Damit wird der div wirklich auf x % der übergeordneten Breite reduziert, und das <img> darin passt sich korrekt an diese 10 % an.*/
    display: block;
    width: 100%;
    height: auto;
  }

  .image_L {
    width: 70%;
    min-width: 0;       /* nur nötig, wenn Wrapper ein Flex-Container ist, schadet aber nie */
    margin: 2rem auto;
    display: block;
  }
  .image_L img {       /* Damit wird der div wirklich auf x % der übergeordneten Breite reduziert, und das <img> darin passt sich korrekt an diese 10 % an.*/
    display: block;
    width: 100%;
    height: auto;
  }

/* Full-height images for e.g. book pages */  
  .image_H {
    width: auto;
    max-height: 100%;
    max-width: 100%;
    min-width: 0;       /* nur nötig, wenn Wrapper ein Flex-Container ist, schadet aber nie */
    margin: 2rem auto;
    display: block;
  }
  .image_H img {       /* Für Bilder die 80% der Höhe der Seite erreichen sollen, wie Buchseiten*/
    display: block;       /* für margin:auto centering */
    margin: 0 auto;
    max-height: 80vh;     /* max. 80% der Fensterhöhe */
    max-width: 100%;
    width: auto;          /* Breite passt sich am Seitenverhältnis an */
    height: auto;         /* Höhe ebenfalls proportional */
  }

.image-placeholder-wide {
  max-width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #333;
  margin: 2rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #777;
  font-style: italic;
}
/* ENDE IMAGE SIZING UTILITIES */


/* ========== BUTTONS ========== */
.button-wrapper {
  text-align: center;
  margin: 3rem 0;
}

a.button {
  background-color: #222;
  color: #f0e6d2;
  padding: 1rem 2rem;
  text-decoration: none;
  border: 2px solid #f0e6d2;
  border-radius: 8px;
  transition: background-color 0.3s ease;
}

a.button:hover {
  background-color: #444;
}


/* ========== QUIZ BUTTONS ========== */
.quiz-button {
  margin: 0 0.3rem;
  padding: 0.2rem 0.6rem;
  background-color: #222;
  color: #f0e6d2;
  border: 1px solid #f0e6d2;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'MedievalSharp', serif;
  font-size: 1rem;
}

.quiz-button:hover {
  background-color: #444;
}

.quiz-button.correct {
  background-color: #2e8b57;
}

.quiz-button.wrong {
  background-color: #8b0000;
}

/* FÜR OPTIMIERUNGEN und ab LABOR2.HTML*/
/* Basis-Design für Spiel-Buttons */
/* btn-qz-primary = Button-Quiz-Standard
Aufrufbar im Flow: 
<button class="btn-qz-standard" onclick="revealSection('step-2')">Ok! Ich kann wieder klar denken</button>
oder in Forms: 
<form id="code02Form">
  <input type="text" id="code02Input" required />
  <button type="submit" class="btn-qz-standard">Prüfen</button>
</form>
*/
.btn-qz-standard {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background-color: #0070ba;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  margin-left: 1rem;
  transition: background-color 0.3s ease;
}

.btn-qz-standard:hover {
  background-color: #005fa3;
}

/* Optionale class zum zentrieren der Buttons - aufrufbar über 
<div class="button-center">
  <button class="btn-qz-standard">Weiter</button>
</div> */
.button-center {
  text-align: center;
  margin-top: 2rem;
}

#quiz-feedback {
  margin-top: 1rem;
  font-style: italic;
}

.hidden {
  display: none;
}
/* ENDE BUTTONS */






/* ========== MODAL FOR IMAGES ========== */
  .modal4img {
    display: none;             /* per JS: display:flex bei offen */
    position: fixed; top:0; left:0; right:0; bottom:0;
    justify-content: center; align-items: center;
    background: rgba(0,0,0,0.8);
    z-index: 9999;
  }
  .modal4img-content {
    position: relative;
    width: 80vw; 
    max-width: 1200px;
    height: 800px;
    max-height: 90vh;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .img-container {
    width: 100%;
    height: 100%;
    display: flex;               /* Bild wird zum Flex-Item */
    justify-content: flex-start;     /* NICHT über center horizontal zentrieren, damit in alle Richtungen Scrollbar*/
    align-items: flex-start;         /* NICHT über center vertikal zentrieren, damit in alle Richtungen Scrollbar */
    overflow: auto;              /* und gleichzeitig Scrollen erlauben */    
  }
  #zoomable {
    transform-origin: center center;
    transition: transform 0.1s ease-out;
    cursor: grab;
    display: block;
    user-select: none;
    max-width: none;
    width: 90vw;   /* initial un bei Mobiles nicht gleich massiv initial zu zoomen */
    height: auto;
  }
  #zoomable.grabbing {
    cursor: grabbing;
  }
  .close-modal4img {
    position: absolute; 
    top: 10px; 
    right: 10px;
    z-index: 1000;
    background: blue; 
    border: none; 
    font-size: 2rem; 
    color: #fff;
    cursor: pointer;
  }

  .open-modal4img {
  cursor: pointer;
}

/* ENDE NEUUER TEIL MODALE */



/* ========== FOOTER ========== */
.main-footer {
  background-color: #111;
  color: #f0e6d2;
  padding: 1rem 0;
  text-align: center;
  box-shadow: 0 -2px 5px rgba(255, 255, 255, 0.05);
  position: fixed;
  z-index: 10;
  bottom: 0;
  width: 100%;
}

.footer-inner {
  max-width: 1200px;
  margin: auto;
}

.main-footer nav a {
  margin: 0 1rem;
  color: #f0e6d2;
  text-decoration: none;
  font-size: 0.9rem;
}

.main-footer nav a:hover {
  text-decoration: underline;
}


/* ========== QR-CODE-STYLING ========== */
.qr-wrapper {
  text-align: center;
  margin: 3rem 0;
}

.qr-wrapper img {
  border: 2px solid #f0e6d2;
  border-radius: 8px;
  padding: 0.5rem;
  background-color: #222;
}




/* ========== Rätsel ========== */
#charadeForm,
#romanForm,
#labrevealForm,
#code01Form,
#code02Form,
#code03Form,
#code05Form,
#code04Form,
#book01Form {
  text-align: center;
  margin-top: 2rem;
}

#charadeForm input[type="text"],
#romanForm input[type="text"],
#labrevealForm input[type="text"],
#code01Form[type="text"],
#code02Form[type="text"],
#code03Form[type="text"],
#code05Form[type="text"],
#code04Form[type="text"],
#book01Form input[type="text"] {
  padding: 0.5rem;
  font-size: 1rem;
  width: 60%;
  max-width: 400px;
  margin-bottom: 0.5rem;
  background-color: #222;
  color: #f0e6d2;
  border: 1px solid #444;
  border-radius: 5px;
  font-family: inherit;
}

#charadeForm button,
#romanForm button,
#labrevealForm button,
#code01Form button,
#code02Form button,
#code03Form button,
#code05Form button,
#code04Form button,
#book01Form button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background-color: #0070ba;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  margin-left: 1rem;
}

#charadeForm button:hover,
#romanForm button:hover,
#labrevealForm button:hover,
#code01Form button:hover,
#code02Form button:hover,
#code03Form button:hover,
#code05Form button:hover,
#code04Form button:hover,
#book01Form button:hover {
  background-color: #005fa3;
}

#code01Feedback,
#code03Feedback,
#code05Feedback,
#code04Feedback,
#code02Feedback {
  text-align:left;
  margin-top: 1rem;
}

#charadeFeedback,
#romanFeedback,
#labFeedback,
#book01Feedback {
  text-align: center;
  margin-top: 1rem;
  font-weight: bold;
}

#book01SuccessText {
  text-align: center;
  margin-top: 1rem;
}

.reward-image {
  margin: 2rem auto;
  width: 120px;
  height: auto;
  filter: drop-shadow(0 0 10px gold);
  transition: transform 0.3s ease;
}

.reward-image:hover {
  transform: scale(1.1);
}

#romanRewardWrapper {
  text-align: center;
  margin-top: 2rem;
}

#romanRewardWrapper p {
  margin-top: 1rem;
  font-style: italic;
  color: gold;
  font-size: 1.1rem;
}


/* ========== LABOR-OVERLAY ========== */
.image-reveal-container {
  position: relative;
  width: 80%;
  max-width: 800px;
  margin: 2rem auto;
}

.image-reveal-container img {
  width: 100%;
  display: block;
  border-radius: 10px;
}

.image-back {
  position: relative;
  z-index: 1;
}

.image-top {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  transition: opacity 8s ease;
  opacity: 1;
}

.image-top.revealed {
  opacity: 0;
  pointer-events: none; /* ← Klicks durchlassen für Vergrößerung des darunterliegenden Bildes */
}

/* Zierleisten-Verhalten */
.divider-strip {
  height: 60px; /* oder die Höhe, die du möchtest */
  background-image: url("pics/zierleiste01.png");
  background-repeat: repeat-x;
  background-size: auto 100%;
  background-position: center;
  margin: 2rem auto;
  overflow: hidden;
}



/* SMOKE -Effekt */
.smoke-image {
  width: 100%;
  position: relative; /* 🔑 Damit .smoke-layer sich daran ausrichtet */
}

.smoke-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
  transition: opacity 15s ease-in;
}

/* BEREICH für VIGENERE-VERSCHLÜSSELUNG */
    /* Textareas füllen ihren Container maximal aus */
    #vigenere textarea {
      display: block;
      width: 100%;
      height: auto;
      min-height: 100px;
      box-sizing: border-box;
      background-color: #f0e6d2; /* Standard-Textfarbe als Hintergrund */
      color: blue;
      border: 1px solid #444;
      border-radius: 5px;
      padding: 0.5rem;
      font-family: Arial, Helvetica, sans-serif;
      margin-bottom: 1rem;
    }
    #vigenere input[type="text"] {
      display: block;
      width: 100%;
      box-sizing: border-box;
      margin-bottom: 1rem;
      padding: 0.5rem;
    }
    #vigenere Output[type="text"] {
      display: block;
      width: 100%;
      box-sizing: border-box;
      margin-bottom: 1rem;
      padding: 0.5rem;
    }
    #vigenere #keyInputdiv,
    #vigenere #keyOutputdiv{
      margin: 0 auto 1rem;
      display: block;
      max-width: 200px;
      box-sizing: border-box;
      margin-bottom: 1rem;
      padding: 0.5rem;
    }

/* ENDE BEREICH für VIGENERE-VERSCHLÜSSELUNG */

/* BEREICH COUNTDOWN & BILDWECHSEL */


  /* Counter OVER Pic-Effekt */
  .over-image {
    width: 100%;
    position: relative; /* 🔑 Damit .over-layer sich daran ausrichtet */
  }

  /* COUNTER-LAYER HALBTRANSPARENT */
  .over-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    opacity: 0.3;
    z-index: 10;
    transition: opacity 15s ease-in;
  }    

  /* PIC-LAYER-OHNE TRANSPARENZ*/

  .over-layer-pic {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    opacity: 0.9;
    z-index: 6;
    transition: opacity 15s ease-in;
  }

  
#countdown {
  text-align: center;
  font-size: 2rem;
  font-family: monospace;
  color: #ffdd57;
  background: rgba(0, 0, 0, 0.7);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  z-index: 1000;
}

/* 🔍 Für kleinere Bildschirme (unter 768px Breite) */
@media (max-width: 768px) {
  #countdown {
    font-size: 1.2rem;
    padding: 0.3rem 0.6rem;
  }
}

/* 🔍 Für sehr kleine Bildschirme (unter 480px Breite) */
@media (max-width: 480px) {
  #countdown {
    font-size: 1rem;
    padding: 0.2rem 0.5rem;
  }
}


    /* Das Bild, das alle X Sekunden gewechselt wird */
    #targetImage1 {
      display: block;                  /* Block-Element, damit margin:auto funktioniert */
      margin: 5rem auto;               /* Oben/unten 5rem Abstand, zentriert horizontal */
      max-width: 80%;                  /* Maximal 80% der übergeordneten Breite */
      height: auto;                    /* Höhe passt sich proportional an */
    }
/* ENDE BEREICH COUNTDOWN & BILDWECHSEL */



/* BEREICH FÜR DIE HINTS n SOLUTIONS */
  
    .hintsnsolutions h3 {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .btn-toggle-puzzle,
    .btn-toggle-hint {
      margin-bottom: 0.5rem;
      padding: 0.5rem 1rem;
      cursor: pointer;
      background: #0070ba;
      color: white;
      border: none;
      border-radius: 4px;
    }

    .hint-controls {
      margin-bottom: 1rem;
    }

    .hint-controls .btn-toggle-hint {
      margin-right: .5rem;
    }

    /* ENDE BEREICH FÜR DIE HINTS n SOLUTIONS */    