/* =========================================================================
   1. GLOBAL & BODY INITIALISIERUNG (Mit Satoshi als Hauptschriftart)
   ========================================================================= */
@font-face {
  font-family: "Satoshi";
  src: url("Satoshi.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "AmaticCH";
  src: url("AmaticSC-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "HangedLetters";
  src: url("HangedLetters.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

body {
  margin: 0;
  padding: 0;
  /* KORREKTUR: Satoshi gilt jetzt für die gesamte Webseite! */
  font-family: "Satoshi", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f0f2f5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  color: #333;
  margin: 0;
  padding: 0;
  /* KORREKTUR: Satoshi gilt jetzt für die gesamte Webseite! */
  font-family: "Satoshi", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f0f2f5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  color: #333;
}

/* Zwingt auch Formularelemente und Knöpfe, Satoshi zu nutzen */
input,
button,
select,
textarea {
  font-family: "Satoshi", sans-serif;
}

/* =========================================================================
   2. HEADER BEREICH
   ========================================================================= */
.main-header {
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 20px;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 4px 15px rgba(255, 105, 180, 0.15); /* Schön abgestimmter, leicht rosa Schatten */

  /* NEU: Der animierte Chantalisator-Hintergrund für den Header */
  background: linear-gradient(135deg, #ff66b2, #ffb3d9, #fff0f5, #ff3399);
  background-size: 400% 400%;
  animation: auroraChantali 18s ease infinite;
}

.header-inner {
  max-width: 1050px;
  margin: 0 auto;
  text-align: center;
}

.main-header h1 {
  font-family: "HangedLetters", sans-serif;
  margin: 0 !important;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 8px;
  line-height: 1.1;
  color: #1a202c; /* Etwas dunkleres Anthrazit für perfekten Kontrast auf Rosa */
}

/* Identisch mit der linken Slider-Farbe (Rosa) */
.main-header h1 span.brand-pink {
  color: #d61a7a !important; /* Etwas kräftigeres Rosa, damit es sich vom Hintergrund abhebt */
}

/* Identisch mit der rechten Slider-Farbe (Blau) */
.main-header h1 span.brand-blue {
  color: #0056b3 !important; /* Ein satteres Blau, das auf dem Rosa richtig "knallt" */
}

.main-header .tagline {
  margin: 2px 0 0 0 !important;
  font-size: 11px;
  color: #4a5568; /* Dunkleres Grau, damit der Untertitel lesbar bleibt */
  font-weight: 600; /* Etwas dicker für bessere Lesbarkeit */
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* WICHTIG: Das @keyframes-Ereignis für die Bewegung (falls noch nicht im CSS) */
@keyframes auroraChantali {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}


/* =========================================================================
   3. HAUPT-LAYOUT (DER WRAPPER)
   ========================================================================= */
.wrapper {
  display: flex;
  flex-direction: row-reverse; /* App links, Info rechts am PC */
  gap: 25px;
  max-width: 1050px;
  width: 100%;
  justify-content: center;
  align-items: flex-start;

  /* KORREKTUR: Jetzt exakt 25px Abstand nach oben zum Header! */
  padding: 25px 20px 40px 20px;

  box-sizing: border-box;
  flex: 1; /* Füllt den Raum zum Footer aus */
  margin: 0 auto;
}

/* =========================================================================
   4. DIE BEIDEN CONTAINER (OPTISCH ABSOLUT IDENTISCH)
   ========================================================================= */
.container,
.info-container {
  /* KORREKTUR: Zwingt beide Boxen, exakt den gleichen Platz einzunehmen */
  flex: 1;

  max-width: 500px;
  width: 100%;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  color: #333;
}

.container {
  text-align: center;
}

.info-container {
  text-align: left;
}

/* Überschriften-Fix für beide Boxen */
.container h2,
.info-container h2 {
  margin-top: 0 !important;
  margin-bottom: 15px;
  color: #ff69b4;
  font-size: 22px;
  text-align: center;
}

/* =========================================================================
   5. FORMULAR ELEMENTE & SLIDER
   ========================================================================= */
.input-group {
  margin-bottom: 15px;
  text-align: left;
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
  font-size: 16px;
}

button {
  background: #ff69b4;
  color: white;
  border: none;
  padding: 12px 20px;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
  transition: background 0.2s;
}

button:hover {
  background: #ff4da6;
}

button.secondary {
  background: #2196f3;
}

button.secondary:hover {
  background: #1976d2;
}

.slider-container {
  margin: 20px 0;
  text-align: left;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  font-size: 14px;
  color: #555;
  margin-top: 5px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(to right, #ff69b4 40%, #1e90ff 60%) !important;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #333333;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #333333;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* =========================================================================
   6. INTERNE INFO-ELEMENTE & POLAROID
   ========================================================================= */
.info-container p {
  font-size: 15px;
  line-height: 1.6;
}

.info-container .steps {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #eaeaea;
  margin: 20px 0;
}

.info-container ul {
  margin: 0;
  padding-left: 20px;
}

.info-container li {
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.info-container li:last-child {
  margin-bottom: 0;
}

.info-container .footer-note {
  font-weight: bold;
  color: #333;
  margin-bottom: 0;
  text-align: center;
  display: block;
}

.name-display {
  display: none;
  margin: 20px 0;
  padding: 15px;
  background: #fce4ec;
  border: 2px dashed #e91e63;
  border-radius: 8px;

  /* Der Einleitungstext nutzt standardmäßig die Hauptschrift Satoshi */
  font-family: "Satoshi", sans-serif;
  font-size: 16px;
  font-weight: bold;
  color: #333;
  text-align: center;
}

/* NEU: Das Element, das exakt den Chanti-Namen umschließt */
.chanti-accent-name {
  font-family: "AmaticCH", sans-serif;
  font-size: 46px; /* Schön groß, da Amatic sehr filigran ist */
  font-weight: 800; /* Macht die Schrift schön kräftig */
  color: #c2185b;
  display: block; /* Setzt den Namen in eine neue Zeile */
  margin-top: 10px;
  letter-spacing: 1px; /* Gibt den schmalen Buchstaben etwas Luft */
}

.polaroid-frame {
  display: none;
  width: 320px;
  background: white;
  padding: 15px 15px 30px 15px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  margin: 20px auto;
  border: 1px solid #ddd;
  box-sizing: border-box;
}

.polaroid-image-area {
  width: 290px;
  height: 290px;
  background: #222;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  display: block;
}

canvas {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#countdown-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  /* KORREKTUR: Hintergrund ist jetzt zu 100% transparent (kein Abdunkeln mehr!) */
  background: transparent;

  justify-content: center;
  align-items: center;
  color: white;
  font-size: 80px;
  font-weight: bold;
  font-family: Arial, sans-serif;

  /* OPTIMIERUNG: Ein extrem starker Konturschatten, damit man die weiße Zahl auf jedem Bild sieht */
  text-shadow: 0 0 15px rgba(0, 0, 0, 0.9), 0 0 5px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.polaroid-text {
  font-family: "Comic Sans MS", "Caveat", cursive, sans-serif;
  font-size: 22px;
  color: #222;
  margin-top: 20px;
  text-align: center;
  word-wrap: break-word;
}

/* =========================================================================
   7. STATUS & FOOTER BEREICH
   ========================================================================= */
#upload-status {
  display: none;
  margin: 10px 0;
  font-weight: bold;
  color: #2196f3;
}

#download-btn {
  background: #ff69b4;
  display: none;
}

#download-btn:hover {
  background: #ff4da6;
}

.main-footer {
  background: #1a202c;
  color: #a0aec0;
  padding: 25px 20px;
  width: 100%;
  box-sizing: border-box;
  font-size: 14px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1050px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.main-footer p {
  margin: 0;
}

.main-footer a {
  color: #cbd5e1;
  text-decoration: none;
  transition: color 0.2s;
}

.main-footer a:hover {
  color: #e91e63;
}

/* =========================================================================
   8. RESPONSIVE DESIGN (MOBIL-ANSICHT)
   ========================================================================= */
@media (max-width: 850px) {
  .wrapper {
    flex-direction: column-reverse; /* App oben, Info unten auf Handys */
    align-items: center;
    padding: 10px 10px 40px 10px;
  }

  .info-container,
  .container {
    max-width: 500px;
  }

  .header-inner {
    text-align: center;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* Rahmen für das leere Pflichtfeld */
.input-error {
  border: 2px solid #1e90ff !important;
  background-color: #f0f7ff !important; /* Ein ganz zartes, passendes Hellblau für den Hintergrund */
}

/* Optionaler, cooler Rütteleffekt für das Eingabefeld */
.shake {
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

/* Styling für die hüpfenden Buchstaben */
.bounce-letter {
  display: inline-block;
  animation: bounceWave 1.2s infinite ease-in-out;
}

/* Verhindert, dass Leerzeichen kollabieren */
.bounce-space {
  display: inline-block;
  width: 6px;
}

/* Die Hüpf-Animation (geht leicht hoch und rotiert minimal) */
@keyframes bounceWave {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px); /* So hoch hüpfen die Buchstaben */
  }
}

/* Das Blitz-Overlay über dem Kamerabild */
#flash-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  pointer-events: none;
  z-index: 10; /* Liegt über dem Video */
}

/* Die Blitz-Animation */
.flash-active {
  animation: cameraFlash 0.4s ease-out;
}

@keyframes cameraFlash {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* =========================================================================
   STYLING FÜR DIE ABSCHLIESSENDEN INFO-TEXTE
   ========================================================================= */
.jogginghose-note,
#global-counter-display {
  font-size: 15px;
  line-height: 1.6;
  color: #333;
  text-align: center;
  font-weight: bold;
}

/* Symmetrischer Abstand zwischen den beiden Sätzen */
.jogginghose-note {
  margin-bottom: 5px;
}

#global-counter-display {
  margin-top: 5px;
}

/* Der bunte, extra fette Zähler-Highlight-Effekt */
#live-counter-num {
  color: #ff69b4; /* Dein exaktes Slider-Rosa */
  font-size: 19px;
  font-weight: 800;
}

/* =========================================================================
   NEU: RECHTLICHES-TOOLTIP (Absolut krisensicher und getrennt)
   ========================================================================= */
.tooltip-container {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

/* Das schwebende Fenster - standardmäßig komplett UNSICHTBAR */
.tooltip-container .rechtliches-popup {
  display: none !important; /* Erzwingt, dass es beim Laden unsichtbar ist */
  opacity: 0;
  width: 280px;
  height: 200px;
  overflow-y: auto;
  background-color: #ffffff;
  color: #333333;
  text-align: left;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2e8f0;
  font-family: "Satoshi", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  font-weight: normal;

  /* Exakte Positionierung über dem Link */
  position: absolute;
  bottom: 140%;
  left: 50%;
  z-index: 9999;
}

/* Der kleine weiße Pfeil unten am Fenster */
.tooltip-container .rechtliches-popup::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -6px;
  border-width: 6px;
  border-style: solid;
  border-color: #ffffff transparent transparent transparent;
}

/* Teilt die Fenster links und rechts auf, damit sie sich nicht überlagern */
.tooltip-container:first-of-type .rechtliches-popup {
  transform: translateX(-35%);
}
.tooltip-container:last-of-type .rechtliches-popup {
  transform: translateX(-70%);
}
/* NEU: Diese Klasse wird per Klick aktiviert */
.tooltip-container .rechtliches-popup.is-open {
  display: block !important;
  opacity: 1 !important;
}

/* =========================================================================
   STYLING FÜR DIE FEHLERMELDUNG ÜBER DEM BUTTON (Neu hinzugefügt)
   ========================================================================= */
#error-message {
  display: none; /* Versteckt die Meldung beim ersten Laden der Seite */
  color: #1e90ff; /* Leuchtet im exakten Jungen-Blau auf */
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 10px;
  text-align: left;
}

/* =========================================================================
   STYLING FÜR DEN VORLESE-BUTTON
   ========================================================================= */
#speak-btn {
  display: none; /* Sorgt dafür, dass der Button zu Beginn unsichtbar ist! */
  background: #1e90ff !important; /* Dein schickes Jungen-Blau */
  color: white;
  border: none;
  font-size: 16px;
  padding: 12px 20px;
  border-radius: 6px !important; /* Sportlich rund */
  margin: 10px auto 20px auto !important;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  transition: background 0.2s;
}

#speak-btn:hover {
  background: #1572cb !important; /* Dunkleres Blau beim Hovern */
}

/* Styling für deinen vorhandenen Button */
#cam-btn.secondary {
  position: relative;
  overflow: hidden; /* Wichtig: Schneidet den Lichtstreif außerhalb des Buttons ab */
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  color: #ffffff;
  background-color: #3b82f6; /* Beispiel-Farbe (Blau) */
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease;
}

/* Hover-Effekt für den Button-Hintergrund */
#cam-btn.secondary:hover {
  background-color: #2563eb;
}

/* Der glänzende Lichtstreif */
#cam-btn.secondary::before {
  content: "";
  position: absolute;
  top: 0;
  left: -150%; /* Startet unsichtbar weit links außerhalb des Buttons */
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(
    -25deg
  ); /* Schrägt den Lichtstreif für den typischen "Glanzeffekt" an */
  animation: shine 5s infinite ease-in-out; /* Läuft unendlich alle 3 Sekunden */
}

/* Die Animation, die den Streifen von links nach rechts bewegt */
@keyframes shine {
  0% {
    left: -150%;
  }
  50% {
    left: 150%; /* Wandert nach rechts durch den Button hindurch */
  }
  100% {
    left: 150%; /* Pause-Effekt, bevor die Animation von vorne startet */
  }
}
  /* Container im Textfluss */
  .bild-container {
    display: inline-block;
    position: relative;
    vertical-align: middle;
  }

  /* Standard-Ansicht (klein) */
  .bild-container img {
    width: 35px;
    height: auto;
    cursor: pointer;
    display: block;
  }

  /* Unsichtbarer Zustand für das große Bild (Vorbereitung für CSS-Animation) */
  .bild-container::after {
    content: "";
    display: block;
    position: absolute;
    /* Positioniert die Vorschau nach links oben */
    right: 0;
    bottom: 100%; 
    width: 0;
    height: 0;
    background-size: cover;
    background-position: top right;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border-radius: 4px;
    
    /* Der smoothe Effekt */
    opacity: 0;
    transform: scale(0.8);
    transform-origin: bottom right; /* Startet die Skalierung unten rechts */
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), 
                opacity 0.2s ease-out;
    pointer-events: none; /* Verhindert Flackern beim Verlassen */
    z-index: 100;
  }

  /* Aktivierung des Effekts bei Mouseover */
  .bild-container:hover::after {
    /* Hier die URL des Originalbildes eintragen */
    background-image: url('img/sample_male.jpg'); 
    width: 300px;
    height: 375px;
    opacity: 1;
    transform: scale(1);
    margin-bottom: 5px; /* Kleiner Abstand zum Text */
    margin-right: 5px;
  }
  
  /* Stylt den abgedunkelten Hintergrund hinter dem Modal */
dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px); /* Macht den Hintergrund leicht unscharf */
}
dialog {
  border: none;
  border-radius: 8px;
  padding: 20px;
}
/* Stylt das Modal selbst */
dialog#myModal {
  width: 90%;          /* Nimmt auf kleinen Bildschirmen 90% der Breite ein */
  max-width: 600px;    /* Verhindert, dass es auf großen Bildschirmen riesig wird */
  border: none;        /* Entfernt den hässlichen Standard-Rahmen */
  border-radius: 12px; /* Schöne abgerundete Ecken passend zum Webdesign */
  padding: 25px;       /* Platz zwischen Text und Rand */
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3); /* Sanfter Schattenwurf */
}

/* Stylt den abgedunkelten Hintergrund (Backdrop) */
dialog#myModal::backdrop {
  background-color: rgba(0, 0, 0, 0.6); /* Dunkelt die Seite ab */
  backdrop-filter: blur(4px);           /* Macht den Hintergrund leicht unscharf */
}