/**
 * SE TTS Player v5.2.7
 * (c) SoftENGINE GmbH
 *
 * Theme (Default): Gold (#F9BD00) + Black Text
 * Alle Farben sind über CSS-Variablen (siehe #setp-theme-vars im PHP) überschreibbar.
 */

/* Reset */
#setp-player,
#setp-player *,
#setp-help,
#setp-help * {
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  line-height: 1.4 !important;
}

#setp-player,
#setp-help{
  --setp-text: #000000;
  --setp-accent: #F9BD00;
  --setp-accent-rgb: 249,189,0;
  --setp-speaking: #EA901E;
  --setp-speaking-rgb: 234,144,30;

  --setp-player-bg: linear-gradient(140deg, #FFF6CC 0%, #FFE08A 55%, #F9BD00 85%, #E7A800 100%);
  --setp-toggle-bg: linear-gradient(145deg, #FFF2B8 0%, #F9BD00 100%);
  --setp-help-bg: linear-gradient(140deg, #FFF6CC 0%, #FFE08A 55%, #F9BD00 85%, #E7A800 100%);
  --setp-speaker-bg: rgba(255,255,255,0.35);

  --setp-ad-btn-bg: #F9BD00;
  --setp-ad-btn-text: #323F42;
  --setp-ad-btn-radius: 12px;
  --setp-ad-btn-padding: 10px 16px;
}

/* ========================================
   PLAYER CONTAINER
   ======================================== */
#setp-player {
  position: fixed !important;
  z-index: 2147483647 !important;
  right: 20px;
  top: 90px;
  left: auto;
  bottom: auto;
  height: 54px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  font-size: 12px !important;
  background: transparent !important;
  border-radius: 27px !important;
  overflow: visible !important;
  color: var(--setp-text) !important;
  /* wichtig für Mobile-Drag (PointerEvents): der Player selbst darf nicht "pannen" */
  touch-action: manipulation !important;
}

#setp-player:not(.setp-open) { width: 54px !important; }

#setp-player.setp-open {
  width: auto !important;
  max-width: calc(100vw - 40px) !important;
  background: var(--setp-player-bg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 1px solid rgba(0,0,0,0.12) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25) !important;
}

/* ========================================
   PULSIERENDER SCHATTEN - Vorlesen (EA901E)
   ======================================== */
#setp-toggle {
  position: relative !important;
  overflow: visible !important;
}

#setp-speaker { position: relative !important; z-index: 2 !important; }

#setp-toggle::after {
  content: "" !important;
  position: absolute !important;
  inset: -6px !important;
  border-radius: 999px !important;
  pointer-events: none !important;
  opacity: 0 !important;
  z-index: 1 !important;
  box-shadow:
    0 0 0 0 rgba(var(--setp-speaking-rgb), 0.65),
    0 0 16px rgba(var(--setp-speaking-rgb), 0.55),
    0 0 32px rgba(var(--setp-speaking-rgb), 0.35) !important;
}

#setp-player.setp-speaking #setp-toggle::after {
  opacity: 1 !important;
  animation: setp-pulse var(--setp-pulse-duration, 0.9s) ease-out infinite !important;
}

@keyframes setp-pulse {
  0% {
    transform: scale(0.94);
    box-shadow:
      0 0 0 0 rgba(var(--setp-speaking-rgb), 0.55),
      0 0 14px rgba(var(--setp-speaking-rgb), 0.50),
      0 0 28px rgba(var(--setp-speaking-rgb), 0.30);
    opacity: 1;
  }
  65% {
    transform: scale(1.08);
    box-shadow:
      0 0 0 16px rgba(var(--setp-speaking-rgb), 0.00),
      0 0 18px rgba(var(--setp-speaking-rgb), 0.28),
      0 0 36px rgba(var(--setp-speaking-rgb), 0.18);
    opacity: 0.70;
  }
  100% {
    transform: scale(1.12);
    box-shadow:
      0 0 0 22px rgba(var(--setp-speaking-rgb), 0.00),
      0 0 20px rgba(var(--setp-speaking-rgb), 0.18),
      0 0 42px rgba(var(--setp-speaking-rgb), 0.12);
    opacity: 0.25;
  }
}

/* ========================================
   TOGGLE (Lautsprecher)
   ======================================== */
#setp-toggle {
  order: 99 !important;
  width: 54px !important;
  height: 54px !important;
  min-width: 54px !important;
  flex-shrink: 0 !important;
  background: var(--setp-toggle-bg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border-radius: 27px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid rgba(0,0,0,0.12) !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18) !important;
  transition: box-shadow 0.2s !important;
  color: var(--setp-text) !important;
  /* Mobile Drag über das Toggle-Icon */
  touch-action: none !important;
}

#setp-toggle:hover { box-shadow: 0 8px 22px rgba(0,0,0,0.22) !important; }

#setp-player.setp-open:not(.setp-speaking) #setp-toggle { box-shadow: 0 4px 14px rgba(0,0,0,0.15) !important; }

#setp-speaker {
  width: 36px !important;
  height: 36px !important;
  background: var(--setp-speaker-bg) !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Geschlossen: Icon etwas präsenter, damit weniger leerer Rand bleibt */
#setp-player:not(.setp-open) #setp-speaker {
  width: 40px !important;
  height: 40px !important;
}

#setp-speaker svg { display: block !important; width: 18px !important; height: 18px !important; }
#setp-speaker img { display: block !important; width: 18px !important; height: 18px !important; object-fit: contain !important; }

#setp-player:not(.setp-open) #setp-speaker svg,
#setp-player:not(.setp-open) #setp-speaker img,
#setp-player:not(.setp-open) .setp-icon--speaker {
  width: 20px !important;
  height: 20px !important;
}

.setp-icon { display:block !important; object-fit: contain !important; }
.setp-icon--speaker { width: 18px !important; height: 18px !important; }
.setp-icon--help { width: 12px !important; height: 12px !important; }

/* ========================================
   PANEL
   ======================================== */
#setp-panel {
  order: 1 !important;
  display: none !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 0 15px !important;
  height: 100% !important;
  color: var(--setp-text) !important;
}

#setp-player.setp-open #setp-panel { display: flex !important; }

/* ========================================
   BUTTONS
   ======================================== */
#setp-panel button {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  background: rgba(255, 255, 255, 0.45) !important;
  border: 1px solid rgba(0, 0, 0, 0.14) !important;
  border-radius: 50% !important;
  color: var(--setp-text) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#setp-panel button:hover {
  background: rgba(255, 255, 255, 0.58) !important;
  border-color: rgba(0, 0, 0, 0.20) !important;
}

#setp-panel button svg { display: block !important; width: 14px !important; height: 14px !important; }
#setp-panel button img { width: 14px !important; height: 14px !important; }

#setp-panel button[data-setp="info"] strong {
  font-size: 16px !important;
  font-weight: 700 !important;
  font-style: italic !important;
  font-family: Georgia, serif !important;
  color: var(--setp-text) !important;
}

#setp-drag { cursor: grab !important; }
#setp-drag:active { cursor: grabbing !important; }

/* Drag-Handle darf auf Touch nicht scrollen */
#setp-drag{
  touch-action: none !important;
}

/* ========================================
   CONTROLS
   ======================================== */
.setp-control {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  height: 32px !important;
  white-space: nowrap !important;
  color: var(--setp-text) !important;
}

.setp-control label {
  color: var(--setp-text) !important;
  font-size: 11px !important;
  opacity: 0.9 !important;
}

#setp-vol {
  width: 60px !important;
  height: 4px !important;
  background: rgba(0, 0, 0, 0.18) !important;
  border-radius: 2px !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  cursor: pointer !important;
}

#setp-vol::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  width: 14px !important;
  height: 14px !important;
  background: #000 !important; /* Regler-Dot schwarz */
  border-radius: 50% !important;
  border: 2px solid rgba(255,255,255,0.75) !important;
}

#setp-vol::-moz-range-thumb {
  width: 14px !important;
  height: 14px !important;
  background: #000 !important; /* Regler-Dot schwarz */
  border-radius: 50% !important;
  border: 2px solid rgba(255,255,255,0.75) !important;
}

#setp-voice {
  height: 28px !important;
  background: rgba(255, 255, 255, 0.45) !important;
  color: var(--setp-text) !important;
  border: 1px solid rgba(0, 0, 0, 0.14) !important;
  border-radius: 8px !important;
  padding: 0 8px !important;
  font-size: 11px !important;
  cursor: pointer !important;
  max-width: 150px !important;
}

#setp-voice option { background: #fff !important; color: #000 !important; }

#setp-status {
  color: var(--setp-text) !important;
  font-size: 11px !important;
  min-width: 50px !important;
  text-align: center !important;
  opacity: 0.95 !important;
}

/* ========================================
   HELP PANEL - Popup über dem Player
   ======================================== */
#setp-help {
  position: fixed !important;
  z-index: 2147483646 !important;
  overflow: hidden !important;
  background: var(--setp-help-bg) !important; /* nicht mehr transparent */
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border-radius: 16px !important;
  border: 1px solid rgba(0, 0, 0, 0.14) !important;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28) !important;
  color: var(--setp-text) !important;
  display: none !important;
}

#setp-help.setp-visible { display: block !important; }

#setp-help-inner {
  display: flex !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 220px !important;
}

#setp-help-inner{ overflow: hidden !important; }

/* ----------------------------------------
   ROBUST: Werbebild darf Layout nie sprengen
   Viele Themes überschreiben <img> mit !important.
   Daher hier bewusst höhere Spezifizität unter #setp-help.
   Außerdem: flex:... */

#setp-help-left,
#setp-help-right{
  flex: 1 1 0% !important;
  min-width: 0 !important;
}


#setp-help-left {
  flex: 1 !important;
  padding: 18px 22px !important;
  overflow-y: auto !important;
  color: var(--setp-text) !important;
}

#setp-help-left h3 {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: var(--setp-text) !important;
  margin: 0 0 12px 0 !important;
}

#setp-help-left dl {
  display: grid !important;
  grid-template-columns: auto 1fr !important;
  gap: 6px 14px !important;
  align-items: center !important;
  margin: 0 0 16px 0 !important;
}

#setp-help-left dt {
  color: var(--setp-text) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  display: flex !important;
  align-items: center !important;
}

#setp-help-left dd {
  font-size: 12px !important;
  color: var(--setp-text) !important;
  opacity: 0.95 !important;
}

#setp-help-left .setp-help-note {
  font-size: 12px !important;
  color: var(--setp-text) !important;
  margin: 10px 0 0 0 !important;
  opacity: 0.95 !important;
}

.setp-help-i{
  color: var(--setp-text) !important;
  font-style: italic !important;
}

#setp-help-sep {
  width: 1px !important;
  background: rgba(0, 0, 0, 0.16) !important;
  align-self: stretch !important;
}

#setp-help-right {
  flex: 1 !important;
  display: flex !important;
  align-items: stretch !important;
  justify-content: center !important;
  padding: 18px !important;
  min-height: 0 !important; /* wichtig für flex shrink */
  overflow: hidden !important;
  min-width: 0 !important;
}

.setp-ad-wrap{
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: stretch !important;
  min-height: 0 !important;

  overflow: hidden !important;
  min-width: 0 !important;
}

.setp-ad-media{
  flex: 1 1 0% !important;
  width: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  align-items: stretch !important;
  justify-content: stretch !important;

  overflow: hidden !important;
  min-width: 0 !important;
  order: 1 !important;
}

.setp-ad-link{
  position: relative !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  min-width: 0 !important;
  min-height: 0 !important;
  flex: 1 1 0% !important;
  line-height: 0 !important;
  text-decoration: none !important;
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-color: transparent !important;
}

/* Extra-spezifisch, damit kein Theme das Bild "aufdrückt".
   WICHTIG: width/height bleiben auto, damit das Bild IMMER innerhalb
   des vorhandenen Bereichs skaliert (kein "rauslaufen" links/rechts). */
#setp-help img.setp-ad-img{
  display: none !important;
}
#setp-help .setp-ad-btn{
  margin-top: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  background: var(--setp-ad-btn-bg) !important;
  color: var(--setp-ad-btn-text) !important;
  border-radius: var(--setp-ad-btn-radius) !important;
  padding: var(--setp-ad-btn-padding) !important;
  font-weight: 700 !important;
  letter-spacing: 0.2px !important;
  border: 1px solid rgba(0,0,0,0.14) !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12) !important;
  max-width: 100% !important;

  order: 2 !important;
  flex: 0 0 auto !important;
}
#setp-help .setp-ad-btn:hover{
  filter: brightness(0.98) !important;
}

.setp-ad-placeholder {
  width: 100% !important;
  height: 100% !important;
  min-height: 120px !important;
  border: 1px dashed rgba(0, 0, 0, 0.22) !important;
  border-radius: 10px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  color: rgba(0,0,0,0.65) !important;
  font-size: 14px !important;
  background: rgba(255,255,255,0.35) !important;
}

.setp-ad-placeholder small { font-size: 11px !important; opacity: 0.75 !important; }

/* Google Translate verstecken */
#google_translate_element,
.goog-te-banner-frame,
.skiptranslate,
.goog-te-gadget {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
}

body { top: 0 !important; }

/* Responsive */
@media (max-width: 600px) {
  #setp-panel { gap: 5px !important; padding: 0 8px !important; }
  #setp-vol { width: 40px !important; }
  /* Auf Handys den Lautstärkeregler ausblenden und den Platz der Stimme geben */
  .setp-control-vol{ display:none !important; }

  .setp-control-voice{
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }
  #setp-voice{
    width: 100% !important;
    max-width: none !important;
  }
}

/* ========================================
   MOBILE LAYOUT (passt auf schmale Displays)
   Ziel: kein Abschneiden, große Tap-Flächen,
   trotzdem volle Funktion.
   ======================================== */
@media (max-width: 480px) {
  /* Player im offenen Zustand immer innerhalb der Viewport-Breite */
  #setp-player.setp-open{
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
  }

  /* Panel darf schrumpfen */
  #setp-panel{
    flex: 1 1 auto !important;
    min-width: 0 !important;
    padding: 0 10px !important;
    gap: 6px !important;
  }

  /* Toggle bleibt fix */
  #setp-toggle{ flex: 0 0 54px !important; }

  /* Buttons etwas kompakter */
  #setp-panel button{
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
  }
  #setp-panel button svg,
  #setp-panel button img{
    width: 13px !important;
    height: 13px !important;
  }

  /* Drag-Button ausblenden: Drag geht auf Mobile über das Toggle-Icon */
  #setp-drag{ display: none !important; }

  /* Labels ausblenden spart massiv Breite */
  .setp-control label{ display:none !important; }
  .setp-control{ gap: 4px !important; min-width: 0 !important; }

  /* Vol-Regler bleibt auf Mobile ausgeblendet (siehe @media 600px) */

  /* Stimme soll shrinken können */
  #setp-voice{
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    font-size: 10px !important;
  }

  #setp-status{
    min-width: 40px !important;
    font-size: 10px !important;
  }
}

@media (max-width: 360px) {
  /* auf sehr kleinen Displays Status ausblenden, um sicher zu passen */
  #setp-status{ display:none !important; }
  #setp-voice{ font-size: 9px !important; }
}
