/* playground-fullscreen.css - Mobile Fullscreen View for Stadtfest */

/* Fullscreen Container (Mobile + Desktop) */
.playground-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 70px; /* Space for bottom navigation on mobile */
  z-index: 100;
  background: transparent; /* Transparent - body gradient shines through */
  display: none;
}

/* Desktop: Adjust for no bottom navigation */
@media (min-width: 769px) {
  .playground-fullscreen {
    bottom: 0; /* No bottom navigation on desktop */
  }
}

.playground-fullscreen.active {
  display: block !important;
}

/* Stadtfest Background Image Container */
.playground-fullscreen-image-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  touch-action: none; /* Disable default touch behaviors */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Image Wrapper - Will be transformed (zoom/pan) together with image */
/* IMPORTANT: 1:1 Aspect Ratio to match positioning tool! */
.playground-image-wrapper {
  position: relative;
  width: 100%;
  max-width: min(100%, 100vh); /* Fit within viewport, stay square */
  aspect-ratio: 1 / 1; /* Force 1:1 aspect ratio (modern CSS) */
  transform-origin: center center;
}

/* Fallback for older browsers without aspect-ratio support */
@supports not (aspect-ratio: 1 / 1) {
  .playground-image-wrapper {
    max-width: 100%;
  }
  .playground-image-wrapper::before {
    content: '';
    display: block;
    padding-bottom: 100%; /* 1:1 aspect ratio fallback */
  }
}

/* Stadtfest Image Element */
.playground-fullscreen-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* Show full image, maintain aspect ratio */
  transform-origin: center center;
  /* Soft shadow - image floats above gradient background */
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.15),
    0 4px 12px rgba(0, 0, 0, 0.10);
}

/* ==========================================
   LEVEL/PROGRESS OVERLAY (TOP)
   ========================================== */

/* Level Overlay (Oben, volle Breite, unter Header) */
.playground-level-overlay {
  position: absolute;
  top: 50px; /* Space for header (same as habits) */
  left: 8px;
  right: 8px;
  transform: none;

  /* NO background - transparent */
  background: none;

  padding: 0;

  color: white;

  /* No text shadow for clean white text */
  text-shadow: none;

  z-index: 10;
}

.level-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.level-overlay-content .level-text {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0;
  color: white;
  text-align: center;
}

.level-overlay-content .progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.4); /* Darker bar background for contrast */
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.level-overlay-content .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #3b82f6);
  transition: width 0.3s ease;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.level-overlay-content .progress-points {
  font-size: 0.75rem;
  margin: 0;
  color: white;
  text-align: center;
  font-weight: 600;
}

/* ==========================================
   BOTTOM BUTTONS - RESPONSIVE LAYOUT
   All buttons aligned to bottom left in order: Story, Audio, Chronik
   ========================================== */

/* Story Button (First button - left) */
.playground-story-fab {
  position: absolute;
  bottom: 20px;
  left: 20px;

  width: 56px;
  height: 56px;

  background-image: url('Grafiken/Buch/Buchcover.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: transparent;
  
  border: none;
  border-radius: 0;
  
  cursor: pointer;
  
  font-size: 0;
  
  transition: transform 0.2s ease, opacity 0.2s ease;
  
  z-index: 21;
  
  padding: 0;
}

.playground-story-fab:hover {
  transform: scale(1.1);
  opacity: 0.8;
}

.playground-story-fab:active {
  transform: scale(0.95);
}

/* Audio Play Button (Second button - middle)
   DEACTIVATED: Audio button removed to simplify UI
   See Texte_vorlesen_lassen.md for reactivation instructions */
/*
.playground-audio-fab {
  position: absolute;
  bottom: 20px;
  left: calc(20px + 56px + 12px);

  width: 56px;
  height: 56px;

  background-image: url('Grafiken/UI_Icons/Geschichte_PLAY.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: transparent;

  border: none;
  border-radius: 0;

  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 0;
  color: transparent;

  transition: transform 0.2s ease, opacity 0.2s ease;

  z-index: 22;

  padding: 0;
}

.playground-audio-fab:hover {
  transform: scale(1.1);
  opacity: 0.8;
}

.playground-audio-fab:active {
  transform: scale(0.95);
}

.playground-audio-fab.playing {
}
*/

/* Chronik Button (Second button - middle, moved from third position) */
.playground-chronik-fab {
  position: absolute;
  bottom: 20px;
  left: calc(20px + 56px + 12px); /* 20px margin + 56px story button + 12px gap */
  
  width: 56px;
  height: 56px;
  
  background-image: url('Grafiken/UI_Icons/ToDo.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: transparent;
  
  border: none;
  border-radius: 0;
  
  cursor: pointer;
  
  transition: transform 0.2s ease, opacity 0.2s ease;
  
  z-index: 20;
  
  padding: 0;
  font-size: 0;
}

.playground-chronik-fab:hover {
  transform: scale(1.1);
  opacity: 0.8;
}

.playground-chronik-fab:active {
  transform: scale(0.95);
}

/* Story Popup (Same style as Chronik) */
.playground-story-popup {
  position: absolute;
  bottom: 90px;
  right: 20px;
  
  width: calc(100% - 40px);
  max-width: 400px;
  
  height: 60vh;
  max-height: 60vh;
  
  background: linear-gradient(to bottom, #d6e8d2, #f5e7d5);
  
  border: 1px solid var(--border-color, #E5E7EB);
  border-radius: 20px;
  
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  
  overflow: hidden;
  
  display: flex;
  flex-direction: column;
  
  z-index: 25;
  
  animation: slideUpFadeIn 0.3s ease-out;
}

/* Story Popup Header */
.story-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid var(--border-color, #E5E7EB);
  border-radius: 20px 20px 0 0;
  flex-shrink: 0;
}

.story-popup-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.story-popup-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.story-popup-close:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Story Popup Content (Scrollable) */
.story-popup-content,
#story-popup-content {
  flex: 1 1 auto;
  overflow-y: auto !important;
  overflow-x: hidden;
  padding: 20px 20px 80px 20px;
  -webkit-overflow-scrolling: touch;
  min-height: 0 !important;
  max-height: 100% !important;
  white-space: pre-line;
  line-height: 1.8;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.story-popup-content::-webkit-scrollbar,
#story-popup-content::-webkit-scrollbar {
  width: 8px;
}

.story-popup-content::-webkit-scrollbar-track,
#story-popup-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.story-popup-content::-webkit-scrollbar-thumb,
#story-popup-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.story-popup-content::-webkit-scrollbar-thumb:hover,
#story-popup-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Chronik Popup Overlay */
.playground-chronik-popup {
  position: absolute;
  bottom: 90px;
  right: 20px;
  
  width: calc(100% - 40px);
  max-width: 400px;
  
  /* WICHTIG: Feste Höhe damit alles passt! */
  height: 60vh;
  max-height: 60vh;
  
  /* Card-Style mit Verlauf wie die App */
  background: linear-gradient(to bottom, #d6e8d2, #f5e7d5);
  
  border: 1px solid var(--border-color, #E5E7EB);
  border-radius: 20px;
  
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  
  overflow: hidden;
  
  /* FLEXBOX FÜR KORREKTE STRUKTUR: Header + Content (scrollable) */
  display: flex;
  flex-direction: column;
  
  z-index: 25;
  
  animation: slideUpFadeIn 0.3s ease-out;
}

@keyframes slideUpFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chronik Popup Header */
.chronik-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid var(--border-color, #E5E7EB);
  border-radius: 20px 20px 0 0;
  
  /* FLEXBOX: Feste Höhe, kein Wachsen */
  flex-shrink: 0;
  height: 60px;
}

.chronik-popup-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary, #1F2937);
  font-weight: 700;
}

.chronik-close-btn {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-primary, #1F2937);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.chronik-close-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* Chronik Popup Content */
.chronik-popup-content {
  padding: 16px 20px 200px 20px; /* Extra bottom padding for last items */
  overflow-y: auto !important;
  overflow-x: hidden;
  color: var(--text-primary, #1F2937);
  
  /* FLEXBOX: Nimm den verfügbaren Raum zwischen Header und Button */
  flex: 1 1 auto;
  min-height: 0 !important;
  max-height: 100% !important;
}

.chronik-popup-day {
  margin-bottom: 24px;
}

.chronik-popup-day:last-child {
  margin-bottom: 0;
}

/* Date Header: Datum links, Punkte rechts */
.chronik-popup-date {
  font-size: 0.85rem;
  color: var(--text-primary, #1F2937);
  font-weight: 700;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border-color, #E5E7EB);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chronik-popup-date-label {
  flex: 1;
}

.chronik-popup-date-points {
  font-weight: 700;
  font-size: 0.85rem;
}

.chronik-popup-date-points.positive {
  color: #10b981;
}

.chronik-popup-date-points.negative {
  color: #ef4444;
}

/* Simple entry line: Zeit | Habit | Punkte */
.chronik-popup-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 8px 16px; /* 16px left padding for indentation */
  border-bottom: 1px solid rgba(229, 231, 235, 0.5);
}

.chronik-popup-entry:last-child {
  border-bottom: none;
}

.chronik-popup-time {
  color: var(--text-muted, #9CA3AF);
  font-size: 0.8rem;
  min-width: 40px;
  font-weight: 500;
}

.chronik-popup-habit-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chronik-popup-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.chronik-popup-habit-name {
  color: var(--text-primary, #1F2937);
  font-size: 0.9rem;
  font-weight: 500;
}

.chronik-popup-points {
  font-weight: 700;
  font-size: 0.9rem;
  text-align: right;
  min-width: 45px;
}

.chronik-popup-points.positive {
  color: #10b981;
}

.chronik-popup-points.negative {
  color: #ef4444;
}

/* Scrollbar for Chronik Popup */
.chronik-popup-content::-webkit-scrollbar {
  width: 6px;
}

.chronik-popup-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

.chronik-popup-content::-webkit-scrollbar-thumb {
  background: var(--accent-color, #10b981);
  border-radius: 10px;
}

.chronik-popup-content::-webkit-scrollbar-thumb:hover {
  background: #059669;
}

/* ==========================================
   BASE OVERLAY STYLES (BOTTOM) - OLD
   ========================================== */

/* Base Overlay Styles - Only for Info and Chronik overlays (NOT for interactive overlays like mailbox!) */
.playground-info-overlay,
.playground-chronik-overlay {
  position: absolute;
  bottom: 20px;
  
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  
  border-radius: 16px;
  padding: 16px;
  
  color: white;
  
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  
  transition: all 0.3s ease;
  
  max-width: calc(50% - 30px);
  min-width: 120px;
}

/* Points Overlay (Links) */
.playground-points-overlay {
  left: 20px;
}

/* Chronik Overlay (Rechts) */
.playground-chronik-overlay {
  right: 20px;
}

/* Overlay Content (ausgeklappt) */
.overlay-content {
  display: block;
}

.playground-overlay[data-collapsed="true"] .overlay-content {
  display: none;
}

/* Overlay Minimal (eingeklappt) */
.overlay-minimal {
  display: none;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.playground-overlay[data-collapsed="true"] .overlay-minimal {
  display: block;
}

/* Eingeklappter Zustand - kleiner */
.playground-overlay[data-collapsed="true"] {
  padding: 12px;
  min-width: 60px;
  max-width: 80px;
}

/* Overlay Title */
.overlay-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: white;
}

/* Level Info */
.level-info {
  margin-bottom: 12px;
}

.level-text {
  font-size: 0.85rem;
  margin: 0 0 6px 0;
  color: rgba(255, 255, 255, 0.8);
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #3b82f6);
  transition: width 0.3s ease;
  border-radius: 10px;
}

.progress-points {
  font-size: 0.75rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  text-align: right;
}

/* Points Boxes */
.points-boxes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.points-box {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.points-box:hover {
  background: rgba(255, 255, 255, 0.15);
}

.points-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.points-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

.points-value {
  font-size: 0.85rem;
  font-weight: 700;
  flex: 1;
  text-align: right;
}

.points-value.positive {
  color: #22c55e;
}

.points-value.negative {
  color: #ef4444;
}

.toggle-icon {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  transition: transform 0.2s ease;
}

.points-box[data-expanded="true"] .toggle-icon {
  transform: rotate(180deg);
}

/* Points Details */
.points-details {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.habit-point-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 4px;
}

.habit-point-entry:last-child {
  margin-bottom: 0;
}

.habit-point-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.habit-point-icon {
  width: 16px;
  height: 16px;
}

.habit-point-value {
  font-weight: 600;
}

.habit-point-value.positive {
  color: #22c55e;
}

.habit-point-value.negative {
  color: #ef4444;
}

/* Toggle Button */
.overlay-toggle-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px auto 0;
  color: white;
  font-size: 0.8rem;
  transition: background 0.2s ease;
}

.overlay-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.overlay-toggle-btn .icon-expanded,
.overlay-toggle-btn .icon-collapsed {
  display: none;
}

.playground-overlay:not([data-collapsed="true"]) .overlay-toggle-btn .icon-expanded {
  display: block;
}

.playground-overlay[data-collapsed="true"] .overlay-toggle-btn .icon-collapsed {
  display: block;
}

/* Chronik Content */
.chronik-content {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.chronik-day {
  margin-bottom: 12px;
}

.chronik-day:last-child {
  margin-bottom: 0;
}

.chronik-date {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.chronik-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 4px;
  font-size: 0.75rem;
}

.chronik-entry:last-child {
  margin-bottom: 0;
}

.chronik-habit {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.9);
}

.chronik-icon {
  width: 16px;
  height: 16px;
}

.chronik-status {
  font-size: 0.7rem;
}

.chronik-points {
  font-weight: 600;
  font-size: 0.75rem;
}

.chronik-points.positive {
  color: #22c55e;
}

.chronik-points.negative {
  color: #ef4444;
}

/* Chronik More Button */
.chronik-more-btn {
  width: 100%;
  padding: 8px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chronik-more-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Scrollbar Styling */
.chronik-content::-webkit-scrollbar {
  width: 4px;
}

.chronik-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.chronik-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
}

.chronik-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Mobile Responsive Adjustments */
@media (max-width: 600px) {
  .playground-overlay {
    max-width: calc(50% - 15px);
  }
  
  .playground-info-overlay {
    left: 10px;
  }
  
  .playground-chronik-overlay {
    right: 10px;
  }
  
  .overlay-title {
    font-size: 0.9rem;
  }
  
  .level-text,
  .points-label,
  .points-value {
    font-size: 0.75rem;
  }
  
  .chronik-content {
    max-height: 150px;
  }
}

/* Very Small Screens - Stack vertically */
@media (max-width: 400px) {
  .playground-overlay {
    max-width: calc(100% - 40px);
  }
  
  .playground-info-overlay {
    left: 20px;
    right: 20px;
    bottom: 120px; /* Above chronik */
  }
  
  .playground-chronik-overlay {
    left: 20px;
    right: 20px;
    bottom: 20px;
  }
}

/* Desktop: Hide fullscreen, keep original view */
@media (min-width: 769px) {
  .playground-fullscreen {
    display: none !important;
  }
}

/* ==========================================
   INTERACTIVE OVERLAYS (Mailbox etc.)
   ========================================== */

/* Overlay Container - fill entire container, overlays positioned with percentage */
.playground-overlays {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  
  /* Debug: uncomment to see overlay boundaries */
  /* border: 2px solid red; */
}

/* Individual Interactive Overlay */
.playground-overlay {
  position: absolute;
  pointer-events: auto; /* Enable clicks on overlay */
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 1;
  background: transparent !important; /* Force transparent background */
  border: none; /* No border */
  box-shadow: none; /* No shadow */
  touch-action: auto; /* Allow touch events to work normally on overlay */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */

  /* Position is set via JavaScript inline styles */
}

.playground-overlay:hover {
  transform: scale(1.1);
  /* Removed drop-shadow on hover */
}

.playground-overlay:active {
  transform: scale(0.95);
}

/* Overlay Icon */
.playground-overlay-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent !important; /* Force transparent background */
  image-rendering: auto; /* Let browser handle PNG transparency properly */
  border: none; /* No border */
  box-shadow: none; /* No shadow */
  filter: none; /* No filters (no drop-shadow) */
}

/* ==========================================
   MOTIVATIONAL NOTE POPUP
   ========================================== */

/* Popup Container */
.motivational-note-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999; /* Very high to be above everything */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none; /* Allow clicks through when not active */
}

.motivational-note-popup.active {
  opacity: 1;
  pointer-events: auto; /* Enable clicks when active */
}

/* Backdrop */
.motivational-note-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

/* Note Content */
.motivational-note-content {
  position: relative;
  max-width: 90%;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transform: scale(0.8);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.motivational-note-popup.active .motivational-note-content {
  transform: scale(1);
}

/* Note Image (Zettel_leer.png) */
.motivational-note-image {
  width: 100%;
  max-width: 700px;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}

/* Text Overlay on Note */
.motivational-note-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 75%;
  text-align: center;
  padding: 20px;
}

.motivational-note-text p {
  font-family: 'Caveat', 'Segoe Print', cursive, sans-serif; /* Handwriting font */
  font-size: 2.2rem;
  line-height: 1.5;
  color: #1a1a1a;
  margin: 0;
  text-shadow: none;
  font-weight: 600;
}

/* Close Button */
.motivational-note-close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  border: 2px solid #333;
  color: #333;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
  z-index: 2;
}

.motivational-note-close:hover {
  background: #f0f0f0;
  transform: scale(1.1);
}

.motivational-note-close:active {
  transform: scale(0.9);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  /* No extra padding - keep tap area tight to the image */
  .playground-overlay {
    /* Removed padding/margin to keep tap area exactly on the icon */
  }

  .motivational-note-popup {
    padding: 20px; /* Add padding on mobile */
  }

  .motivational-note-content {
    max-width: 98%; /* Even wider on mobile */
    max-height: 90vh; /* More height on mobile */
  }

  .motivational-note-image {
    max-width: none; /* Remove max-width limit */
    width: 90vw; /* Use 90% of viewport width */
    max-height: 80vh; /* Limit height to prevent overflow */
  }

  .motivational-note-text {
    width: 78%; /* Wider text area on mobile */
    padding: 15px; /* Reduce padding slightly */
  }

  .motivational-note-text p {
    font-size: 1.6rem; /* Slightly smaller on mobile, but bigger than before */
    line-height: 1.4;
  }

  .motivational-note-close {
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
    top: 5px; /* Adjust position on mobile */
    right: 5px;
  }
}

/* ==========================================
   GARDENER OVERLAYS
   ========================================== */

/* Gärtner Overlays */
.gardener-overlay {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  z-index: 15; /* Above mailboxes (10) */
  transition: transform 0.2s ease, filter 0.2s ease;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated; /* For pixel art */
  touch-action: auto;
  -webkit-tap-highlight-color: transparent;
}

.gardener-overlay img {
  pointer-events: none; /* Prevent drag on image */
  user-select: none;
  -webkit-user-select: none;
}

.gardener-overlay:hover {
  transform: scale(1.1);
  filter: brightness(1.2);
}

.gardener-overlay:active {
  transform: scale(0.95);
}

/* Entrance Animation */
.gardener-overlay.entering {
  animation: gardenerEnter 0.5s ease-out;
}

@keyframes gardenerEnter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Pulsing effect for newly unlocked gardeners */
.gardener-overlay.new {
  animation: gardenerPulse 2s ease-in-out infinite;
}

@keyframes gardenerPulse {
  0%, 100% { 
    transform: scale(1); 
  }
  50% { 
    transform: scale(1.05); 
  }
}

/* ==========================================
   GARDENER SPEECH BUBBLE
   ========================================== */

/* Speech Bubble Container */
.gardener-speech-bubble {
  position: absolute;
  z-index: 20; /* Above gardeners */
  pointer-events: auto;
  
  /* Positioning is set via JS */
  transform: translate(-50%, 0); /* Center horizontally above gardener */
  
  /* Initial state (invisible) */
  opacity: 0;
  transform: translate(-50%, 10px) scale(0.9);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gardener-speech-bubble.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.gardener-speech-bubble.closing {
  opacity: 0;
  transform: translate(-50%, -10px) scale(0.9);
  transition: all 0.2s ease-out;
}

/* Speech Bubble Content */
.speech-bubble-content {
  background: white;
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  min-width: 200px;
  max-width: 280px;
  
  /* Speech bubble tail (pointing down to gardener) */
  margin-bottom: 12px;
}

.speech-bubble-content::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid white;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.1));
}

/* Close Button */
.speech-bubble-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.05);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #666;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.speech-bubble-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #333;
}

.speech-bubble-close:active {
  transform: scale(0.9);
}

/* Message Text */
.speech-bubble-text {
  color: #1F2937;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
  font-weight: 500;
  min-height: 1.6em;
  padding-top: 4px;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  /* Make speech bubble visible on mobile with fixed positioning */
  .gardener-speech-bubble {
    /* position: fixed is set via JS */
    /* These will override JS inline styles */
    z-index: 1000 !important;
  }
  
  .speech-bubble-content {
    min-width: 240px;
    max-width: 320px;
    padding: 24px 28px;
    margin-bottom: 16px; /* Space for tail */
    /* Ensure it's visible */
    background: white !important;
    box-shadow: 
      0 20px 60px rgba(0, 0, 0, 0.3),
      0 8px 20px rgba(0, 0, 0, 0.2);
  }
  
  /* Keep tail on mobile but point downward */
  .speech-bubble-content::after {
    content: '';
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 16px solid white;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.15));
  }
  
  .speech-bubble-text {
    font-size: 1rem;
    line-height: 1.6;
    font-weight: 600;
    min-height: 2em;
  }
  
  .speech-bubble-close {
    width: 36px;
    height: 36px;
    font-size: 1.6rem;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.08);
  }
  
  .speech-bubble-close:active {
    background: rgba(0, 0, 0, 0.15);
  }
}

/* ========================================
   BOOK INTRO SYSTEM
   ======================================== */

/* Book Cover Overlay */
.book-cover-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none; /* Don't block clicks when not active */
}

.book-cover-overlay.active {
  display: flex;
  opacity: 1;
  pointer-events: auto; /* Allow clicks only when active */
}

.book-cover-container:hover {
  animation: none;
  transform: scale(1.1);
}

.book-cover-container:active {
  animation: none;
  transform: scale(0.98);
}

.book-cover-image {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  filter: none; /* Kein Schatten mehr */
}

.book-cover-container {
  position: relative;
  cursor: pointer;
  transition: transform 0.3s ease;
  max-width: 300px;
  max-height: 450px;
  animation: book-pulse 2s ease-in-out infinite;
}

/* Pulsieren - Buch wird größer und kleiner */
@keyframes book-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

.book-level-text {
  position: absolute;
  top: 16%;  /* Vertikale Position: 0% = oben, 50% = Mitte, 100% = unten */
  left: 45%; /* Horizontale Position: 50% = zentriert */
  transform: translateX(-50%) rotate(-5deg);
  font-size: 2rem;
  font-weight: 700;
  color: #d4af37;
  text-shadow:
    2px 2px 4px rgba(0, 0, 0, 0.8),
    0 0 10px rgba(212, 175, 55, 0.5);
  font-family: 'Caveat', cursive;
  pointer-events: none;
  
  /* Nur Fade-in Animation - Pulsieren kommt vom Parent (.book-cover-container) */
  opacity: 0;
  animation: levelTextFadeIn 0.8s ease-out 0.5s forwards;
}

/* Fade-in Animation für Level-Text */
@keyframes levelTextFadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* Book Page Overlay */
.book-page-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
  box-sizing: border-box;
}

.book-page-overlay.active {
  display: flex;
  opacity: 1;
}

.book-page-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Close button (X) */
.book-close-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #8b7355;
  border-radius: 50%;
  font-size: 1.8rem;
  font-weight: 700;
  color: #3a2f25;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.book-close-btn:hover {
  background: white;
  transform: scale(1.1);
}

.book-close-btn:active {
  transform: scale(0.95);
}

/* Book page background */
.book-page-background {
  position: relative;
  width: 100%;
  max-width: 500px;
}

.book-page-image {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 40px rgba(0, 0, 0, 0.5));
}

/* Text content overlay */
.book-page-content {
  position: absolute;
  top: 8%;
  left: 12%;
  right: 12%;
  bottom: 8%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.book-page-text {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 20px 16px;
  font-family: 'Caveat', cursive;
  font-size: 1.8rem;
  line-height: 1.6;
  color: #3a2f25;
  text-align: left;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #8b7355 transparent;
}

.book-page-text::-webkit-scrollbar {
  width: 6px;
}

.book-page-text::-webkit-scrollbar-track {
  background: transparent;
}

.book-page-text::-webkit-scrollbar-thumb {
  background: #8b7355;
  border-radius: 3px;
}

.book-page-text p {
  margin: 0 0 1em 0;
}

.book-page-text p:last-child {
  margin-bottom: 0;
}

/* Navigation buttons */
.book-page-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  width: 100%;
  max-width: 500px;
}

.book-nav-btn {
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #8b7355;
  border-radius: 12px;
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  font-weight: 600;
  color: #3a2f25;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.book-nav-btn:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.book-nav-btn:active {
  transform: translateY(0);
}

.book-page-indicator {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  min-width: 60px;
  text-align: center;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .book-cover-container {
    max-width: 280px;
    max-height: 420px;
  }

  .book-level-text {
    font-size: 1.5rem;
    top: 16%;
  }

  .book-page-text {
    font-size: 1.5rem;
    padding: 16px 12px;
  }

  .book-nav-btn {
    padding: 10px 20px;
    font-size: 1.1rem;
  }

  .book-close-btn {
    width: 44px;
    height: 44px;
    font-size: 1.6rem;
    top: -10px;
    right: -10px;
  }

  .book-page-content {
    top: 10%;
    left: 14%;
    right: 14%;
    bottom: 10%;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .book-cover-container {
    max-width: 240px;
    max-height: 360px;
  }

  .book-level-text {
    font-size: 1.3rem;
  }

  .book-page-text {
    font-size: 1.3rem;
  }

  .book-nav-btn span {
    font-size: 1rem;
  }
}

/* ==========================================
   BOOK FLY ANIMATION - Button fliegt in Mitte
   ========================================== */

/* Clone des Story-Buttons für Animation */
.story-fab-clone {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 56px;
  height: 56px;
  background-image: url('Grafiken/Buch/Buchcover.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: transparent; /* WICHTIG: Kein Hintergrund! */
  z-index: 10001; /* Über allem */
  pointer-events: none; /* Nicht klickbar während Animation */
  border: none; /* Kein Rahmen */
  outline: none; /* Kein Outline */
  border-radius: 0; /* Kein Radius mehr - PNG hat eigene Form */
  box-shadow: none !important; /* Kein Schatten während Animation */
  filter: none !important; /* Kein drop-shadow während Animation */
  
  /* Anti-Aliasing Fixes */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Animation: Button fliegt in die Mitte und wird größer */
@keyframes book-fly-to-center {
  0% {
    /* Start position is set via inline styles - DON'T override! */
    /* NO bottom/left here - use inline styles from JS */
    width: 56px;
    height: 56px;
    transform: translate(0, 0) scale(1);
    opacity: 1;
    filter: none;
    box-shadow: none;
  }
  50% {
    /* Halfway: Moving to center, becoming square */
    bottom: 50%;
    left: 50%;
    width: 56px;
    height: 56px;
    transform: translate(-50%, 50%) scale(3.2);
    filter: none;
    box-shadow: none;
  }
  100% {
    /* Final: Center position, book size */
    bottom: 50%;
    left: 50%;
    width: 56px;
    height: 56px;
    transform: translate(-50%, 50%) scale(5.36);
    opacity: 1;
    filter: none;
    box-shadow: none;
  }
}

/* Animation: Buch fliegt zurück und wird kleiner */
@keyframes book-fly-back {
  0% {
    /* Start: Center position, book size */
    bottom: 50%;
    left: 50%;
    width: 300px;
    height: 450px;
    transform: translate(-50%, 50%) scale(1);
    opacity: 1;
    filter: none;
    box-shadow: none;
  }
  50% {
    /* Halfway: Moving back, becoming square */
    width: 178px;
    height: 178px;
    transform: translate(-50%, 50%) scale(1);
    filter: none;
    box-shadow: none;
  }
  100% {
    /* Final: Button position (from CSS variables set by JS) */
    bottom: var(--target-bottom, 20px);
    left: var(--target-left, 20px);
    width: 56px;
    height: 56px;
    transform: translate(0, 0) scale(1);
    opacity: 1;
    filter: none;
    box-shadow: none;
  }
}

/* Apply animations */
.story-fab-clone.fly-to-center {
  animation: book-fly-to-center 0.8s ease-out forwards;
}

.story-fab-clone.fly-back {
  animation: book-fly-back 0.6s ease-in-out forwards;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  @keyframes book-fly-to-center {
    0% {
      /* Start position from inline styles - DON'T override */
      width: 56px;
      height: 56px;
      transform: translate(0, 0);
    }
    50% {
      bottom: 50%;
      left: 50%;
      width: 168px;
      height: 168px;
    }
    100% {
      bottom: 50%;
      left: 50%;
      width: 280px;
      height: 420px;
      transform: translate(-50%, 50%);
    }
  }
  
  @keyframes book-fly-back {
    0% {
      bottom: 50%;
      left: 50%;
      width: 280px;
      height: 420px;
      transform: translate(-50%, 50%);
    }
    50% {
      width: 168px;
      height: 168px;
    }
    100% {
      bottom: var(--target-bottom, 20px);
      left: var(--target-left, 20px);
      width: 56px;
      height: 56px;
      transform: translate(0, 0);
    }
  }
}

/* Very small screens */
@media (max-width: 480px) {
  @keyframes book-fly-to-center {
    0% {
      /* Start position from inline styles */
      width: 56px;
      height: 56px;
      transform: translate(0, 0);
    }
    50% {
      bottom: 50%;
      left: 50%;
      width: 148px;
      height: 148px;
    }
    100% {
      bottom: 50%;
      left: 50%;
      width: 240px;
      height: 360px;
      transform: translate(-50%, 50%);
    }
  }
  
  @keyframes book-fly-back {
    0% {
      bottom: 50%;
      left: 50%;
      width: 240px;
      height: 360px;
      transform: translate(-50%, 50%);
    }
    50% {
      width: 148px;
      height: 148px;
    }
    100% {
      bottom: var(--target-bottom, 20px);
      left: var(--target-left, 20px);
      width: 56px;
      height: 56px;
      transform: translate(0, 0);
    }
  }
}

/* ==========================================
   NO HABITS VIEW - Lazy Gardener Overlay
   ========================================== */

.no-habits-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  background: transparent;
  pointer-events: none;
}

.no-habits-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 600px;
  padding: 40px 20px;
  margin: 0 auto;
  border: none;
  outline: none;
}

.lazy-gardener-image {
  width: 100%;
  max-width: 300px;
  height: auto;
  margin-bottom: 30px;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  filter: none;
  image-rendering: auto;
  display: block;
  object-fit: contain;
  background: transparent;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
  /* Try to blend away white background */
  mix-blend-mode: multiply;
  isolation: isolate;
}

.no-habits-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 15px;
  font-family: 'Caveat', cursive;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.no-habits-message {
  font-size: 1.3rem;
  line-height: 1.6;
  color: #ffffff;
  margin-bottom: 0;
  max-width: 500px;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .lazy-gardener-image {
    max-width: 250px;
    margin-bottom: 20px;
  }

  .no-habits-title {
    font-size: 2rem;
  }

  .no-habits-message {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .lazy-gardener-image {
    max-width: 200px;
  }

  .no-habits-title {
    font-size: 1.6rem;
  }

  .no-habits-message {
    font-size: 1rem;
  }
}

}
